summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pkcs12/p12_attr.c
diff options
context:
space:
mode:
authortb <>2022-08-03 20:16:06 +0000
committertb <>2022-08-03 20:16:06 +0000
commita32a61a3aa20740d1ab3245e6e33400a7dcfd2ee (patch)
tree2050ca3c5df6f38c2b64ca740e75145adf5ebc5a /src/lib/libcrypto/pkcs12/p12_attr.c
parentea6323b575f9fa3c9246e238f0b70fa2e38bc064 (diff)
downloadopenbsd-a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee.tar.gz
openbsd-a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee.tar.bz2
openbsd-a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee.zip
Prepare to provide PKCS12 accessors
In order to be able to make pkcs12/ opaque, we need an entire family of accessors. These are in a particularly nasty tangle since this was done in about a dozen steps while sprinkling const, renaming functions, etc. The public API also adds backward compat macros for functions that were in the tree for half a day and then renamed. Of course some of them got picked up by some ports. Some of the gruesome hacks in here will go away with the next bump, but that doesn't mean that the pkcs12 directory will be prettier afterward. ok jsing
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/pkcs12/p12_attr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_attr.c b/src/lib/libcrypto/pkcs12/p12_attr.c
index a35a148b11..01a7a3ea8c 100644
--- a/src/lib/libcrypto/pkcs12/p12_attr.c
+++ b/src/lib/libcrypto/pkcs12/p12_attr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_attr.c,v 1.15 2022/05/09 19:19:33 jsing Exp $ */ 1/* $OpenBSD: p12_attr.c,v 1.16 2022/08/03 20:16:06 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 1999. 3 * project 1999.
4 */ 4 */
@@ -138,12 +138,18 @@ PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid)
138char * 138char *
139PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag) 139PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag)
140{ 140{
141 ASN1_TYPE *atype; 141 const ASN1_TYPE *atype;
142 142
143 if (!(atype = PKCS12_get_attr(bag, NID_friendlyName))) 143 if (!(atype = PKCS12_SAFEBAG_get0_attr(bag, NID_friendlyName)))
144 return NULL; 144 return NULL;
145 if (atype->type != V_ASN1_BMPSTRING) 145 if (atype->type != V_ASN1_BMPSTRING)
146 return NULL; 146 return NULL;
147 return OPENSSL_uni2asc(atype->value.bmpstring->data, 147 return OPENSSL_uni2asc(atype->value.bmpstring->data,
148 atype->value.bmpstring->length); 148 atype->value.bmpstring->length);
149} 149}
150
151const STACK_OF(X509_ATTRIBUTE) *
152PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag)
153{
154 return bag->attrib;
155}