Remove deleted PKCS#12 functions from pkcs12.h, get rid of object creation
authorDr. Stephen Henson <steve@openssl.org>
Mon, 29 Mar 1999 22:18:54 +0000 (22:18 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 29 Mar 1999 22:18:54 +0000 (22:18 +0000)
kludge, remove CRs from ssl_ciph.c and update Win32 functions for PKCS#12
code. It might compile under Win32 now ...

crypto/pkcs12/p12_add.c
crypto/pkcs12/p12_attr.c
crypto/pkcs12/p12_init.c
crypto/pkcs12/p12_mutl.c
crypto/pkcs12/p12_utl.c
crypto/pkcs12/pkcs12.h
ssl/ssl_ciph.c
util/libeay.num

index 9e3522c..1a8eadd 100644 (file)
@@ -75,7 +75,7 @@ int nid2;
                PKCS12err(PKCS12_F_PKCS12_PACK_SAFEBAG, ERR_R_MALLOC_FAILURE);
                return NULL;
        }
-       M_ASN1_OBJECT_set(bag->type, nid1);
+       bag->type = OBJ_nid2obj(nid1);
        if (!ASN1_pack_string(obj, i2d, &bag->value.octet)) {
                PKCS12err(PKCS12_F_PKCS12_PACK_SAFEBAG, ERR_R_MALLOC_FAILURE);
                return NULL;
@@ -85,7 +85,7 @@ int nid2;
                return NULL;
        }
        safebag->value.bag = bag;
-       M_ASN1_OBJECT_set(safebag->type, nid2);
+       safebag->type = OBJ_nid2obj(nid2);
        return safebag;
 }
 
@@ -99,7 +99,7 @@ PKCS8_PRIV_KEY_INFO *p8;
                PKCS12err(PKCS12_F_PKCS12_MAKE_SAFEBAG, ERR_R_MALLOC_FAILURE);
                return NULL;
        }
-       M_ASN1_OBJECT_set(bag->type, NID_keyBag);
+       bag->type = OBJ_nid2obj(NID_keyBag);
        bag->value.keybag = p8;
        return bag;
 }
@@ -123,7 +123,7 @@ PKCS8_PRIV_KEY_INFO *p8;
                return NULL;
        }
 
-       M_ASN1_OBJECT_set(bag->type, NID_pkcs8ShroudedKeyBag);
+       bag->type = OBJ_nid2obj(NID_pkcs8ShroudedKeyBag);
        if (!(bag->value.shkeybag = 
          PKCS8_encrypt(pbe_nid, pass, passlen, salt, saltlen, iter, p8))) {
                PKCS12err(PKCS12_F_PKCS12_MAKE_SHKEYBAG, ERR_R_MALLOC_FAILURE);
@@ -142,7 +142,7 @@ STACK *sk;
                PKCS12err(PKCS12_F_PKCS12_PACK_P7_DATA, ERR_R_MALLOC_FAILURE);
                return NULL;
        }
-       M_ASN1_OBJECT_set(p7->type, NID_pkcs7_data);
+       p7->type = OBJ_nid2obj(NID_pkcs7_data);
        if (!(p7->d.data = ASN1_OCTET_STRING_new())) {
                PKCS12err(PKCS12_F_PKCS12_PACK_P7_DATA, ERR_R_MALLOC_FAILURE);
                return NULL;
@@ -174,15 +174,13 @@ STACK *bags;
                PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
                return NULL;
        }
-       /* The next bit may end up in PKCS7_set_type eventually */
-       M_ASN1_OBJECT_set(p7->type, NID_pkcs7_encrypted);
+       p7->type = OBJ_nid2obj(NID_pkcs7_encrypted);
        if (!(p7->d.encrypted = PKCS7_ENCRYPT_new ())) {
                PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
                return NULL;
        }
        ASN1_INTEGER_set (p7->d.encrypted->version, 0);
-       M_ASN1_OBJECT_set(p7->d.encrypted->enc_data->content_type,
-                                                               NID_pkcs7_data);
+       p7->d.encrypted->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data);
        if (!(pbe = PKCS5_pbe_set (pbe_nid, iter, salt, saltlen))) {
                PKCS12err(PKCS12_F_PKCS12_PACK_P7ENCDATA, ERR_R_MALLOC_FAILURE);
                return NULL;
index 49b9a88..f534745 100644 (file)
@@ -88,7 +88,7 @@ int namelen;
                PKCS12err(PKCS12_F_PKCS12_ADD_LOCALKEYID, ERR_R_MALLOC_FAILURE);
                return 0;
        }
