Prepare to provide X509_re_X509*_tbs()
authortb <tb@openbsd.org>
Sat, 23 Oct 2021 11:56:10 +0000 (11:56 +0000)
committertb <tb@openbsd.org>
Sat, 23 Oct 2021 11:56:10 +0000 (11:56 +0000)
ok beck jsing

lib/libcrypto/asn1/x_x509.c
lib/libcrypto/x509/x509.h
lib/libcrypto/x509/x509_req.c
lib/libcrypto/x509/x509cset.c

index 422f625..ebe09a6 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x_x509.c,v 1.27 2021/09/02 12:41:44 job Exp $ */
+/* $OpenBSD: x_x509.c,v 1.28 2021/10/23 11:56:10 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -353,6 +353,13 @@ i2d_X509_AUX(X509 *a, unsigned char **pp)
        return length;
 }
 
+int
+i2d_re_X509_tbs(X509 *x, unsigned char **pp)
+{
+       x->cert_info->enc.modified = 1;
+       return i2d_X509_CINF(x->cert_info, pp);
+}
+
 void
 X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg,
     const X509 *x)
index e8383d7..84288de 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509.h,v 1.80 2021/10/23 11:41:50 tb Exp $ */
+/* $OpenBSD: x509.h,v 1.81 2021/10/23 11:56:10 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -596,6 +596,10 @@ extern "C" {
 int X509_CRL_up_ref(X509_CRL *x);
 int X509_CRL_get_signature_nid(const X509_CRL *crl);
 
+#if defined(LIBRESSL_NEW_API)
+int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp);
+#endif
+
 const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl);
 long X509_CRL_get_version(const X509_CRL *crl);
 const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);
@@ -906,6 +910,11 @@ int X509_set_ex_data(X509 *r, int idx, void *arg);
 void *X509_get_ex_data(X509 *r, int idx);
 int            i2d_X509_AUX(X509 *a,unsigned char **pp);
 X509 *         d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
+
+#if defined(LIBRESSL_NEW_API)
+int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
+#endif
+
 void X509_get0_signature(const ASN1_BIT_STRING **psig,
     const X509_ALGOR **palg, const X509 *x);
 int X509_get_signature_nid(const X509 *x);
@@ -1019,6 +1028,7 @@ X509_NAME *X509_REQ_get_subject_name(const X509_REQ *x);
 int            X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
 EVP_PKEY *     X509_REQ_get_pubkey(X509_REQ *req);
 #if defined(LIBRESSL_NEW_API)
+int            i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);
 EVP_PKEY *     X509_REQ_get0_pubkey(X509_REQ *req);
 #endif
 int            X509_REQ_extension_nid(int nid);
index fe20b1c..c81fe4a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_req.c,v 1.22 2021/10/22 16:42:13 tb Exp $ */
+/* $OpenBSD: x509_req.c,v 1.23 2021/10/23 11:56:10 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -349,3 +349,10 @@ X509_REQ_add1_attr_by_txt(X509_REQ *req, const char *attrname, int type,
                return 1;
        return 0;
 }
+
+int
+i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp)
+{
+       req->req_info->enc.modified = 1;
+       return i2d_X509_REQ_INFO(req->req_info, pp);
+}
index 182dd8a..98fbdc2 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509cset.c,v 1.14 2018/02/22 17:01:44 jsing Exp $ */
+/* $OpenBSD: x509cset.c,v 1.15 2021/10/23 11:56:10 tb Exp $ */
 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 2001.
  */
@@ -208,3 +208,10 @@ X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial)
        }
        return (in != NULL);
 }
+
+int
+i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp)
+{
+       crl->crl->enc.modified = 1;
+       return i2d_X509_CRL_INFO(crl->crl, pp);
+}