Skip to content

Commit

Permalink
Add new prime.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Nov 28, 2024
1 parent be124f9 commit 3b9a4a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/relic_fp.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ enum {
PRIME_22605,
/* Curve1174 251-bit prime modulus. */
PRIME_25109,
/* SQIsign lvl1 251-bit prime modulus. */
SQI_251,
/** Prime with high 2-adicity for curve Tweedledum. */
PRIME_H2ADC,
/** Curve25519 255-bit prime modulus. */
Expand Down
8 changes: 8 additions & 0 deletions src/fp/relic_fp_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ void fp_param_set(int param) {
bn_sub_dig(p, p, 9);
fp_prime_set_dense(p);
break;
case SQI_251:
bn_set_2b(p, 248);
bn_mul_dig(p, p, 5);
bn_sub_dig(p, p, 1);
fp_prime_set_dense(p);
break;
#elif FP_PRIME == 254
case BN_254:
/* x = -(2^62 + 2^55 + 1). */
Expand Down Expand Up @@ -774,6 +780,8 @@ int fp_param_set_any_pmers(void) {
fp_param_set(NIST_192);
#elif FP_PRIME == 224
fp_param_set(NIST_224);
#elif FP_PRIME == 251
fp_param_set(SQI_251);
#elif FP_PRIME == 255
fp_param_set(PRIME_25519);
#elif FP_PRIME == 256
Expand Down

0 comments on commit 3b9a4a8

Please sign in to comment.