From: Guus Sliepen Date: Sat, 19 Dec 2009 19:26:30 +0000 (+0100) Subject: Fix reading raw RSA keys with libgcrypt. X-Git-Tag: import-tinc-1.1~565 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=0bfd69a2736cb98470b47c1f6cba617b58bb86ef;p=meshlink Fix reading raw RSA keys with libgcrypt. --- 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));