aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_rsa.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-11-25 14:38:48 +0100
committerChristian Grothoff <christian@grothoff.org>2021-11-25 14:38:48 +0100
commit63854ee52ec8d24928c2346928a3dbea22ebd1fe (patch)
tree353e8104a758592004d59c1d3ecdcd0186a4fe8e /src/util/crypto_rsa.c
parentfff38c7f0b1bee8302b4e5689c77412d28542398 (diff)
downloadgnunet-63854ee52ec8d24928c2346928a3dbea22ebd1fe.tar.gz
gnunet-63854ee52ec8d24928c2346928a3dbea22ebd1fe.zip
add pk invariant check
Diffstat (limited to 'src/util/crypto_rsa.c')
-rw-r--r--src/util/crypto_rsa.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index f017d1f10..43e6eedac 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -296,6 +296,30 @@ struct GNUNET_CRYPTO_RsaPublicKeyHeaderP
296GNUNET_NETWORK_STRUCT_END 296GNUNET_NETWORK_STRUCT_END
297 297
298 298
299bool
300GNUNET_CRYPTO_rsa_public_key_check (
301 const struct GNUNET_CRYPTO_RsaPublicKey *key)
302{
303 gcry_mpi_t ne[2];
304 int ret;
305
306 ret = key_from_sexp (ne,
307 key->sexp,
308 "public-key",
309 "ne");
310 if (0 != ret)
311 ret = key_from_sexp (ne,
312 key->sexp,
313 "rsa",
314 "ne");
315 if (0 != ret)
316 return false;
317 gcry_mpi_release (ne[0]);
318 gcry_mpi_release (ne[1]);
319 return true;
320}
321
322
299size_t 323size_t
300GNUNET_CRYPTO_rsa_public_key_encode ( 324GNUNET_CRYPTO_rsa_public_key_encode (
301 const struct GNUNET_CRYPTO_RsaPublicKey *key, 325 const struct GNUNET_CRYPTO_RsaPublicKey *key,