aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-03-28 08:21:16 +0200
committerWerner Koch <[email protected]>2022-03-30 09:04:42 +0200
commit67b36154f88ebe271a40c3f3f7b963943c656b71 (patch)
treef55c4152d1337420c5d7b1f67265587d8fa0f773
parenta5d126c61cc00aa2d63c389a956330067c90cbfd (diff)
downloadlibgcrypt-67b36154f88ebe271a40c3f3f7b963943c656b71.tar.gz
libgcrypt-67b36154f88ebe271a40c3f3f7b963943c656b71.tar.bz2
libgcrypt-67b36154f88ebe271a40c3f3f7b963943c656b71.zip
tests: Add brainpoolP256r1 to bench-slope.
* tests/bench-slope.c (ECC_ALGO_BRAINP256R1): New. (ecc_algo_fips_allowed): Support this curve. (ecc_algo_name): Ditto. (ecc_algo_curve): Ditto. (ecc_nbits): Ditto. (bench_ecc_init): Ditto.
-rw-r--r--tests/bench-slope.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/bench-slope.c b/tests/bench-slope.c
index cd69a79c..5c49ac25 100644
--- a/tests/bench-slope.c
+++ b/tests/bench-slope.c
@@ -2316,6 +2316,7 @@ enum bench_ecc_algo
ECC_ALGO_NIST_P384,
ECC_ALGO_NIST_P521,
ECC_ALGO_SECP256K1,
+ ECC_ALGO_BRAINP256R1,
__MAX_ECC_ALGO
};
@@ -2365,6 +2366,7 @@ ecc_algo_fips_allowed (int algo)
case ECC_ALGO_NIST_P521:
return 1;
case ECC_ALGO_SECP256K1:
+ case ECC_ALGO_BRAINP256R1:
case ECC_ALGO_ED25519:
case ECC_ALGO_ED448:
case ECC_ALGO_X25519:
@@ -2400,6 +2402,8 @@ ecc_algo_name (int algo)
return "NIST-P521";
case ECC_ALGO_SECP256K1:
return "secp256k1";
+ case ECC_ALGO_BRAINP256R1:
+ return "brainpoolP256r1";
default:
return NULL;
}
@@ -2430,6 +2434,8 @@ ecc_algo_curve (int algo)
return "NIST P-521";
case ECC_ALGO_SECP256K1:
return "secp256k1";
+ case ECC_ALGO_BRAINP256R1:
+ return "brainpoolP256r1";
default:
return NULL;
}
@@ -2460,6 +2466,8 @@ ecc_nbits (int algo)
return 521;
case ECC_ALGO_SECP256K1:
return 256;
+ case ECC_ALGO_BRAINP256R1:
+ return 256;
default:
return 0;
}
@@ -2657,6 +2665,14 @@ bench_ecc_init (struct bench_obj *obj)
err = gcry_sexp_build (&hd->data, NULL,
"(data (flags raw) (value %m))", x);
break;
+ case ECC_ALGO_BRAINP256R1:
+ err = gcry_sexp_build (&hd->key_spec, NULL,
+ "(genkey (ECDSA (curve brainpoolP256r1)))");
+ if (err)
+ break;
+ err = gcry_sexp_build (&hd->data, NULL,
+ "(data (flags raw) (value %m))", x);
+ break;
}
gcry_mpi_release (x);