From 0bfd69a2736cb98470b47c1f6cba617b58bb86ef Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 19 Dec 2009 20:26:30 +0100 Subject: [PATCH] Fix reading raw RSA keys with libgcrypt. --- src/gcrypt/rsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gcrypt/rsa.c b/src/gcrypt/rsa.c index 62a21290..5e4ba41f 100644 --- a/src/gcrypt/rsa.c +++ b/src/gcrypt/rsa.c @@ -184,7 +184,7 @@ bool rsa_set_hex_public_key(rsa_t *rsa, char *n, char *e) { gcry_error_t err = 0; err = gcry_mpi_scan(&rsa->n, GCRYMPI_FMT_HEX, n, 0, NULL) - ?: gcry_mpi_scan(&rsa->e, GCRYMPI_FMT_HEX, n, 0, NULL); + ?: gcry_mpi_scan(&rsa->e, GCRYMPI_FMT_HEX, e, 0, NULL); if(err) { logger(LOG_ERR, "Error while reading RSA public key: %s", gcry_strerror(errno)); @@ -198,8 +198,8 @@ bool rsa_set_hex_private_key(rsa_t *rsa, char *n, char *e, char *d) { gcry_error_t err = 0; err = gcry_mpi_scan(&rsa->n, GCRYMPI_FMT_HEX, n, 0, NULL) - ?: gcry_mpi_scan(&rsa->e, GCRYMPI_FMT_HEX, n, 0, NULL) - ?: gcry_mpi_scan(&rsa->d, GCRYMPI_FMT_HEX, n, 0, NULL); + ?: gcry_mpi_scan(&rsa->e, GCRYMPI_FMT_HEX, e, 0, NULL) + ?: gcry_mpi_scan(&rsa->d, GCRYMPI_FMT_HEX, d, 0, NULL); if(err) { logger(LOG_ERR, "Error while reading RSA public key: %s", gcry_strerror(errno)); -- 2.39.5