diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2015-05-28 19:32:22 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2015-05-28 19:32:22 +0000 |
commit | 3e558d2e9f22c96328d27e5cd35a5da3866e3543 (patch) | |
tree | 3ec605430e95e80c9568166d16d013ccffd6e528 /src/util/test_crypto_rsa.c | |
parent | 88b7ba683487b4bbb03fc4d51b5e794572816d9d (diff) | |
download | gnunet-3e558d2e9f22c96328d27e5cd35a5da3866e3543.tar.gz gnunet-3e558d2e9f22c96328d27e5cd35a5da3866e3543.zip |
Introduce function to duplicate RSA public keys
Diffstat (limited to 'src/util/test_crypto_rsa.c')
-rw-r--r-- | src/util/test_crypto_rsa.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c index b2d749ab9..20c270583 100644 --- a/src/util/test_crypto_rsa.c +++ b/src/util/test_crypto_rsa.c | |||
@@ -33,6 +33,7 @@ main (int argc, | |||
33 | unsigned char rnd_blk[RND_BLK_SIZE]; | 33 | unsigned char rnd_blk[RND_BLK_SIZE]; |
34 | struct GNUNET_CRYPTO_rsa_PrivateKey *priv; | 34 | struct GNUNET_CRYPTO_rsa_PrivateKey *priv; |
35 | struct GNUNET_CRYPTO_rsa_PublicKey *pub; | 35 | struct GNUNET_CRYPTO_rsa_PublicKey *pub; |
36 | struct GNUNET_CRYPTO_rsa_PublicKey *pub_copy; | ||
36 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; | 37 | struct GNUNET_CRYPTO_rsa_BlindingKey *bkey; |
37 | struct GNUNET_CRYPTO_rsa_Signature *sig; | 38 | struct GNUNET_CRYPTO_rsa_Signature *sig; |
38 | struct GNUNET_CRYPTO_rsa_Signature *bsig; | 39 | struct GNUNET_CRYPTO_rsa_Signature *bsig; |
@@ -69,8 +70,10 @@ main (int argc, | |||
69 | sig = GNUNET_CRYPTO_rsa_sign (priv, | 70 | sig = GNUNET_CRYPTO_rsa_sign (priv, |
70 | &hash, | 71 | &hash, |
71 | sizeof (hash)); | 72 | sizeof (hash)); |
73 | pub_copy = GNUNET_CRYPTO_rsa_public_key_dup (pub); | ||
74 | GNUNET_assert (NULL != pub_copy); | ||
72 | GNUNET_assert (GNUNET_OK == | 75 | GNUNET_assert (GNUNET_OK == |
73 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); | 76 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub_copy)); |
74 | /* corrupt our hash and see if the signature is still valid */ | 77 | /* corrupt our hash and see if the signature is still valid */ |
75 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, | 78 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &hash, |
76 | sizeof (struct GNUNET_HashCode)); | 79 | sizeof (struct GNUNET_HashCode)); |
@@ -101,6 +104,7 @@ main (int argc, | |||
101 | GNUNET_CRYPTO_rsa_signature_free (sig); | 104 | GNUNET_CRYPTO_rsa_signature_free (sig); |
102 | GNUNET_CRYPTO_rsa_private_key_free (priv); | 105 | GNUNET_CRYPTO_rsa_private_key_free (priv); |
103 | GNUNET_CRYPTO_rsa_public_key_free (pub); | 106 | GNUNET_CRYPTO_rsa_public_key_free (pub); |
107 | GNUNET_CRYPTO_rsa_public_key_free (pub_copy); | ||
104 | GNUNET_CRYPTO_rsa_blinding_key_free (bkey); | 108 | GNUNET_CRYPTO_rsa_blinding_key_free (bkey); |
105 | return 0; | 109 | return 0; |
106 | } | 110 | } |