pkcs12 accessors
[openssl.git] / crypto / pkcs12 / p12_attr.c
index 70695b7bb6844e2f869b05265dccedf43bf65f05..454db9e46e73871ae0b80ef6e51750b036a357f3 100644 (file)
@@ -1,4 +1,3 @@
-/* p12_attr.c */
 /*
  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
  * 1999.
@@ -58,8 +57,9 @@
  */
 
 #include <stdio.h>
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
 #include <openssl/pkcs12.h>
+#include "p12_lcl.h"
 
 /* Add a local keyid to a safebag */
 
@@ -129,10 +129,16 @@ ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid)
 char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag)
 {
     ASN1_TYPE *atype;
-    if (!(atype = PKCS12_get_attr(bag, NID_friendlyName)))
+
+    if ((atype = PKCS12_get_attr(bag, NID_friendlyName)) == NULL)
         return NULL;
     if (atype->type != V_ASN1_BMPSTRING)
         return NULL;
     return OPENSSL_uni2asc(atype->value.bmpstring->data,
                            atype->value.bmpstring->length);
 }
+
+STACK_OF(X509_ATTRIBUTE) *PKCS12_SAFEBAG_get0_attrs(PKCS12_SAFEBAG *bag)
+{
+    return bag->attrib;
+}