diff options
Diffstat (limited to 'src/util/test_crypto_rsa.c')
-rw-r--r-- | src/util/test_crypto_rsa.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c index 423f1d6f1..5b546f243 100644 --- a/src/util/test_crypto_rsa.c +++ b/src/util/test_crypto_rsa.c | |||
@@ -89,6 +89,20 @@ main (int argc, | |||
89 | GNUNET_assert (NULL != pub_copy); | 89 | GNUNET_assert (NULL != pub_copy); |
90 | GNUNET_assert (GNUNET_OK == | 90 | GNUNET_assert (GNUNET_OK == |
91 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub_copy)); | 91 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub_copy)); |
92 | { | ||
93 | char *buf; | ||
94 | size_t buf_size; | ||
95 | struct GNUNET_CRYPTO_RsaPublicKey *pub2; | ||
96 | |||
97 | buf_size = GNUNET_CRYPTO_rsa_public_key_encode (pub, | ||
98 | &buf); | ||
99 | pub2 = GNUNET_CRYPTO_rsa_public_key_decode (buf, | ||
100 | buf_size); | ||
101 | GNUNET_free (buf); | ||
102 | GNUNET_assert (GNUNET_OK == | ||
103 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub2)); | ||
104 | GNUNET_CRYPTO_rsa_public_key_free (pub2); | ||
105 | } | ||
92 | /* corrupt our hash and see if the signature is still valid */ | 106 | /* corrupt our hash and see if the signature is still valid */ |
93 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, | 107 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, |
94 | sizeof(struct GNUNET_HashCode)); | 108 | sizeof(struct GNUNET_HashCode)); |