diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/test_rsa.c | 26 | 
1 files changed, 17 insertions, 9 deletions
diff --git a/src/util/test_rsa.c b/src/util/test_rsa.c index 85114843..fdacf521 100644 --- a/src/util/test_rsa.c +++ b/src/util/test_rsa.c @@ -38,7 +38,7 @@  int  main (int argc, char *argv[])  { -#define RND_BLK_SIZE 4096 +#define RND_BLK_SIZE 16524    unsigned char rnd_blk[RND_BLK_SIZE];    struct TALER_RSA_PrivateKey *priv;    struct TALER_RSA_PrivateKeyBinaryEncoded *priv_enc; @@ -69,11 +69,13 @@ main (int argc, char *argv[])                                                  ntohs (priv_enc->len))));    GNUNET_free (priv_enc);    priv_enc = NULL; -  EXITIF (GNUNET_OK != TALER_RSA_hash_verify (&hash, -                                              &sig, -                                              &pubkey)); -  EXITIF (GNUNET_OK != TALER_RSA_verify (rnd_blk, -                                         RND_BLK_SIZE, +  EXITIF (GNUNET_OK != TALER_RSA_verify (&hash, sizeof (hash), +                                         &sig, +                                         &pubkey)); +  /* corrupt our hash and see if the signature is still valid */ +  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, +                              sizeof (struct GNUNET_HashCode)); +  EXITIF (GNUNET_OK == TALER_RSA_verify (&hash, sizeof (hash),                                           &sig,                                           &pubkey)); @@ -93,9 +95,15 @@ main (int argc, char *argv[])    EXITIF (GNUNET_OK != TALER_RSA_unblind (&sig,                                            bkey,                                            &pubkey)); -  EXITIF (GNUNET_OK != TALER_RSA_hash_verify (&hash, -                                              &sig, -                                              &pubkey)); +  EXITIF (GNUNET_OK != TALER_RSA_verify (&hash, sizeof (hash), +                                         &sig, +                                         &pubkey)); +  /* corrupt our hash and see if the signature is still valid */ +  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, +                              sizeof (struct GNUNET_HashCode)); +  EXITIF (GNUNET_OK == TALER_RSA_verify (&hash, sizeof (hash), +                                         &sig, +                                         &pubkey));    ret = 0;                      /* all OK */   EXITIF_exit:  | 
