summaryrefslogtreecommitdiff
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.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index 43e6eedac..610e5febc 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -497,7 +497,8 @@ GNUNET_CRYPTO_rsa_public_key_decode (const char *buf,
* @return True if gcd(r,n) = 1, False means RSA key is malicious
*/
static int
-rsa_gcd_validate (gcry_mpi_t r, gcry_mpi_t n)
+rsa_gcd_validate (gcry_mpi_t r,
+ gcry_mpi_t n)
{
gcry_mpi_t g;
int t;
@@ -525,24 +526,29 @@ rsa_blinding_key_derive (const struct GNUNET_CRYPTO_RsaPublicKey *pkey,
gcry_mpi_t n;
blind = GNUNET_new (struct RsaBlindingKey);
- GNUNET_assert (NULL != blind);
/* Extract the composite n from the RSA public key */
- GNUNET_assert (0 == key_from_sexp (&n, pkey->sexp, "rsa", "n"));
+ GNUNET_assert (0 ==
+ key_from_sexp (&n,
+ pkey->sexp,
+ "rsa",
+ "n"));
/* Assert that it at least looks like an RSA key */
- GNUNET_assert (0 == gcry_mpi_get_flag (n, GCRYMPI_FLAG_OPAQUE));
-
+ GNUNET_assert (0 ==
+ gcry_mpi_get_flag (n,
+ GCRYMPI_FLAG_OPAQUE));
GNUNET_CRYPTO_kdf_mod_mpi (&blind->r,
n,
xts, strlen (xts),
bks, sizeof(*bks),
"Blinding KDF");
- if (0 == rsa_gcd_validate (blind->r, n))
+ if (0 == rsa_gcd_validate (blind->r,
+ n))
{
+ gcry_mpi_release (blind->r);
GNUNET_free (blind);
blind = NULL;
}
-
gcry_mpi_release (n);
return blind;
}