summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/dh
diff options
context:
space:
mode:
authorsimon <simon@FreeBSD.org>2006-10-01 07:38:44 +0000
committersimon <simon@FreeBSD.org>2006-10-01 07:38:44 +0000
commit387e65d767783525d46f90e7415169ff0015f809 (patch)
treeddbe8498869205da709070fe1d40135d495b9326 /crypto/openssl/crypto/dh
parentfb3c70eda88d3175627edc6a3316b4508b3d29c5 (diff)
downloadFreeBSD-src-387e65d767783525d46f90e7415169ff0015f809.zip
FreeBSD-src-387e65d767783525d46f90e7415169ff0015f809.tar.gz
Vendor import of OpenSSL 0.9.8d.
Diffstat (limited to 'crypto/openssl/crypto/dh')
-rw-r--r--crypto/openssl/crypto/dh/dh.h5
-rw-r--r--crypto/openssl/crypto/dh/dh_err.c1
-rw-r--r--crypto/openssl/crypto/dh/dh_key.c6
3 files changed, 12 insertions, 0 deletions
diff --git a/crypto/openssl/crypto/dh/dh.h b/crypto/openssl/crypto/dh/dh.h
index 4d0c565..ccdf35a 100644
--- a/crypto/openssl/crypto/dh/dh.h
+++ b/crypto/openssl/crypto/dh/dh.h
@@ -73,6 +73,10 @@
#include <openssl/bn.h>
#endif
+#ifndef OPENSSL_DH_MAX_MODULUS_BITS
+# define OPENSSL_DH_MAX_MODULUS_BITS 10000
+#endif
+
#define DH_FLAG_CACHE_MONT_P 0x01
#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
* implementation now uses constant time
@@ -221,6 +225,7 @@ void ERR_load_DH_strings(void);
/* Reason codes. */
#define DH_R_BAD_GENERATOR 101
#define DH_R_INVALID_PUBKEY 102
+#define DH_R_MODULUS_TOO_LARGE 103
#define DH_R_NO_PRIVATE_VALUE 100
#ifdef __cplusplus
diff --git a/crypto/openssl/crypto/dh/dh_err.c b/crypto/openssl/crypto/dh/dh_err.c
index b14a94f..783bb47 100644
--- a/crypto/openssl/crypto/dh/dh_err.c
+++ b/crypto/openssl/crypto/dh/dh_err.c
@@ -84,6 +84,7 @@ static ERR_STRING_DATA DH_str_reasons[]=
{
{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"},
{ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"},
+{ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"},
{ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"},
{0,NULL}
};
diff --git a/crypto/openssl/crypto/dh/dh_key.c b/crypto/openssl/crypto/dh/dh_key.c
index 79984e1..cb5abdc 100644
--- a/crypto/openssl/crypto/dh/dh_key.c
+++ b/crypto/openssl/crypto/dh/dh_key.c
@@ -179,6 +179,12 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
int ret= -1;
int check_result;
+ if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS)
+ {
+ DHerr(DH_F_COMPUTE_KEY,DH_R_MODULUS_TOO_LARGE);
+ goto err;
+ }
+
ctx = BN_CTX_new();
if (ctx == NULL) goto err;
BN_CTX_start(ctx);
OpenPOWER on IntegriCloud