ext/rubysl/openssl/ossl_pkey_dh.c in rubysl-openssl-2.8.0 vs ext/rubysl/openssl/ossl_pkey_dh.c in rubysl-openssl-2.9
- old
+ new
@@ -504,9 +504,11 @@
VALUE str;
int len;
GetPKeyDH(self, pkey);
dh = pkey->pkey.dh;
+ if (!dh->p)
+ ossl_raise(eDHError, "incomplete DH");
pub_key = GetBNPtr(pub);
len = DH_size(dh);
str = rb_str_new(0, len);
if ((len = DH_compute_key((unsigned char *)RSTRING_PTR(str), pub_key, dh)) < 0) {
ossl_raise(eDHError, NULL);