diff options
| author | tb <> | 2023-08-22 08:59:44 +0000 |
|---|---|---|
| committer | tb <> | 2023-08-22 08:59:44 +0000 |
| commit | 527bcb70fc87367cb2701726052dec1d8346d62d (patch) | |
| tree | aa0650c2402edcd89f87474b350a4e5585ccc206 /src/lib/libc | |
| parent | dd20e7ce8967dae522015f2e1e518278bc9bfa58 (diff) | |
| download | openbsd-527bcb70fc87367cb2701726052dec1d8346d62d.tar.gz openbsd-527bcb70fc87367cb2701726052dec1d8346d62d.tar.bz2 openbsd-527bcb70fc87367cb2701726052dec1d8346d62d.zip | |
Pull the NULL check for cmsbio into the switch
ok jsing
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_lib.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c index 9f8e13d36f..fc899437ab 100644 --- a/src/lib/libcrypto/cms/cms_lib.c +++ b/src/lib/libcrypto/cms/cms_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_lib.c,v 1.20 2023/08/22 08:44:15 tb Exp $ */ | 1 | /* $OpenBSD: cms_lib.c,v 1.21 2023/08/22 08:59:44 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 4 | * project. | 4 | * project. |
| @@ -152,35 +152,31 @@ CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) | |||
| 152 | CMSerror(CMS_R_NO_CONTENT); | 152 | CMSerror(CMS_R_NO_CONTENT); |
| 153 | goto err; | 153 | goto err; |
| 154 | } | 154 | } |
| 155 | switch (OBJ_obj2nid(cms->contentType)) { | ||
| 156 | 155 | ||
| 156 | switch (OBJ_obj2nid(cms->contentType)) { | ||
| 157 | case NID_pkcs7_data: | 157 | case NID_pkcs7_data: |
| 158 | return cont; | 158 | return cont; |
| 159 | |||
| 160 | case NID_pkcs7_signed: | 159 | case NID_pkcs7_signed: |
| 161 | cmsbio = cms_SignedData_init_bio(cms); | 160 | if ((cmsbio = cms_SignedData_init_bio(cms)) == NULL) |
| 161 | goto err; | ||
| 162 | break; | 162 | break; |
| 163 | |||
| 164 | case NID_pkcs7_digest: | 163 | case NID_pkcs7_digest: |
| 165 | cmsbio = cms_DigestedData_init_bio(cms); | 164 | if ((cmsbio = cms_DigestedData_init_bio(cms)) == NULL) |
| 165 | goto err; | ||
| 166 | break; | 166 | break; |
| 167 | |||
| 168 | case NID_pkcs7_encrypted: | 167 | case NID_pkcs7_encrypted: |
| 169 | cmsbio = cms_EncryptedData_init_bio(cms); | 168 | if ((cmsbio = cms_EncryptedData_init_bio(cms)) == NULL) |
| 169 | goto err; | ||
| 170 | break; | 170 | break; |
| 171 | |||
| 172 | case NID_pkcs7_enveloped: | 171 | case NID_pkcs7_enveloped: |
| 173 | cmsbio = cms_EnvelopedData_init_bio(cms); | 172 | if ((cmsbio = cms_EnvelopedData_init_bio(cms)) == NULL) |
| 173 | goto err; | ||
| 174 | break; | 174 | break; |
| 175 | |||
| 176 | default: | 175 | default: |
| 177 | CMSerror(CMS_R_UNSUPPORTED_TYPE); | 176 | CMSerror(CMS_R_UNSUPPORTED_TYPE); |
| 178 | goto err; | 177 | goto err; |
| 179 | } | 178 | } |
| 180 | 179 | ||
| 181 | if (cmsbio == NULL) | ||
| 182 | goto err; | ||
| 183 | |||
| 184 | return BIO_push(cmsbio, cont); | 180 | return BIO_push(cmsbio, cont); |
| 185 | 181 | ||
| 186 | err: | 182 | err: |
