summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2021-10-23 11:56:10 +0000
committertb <>2021-10-23 11:56:10 +0000
commitda4752206df316b9d5b3a44483f2e75b435b9cc6 (patch)
tree6b06b84ca5800ece374ceb1200b750564e91c1c8 /src/lib
parentc5d933b73b08738de0850281b4f0a6fb9ae942c2 (diff)
downloadopenbsd-da4752206df316b9d5b3a44483f2e75b435b9cc6.tar.gz
openbsd-da4752206df316b9d5b3a44483f2e75b435b9cc6.tar.bz2
openbsd-da4752206df316b9d5b3a44483f2e75b435b9cc6.zip
Prepare to provide X509_re_X509*_tbs()
ok beck jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/x_x509.c9
-rw-r--r--src/lib/libcrypto/x509/x509.h12
-rw-r--r--src/lib/libcrypto/x509/x509_req.c9
-rw-r--r--src/lib/libcrypto/x509/x509cset.c9
4 files changed, 35 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c
index 422f6256f7..ebe09a6099 100644
--- a/src/lib/libcrypto/asn1/x_x509.c
+++ b/src/lib/libcrypto/asn1/x_x509.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_x509.c,v 1.27 2021/09/02 12:41:44 job Exp $ */ 1/* $OpenBSD: x_x509.c,v 1.28 2021/10/23 11:56:10 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -353,6 +353,13 @@ i2d_X509_AUX(X509 *a, unsigned char **pp)
353 return length; 353 return length;
354} 354}
355 355
356int
357i2d_re_X509_tbs(X509 *x, unsigned char **pp)
358{
359 x->cert_info->enc.modified = 1;
360 return i2d_X509_CINF(x->cert_info, pp);
361}
362
356void 363void
357X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg, 364X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg,
358 const X509 *x) 365 const X509 *x)
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h
index e8383d717c..84288de5de 100644
--- a/src/lib/libcrypto/x509/x509.h
+++ b/src/lib/libcrypto/x509/x509.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.h,v 1.80 2021/10/23 11:41:50 tb Exp $ */ 1/* $OpenBSD: x509.h,v 1.81 2021/10/23 11:56:10 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -596,6 +596,10 @@ extern "C" {
596int X509_CRL_up_ref(X509_CRL *x); 596int X509_CRL_up_ref(X509_CRL *x);
597int X509_CRL_get_signature_nid(const X509_CRL *crl); 597int X509_CRL_get_signature_nid(const X509_CRL *crl);
598 598
599#if defined(LIBRESSL_NEW_API)
600int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp);
601#endif
602
599const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); 603const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl);
600long X509_CRL_get_version(const X509_CRL *crl); 604long X509_CRL_get_version(const X509_CRL *crl);
601const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); 605const 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);
906void *X509_get_ex_data(X509 *r, int idx); 910void *X509_get_ex_data(X509 *r, int idx);
907int i2d_X509_AUX(X509 *a,unsigned char **pp); 911int i2d_X509_AUX(X509 *a,unsigned char **pp);
908X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length); 912X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
913
914#if defined(LIBRESSL_NEW_API)
915int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
916#endif
917
909void X509_get0_signature(const ASN1_BIT_STRING **psig, 918void X509_get0_signature(const ASN1_BIT_STRING **psig,
910 const X509_ALGOR **palg, const X509 *x); 919 const X509_ALGOR **palg, const X509 *x);
911int X509_get_signature_nid(const X509 *x); 920int X509_get_signature_nid(const X509 *x);
@@ -1019,6 +1028,7 @@ X509_NAME *X509_REQ_get_subject_name(const X509_REQ *x);
1019int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); 1028int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
1020EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); 1029EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req);
1021#if defined(LIBRESSL_NEW_API) 1030#if defined(LIBRESSL_NEW_API)
1031int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);
1022EVP_PKEY * X509_REQ_get0_pubkey(X509_REQ *req); 1032EVP_PKEY * X509_REQ_get0_pubkey(X509_REQ *req);
1023#endif 1033#endif
1024int X509_REQ_extension_nid(int nid); 1034int X509_REQ_extension_nid(int nid);
diff --git a/src/lib/libcrypto/x509/x509_req.c b/src/lib/libcrypto/x509/x509_req.c
index fe20b1c70d..c81fe4a3a9 100644
--- a/src/lib/libcrypto/x509/x509_req.c
+++ b/src/lib/libcrypto/x509/x509_req.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_req.c,v 1.22 2021/10/22 16:42:13 tb Exp $ */ 1/* $OpenBSD: x509_req.c,v 1.23 2021/10/23 11:56:10 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -349,3 +349,10 @@ X509_REQ_add1_attr_by_txt(X509_REQ *req, const char *attrname, int type,
349 return 1; 349 return 1;
350 return 0; 350 return 0;
351} 351}
352
353int
354i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp)
355{
356 req->req_info->enc.modified = 1;
357 return i2d_X509_REQ_INFO(req->req_info, pp);
358}
diff --git a/src/lib/libcrypto/x509/x509cset.c b/src/lib/libcrypto/x509/x509cset.c
index 182dd8a954..98fbdc2025 100644
--- a/src/lib/libcrypto/x509/x509cset.c
+++ b/src/lib/libcrypto/x509/x509cset.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509cset.c,v 1.14 2018/02/22 17:01:44 jsing Exp $ */ 1/* $OpenBSD: x509cset.c,v 1.15 2021/10/23 11:56:10 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -208,3 +208,10 @@ X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial)
208 } 208 }
209 return (in != NULL); 209 return (in != NULL);
210} 210}
211
212int
213i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp)
214{
215 crl->crl->enc.modified = 1;
216 return i2d_X509_CRL_INFO(crl->crl, pp);
217}