projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check return of PEM_write_* functions and report possible errors
[openssl.git]
/
apps
/
pkcs12.c
diff --git
a/apps/pkcs12.c
b/apps/pkcs12.c
index 406b10328a5ba6add921e1b1ee6a9370f44617d5..af5f670ba30fb5fb089be525c91bc7217f298eca 100644
(file)
--- a/
apps/pkcs12.c
+++ b/
apps/pkcs12.c
@@
-674,6
+674,7
@@
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
PKCS8_PRIV_KEY_INFO *p8;
X509 *x509;
STACK_OF(X509_ATTRIBUTE) *attrs;
PKCS8_PRIV_KEY_INFO *p8;
X509 *x509;
STACK_OF(X509_ATTRIBUTE) *attrs;
+ int ret = 0;
attrs = PKCS12_SAFEBAG_get0_attrs(bag);
attrs = PKCS12_SAFEBAG_get0_attrs(bag);
@@
-688,7
+689,7
@@
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
if ((pkey = EVP_PKCS82PKEY(p8)) == NULL)
return 0;
print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
if ((pkey = EVP_PKCS82PKEY(p8)) == NULL)
return 0;
print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
- PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, pempass);
+
ret =
PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, pempass);
EVP_PKEY_free(pkey);
break;
EVP_PKEY_free(pkey);
break;
@@
-713,7
+714,7
@@
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
}
print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
PKCS8_PRIV_KEY_INFO_free(p8);
}
print_attribs(out, PKCS8_pkey_get0_attrs(p8), "Key Attributes");
PKCS8_PRIV_KEY_INFO_free(p8);
- PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, pempass);
+
ret =
PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, pempass);
EVP_PKEY_free(pkey);
break;
EVP_PKEY_free(pkey);
break;
@@
-733,7
+734,7
@@
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
if ((x509 = PKCS12_SAFEBAG_get1_cert(bag)) == NULL)
return 0;
dump_cert_text(out, x509);
if ((x509 = PKCS12_SAFEBAG_get1_cert(bag)) == NULL)
return 0;
dump_cert_text(out, x509);
- PEM_write_bio_X509(out, x509);
+
ret =
PEM_write_bio_X509(out, x509);
X509_free(x509);
break;
X509_free(x509);
break;
@@
-750,7
+751,7
@@
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
BIO_printf(bio_err, "\n");
return 1;
}
BIO_printf(bio_err, "\n");
return 1;
}
- return
1
;
+ return
ret
;
}
/* Given a single certificate return a verified chain or NULL if error */
}
/* Given a single certificate return a verified chain or NULL if error */