diff options
author | 2018-02-20 17:09:20 +0000 | |
---|---|---|
committer | 2018-02-20 17:09:20 +0000 | |
commit | fdea4479e534474b74864958e5a802ed0412c941 (patch) | |
tree | 47cd868045a08e2478e501a22ea86923c598d68a | |
parent | Provide X509_REQ_get0_signature() (diff) | |
download | wireguard-openbsd-fdea4479e534474b74864958e5a802ed0412c941.tar.xz wireguard-openbsd-fdea4479e534474b74864958e5a802ed0412c941.zip |
Provide X509_NAME_get0_der().
From OpenSSL.
-rw-r--r-- | lib/libcrypto/Symbols.list | 1 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_name.c | 15 | ||||
-rw-r--r-- | lib/libcrypto/x509/x509.h | 3 |
3 files changed, 17 insertions, 2 deletions
diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index f446e08ea7b..022176264e1 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -2695,6 +2695,7 @@ X509_NAME_digest X509_NAME_dup X509_NAME_entry_count X509_NAME_free +X509_NAME_get0_der X509_NAME_get_entry X509_NAME_get_index_by_NID X509_NAME_get_index_by_OBJ diff --git a/lib/libcrypto/asn1/x_name.c b/lib/libcrypto/asn1/x_name.c index 30fef39fb79..4bf184252f1 100644 --- a/lib/libcrypto/asn1/x_name.c +++ b/lib/libcrypto/asn1/x_name.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_name.c,v 1.33 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: x_name.c,v 1.34 2018/02/20 17:09:20 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -640,3 +640,16 @@ X509_NAME_set(X509_NAME **xn, X509_NAME *name) } return (*xn != NULL); } + +int +X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, size_t *pderlen) +{ + /* Make sure encoding is valid. */ + if (i2d_X509_NAME(nm, NULL) <= 0) + return 0; + if (pder != NULL) + *pder = (unsigned char *)nm->bytes->data; + if (pderlen != NULL) + *pderlen = nm->bytes->length; + return 1; +} diff --git a/lib/libcrypto/x509/x509.h b/lib/libcrypto/x509/x509.h index 26e71ee40e4..6f0f5f4deca 100644 --- a/lib/libcrypto/x509/x509.h +++ b/lib/libcrypto/x509/x509.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.h,v 1.31 2018/02/20 17:06:19 jsing Exp $ */ +/* $OpenBSD: x509.h,v 1.32 2018/02/20 17:09:20 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -758,6 +758,7 @@ void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); X509_NAME *X509_NAME_dup(X509_NAME *xn); +int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, size_t *pderlen); X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); int X509_cmp_time(const ASN1_TIME *s, time_t *t); |