summaryrefslogtreecommitdiff
path: root/drivers/builtin_openssl2/crypto/dh/dh_key.c
diff options
context:
space:
mode:
authormrezai <mhd.rezai@gmail.com>2016-04-15 19:03:35 +0430
committermrezai <mhd.rezai@gmail.com>2016-04-15 19:03:35 +0430
commite97922f22038e9049ed4c2db5b3736dfaa0edde3 (patch)
tree37e036a343e7482a387b7acd0a88509af78a69eb /drivers/builtin_openssl2/crypto/dh/dh_key.c
parent880f4abda44a42532abb6f15999a90bc85f6264a (diff)
Update OpenSSL to version 1.0.2g
Diffstat (limited to 'drivers/builtin_openssl2/crypto/dh/dh_key.c')
-rw-r--r--drivers/builtin_openssl2/crypto/dh/dh_key.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/builtin_openssl2/crypto/dh/dh_key.c b/drivers/builtin_openssl2/crypto/dh/dh_key.c
index 9e1d8e5822..1d80fb2c5f 100644
--- a/drivers/builtin_openssl2/crypto/dh/dh_key.c
+++ b/drivers/builtin_openssl2/crypto/dh/dh_key.c
@@ -94,6 +94,20 @@ int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
return dh->meth->compute_key(key, pub_key, dh);
}
+int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh)
+{
+ int rv, pad;
+ rv = dh->meth->compute_key(key, pub_key, dh);
+ if (rv <= 0)
+ return rv;
+ pad = BN_num_bytes(dh->p) - rv;
+ if (pad > 0) {
+ memmove(key + pad, key, rv);
+ memset(key, 0, pad);
+ }
+ return rv + pad;
+}
+
static DH_METHOD dh_ossl = {
"OpenSSL DH Method",
generate_key,