-       M_ASN1_OBJECT_set(attrib->object, NID_localKeyID);
+       attrib->object = OBJ_nid2obj(NID_localKeyID);
        if (!(attrib->value.set = sk_new(NULL))) {
                PKCS12err(PKCS12_F_PKCS12_ADD_LOCALKEYID, ERR_R_MALLOC_FAILURE);
                return 0;
@@ -132,7 +132,7 @@ int usage;
                PKCS12err(PKCS12_F_PKCS8_ADD_KEYUSAGE, ERR_R_MALLOC_FAILURE);
                return 0;
        }
-       M_ASN1_OBJECT_set(attrib->object, NID_key_usage);
+       attrib->object = OBJ_nid2obj(NID_key_usage);
        if (!(attrib->value.set = sk_new(NULL))) {
                PKCS12err(PKCS12_F_PKCS8_ADD_KEYUSAGE, ERR_R_MALLOC_FAILURE);
                return 0;
@@ -196,7 +196,7 @@ int namelen;
                PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE);
                return 0;
        }
-       M_ASN1_OBJECT_set(attrib->object, NID_friendlyName);
+       attrib->object = OBJ_nid2obj(NID_friendlyName);
        if (!(attrib->value.set = sk_new(NULL))) {
                PKCS12err(PKCS12_F_ADD_FRIENDLYNAME,ERR_R_MALLOC_FAILURE);
                return 0;
index f6846a8..6ec6fb4 100644 (file)
@@ -79,7 +79,7 @@ int mode;
                PKCS12err(PKCS12_F_PKCS12_INIT,ERR_R_MALLOC_FAILURE);
                return NULL;
        }
