diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_ameth.c')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 73c58ec94c..7da4ac5695 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ameth.c,v 1.12 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.13 2014/07/12 16:03:37 miod 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 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -125,8 +125,7 @@ dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | |||
| 125 | err: | 125 | err: |
| 126 | if (public_key) | 126 | if (public_key) |
| 127 | ASN1_INTEGER_free(public_key); | 127 | ASN1_INTEGER_free(public_key); |
| 128 | if (dsa) | 128 | DSA_free(dsa); |
| 129 | DSA_free(dsa); | ||
| 130 | return 0; | 129 | return 0; |
| 131 | } | 130 | } |
| 132 | 131 | ||
| @@ -264,7 +263,7 @@ dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) | |||
| 264 | } | 263 | } |
| 265 | 264 | ||
| 266 | EVP_PKEY_assign_DSA(pkey, dsa); | 265 | EVP_PKEY_assign_DSA(pkey, dsa); |
| 267 | BN_CTX_free (ctx); | 266 | BN_CTX_free(ctx); |
| 268 | if (ndsa) | 267 | if (ndsa) |
| 269 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 268 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); |
| 270 | else | 269 | else |
| @@ -275,7 +274,7 @@ dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) | |||
| 275 | decerr: | 274 | decerr: |
| 276 | DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR); | 275 | DSAerr(DSA_F_DSA_PRIV_DECODE, EVP_R_DECODE_ERROR); |
| 277 | dsaerr: | 276 | dsaerr: |
| 278 | BN_CTX_free (ctx); | 277 | BN_CTX_free(ctx); |
| 279 | if (privkey) | 278 | if (privkey) |
| 280 | ASN1_INTEGER_free(privkey); | 279 | ASN1_INTEGER_free(privkey); |
| 281 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); | 280 | sk_ASN1_TYPE_pop_free(ndsa, ASN1_TYPE_free); |
| @@ -358,20 +357,17 @@ dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) | |||
| 358 | 357 | ||
| 359 | if ((a = BN_dup(from->pkey.dsa->p)) == NULL) | 358 | if ((a = BN_dup(from->pkey.dsa->p)) == NULL) |
| 360 | return 0; | 359 | return 0; |
| 361 | if (to->pkey.dsa->p != NULL) | 360 | BN_free(to->pkey.dsa->p); |
| 362 | BN_free(to->pkey.dsa->p); | ||
| 363 | to->pkey.dsa->p = a; | 361 | to->pkey.dsa->p = a; |
| 364 | 362 | ||
| 365 | if ((a = BN_dup(from->pkey.dsa->q)) == NULL) | 363 | if ((a = BN_dup(from->pkey.dsa->q)) == NULL) |
| 366 | return 0; | 364 | return 0; |
| 367 | if (to->pkey.dsa->q != NULL) | 365 | BN_free(to->pkey.dsa->q); |
| 368 | BN_free(to->pkey.dsa->q); | ||
| 369 | to->pkey.dsa->q = a; | 366 | to->pkey.dsa->q = a; |
| 370 | 367 | ||
| 371 | if ((a = BN_dup(from->pkey.dsa->g)) == NULL) | 368 | if ((a = BN_dup(from->pkey.dsa->g)) == NULL) |
| 372 | return 0; | 369 | return 0; |
| 373 | if (to->pkey.dsa->g != NULL) | 370 | BN_free(to->pkey.dsa->g); |
| 374 | BN_free(to->pkey.dsa->g); | ||
| 375 | to->pkey.dsa->g = a; | 371 | to->pkey.dsa->g = a; |
| 376 | return 1; | 372 | return 1; |
| 377 | } | 373 | } |
