Skip to content

Commit 2213306

Browse files
committed
ECC double point: SECP112R2 and SEC128R2 are Koblitz curves
SECP112r2 and SECP128R2 are Koblitz curves, so don't compile them in unless HAVE_ECC_KOBLITZ is defined. This requires custom curves which enables point doubling to support A != -3.
1 parent 8f7adb2 commit 2213306

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

wolfcrypt/src/ecc.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ enum {
337337
#endif
338338
#define ecc_oid_secp112r1_sz CODED_SECP112R1_SZ
339339
#endif /* !NO_ECC_SECP */
340-
#ifdef HAVE_ECC_SECPR2
340+
#if defined(HAVE_ECC_SECPR2) && defined(HAVE_ECC_KOBLITZ)
341341
#ifdef HAVE_OID_ENCODING
342342
#define CODED_SECP112R2 {1,3,132,0,7}
343343
#define CODED_SECP112R2_SZ 5
@@ -351,7 +351,7 @@ enum {
351351
#define ecc_oid_secp112r2 CODED_SECP112R2
352352
#endif
353353
#define ecc_oid_secp112r2_sz CODED_SECP112R2_SZ
354-
#endif /* HAVE_ECC_SECPR2 */
354+
#endif /* HAVE_ECC_SECPR2 && HAVE_ECC_KOBLITZ */
355355
#endif /* ECC112 */
356356
#ifdef ECC128
357357
#ifndef NO_ECC_SECP
@@ -369,7 +369,7 @@ enum {
369369
#endif
370370
#define ecc_oid_secp128r1_sz CODED_SECP128R1_SZ
371371
#endif /* !NO_ECC_SECP */
372-
#ifdef HAVE_ECC_SECPR2
372+
#if defined(HAVE_ECC_SECPR2) && defined(HAVE_ECC_KOBLITZ)
373373
#ifdef HAVE_OID_ENCODING
374374
#define CODED_SECP128R2 {1,3,132,0,29}
375375
#define CODED_SECP128R2_SZ 5
@@ -383,7 +383,7 @@ enum {
383383
#define ecc_oid_secp128r2 CODED_SECP128R2
384384
#endif
385385
#define ecc_oid_secp128r2_sz CODED_SECP128R2_SZ
386-
#endif /* HAVE_ECC_SECPR2 */
386+
#endif /* HAVE_ECC_SECPR2 && HAVE_ECC_KOBLITZ */
387387
#endif /* ECC128 */
388388
#ifdef ECC160
389389
#ifndef FP_ECC
@@ -790,7 +790,7 @@ const ecc_set_type ecc_sets[] = {
790790
1, /* cofactor */
791791
},
792792
#endif /* !NO_ECC_SECP */
793-
#ifdef HAVE_ECC_SECPR2
793+
#if defined(HAVE_ECC_SECPR2) && defined(HAVE_ECC_KOBLITZ)
794794
{
795795
14, /* size/bytes */
796796
ECC_SECP112R2, /* ID */
@@ -806,7 +806,7 @@ const ecc_set_type ecc_sets[] = {
806806
ECC_SECP112R2_OID, /* oid sum */
807807
4, /* cofactor */
808808
},
809-
#endif /* HAVE_ECC_SECPR2 */
809+
#endif /* HAVE_ECC_SECPR2 && HAVE_ECC_KOBLITZ */
810810
#endif /* ECC112 */
811811
#ifdef ECC128
812812
#ifndef NO_ECC_SECP
@@ -826,7 +826,7 @@ const ecc_set_type ecc_sets[] = {
826826
1, /* cofactor */
827827
},
828828
#endif /* !NO_ECC_SECP */
829-
#ifdef HAVE_ECC_SECPR2
829+
#if defined(HAVE_ECC_SECPR2) && defined(HAVE_ECC_KOBLITZ)
830830
{
831831
16, /* size/bytes */
832832
ECC_SECP128R2, /* ID */
@@ -842,7 +842,7 @@ const ecc_set_type ecc_sets[] = {
842842
ECC_SECP128R2_OID, /* oid sum */
843843
4, /* cofactor */
844844
},
845-
#endif /* HAVE_ECC_SECPR2 */
845+
#endif /* HAVE_ECC_SECPR2 && HAVE_ECC_KOBLITZ */
846846
#endif /* ECC128 */
847847
#ifdef ECC160
848848
#ifndef FP_ECC

0 commit comments

Comments
 (0)