summaryrefslogtreecommitdiffstats
path: root/ssl/t1_lib.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-04-06 17:49:48 +0100
committerMatt Caswell <matt@openssl.org>2016-04-09 10:10:55 +0100
commit0aeddcfa61250a6c474c4f8b3533772a63192f1b (patch)
treed8ac8b14fc1bd8a365d522a0ecf0fc9999c01575 /ssl/t1_lib.c
parentb9aec69ace2ae84b2b4494cc49725945805d5a29 (diff)
Make DH opaque
Move the dh_st structure into an internal header file and provide relevant accessors for the internal fields. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'ssl/t1_lib.c')
-rw-r--r--ssl/t1_lib.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 6e7b5edbc4..a4cd23ab39 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -4091,17 +4091,20 @@ DH *ssl_get_auto_dh(SSL *s)
if (dh_secbits >= 128) {
DH *dhp = DH_new();
+ BIGNUM *p, *g;
if (dhp == NULL)
return NULL;
- dhp->g = BN_new();
- if (dhp->g != NULL)
- BN_set_word(dhp->g, 2);
+ g = BN_new();
+ if (g != NULL)
+ BN_set_word(g, 2);
if (dh_secbits >= 192)
- dhp->p = get_rfc3526_prime_8192(NULL);
+ p = get_rfc3526_prime_8192(NULL);
else
- dhp->p = get_rfc3526_prime_3072(NULL);
- if (dhp->p == NULL || dhp->g == NULL) {
+ p = get_rfc3526_prime_3072(NULL);
+ if (p == NULL || g == NULL || !DH_set0_pqg(dhp, p, NULL, g)) {
DH_free(dhp);
+ BN_free(p);
+ BN_free(g);
return NULL;
}
return dhp;