Clear warnings/errors within RL_DEBUG code sections (RL_DEBUG should be renamed)
[openssl.git] / apps / pkcs12.c
index 9c431259dd4bca123697f887b44069fb8facf24c..4d62a7b8cabd3e30465c637ad29707dd50d3cec7 100644 (file)
@@ -112,12 +112,12 @@ int MAIN(int argc, char **argv)
     int maciter = PKCS12_DEFAULT_ITER;
     int twopass = 0;
     int keytype = 0;
-    int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
+    int cert_pbe;
     int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
     int ret = 1;
     int macver = 1;
     int noprompt = 0;
-    STACK_OF(STRING) *canames = NULL;
+    STACK_OF(OPENSSL_STRING) *canames = NULL;
     char *cpass = NULL, *mpass = NULL;
     char *passargin = NULL, *passargout = NULL, *passarg = NULL;
     char *passin = NULL, *passout = NULL;
@@ -130,6 +130,13 @@ int MAIN(int argc, char **argv)
 
     apps_startup();
 
+#ifdef OPENSSL_FIPS
+    if (FIPS_mode())
+       cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
+    else
+#endif
+    cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
+
     enc = EVP_des_ede3_cbc();
     if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 
@@ -222,8 +229,8 @@ int MAIN(int argc, char **argv)
                } else if (!strcmp (*args, "-caname")) {
                    if (args[1]) {
                        args++; 
-                       if (!canames) canames = sk_STRING_new_null();
-                       sk_STRING_push(canames, *args);
+                       if (!canames) canames = sk_OPENSSL_STRING_new_null();
+                       sk_OPENSSL_STRING_push(canames, *args);
                    } else badarg = 1;
                } else if (!strcmp (*args, "-in")) {
                    if (args[1]) {
@@ -549,9 +556,9 @@ int MAIN(int argc, char **argv)
 
        /* Add any CA names */
 
-       for (i = 0; i < sk_STRING_num(canames); i++)
+       for (i = 0; i < sk_OPENSSL_STRING_num(canames); i++)
                {
-               catmp = (unsigned char *)sk_STRING_value(canames, i);
+               catmp = (unsigned char *)sk_OPENSSL_STRING_value(canames, i);
                X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
                }
 
@@ -647,7 +654,7 @@ int MAIN(int argc, char **argv)
 
     if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);
 
-    if (options & INFO) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
+    if ((options & INFO) && p12->mac) BIO_printf (bio_err, "MAC Iteration %ld\n", p12->mac->iter ? ASN1_INTEGER_get (p12->mac->iter) : 1);
     if(macver) {
 #ifdef CRYPTO_MDEBUG
     CRYPTO_push_info("verify MAC");
@@ -687,7 +694,7 @@ int MAIN(int argc, char **argv)
 #endif
     BIO_free(in);
     BIO_free_all(out);
-    if (canames) sk_STRING_free(canames);
+    if (canames) sk_OPENSSL_STRING_free(canames);
     if(passin) OPENSSL_free(passin);
     if(passout) OPENSSL_free(passout);
     apps_shutdown();
@@ -923,7 +930,7 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name)
                        av = sk_ASN1_TYPE_value(attr->value.set, 0);
                        switch(av->type) {
                                case V_ASN1_BMPSTRING:
-                               value = uni2asc(av->value.bmpstring->data,
+                               value = OPENSSL_uni2asc(av->value.bmpstring->data,
                                               av->value.bmpstring->length);
                                BIO_printf(out, "%s\n", value);
                                OPENSSL_free(value);