summaryrefslogtreecommitdiffstats
path: root/src/crypto/ec/ec_asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/ec/ec_asn1.c')
-rw-r--r--src/crypto/ec/ec_asn1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/crypto/ec/ec_asn1.c b/src/crypto/ec/ec_asn1.c
index 7c4be07..a085be5 100644
--- a/src/crypto/ec/ec_asn1.c
+++ b/src/crypto/ec/ec_asn1.c
@@ -329,6 +329,11 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const uint8_t **inp, long len) {
goto err;
}
+ if (BN_cmp(ret->priv_key, EC_GROUP_get0_order(ret->group)) >= 0) {
+ OPENSSL_PUT_ERROR(EC, EC_R_WRONG_ORDER);
+ goto err;
+ }
+
EC_POINT_free(ret->pub_key);
ret->pub_key = EC_POINT_new(ret->group);
if (ret->pub_key == NULL) {