aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_rsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_rsa.c')
-rw-r--r--src/util/test_rsa.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/util/test_rsa.c b/src/util/test_rsa.c
index 85114843d..fdacf5212 100644
--- a/src/util/test_rsa.c
+++ b/src/util/test_rsa.c
@@ -38,7 +38,7 @@
38int 38int
39main (int argc, char *argv[]) 39main (int argc, char *argv[])
40{ 40{
41#define RND_BLK_SIZE 4096 41#define RND_BLK_SIZE 16524
42 unsigned char rnd_blk[RND_BLK_SIZE]; 42 unsigned char rnd_blk[RND_BLK_SIZE];
43 struct TALER_RSA_PrivateKey *priv; 43 struct TALER_RSA_PrivateKey *priv;
44 struct TALER_RSA_PrivateKeyBinaryEncoded *priv_enc; 44 struct TALER_RSA_PrivateKeyBinaryEncoded *priv_enc;
@@ -69,11 +69,13 @@ main (int argc, char *argv[])
69 ntohs (priv_enc->len)))); 69 ntohs (priv_enc->len))));
70 GNUNET_free (priv_enc); 70 GNUNET_free (priv_enc);
71 priv_enc = NULL; 71 priv_enc = NULL;
72 EXITIF (GNUNET_OK != TALER_RSA_hash_verify (&hash, 72 EXITIF (GNUNET_OK != TALER_RSA_verify (&hash, sizeof (hash),
73 &sig, 73 &sig,
74 &pubkey)); 74 &pubkey));
75 EXITIF (GNUNET_OK != TALER_RSA_verify (rnd_blk, 75 /* corrupt our hash and see if the signature is still valid */
76 RND_BLK_SIZE, 76 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash,
77 sizeof (struct GNUNET_HashCode));
78 EXITIF (GNUNET_OK == TALER_RSA_verify (&hash, sizeof (hash),
77 &sig, 79 &sig,
78 &pubkey)); 80 &pubkey));
79 81
@@ -93,9 +95,15 @@ main (int argc, char *argv[])
93 EXITIF (GNUNET_OK != TALER_RSA_unblind (&sig, 95 EXITIF (GNUNET_OK != TALER_RSA_unblind (&sig,
94 bkey, 96 bkey,
95 &pubkey)); 97 &pubkey));
96 EXITIF (GNUNET_OK != TALER_RSA_hash_verify (&hash, 98 EXITIF (GNUNET_OK != TALER_RSA_verify (&hash, sizeof (hash),
97 &sig, 99 &sig,
98 &pubkey)); 100 &pubkey));
101 /* corrupt our hash and see if the signature is still valid */
102 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash,
103 sizeof (struct GNUNET_HashCode));
104 EXITIF (GNUNET_OK == TALER_RSA_verify (&hash, sizeof (hash),
105 &sig,
106 &pubkey));
99 ret = 0; /* all OK */ 107 ret = 0; /* all OK */
100 108
101 EXITIF_exit: 109 EXITIF_exit: