diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-05-24 18:14:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-05-24 18:14:04 +0000 |
commit | 425065e903d0eb1a4a1faeaf183401fa49e9560b (patch) | |
tree | a64ed547fb3154917743692a65c4bdf38e330c6a /src/util/test_crypto_rsa.c | |
parent | b2bbad6a70f3d7e089b14f282dd8e6a4dfe6ce46 (diff) | |
download | gnunet-425065e903d0eb1a4a1faeaf183401fa49e9560b.tar.gz gnunet-425065e903d0eb1a4a1faeaf183401fa49e9560b.zip |
fixing #4483: optimize blinding key storage/transmission
Diffstat (limited to 'src/util/test_crypto_rsa.c')
-rw-r--r-- | src/util/test_crypto_rsa.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c index 6f953386f..2abb008e2 100644 --- a/src/util/test_crypto_rsa.c +++ b/src/util/test_crypto_rsa.c | |||
@@ -43,10 +43,10 @@ main (int argc, | |||
43 | struct GNUNET_CRYPTO_RsaPrivateKey *priv_copy; | 43 | struct GNUNET_CRYPTO_RsaPrivateKey *priv_copy; |
44 | struct GNUNET_CRYPTO_RsaPublicKey *pub; | 44 | struct GNUNET_CRYPTO_RsaPublicKey *pub; |
45 | struct GNUNET_CRYPTO_RsaPublicKey *pub_copy; | 45 | struct GNUNET_CRYPTO_RsaPublicKey *pub_copy; |
46 | struct GNUNET_CRYPTO_RsaBlindingKey *bkey; | ||
47 | struct GNUNET_CRYPTO_RsaSignature *sig; | 46 | struct GNUNET_CRYPTO_RsaSignature *sig; |
48 | struct GNUNET_CRYPTO_RsaSignature *sig_copy; | 47 | struct GNUNET_CRYPTO_RsaSignature *sig_copy; |
49 | struct GNUNET_CRYPTO_RsaSignature *bsig; | 48 | struct GNUNET_CRYPTO_RsaSignature *bsig; |
49 | struct GNUNET_CRYPTO_RsaBlindingKeySecret bsec; | ||
50 | struct GNUNET_HashCode hash; | 50 | struct GNUNET_HashCode hash; |
51 | char *blind_buf; | 51 | char *blind_buf; |
52 | size_t bsize; | 52 | size_t bsize; |
@@ -110,19 +110,21 @@ main (int argc, | |||
110 | GNUNET_CRYPTO_rsa_signature_free (sig); | 110 | GNUNET_CRYPTO_rsa_signature_free (sig); |
111 | 111 | ||
112 | /* test blind signing */ | 112 | /* test blind signing */ |
113 | bkey = GNUNET_CRYPTO_rsa_blinding_key_create (KEY_SIZE); | 113 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, |
114 | &bsec, | ||
115 | sizeof (bsec)); | ||
114 | bsize = GNUNET_CRYPTO_rsa_blind (&hash, | 116 | bsize = GNUNET_CRYPTO_rsa_blind (&hash, |
115 | bkey, | 117 | &bsec, |
116 | pub, | 118 | pub, |
117 | &blind_buf); | 119 | &blind_buf); |
118 | GNUNET_assert (0 != bsize); | 120 | GNUNET_assert (0 != bsize); |
119 | bsig = GNUNET_CRYPTO_rsa_sign_blinded (priv, | 121 | bsig = GNUNET_CRYPTO_rsa_sign_blinded (priv, |
120 | blind_buf, | 122 | blind_buf, |
121 | bsize); | 123 | bsize); |
122 | GNUNET_free (blind_buf); | 124 | GNUNET_free (blind_buf); |
123 | sig = GNUNET_CRYPTO_rsa_unblind (bsig, | 125 | sig = GNUNET_CRYPTO_rsa_unblind (bsig, |
124 | bkey, | 126 | &bsec, |
125 | pub); | 127 | pub); |
126 | GNUNET_CRYPTO_rsa_signature_free (bsig); | 128 | GNUNET_CRYPTO_rsa_signature_free (bsig); |
127 | GNUNET_assert (GNUNET_OK == | 129 | GNUNET_assert (GNUNET_OK == |
128 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); | 130 | GNUNET_CRYPTO_rsa_verify (&hash, sig, pub)); |
@@ -132,6 +134,5 @@ main (int argc, | |||
132 | GNUNET_CRYPTO_rsa_private_key_free (priv_copy); | 134 | GNUNET_CRYPTO_rsa_private_key_free (priv_copy); |
133 | GNUNET_CRYPTO_rsa_public_key_free (pub); | 135 | GNUNET_CRYPTO_rsa_public_key_free (pub); |
134 | GNUNET_CRYPTO_rsa_public_key_free (pub_copy); | 136 | GNUNET_CRYPTO_rsa_public_key_free (pub_copy); |
135 | GNUNET_CRYPTO_rsa_blinding_key_free (bkey); | ||
136 | return 0; | 137 | return 0; |
137 | } | 138 | } |