diff --git a/circuits/circuits/tests/utils/ecdsa/test_brainpoolP512r1.circom b/circuits/circuits/tests/utils/ecdsa/test_brainpoolP512r1.circom new file mode 100644 index 000000000..3dfd715aa --- /dev/null +++ b/circuits/circuits/tests/utils/ecdsa/test_brainpoolP512r1.circom @@ -0,0 +1,13 @@ +pragma circom 2.1.9; + +include "../../../utils/crypto/signature/ecdsa/ecdsaVerifier.circom"; + +template VerifyBrainpoolP384r1Sha384() { + signal input signature[2 * 8]; + signal input pubKey[2 * 8]; + signal input hashParsed[512]; + + EcdsaVerifier(29, 64, 8)(signature, pubKey, hashParsed); +} + +component main = VerifyBrainpoolP384r1Sha384(); \ No newline at end of file diff --git a/circuits/circuits/tests/utils/ecdsa/test_p256.circom b/circuits/circuits/tests/utils/ecdsa/test_p256.circom new file mode 100644 index 000000000..e92b9aaf9 --- /dev/null +++ b/circuits/circuits/tests/utils/ecdsa/test_p256.circom @@ -0,0 +1,13 @@ +pragma circom 2.1.9; + +include "../../../utils/crypto/signature/ecdsa/ecdsaVerifier.circom"; + +template VerifyP256Sha256() { + signal input signature[2 * 4]; + signal input pubKey[2 * 4]; + signal input hashParsed[256]; + + EcdsaVerifier(8, 64, 4)(signature, pubKey, hashParsed); +} + +component main = VerifyP256Sha256(); \ No newline at end of file diff --git a/circuits/circuits/tests/utils/ecdsa/test_p384.circom b/circuits/circuits/tests/utils/ecdsa/test_p384.circom new file mode 100644 index 000000000..354e21d6f --- /dev/null +++ b/circuits/circuits/tests/utils/ecdsa/test_p384.circom @@ -0,0 +1,13 @@ +pragma circom 2.1.9; + +include "../../../utils/crypto/signature/ecdsa/ecdsaVerifier.circom"; + +template VerifyP384r1Sha384() { + signal input signature[2 * 6]; + signal input pubKey[2 * 6]; + signal input hashParsed[384]; + + EcdsaVerifier(9, 64, 6)(signature, pubKey, hashParsed); +} + +component main = VerifyP384r1Sha384(); \ No newline at end of file diff --git a/circuits/tests/utils/ecdsa.test.ts b/circuits/tests/utils/ecdsa.test.ts index 2096a6ed0..2daae5b3f 100644 --- a/circuits/tests/utils/ecdsa.test.ts +++ b/circuits/tests/utils/ecdsa.test.ts @@ -28,6 +28,27 @@ const testSuite = [ k: 6, reason: 'when hash bits are the same as curve bits', }, + { + hash: 'sha512', + curve: 'brainpoolP512r1', + n: 64, + k: 8, + reason: 'when hash bits are the same as curve bits', + }, + { + hash: 'sha256', + curve: 'p256', + n: 64, + k: 4, + reason: 'when hash bits are the same as curve bits', + }, + { + hash: 'sha384', + curve: 'p384', + n: 64, + k: 6, + reason: 'when hash bits are the same as curve bits', + }, ]; describe('ecdsa', () => {