-       M_ASN1_OBJECT_set(pkcs12->authsafes->type, mode);
+       pkcs12->authsafes->type = OBJ_nid2obj(mode);
        switch (mode) {
                case NID_pkcs7_data:
                        if (!(pkcs12->authsafes->d.data =
index d5c2f73..9acd6ce 100644 (file)
@@ -173,8 +173,7 @@ EVP_MD *md_type;
        }
        if (!salt) RAND_bytes (p12->mac->salt->data, saltlen);
        else memcpy (p12->mac->salt->data, salt, saltlen);
-       M_ASN1_OBJECT_set(p12->mac->dinfo->algor->algorithm,
-                                                        EVP_MD_type(md_type));
+       p12->mac->dinfo->algor->algorithm = OBJ_nid2obj(EVP_MD_type(md_type));
        if (!(p12->mac->dinfo->algor->parameter = ASN1_TYPE_new())) {
                PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
                return 0;
index 1404dbc..990fb7c 100644 (file)
@@ -95,17 +95,6 @@ int unilen;
        return asctmp;
 }
 
-/* Tag an object type onto an error code */
-
-void PKCS12_add_obj_error (obj)
-ASN1_OBJECT *obj;
-{
-       char obj_tmp[80];
-       if (!obj) strcpy (obj_tmp, "NULL");
-       else i2t_ASN1_OBJECT(obj_tmp, 80, obj);
-       ERR_add_error_data(2, "TYPE=", obj_tmp);
-}
-
 int i2d_PKCS12_bio(bp, p12)
 BIO *bp;
 PKCS12 *p12;
index 1f03e2b..6e9ee78 100644 (file)
@@ -188,11 +188,6 @@ ASN1_seq_unpack((p12)->authsafes->d.data->data, \
 
 #define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)
 
-#define M_ASN1_OBJECT_set(obj, nid) \
-{\
-ASN1_OBJECT_free(obj); \
-obj = OBJ_nid2obj((nid));\
-}
 
 #ifndef NOPROTO
 PKCS12_SAFEBAG *PKCS12_pack_safebag(char *obj, int (*i2d)(), int nid1, int nid2);
@@ -221,7 +216,6 @@ int PKCS12_set_mac(PKCS12 *p12, unsigned char *pass, int passlen, unsigned char
 int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, EVP_MD *md_type);
 unsigned char *asc2uni(unsigned char *asc, unsigned char **uni, int *unilen);
 char *uni2asc(unsigned char *uni, int unilen);
-void PKCS12_add_obj_error(ASN1_OBJECT *obj);
 int i2d_PKCS12_BAGS(PKCS12_BAGS *a, unsigned char **pp);
 PKCS12_BAGS *PKCS12_BAGS_new(void);
 PKCS12_BAGS *d2i_PKCS12_BAGS(PKCS12_BAGS **a, unsigned char **pp, long length);
@@ -239,8 +233,6 @@ PKCS12_SAFEBAG *PKCS12_SAFEBAG_new(void);
 PKCS12_SAFEBAG *d2i_PKCS12_SAFEBAG(PKCS12_SAFEBAG **a, unsigned char **pp, long length);
 void PKCS12_SAFEBAG_free(PKCS12_SAFEBAG *a);
 void ERR_load_PKCS12_strings(void);
-void ERR_PKCS12_error(int function, int reason, char *file, int line);
-void PKCS12_add_obj(void);
 void PKCS12_PBE_add(void);
 int PKCS12_parse(PKCS12 *p12, char *pass, EVP_PKEY **pkey, X509 **cert, STACK **ca);
 PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, STACK *ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype);
@@ -273,7 +265,6 @@ int PKCS12_set_mac();
 int PKCS12_setup_mac();
 unsigned char *asc2uni();
 char *uni2asc();
-void PKCS12_add_obj_error();
 int i2d_PKCS12_BAGS();
 PKCS12_BAGS *PKCS12_BAGS_new();
 PKCS12_BAGS *d2i_PKCS12_BAGS();
@@ -291,8 +282,6 @@ PKCS12_SAFEBAG *PKCS12_SAFEBAG_new();
 PKCS12_SAFEBAG *d2i_PKCS12_SAFEBAG();
 void PKCS12_SAFEBAG_free();
 void ERR_load_PKCS12_strings();
-void ERR_PKCS12_error ();
-void PKCS12_add_obj();
 void PKCS12_PBE_add();
 int PKCS8_add_keyusage();
 ASN1_TYPE *PKCS12_get_attr_gen();
index 29058d7..e3f61ea 100644 (file)
@@ -617,7 +617,7 @@ SSL_CIPHER *cipher;
 char *buf;
 int len;
        {
-        int is_export,pkl,kl;\r
+        int is_export,pkl,kl;
        char *ver,*exp;
        char *kx,*au,*enc,*mac;
        unsigned long alg,alg2;
@@ -626,10 +626,10 @@ int len;
        alg=cipher->algorithms;
        alg2=cipher->algorithm2;
 
-        is_export=SSL_IS_EXPORT(alg);\r
+        is_export=SSL_IS_EXPORT(alg);
        pkl=SSL_EXPORT_PKEYLENGTH(alg);
        kl=SSL_EXPORT_KEYLENGTH(alg);
-        exp=is_export?" export":"";\r
+        exp=is_export?" export":"";
 
        if (alg & SSL_SSLV2)
                ver="SSLv2";
@@ -641,7 +641,7 @@ int len;
        switch (alg&SSL_MKEY_MASK)
                {
        case SSL_kRSA:
-                kx=is_export?(pkl == 512 ? "RSA(512)" : "RSA(1024)"):"RSA";\r
+                kx=is_export?(pkl == 512 ? "RSA(512)" : "RSA(1024)"):"RSA";
                break;
        case SSL_kDHr:
                kx="DH/RSA";
@@ -653,7 +653,7 @@ int len;
                kx="Fortezza";
                break;
        case SSL_kEDH:
-                kx=is_export?(pkl == 512 ? "DH(512)" : "DH(1024)"):"DH";\r
+                kx=is_export?(pkl == 512 ? "DH(512)" : "DH(1024)"):"DH";
                break;
        default:
                kx="unknown";
@@ -682,17 +682,17 @@ int len;
        switch (alg&SSL_ENC_MASK)
                {
        case SSL_DES:
-                enc=(is_export && kl == 5)?"DES(40)":"DES(56)";\r
+                enc=(is_export && kl == 5)?"DES(40)":"DES(56)";
                break;
        case SSL_3DES:
                enc="3DES(168)";
                break;
        case SSL_RC4:
-                enc=is_export?(kl == 5 ? "RC4(40)" : "RC4(56)")\r
+                enc=is_export?(kl == 5 ? "RC4(40)" : "RC4(56)")
                  :((alg2&SSL2_CF_8_BYTE_ENC)?"RC4(64)":"RC4(128)");
                break;
        case SSL_RC2:
-                enc=is_export?(kl == 5 ? "RC2(40)" : "RC2(56)"):"RC2(128)";\r
+                enc=is_export?(kl == 5 ? "RC2(40)" : "RC2(56)"):"RC2(128)";
                break;
        case SSL_IDEA:
                enc="IDEA(128)";
index 4404a2b..b30443c 100755 (executable)
@@ -1229,3 +1229,78 @@ i2d_AUTHORITY_KEYID                     1254
 d2i_AUTHORITY_KEYID                     1255
 AUTHORITY_KEYID_new                     1256
 AUTHORITY_KEYID_free                    1257
+ASN1_seq_unpack                         1258
+ASN1_seq_pack                           1259
+ASN1_unpack_string                      1260
+ASN1_pack_string                        1261
+PKCS12_pack_safebag                     1262
+PKCS12_MAKE_KEYBAG                      1263
+PKCS8_encrypt                           1264
+PKCS12_MAKE_SHKEYBAG                    1265
+PKCS12_pack_p7data                      1266
+PKCS12_pack_p7encdata                   1267
+PKCS12_add_localkeyid                   1268
+PKCS12_add_friendlyname_asc             1269
+PKCS12_add_friendlyname_uni             1270
+PKCS12_get_friendlyname                 1271
+PKCS12_pbe_crypt                        1272
+PKCS12_decrypt_d2i                      1273
+PKCS12_i2d_encrypt                      1274
+PKCS12_init                             1275
+PKCS12_key_gen_asc                      1276
+PKCS12_key_gen_uni                      1277
+PKCS12_gen_mac                          1278
+PKCS12_verify_mac                       1279
+PKCS12_set_mac                          1280
+PKCS12_setup_mac                        1281
+asc2uni                                 1282
+uni2asc                                 1283
+i2d_PKCS12_BAGS                         1284
+PKCS12_BAGS_new                         1285
+d2i_PKCS12_BAGS                         1286
+PKCS12_BAGS_free                        1287
+i2d_PKCS12                              1288
+d2i_PKCS12                              1289
+PKCS12_new                              1290
+PKCS12_free                             1291
+i2d_PKCS12_MAC_DATA                     1292
+PKCS12_MAC_DATA_new                     1293
+d2i_PKCS12_MAC_DATA                     1294
+PKCS12_MAC_DATA_free                    1295
+i2d_PKCS12_SAFEBAG                      1296
+PKCS12_SAFEBAG_new                      1297
+d2i_PKCS12_SAFEBAG                      1298
+PKCS12_SAFEBAG_free                     1299
+ERR_load_PKCS12_strings                 1300
+PKCS12_PBE_add                          1301
+PKCS8_add_keyusage                      1302
+PKCS12_get_attr_gen                     1303
+PKCS12_parse                            1304
+PKCS12_create                           1305
+i2d_PKCS12_bio                          1306
+i2d_PKCS12_fp                           1307
+d2i_PKCS12_bio                          1308
+d2i_PKCS12_fp                           1309
+i2d_PBEPARAM                            1310
+PBEPARAM_new                            1311
+d2i_PBEPARAM                            1312
+PBEPARAM_free                           1313
+i2d_PKCS8_PRIV_KEY_INFO                 1314
+PKCS8_PRIV_KEY_INFO_new                 1315
+d2i_PKCS8_PRIV_KEY_INFO                 1316
+PKCS8_PRIV_KEY_INFO_free                1317
+EVP_PKCS82PKEY                          1318
+EVP_PKEY2PKCS8                          1319
+PKCS8_set_broken                        1320
+EVP_PBE_ALGOR_CipherInit                1321
+EVP_PBE_alg_add                         1322
+PKCS5_pbe_set                           1323
+EVP_PBE_cleanup                         1324
+i2d_SXNET                               1325
+d2i_SXNET                               1326
+SXNET_new                               1327
+SXNET_free                              1328
+i2d_SXNETID                             1329
+d2i_SXNETID                             1330
+SXNETID_new                             1331
+SXNETID_free                            1332