summaryrefslogtreecommitdiffstats
path: root/crypto/ecdsa
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2003-11-16 12:24:45 +0000
committerUlf Möller <ulf@openssl.org>2003-11-16 12:24:45 +0000
commitac9c6e10a42ae993f5d23db35743d699e4b801a8 (patch)
tree9fd6313a517bb8cb36d7a5b97b57e2e9ef86f7a5 /crypto/ecdsa
parent1a0173304755bd44662a201734f80eca3afe8a9c (diff)
The x9.62 tests replace the PRNG with specific numbers,
so don't run them if BN_DEBUG_RAND is defined. Also, fix another small bug. Submitted by: Nils Larsch
Diffstat (limited to 'crypto/ecdsa')
-rw-r--r--crypto/ecdsa/ecdsatest.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c
index 7beae6f739..65f4870474 100644
--- a/crypto/ecdsa/ecdsatest.c
+++ b/crypto/ecdsa/ecdsatest.c
@@ -328,6 +328,8 @@ int test_builtin(BIO *out)
/* now create and verify a signature for every curve */
for (n = 0; n < crv_len; n++)
{
+ unsigned char dirt, offset;
+
nid = curves[n].nid;
/* create new ecdsa key (== EC_KEY) */
if ((eckey = EC_KEY_new()) == NULL)
@@ -406,9 +408,10 @@ int test_builtin(BIO *out)
}
BIO_printf(out, ".");
BIO_flush(out);
- /* modify signature */
- signature[((int)signature[0])%sig_len] ^=
- signature[((int)signature[1])%sig_len];
+ /* modify a single byte of the signature */
+ offset = signature[10] % sig_len;
+ dirt = signature[11];
+ signature[offset] ^= dirt ? dirt : 1;
if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)
{
BIO_printf(out, " failed\n");
@@ -468,7 +471,9 @@ int main(void)
RAND_seed(rnd_seed, sizeof(rnd_seed));
/* the tests */
+#ifndef BN_DEBUG_RAND
if (!x9_62_tests(out)) goto err;
+#endif
if (!test_builtin(out)) goto err;
ret = 1;