diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-08-22 08:59:45 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-08-22 08:59:45 +0000 |
commit | e0902b0f935fee6b1e42481ead91dab68030d6f0 (patch) | |
tree | 0e8461b10aa113da070b4980565741aca0592693 /lib | |
parent | fd454e84b56b69963287c688f0a9e5375ab7c06e (diff) |
Pull the NULL check for cmsbio into the switch
ok jsing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/cms/cms_lib.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/libcrypto/cms/cms_lib.c b/lib/libcrypto/cms/cms_lib.c index 9f8e13d36fe..fc899437ab7 100644 --- a/lib/libcrypto/cms/cms_lib.c +++ b/lib/libcrypto/cms/cms_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_lib.c,v 1.20 2023/08/22 08:44:15 tb Exp $ */ +/* $OpenBSD: cms_lib.c,v 1.21 2023/08/22 08:59:44 tb Exp $ */ /* * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. @@ -152,35 +152,31 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) CMSerror(CMS_R_NO_CONTENT); goto err; } - switch (OBJ_obj2nid(cms->contentType)) { + switch (OBJ_obj2nid(cms->contentType)) { case NID_pkcs7_data: return cont; - case NID_pkcs7_signed: - cmsbio = cms_SignedData_init_bio(cms); + if ((cmsbio = cms_SignedData_init_bio(cms)) == NULL) + goto err; break; - case NID_pkcs7_digest: - cmsbio = cms_DigestedData_init_bio(cms); + if ((cmsbio = cms_DigestedData_init_bio(cms)) == NULL) + goto err; break; - case NID_pkcs7_encrypted: - cmsbio = cms_EncryptedData_init_bio(cms); + if ((cmsbio = cms_EncryptedData_init_bio(cms)) == NULL) + goto err; break; - case NID_pkcs7_enveloped: - cmsbio = cms_EnvelopedData_init_bio(cms); + if ((cmsbio = cms_EnvelopedData_init_bio(cms)) == NULL) + goto err; break; - default: CMSerror(CMS_R_UNSUPPORTED_TYPE); goto err; } - if (cmsbio == NULL) - goto err; - return BIO_push(cmsbio, cont); err: |