diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/cms.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c index 7eb87322c8..1d23c529b9 100644 --- a/src/usr.bin/openssl/cms.c +++ b/src/usr.bin/openssl/cms.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms.c,v 1.22 2022/01/05 11:38:19 inoguchi Exp $ */ | 1 | /* $OpenBSD: cms.c,v 1.23 2022/01/05 12:51:49 inoguchi Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -1332,7 +1332,8 @@ cms_main(int argc, char **argv) | |||
| 1332 | goto end; | 1332 | goto end; |
| 1333 | } | 1333 | } |
| 1334 | } else | 1334 | } else |
| 1335 | in = BIO_new_fp(stdin, BIO_NOCLOSE); | 1335 | if ((in = BIO_new_fp(stdin, BIO_NOCLOSE)) == NULL) |
| 1336 | goto end; | ||
| 1336 | 1337 | ||
| 1337 | if (cms_config.operation & SMIME_IP) { | 1338 | if (cms_config.operation & SMIME_IP) { |
| 1338 | if (cms_config.informat == FORMAT_SMIME) | 1339 | if (cms_config.informat == FORMAT_SMIME) |
| @@ -1402,7 +1403,8 @@ cms_main(int argc, char **argv) | |||
| 1402 | goto end; | 1403 | goto end; |
| 1403 | } | 1404 | } |
| 1404 | } else { | 1405 | } else { |
| 1405 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | 1406 | if ((out = BIO_new_fp(stdout, BIO_NOCLOSE)) == NULL) |
| 1407 | goto end; | ||
| 1406 | } | 1408 | } |
| 1407 | 1409 | ||
| 1408 | if ((cms_config.operation == SMIME_VERIFY) || | 1410 | if ((cms_config.operation == SMIME_VERIFY) || |
| @@ -1410,8 +1412,10 @@ cms_main(int argc, char **argv) | |||
| 1410 | if ((store = setup_verify(bio_err, cms_config.CAfile, cms_config.CApath)) == NULL) | 1412 | if ((store = setup_verify(bio_err, cms_config.CAfile, cms_config.CApath)) == NULL) |
| 1411 | goto end; | 1413 | goto end; |
| 1412 | X509_STORE_set_verify_cb(store, cms_cb); | 1414 | X509_STORE_set_verify_cb(store, cms_cb); |
| 1413 | if (cms_config.vpm != NULL) | 1415 | if (cms_config.vpm != NULL) { |
| 1414 | X509_STORE_set1_param(store, cms_config.vpm); | 1416 | if (!X509_STORE_set1_param(store, cms_config.vpm)) |
| 1417 | goto end; | ||
| 1418 | } | ||
| 1415 | } | 1419 | } |
| 1416 | ret = 3; | 1420 | ret = 3; |
| 1417 | 1421 | ||
| @@ -1431,8 +1435,11 @@ cms_main(int argc, char **argv) | |||
| 1431 | CMS_RecipientInfo *ri; | 1435 | CMS_RecipientInfo *ri; |
| 1432 | struct cms_key_param *kparam; | 1436 | struct cms_key_param *kparam; |
| 1433 | int tflags = cms_config.flags; | 1437 | int tflags = cms_config.flags; |
| 1434 | X509 *x = sk_X509_value(cms_config.encerts, i); | 1438 | X509 *x; |
| 1435 | for (kparam = cms_config.key_first; kparam; kparam = kparam->next) { | 1439 | |
| 1440 | if ((x = sk_X509_value(cms_config.encerts, i)) == NULL) | ||
| 1441 | goto end; | ||
| 1442 | for (kparam = cms_config.key_first; kparam != NULL; kparam = kparam->next) { | ||
| 1436 | if (kparam->idx == i) { | 1443 | if (kparam->idx == i) { |
| 1437 | tflags |= CMS_KEY_PARAM; | 1444 | tflags |= CMS_KEY_PARAM; |
| 1438 | break; | 1445 | break; |
| @@ -1484,6 +1491,8 @@ cms_main(int argc, char **argv) | |||
| 1484 | if (sis == NULL) | 1491 | if (sis == NULL) |
| 1485 | goto end; | 1492 | goto end; |
| 1486 | si = sk_CMS_SignerInfo_value(sis, 0); | 1493 | si = sk_CMS_SignerInfo_value(sis, 0); |
| 1494 | if (si == NULL) | ||
| 1495 | goto end; | ||
| 1487 | srcms = CMS_sign_receipt(si, signer, key, other, cms_config.flags); | 1496 | srcms = CMS_sign_receipt(si, signer, key, other, cms_config.flags); |
| 1488 | if (srcms == NULL) | 1497 | if (srcms == NULL) |
| 1489 | goto end; | 1498 | goto end; |
| @@ -1788,7 +1797,8 @@ receipt_request_print(BIO *out, CMS_ContentInfo *cms) | |||
| 1788 | if ((sis = CMS_get0_SignerInfos(cms)) == NULL) | 1797 | if ((sis = CMS_get0_SignerInfos(cms)) == NULL) |
| 1789 | return; | 1798 | return; |
| 1790 | for (i = 0; i < sk_CMS_SignerInfo_num(sis); i++) { | 1799 | for (i = 0; i < sk_CMS_SignerInfo_num(sis); i++) { |
| 1791 | si = sk_CMS_SignerInfo_value(sis, i); | 1800 | if ((si = sk_CMS_SignerInfo_value(sis, i)) == NULL) |
| 1801 | return; | ||
| 1792 | rv = CMS_get1_ReceiptRequest(si, &rr); | 1802 | rv = CMS_get1_ReceiptRequest(si, &rr); |
| 1793 | BIO_printf(bio_err, "Signer %d:\n", i + 1); | 1803 | BIO_printf(bio_err, "Signer %d:\n", i + 1); |
| 1794 | if (rv == 0) | 1804 | if (rv == 0) |
