diff options
Diffstat (limited to 'src/lib/libcrypto/dh/dh_ameth.c')
-rw-r--r-- | src/lib/libcrypto/dh/dh_ameth.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c index 24c8bb25ec..0402092a4f 100644 --- a/src/lib/libcrypto/dh/dh_ameth.c +++ b/src/lib/libcrypto/dh/dh_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh_ameth.c,v 1.13 2015/01/08 01:44:29 doug Exp $ */ | 1 | /* $OpenBSD: dh_ameth.c,v 1.14 2017/01/29 17:49:22 beck 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 | */ |
@@ -89,7 +89,7 @@ dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | |||
89 | X509_ALGOR_get0(NULL, &ptype, &pval, palg); | 89 | X509_ALGOR_get0(NULL, &ptype, &pval, palg); |
90 | 90 | ||
91 | if (ptype != V_ASN1_SEQUENCE) { | 91 | if (ptype != V_ASN1_SEQUENCE) { |
92 | DHerr(DH_F_DH_PUB_DECODE, DH_R_PARAMETER_ENCODING_ERROR); | 92 | DHerror(DH_R_PARAMETER_ENCODING_ERROR); |
93 | goto err; | 93 | goto err; |
94 | } | 94 | } |
95 | 95 | ||
@@ -98,18 +98,18 @@ dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | |||
98 | pmlen = pstr->length; | 98 | pmlen = pstr->length; |
99 | 99 | ||
100 | if (!(dh = d2i_DHparams(NULL, &pm, pmlen))) { | 100 | if (!(dh = d2i_DHparams(NULL, &pm, pmlen))) { |
101 | DHerr(DH_F_DH_PUB_DECODE, DH_R_DECODE_ERROR); | 101 | DHerror(DH_R_DECODE_ERROR); |
102 | goto err; | 102 | goto err; |
103 | } | 103 | } |
104 | 104 | ||
105 | if (!(public_key=d2i_ASN1_INTEGER(NULL, &p, pklen))) { | 105 | if (!(public_key=d2i_ASN1_INTEGER(NULL, &p, pklen))) { |
106 | DHerr(DH_F_DH_PUB_DECODE, DH_R_DECODE_ERROR); | 106 | DHerror(DH_R_DECODE_ERROR); |
107 | goto err; | 107 | goto err; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* We have parameters now set public key */ | 110 | /* We have parameters now set public key */ |
111 | if (!(dh->pub_key = ASN1_INTEGER_to_BN(public_key, NULL))) { | 111 | if (!(dh->pub_key = ASN1_INTEGER_to_BN(public_key, NULL))) { |
112 | DHerr(DH_F_DH_PUB_DECODE, DH_R_BN_DECODE_ERROR); | 112 | DHerror(DH_R_BN_DECODE_ERROR); |
113 | goto err; | 113 | goto err; |
114 | } | 114 | } |
115 | 115 | ||
@@ -138,13 +138,13 @@ dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
138 | 138 | ||
139 | str = ASN1_STRING_new(); | 139 | str = ASN1_STRING_new(); |
140 | if (str == NULL) { | 140 | if (str == NULL) { |
141 | DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE); | 141 | DHerror(ERR_R_MALLOC_FAILURE); |
142 | goto err; | 142 | goto err; |
143 | } | 143 | } |
144 | 144 | ||
145 | str->length = i2d_DHparams(dh, &str->data); | 145 | str->length = i2d_DHparams(dh, &str->data); |
146 | if (str->length <= 0) { | 146 | if (str->length <= 0) { |
147 | DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE); | 147 | DHerror(ERR_R_MALLOC_FAILURE); |
148 | goto err; | 148 | goto err; |
149 | } | 149 | } |
150 | ptype = V_ASN1_SEQUENCE; | 150 | ptype = V_ASN1_SEQUENCE; |
@@ -158,7 +158,7 @@ dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | |||
158 | ASN1_INTEGER_free(pub_key); | 158 | ASN1_INTEGER_free(pub_key); |
159 | 159 | ||
160 | if (penclen <= 0) { | 160 | if (penclen <= 0) { |
161 | DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE); | 161 | DHerror(ERR_R_MALLOC_FAILURE); |
162 | goto err; | 162 | goto err; |
163 | } | 163 | } |
164 | 164 | ||
@@ -209,7 +209,7 @@ dh_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) | |||
209 | goto decerr; | 209 | goto decerr; |
210 | /* We have parameters now set private key */ | 210 | /* We have parameters now set private key */ |
211 | if (!(dh->priv_key = ASN1_INTEGER_to_BN(privkey, NULL))) { | 211 | if (!(dh->priv_key = ASN1_INTEGER_to_BN(privkey, NULL))) { |
212 | DHerr(DH_F_DH_PRIV_DECODE, DH_R_BN_ERROR); | 212 | DHerror(DH_R_BN_ERROR); |
213 | goto dherr; | 213 | goto dherr; |
214 | } | 214 | } |
215 | /* Calculate public key */ | 215 | /* Calculate public key */ |
@@ -223,7 +223,7 @@ dh_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8) | |||
223 | return 1; | 223 | return 1; |
224 | 224 | ||
225 | decerr: | 225 | decerr: |
226 | DHerr(DH_F_DH_PRIV_DECODE, EVP_R_DECODE_ERROR); | 226 | DHerror(EVP_R_DECODE_ERROR); |
227 | dherr: | 227 | dherr: |
228 | DH_free(dh); | 228 | DH_free(dh); |
229 | return 0; | 229 | return 0; |
@@ -240,13 +240,13 @@ dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
240 | params = ASN1_STRING_new(); | 240 | params = ASN1_STRING_new(); |
241 | 241 | ||
242 | if (!params) { | 242 | if (!params) { |
243 | DHerr(DH_F_DH_PRIV_ENCODE, ERR_R_MALLOC_FAILURE); | 243 | DHerror(ERR_R_MALLOC_FAILURE); |
244 | goto err; | 244 | goto err; |
245 | } | 245 | } |
246 | 246 | ||
247 | params->length = i2d_DHparams(pkey->pkey.dh, ¶ms->data); | 247 | params->length = i2d_DHparams(pkey->pkey.dh, ¶ms->data); |
248 | if (params->length <= 0) { | 248 | if (params->length <= 0) { |
249 | DHerr(DH_F_DH_PRIV_ENCODE,ERR_R_MALLOC_FAILURE); | 249 | DHerror(ERR_R_MALLOC_FAILURE); |
250 | goto err; | 250 | goto err; |
251 | } | 251 | } |
252 | params->type = V_ASN1_SEQUENCE; | 252 | params->type = V_ASN1_SEQUENCE; |
@@ -255,7 +255,7 @@ dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | |||
255 | prkey = BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL); | 255 | prkey = BN_to_ASN1_INTEGER(pkey->pkey.dh->priv_key, NULL); |
256 | 256 | ||
257 | if (!prkey) { | 257 | if (!prkey) { |
258 | DHerr(DH_F_DH_PRIV_ENCODE, DH_R_BN_ERROR); | 258 | DHerror(DH_R_BN_ERROR); |
259 | goto err; | 259 | goto err; |
260 | } | 260 | } |
261 | 261 | ||
@@ -294,7 +294,7 @@ dh_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) | |||
294 | DH *dh; | 294 | DH *dh; |
295 | 295 | ||
296 | if (!(dh = d2i_DHparams(NULL, pder, derlen))) { | 296 | if (!(dh = d2i_DHparams(NULL, pder, derlen))) { |
297 | DHerr(DH_F_DH_PARAM_DECODE, ERR_R_DH_LIB); | 297 | DHerror(ERR_R_DH_LIB); |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | EVP_PKEY_assign_DH(pkey, dh); | 300 | EVP_PKEY_assign_DH(pkey, dh); |
@@ -374,7 +374,7 @@ do_dh_print(BIO *bp, const DH *x, int indent, ASN1_PCTX *ctx, int ptype) | |||
374 | ret = 1; | 374 | ret = 1; |
375 | if (0) { | 375 | if (0) { |
376 | err: | 376 | err: |
377 | DHerr(DH_F_DO_DH_PRINT,reason); | 377 | DHerror(reason); |
378 | } | 378 | } |
379 | free(m); | 379 | free(m); |
380 | return(ret); | 380 | return(ret); |