aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_rsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/crypto_rsa.c')
-rw-r--r--src/util/crypto_rsa.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index 9896d8dce..2aadf2fc4 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -222,7 +222,6 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf,
222 size_t len) 222 size_t len)
223{ 223{
224 struct GNUNET_CRYPTO_rsa_PrivateKey *key; 224 struct GNUNET_CRYPTO_rsa_PrivateKey *key;
225
226 key = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey); 225 key = GNUNET_new (struct GNUNET_CRYPTO_rsa_PrivateKey);
227 if (0 != 226 if (0 !=
228 gcry_sexp_new (&key->sexp, 227 gcry_sexp_new (&key->sexp,
@@ -230,11 +229,18 @@ GNUNET_CRYPTO_rsa_private_key_decode (const char *buf,
230 len, 229 len,
231 0)) 230 0))
232 { 231 {
233 GNUNET_break_op (0); 232 LOG (GNUNET_ERROR_TYPE_WARNING,
233 "Decoded private key is not valid\n");
234 GNUNET_free (key); 234 GNUNET_free (key);
235 return NULL; 235 return NULL;
236 } 236 }
237 /* FIXME: verify that this is an RSA private key */ 237 if (0 != gcry_pk_testkey (key->sexp))
238 {
239 LOG (GNUNET_ERROR_TYPE_WARNING,
240 "Decoded private key is not valid\n");
241 GNUNET_CRYPTO_rsa_private_key_free (key);
242 return NULL;
243 }
238 return key; 244 return key;
239} 245}
240 246