summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2004-07-06 15:50:04 +0000
committerGeoff Thorpe <geoff@openssl.org>2004-07-06 15:50:04 +0000
commitace3ebd661d01270133a0fbed7c861c0ef9aae28 (patch)
treebee0884b63c35454900f124cbd2e5f862389d094 /crypto/bn
parenteea674567c41a116e702101276f4c66f30ab6d7e (diff)
Improve error handling if decompression of an ec point fails, and cleanup
ec_curve.c (unify comments, etc). Submitted by: Nils Larsch Reviewed by: Bodo Moeller, Geoff Thorpe
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn.h1
-rw-r--r--crypto/bn/bn_err.c1
-rw-r--r--crypto/bn/bn_gf2m.c6
3 files changed, 7 insertions, 1 deletions
diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h
index cbe3153e9e..acf48b9784 100644
--- a/crypto/bn/bn.h
+++ b/crypto/bn/bn.h
@@ -783,6 +783,7 @@ void ERR_load_BN_strings(void);
#define BN_R_NOT_IMPLEMENTED 116
#define BN_R_NOT_INITIALIZED 107
#define BN_R_NO_INVERSE 108
+#define BN_R_NO_SOLUTION 117
#define BN_R_P_IS_NOT_PRIME 112
#define BN_R_TOO_MANY_ITERATIONS 113
#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
diff --git a/crypto/bn/bn_err.c b/crypto/bn/bn_err.c
index 747591f9cb..b42208ae0b 100644
--- a/crypto/bn/bn_err.c
+++ b/crypto/bn/bn_err.c
@@ -116,6 +116,7 @@ static ERR_STRING_DATA BN_str_reasons[]=
{BN_R_NOT_IMPLEMENTED ,"not implemented"},
{BN_R_NOT_INITIALIZED ,"not initialized"},
{BN_R_NO_INVERSE ,"no inverse"},
+{BN_R_NO_SOLUTION ,"no solution"},
{BN_R_P_IS_NOT_PRIME ,"p is not prime"},
{BN_R_TOO_MANY_ITERATIONS ,"too many iterations"},
{BN_R_TOO_MANY_TEMPORARY_VARIABLES ,"too many temporary variables"},
diff --git a/crypto/bn/bn_gf2m.c b/crypto/bn/bn_gf2m.c
index 17513b1166..8a945f043f 100644
--- a/crypto/bn/bn_gf2m.c
+++ b/crypto/bn/bn_gf2m.c
@@ -988,7 +988,11 @@ int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned int p
if (!BN_GF2m_mod_sqr_arr(w, z, p, ctx)) goto err;
if (!BN_GF2m_add(w, z, w)) goto err;
- if (BN_GF2m_cmp(w, a)) goto err;
+ if (BN_GF2m_cmp(w, a))
+ {
+ BNerr(BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR, BN_R_NO_SOLUTION);
+ goto err;
+ }
if (!BN_copy(r, z)) goto err;
bn_check_top(r);