Code style: space after 'if'
[openssl.git] / apps / pkcs12.c
index 0de46f008d2d7f8cd4dbc7ae32e7ab1d9804f3d1..43892e57985b04b5c8a3e9a486eafe01a7675c01 100644 (file)
@@ -672,8 +672,7 @@ int MAIN(int argc, char **argv)
         CRYPTO_push_info("process -export_cert: freeing");
 # endif
 
-        if (key)
-            EVP_PKEY_free(key);
+        EVP_PKEY_free(key);
         if (certs)
             sk_X509_pop_free(certs, X509_free);
         if (ucert)
@@ -741,8 +740,7 @@ int MAIN(int argc, char **argv)
 # endif
     ret = 0;
  end:
-    if (p12)
-        PKCS12_free(p12);
+    PKCS12_free(p12);
     if (export_cert || inrand)
         app_RAND_write_file(NULL, bio_err);
 # ifdef CRYPTO_MDEBUG
@@ -799,9 +797,7 @@ int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass,
     ret = 1;
 
  err:
-
-    if (asafes)
-        sk_PKCS7_pop_free(asafes, PKCS7_free);
+    sk_PKCS7_pop_free(asafes, PKCS7_free);
     return ret;
 }
 
@@ -892,7 +888,6 @@ int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
         i2a_ASN1_OBJECT(bio_err, bag->type);
         BIO_printf(bio_err, "\n");
         return 1;
-        break;
     }
     return 1;
 }
@@ -994,17 +989,19 @@ int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,
     }
     BIO_printf(out, "%s\n", name);
     for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) {
+        ASN1_OBJECT *attr_obj;
         attr = sk_X509_ATTRIBUTE_value(attrlst, i);
-        attr_nid = OBJ_obj2nid(attr->object);
+        attr_obj = X509_ATTRIBUTE_get0_object(attr);
+        attr_nid = OBJ_obj2nid(attr_obj);
         BIO_printf(out, "    ");
         if (attr_nid == NID_undef) {
-            i2a_ASN1_OBJECT(out, attr->object);
+            i2a_ASN1_OBJECT(out, attr_obj);
             BIO_printf(out, ": ");
         } else
             BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid));
 
-        if (sk_ASN1_TYPE_num(attr->value.set)) {
-            av = sk_ASN1_TYPE_value(attr->value.set, 0);
+        if (X509_ATTRIBUTE_count(attr)) {
+            av = X509_ATTRIBUTE_get0_type(attr, 0);
             switch (av->type) {
             case V_ASN1_BMPSTRING:
                 value = OPENSSL_uni2asc(av->value.bmpstring->data,