forked from wolfSSL/wolfssl
ECC FP: cached doesn't work when order has more bits than prime
Small curves that are not commonly used do not work with scalars that are the length of the order when the order is longer than the prime. The table is generated based on modulus length not order length. Simple fix is to not allow these curves to be used with FP_ECC. Order isn't passed into the pseudo-public APIs.
This commit is contained in:
@ -296,6 +296,7 @@ enum {
|
|||||||
#endif /* HAVE_ECC_SECPR2 */
|
#endif /* HAVE_ECC_SECPR2 */
|
||||||
#endif /* ECC128 */
|
#endif /* ECC128 */
|
||||||
#ifdef ECC160
|
#ifdef ECC160
|
||||||
|
#ifndef FP_ECC
|
||||||
#ifndef NO_ECC_SECP
|
#ifndef NO_ECC_SECP
|
||||||
#ifdef HAVE_OID_ENCODING
|
#ifdef HAVE_OID_ENCODING
|
||||||
#define CODED_SECP160R1 {1,3,132,0,8}
|
#define CODED_SECP160R1 {1,3,132,0,8}
|
||||||
@ -341,6 +342,7 @@ enum {
|
|||||||
#endif
|
#endif
|
||||||
#define ecc_oid_secp160k1_sz CODED_SECP160K1_SZ
|
#define ecc_oid_secp160k1_sz CODED_SECP160K1_SZ
|
||||||
#endif /* HAVE_ECC_KOBLITZ */
|
#endif /* HAVE_ECC_KOBLITZ */
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ECC_BRAINPOOL
|
#ifdef HAVE_ECC_BRAINPOOL
|
||||||
#ifdef HAVE_OID_ENCODING
|
#ifdef HAVE_OID_ENCODING
|
||||||
#define CODED_BRAINPOOLP160R1 {1,3,36,3,3,2,8,1,1,1}
|
#define CODED_BRAINPOOLP160R1 {1,3,36,3,3,2,8,1,1,1}
|
||||||
@ -450,7 +452,7 @@ enum {
|
|||||||
#endif
|
#endif
|
||||||
#define ecc_oid_secp224r1_sz CODED_SECP224R1_SZ
|
#define ecc_oid_secp224r1_sz CODED_SECP224R1_SZ
|
||||||
#endif /* !NO_ECC_SECP */
|
#endif /* !NO_ECC_SECP */
|
||||||
#ifdef HAVE_ECC_KOBLITZ
|
#if defined(HAVE_ECC_KOBLITZ) && !defined(FP_ECC)
|
||||||
#ifdef HAVE_OID_ENCODING
|
#ifdef HAVE_OID_ENCODING
|
||||||
#define CODED_SECP224K1 {1,3,132,0,32}
|
#define CODED_SECP224K1 {1,3,132,0,32}
|
||||||
#define CODED_SECP224K1_SZ 5
|
#define CODED_SECP224K1_SZ 5
|
||||||
@ -738,6 +740,7 @@ const ecc_set_type ecc_sets[] = {
|
|||||||
#endif /* HAVE_ECC_SECPR2 */
|
#endif /* HAVE_ECC_SECPR2 */
|
||||||
#endif /* ECC128 */
|
#endif /* ECC128 */
|
||||||
#ifdef ECC160
|
#ifdef ECC160
|
||||||
|
#ifndef FP_ECC
|
||||||
#ifndef NO_ECC_SECP
|
#ifndef NO_ECC_SECP
|
||||||
{
|
{
|
||||||
20, /* size/bytes */
|
20, /* size/bytes */
|
||||||
@ -789,6 +792,7 @@ const ecc_set_type ecc_sets[] = {
|
|||||||
1, /* cofactor */
|
1, /* cofactor */
|
||||||
},
|
},
|
||||||
#endif /* HAVE_ECC_KOBLITZ */
|
#endif /* HAVE_ECC_KOBLITZ */
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ECC_BRAINPOOL
|
#ifdef HAVE_ECC_BRAINPOOL
|
||||||
{
|
{
|
||||||
20, /* size/bytes */
|
20, /* size/bytes */
|
||||||
@ -912,7 +916,7 @@ const ecc_set_type ecc_sets[] = {
|
|||||||
1, /* cofactor */
|
1, /* cofactor */
|
||||||
},
|
},
|
||||||
#endif /* !NO_ECC_SECP */
|
#endif /* !NO_ECC_SECP */
|
||||||
#ifdef HAVE_ECC_KOBLITZ
|
#if defined(HAVE_ECC_KOBLITZ) && !defined(FP_ECC)
|
||||||
{
|
{
|
||||||
28, /* size/bytes */
|
28, /* size/bytes */
|
||||||
ECC_SECP224K1, /* ID */
|
ECC_SECP224K1, /* ID */
|
||||||
@ -928,7 +932,7 @@ const ecc_set_type ecc_sets[] = {
|
|||||||
ECC_SECP224K1_OID, /* oid sum */
|
ECC_SECP224K1_OID, /* oid sum */
|
||||||
1, /* cofactor */
|
1, /* cofactor */
|
||||||
},
|
},
|
||||||
#endif /* HAVE_ECC_KOBLITZ */
|
#endif /* HAVE_ECC_KOBLITZ && !FP_ECC */
|
||||||
#ifdef HAVE_ECC_BRAINPOOL
|
#ifdef HAVE_ECC_BRAINPOOL
|
||||||
{
|
{
|
||||||
28, /* size/bytes */
|
28, /* size/bytes */
|
||||||
|
Reference in New Issue
Block a user