mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Make get_dh1024
compatible with OpenSSL v1.1.0
Fixes the following error:
```
../../../../ext/puma_http11/mini_ssl.c: In function ‘get_dh1024’:
../../../../ext/puma_http11/mini_ssl.c:90:5: error: dereferencing pointer to incomplete type ‘DH {aka struct dh_st}’
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
```
These changes are based on the following patch to nginx:
<789abf2b8c
>
("SSL: default DH parameters compatible with OpenSSL 1.1.0").
Relevant parts of the nginx source code in their full context can be
found here:
<https://github.com/nginx/nginx/blob/release-1.10.2/src/event/ngx_event_openssl.c#L954-L980>.
For reference:
> *) Made DH and DH_METHOD opaque. The structures for managing DH objects
> have been moved out of the public header files. New functions for managing
> these have been added.
> [Matt Caswell]
<https://www.openssl.org/news/cl110.txt>
Fixes #1136.
This commit is contained in:
parent
017348f40d
commit
12a856ee63
1 changed files with 14 additions and 0 deletions
|
@ -87,6 +87,8 @@ DH *get_dh1024() {
|
||||||
|
|
||||||
DH *dh;
|
DH *dh;
|
||||||
dh = DH_new();
|
dh = DH_new();
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100005L
|
||||||
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
|
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
|
||||||
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
|
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
|
||||||
|
|
||||||
|
@ -94,6 +96,18 @@ DH *get_dh1024() {
|
||||||
DH_free(dh);
|
DH_free(dh);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
BIGNUM *p, *g;
|
||||||
|
p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
|
||||||
|
g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
|
||||||
|
|
||||||
|
if (p == NULL || g == NULL || !DH_set0_pqg(dh, p, NULL, g)) {
|
||||||
|
DH_free(dh);
|
||||||
|
BN_free(p);
|
||||||
|
BN_free(g);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return dh;
|
return dh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue