diff options
author | Matt Johnston <matt@ucc.asn.au> | 2007-02-22 14:53:49 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2007-02-22 14:53:49 +0000 |
commit | b01a74a9d757ce2b83465214bde1fa07d3e2d3ea (patch) | |
tree | 092cac6797947f7b23fcdcc2c081b19c390c5bc4 /libtomcrypt/testprof/dsa_test.c | |
parent | 66643fa5c723da2dc781c5eeae2e008c280a7b1c (diff) | |
parent | 7f12251fbb2acefac04e13a7c6a95ca4dd4b5578 (diff) |
merge of 'a9b0496634cdd25647b65e585cc3240f3fa699ee'
and 'c22be8b8f570b48e9662dac32c7b3e7148a42206'
--HG--
extra : convert_revision : 066f6aef2791d54b9ec6a0c3033fd28fa946251f
Diffstat (limited to 'libtomcrypt/testprof/dsa_test.c')
-rw-r--r-- | libtomcrypt/testprof/dsa_test.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libtomcrypt/testprof/dsa_test.c b/libtomcrypt/testprof/dsa_test.c index aa4988c..f623092 100644 --- a/libtomcrypt/testprof/dsa_test.c +++ b/libtomcrypt/testprof/dsa_test.c @@ -5,7 +5,7 @@ int dsa_test(void) { unsigned char msg[16], out[1024], out2[1024]; - unsigned long x; + unsigned long x, y; int stat1, stat2; dsa_key key, key2; @@ -15,6 +15,20 @@ int dsa_test(void) /* verify it */ DO(dsa_verify_key(&key, &stat1)); if (stat1 == 0) { fprintf(stderr, "dsa_verify_key "); return 1; } + + /* encrypt a message */ + for (x = 0; x < 16; x++) { msg[x] = x; } + x = sizeof(out); + DO(dsa_encrypt_key(msg, 16, out, &x, &yarrow_prng, find_prng("yarrow"), find_hash("sha1"), &key)); + + /* decrypt */ + y = sizeof(out2); + DO(dsa_decrypt_key(out, x, out2, &y, &key)); + + if (y != 16 || memcmp(out2, msg, 16)) { + fprintf(stderr, "dsa_decrypt failed, y == %lu\n", y); + return 1; + } /* sign the message */ x = sizeof(out); @@ -64,5 +78,5 @@ int dsa_test(void) #endif /* $Source: /cvs/libtom/libtomcrypt/testprof/dsa_test.c,v $ */ -/* $Revision: 1.8 $ */ -/* $Date: 2005/06/03 19:24:32 $ */ +/* $Revision: 1.9 $ */ +/* $Date: 2005/10/30 18:49:14 $ */ |