Another stack.
authorBen Laurie <ben@openssl.org>
Sun, 30 May 1999 21:16:24 +0000 (21:16 +0000)
committerBen Laurie <ben@openssl.org>
Sun, 30 May 1999 21:16:24 +0000 (21:16 +0000)
crypto/asn1/p8_pkey.c
crypto/pkcs12/p12_attr.c
crypto/x509/x509.h

index 17c5bc3ccb54762cc90b3366e410fd2a72e4eb41..dee229451cd5e29f0507190a58595db58354f4ee 100644 (file)
@@ -68,14 +68,16 @@ int i2d_PKCS8_PRIV_KEY_INFO (PKCS8_PRIV_KEY_INFO *a, unsigned char **pp)
        M_ASN1_I2D_len (a->version, i2d_ASN1_INTEGER);
        M_ASN1_I2D_len (a->pkeyalg, i2d_X509_ALGOR);
        M_ASN1_I2D_len (a->pkey, i2d_ASN1_TYPE);
-       M_ASN1_I2D_len_IMP_SET_opt (a->attributes, i2d_X509_ATTRIBUTE, 0);
+       M_ASN1_I2D_len_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes,
+                                        i2d_X509_ATTRIBUTE, 0);
        
        M_ASN1_I2D_seq_total ();
 
        M_ASN1_I2D_put (a->version, i2d_ASN1_INTEGER);
        M_ASN1_I2D_put (a->pkeyalg, i2d_X509_ALGOR);
        M_ASN1_I2D_put (a->pkey, i2d_ASN1_TYPE);
-       M_ASN1_I2D_put_IMP_SET_opt (a->attributes, i2d_X509_ATTRIBUTE, 0);
+       M_ASN1_I2D_put_IMP_SET_opt_type (X509_ATTRIBUTE, a->attributes,
+                                        i2d_X509_ATTRIBUTE, 0);
 
        M_ASN1_I2D_finish();
 }
@@ -103,8 +105,9 @@ PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a,
        M_ASN1_D2I_get (ret->version, d2i_ASN1_INTEGER);
        M_ASN1_D2I_get (ret->pkeyalg, d2i_X509_ALGOR);
        M_ASN1_D2I_get (ret->pkey, d2i_ASN1_TYPE);
-       M_ASN1_D2I_get_IMP_set_opt(ret->attributes, d2i_X509_ATTRIBUTE,
-                                                X509_ATTRIBUTE_free, 0);
+       M_ASN1_D2I_get_IMP_set_opt_type(X509_ATTRIBUTE, ret->attributes,
+                                       d2i_X509_ATTRIBUTE,
+                                       X509_ATTRIBUTE_free, 0);
        if (ASN1_TYPE_get(ret->pkey) == V_ASN1_SEQUENCE) 
                                                ret->broken = PKCS8_NO_OCTET;
        M_ASN1_D2I_Finish(a, PKCS8_PRIV_KEY_INFO_free, ASN1_F_D2I_PKCS8_PRIV_KEY_INFO);
@@ -120,6 +123,6 @@ void PKCS8_PRIV_KEY_INFO_free (PKCS8_PRIV_KEY_INFO *a)
                memset (a->pkey->value.octet_string->data,
                                 0, a->pkey->value.octet_string->length);
        ASN1_TYPE_free (a->pkey);
-       sk_pop_free (a->attributes, X509_ATTRIBUTE_free);
-       Free ((char *)a);
+       sk_X509_ATTRIBUTE_pop_free (a->attributes, X509_ATTRIBUTE_free);
+       Free (a);
 }
index e096023c32b13fa8efe97ba74ee2f2e06e8473e7..0dcf553e2a14d5ddca4ac7c89881d4b8436e43fb 100644 (file)
@@ -135,11 +135,12 @@ int PKCS8_add_keyusage (PKCS8_PRIV_KEY_INFO *p8, int usage)
        }
        sk_ASN1_TYPE_push (attrib->value.set,keyid);
        attrib->set = 1;
-       if (!p8->attributes && !(p8->attributes = sk_new (NULL))) {
+       if (!p8->attributes
+           && !(p8->attributes = sk_X509_ATTRIBUTE_new (NULL))) {
                PKCS12err(PKCS12_F_PKCS8_ADD_KEYUSAGE, ERR_R_MALLOC_FAILURE);
                return 0;
        }
-       sk_push (p8->attributes, (char *)attrib);
+       sk_X509_ATTRIBUTE_push (p8->attributes, attrib);
        return 1;
 }
 
index 693d42113cf72a8f31a11e3b5a4270f8bcf3b3ee..9ed79942d99ebc2adbd00e37f321d75bc2eaa210 100644 (file)
@@ -375,7 +375,7 @@ typedef struct pkcs8_priv_key_info_st
         ASN1_INTEGER *version;
         X509_ALGOR *pkeyalg;
         ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */
-        STACK *attributes;
+        STACK_OF(X509_ATTRIBUTE) *attributes;
         } PKCS8_PRIV_KEY_INFO;
 
 #include <openssl/x509_vfy.h>