diff options
author | djm <> | 2005-04-29 05:39:33 +0000 |
---|---|---|
committer | djm <> | 2005-04-29 05:39:33 +0000 |
commit | 68edd00d9258df93b1366c71ac124e0cadf7bc08 (patch) | |
tree | 3ce4ae2a9747bbc11aed1f95f9bbea92c41f8683 /src/lib/libcrypto/pkcs7/pk7_lib.c | |
parent | f396ed0f5ce0af56bfde2e75e15cf1f52924c779 (diff) | |
download | openbsd-68edd00d9258df93b1366c71ac124e0cadf7bc08.tar.gz openbsd-68edd00d9258df93b1366c71ac124e0cadf7bc08.tar.bz2 openbsd-68edd00d9258df93b1366c71ac124e0cadf7bc08.zip |
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/pkcs7/pk7_lib.c')
-rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_lib.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index 985b07245c..ee1817c7af 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
@@ -164,7 +164,12 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
164 | p7->type=obj; | 164 | p7->type=obj; |
165 | if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) | 165 | if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) |
166 | goto err; | 166 | goto err; |
167 | ASN1_INTEGER_set(p7->d.sign->version,1); | 167 | if (!ASN1_INTEGER_set(p7->d.sign->version,1)) |
168 | { | ||
169 | PKCS7_SIGNED_free(p7->d.sign); | ||
170 | p7->d.sign=NULL; | ||
171 | goto err; | ||
172 | } | ||
168 | break; | 173 | break; |
169 | case NID_pkcs7_data: | 174 | case NID_pkcs7_data: |
170 | p7->type=obj; | 175 | p7->type=obj; |
@@ -176,6 +181,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
176 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) | 181 | if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) |
177 | == NULL) goto err; | 182 | == NULL) goto err; |
178 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); | 183 | ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); |
184 | if (!ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1)) | ||
185 | goto err; | ||
179 | p7->d.signed_and_enveloped->enc_data->content_type | 186 | p7->d.signed_and_enveloped->enc_data->content_type |
180 | = OBJ_nid2obj(NID_pkcs7_data); | 187 | = OBJ_nid2obj(NID_pkcs7_data); |
181 | break; | 188 | break; |
@@ -183,7 +190,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
183 | p7->type=obj; | 190 | p7->type=obj; |
184 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) | 191 | if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) |
185 | == NULL) goto err; | 192 | == NULL) goto err; |
186 | ASN1_INTEGER_set(p7->d.enveloped->version,0); | 193 | if (!ASN1_INTEGER_set(p7->d.enveloped->version,0)) |
194 | goto err; | ||
187 | p7->d.enveloped->enc_data->content_type | 195 | p7->d.enveloped->enc_data->content_type |
188 | = OBJ_nid2obj(NID_pkcs7_data); | 196 | = OBJ_nid2obj(NID_pkcs7_data); |
189 | break; | 197 | break; |
@@ -191,7 +199,8 @@ int PKCS7_set_type(PKCS7 *p7, int type) | |||
191 | p7->type=obj; | 199 | p7->type=obj; |
192 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) | 200 | if ((p7->d.encrypted=PKCS7_ENCRYPT_new()) |
193 | == NULL) goto err; | 201 | == NULL) goto err; |
194 | ASN1_INTEGER_set(p7->d.encrypted->version,0); | 202 | if (!ASN1_INTEGER_set(p7->d.encrypted->version,0)) |
203 | goto err; | ||
195 | p7->d.encrypted->enc_data->content_type | 204 | p7->d.encrypted->enc_data->content_type |
196 | = OBJ_nid2obj(NID_pkcs7_data); | 205 | = OBJ_nid2obj(NID_pkcs7_data); |
197 | break; | 206 | break; |
@@ -318,15 +327,18 @@ int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | |||
318 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; | 327 | if (pkey->type == EVP_PKEY_DSA) is_dsa = 1; |
319 | else is_dsa = 0; | 328 | else is_dsa = 0; |
320 | /* We now need to add another PKCS7_SIGNER_INFO entry */ | 329 | /* We now need to add another PKCS7_SIGNER_INFO entry */ |
321 | ASN1_INTEGER_set(p7i->version,1); | 330 | if (!ASN1_INTEGER_set(p7i->version,1)) |
322 | X509_NAME_set(&p7i->issuer_and_serial->issuer, | 331 | goto err; |
323 | X509_get_issuer_name(x509)); | 332 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
333 | X509_get_issuer_name(x509))) | ||
334 | goto err; | ||
324 | 335 | ||
325 | /* because ASN1_INTEGER_set is used to set a 'long' we will do | 336 | /* because ASN1_INTEGER_set is used to set a 'long' we will do |
326 | * things the ugly way. */ | 337 | * things the ugly way. */ |
327 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); | 338 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); |
328 | p7i->issuer_and_serial->serial= | 339 | if (!(p7i->issuer_and_serial->serial= |
329 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 340 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
341 | goto err; | ||
330 | 342 | ||
331 | /* lets keep the pkey around for a while */ | 343 | /* lets keep the pkey around for a while */ |
332 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); | 344 | CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); |
@@ -423,16 +435,20 @@ int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri) | |||
423 | 435 | ||
424 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) | 436 | int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) |
425 | { | 437 | { |
426 | ASN1_INTEGER_set(p7i->version,0); | 438 | if (!ASN1_INTEGER_set(p7i->version,0)) |
427 | X509_NAME_set(&p7i->issuer_and_serial->issuer, | 439 | return 0; |
428 | X509_get_issuer_name(x509)); | 440 | if (!X509_NAME_set(&p7i->issuer_and_serial->issuer, |
441 | X509_get_issuer_name(x509))) | ||
442 | return 0; | ||
429 | 443 | ||
430 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); | 444 | M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); |
431 | p7i->issuer_and_serial->serial= | 445 | if (!(p7i->issuer_and_serial->serial= |
432 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)); | 446 | M_ASN1_INTEGER_dup(X509_get_serialNumber(x509)))) |
447 | return 0; | ||
433 | 448 | ||
434 | X509_ALGOR_free(p7i->key_enc_algor); | 449 | X509_ALGOR_free(p7i->key_enc_algor); |
435 | p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor); | 450 | if (!(p7i->key_enc_algor= X509_ALGOR_dup(x509->cert_info->key->algor))) |
451 | return 0; | ||
436 | 452 | ||
437 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); | 453 | CRYPTO_add(&x509->references,1,CRYPTO_LOCK_X509); |
438 | p7i->cert=x509; | 454 | p7i->cert=x509; |