summaryrefslogtreecommitdiff
path: root/cipher/pubkey-util.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-07-23 14:20:20 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-07-23 14:20:20 +0900
commit285b4cb70df1553c60fb5da6c94e1106694d4f9e (patch)
tree013fe5efc9cf2a74db8b4139747c74a06b639a3c /cipher/pubkey-util.c
parent51307b1ceaa752d5a737b06ab0217d310faea403 (diff)
downloadlibgcrypt-285b4cb70df1553c60fb5da6c94e1106694d4f9e.tar.gz
cipher: Extend RSA-PSS internal function for verify, too.
* cipher/pubkey-internal.h (_gcry_rsa_pss_verify): Support internal hashing. * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Use opaque MPI for RSA-PSS. * cipher/rsa-common.c (_gcry_rsa_pss_verify): Support internal hashing. * cipher/rsa.c (rsa_verify): Allow opaque MPI for RSA-PSS. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'cipher/pubkey-util.c')
-rw-r--r--cipher/pubkey-util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cipher/pubkey-util.c b/cipher/pubkey-util.c
index 9c6c1e16..02f7909e 100644
--- a/cipher/pubkey-util.c
+++ b/cipher/pubkey-util.c
@@ -39,9 +39,10 @@ static int
pss_verify_cmp (void *opaque, gcry_mpi_t tmp)
{
struct pk_encoding_ctx *ctx = opaque;
- gcry_mpi_t hash = ctx->verify_arg;
+ gcry_mpi_t value = ctx->verify_arg;
- return _gcry_rsa_pss_verify (hash, tmp, ctx->nbits - 1,
+ return _gcry_rsa_pss_verify (value, !(ctx->flags & PUBKEY_FLAG_PREHASH),
+ tmp, ctx->nbits - 1,
ctx->hash_algo, ctx->saltlen);
}
@@ -1129,7 +1130,7 @@ _gcry_pk_util_data_to_mpi (gcry_sexp_t input, gcry_mpi_t *ret_mpi,
sexp_release (list);
}
- *ret_mpi = sexp_nth_mpi (lhash, 2, GCRYMPI_FMT_USG);
+ *ret_mpi = sexp_nth_mpi (lhash, 2, GCRYMPI_FMT_OPAQUE);
if (!*ret_mpi)
rc = GPG_ERR_INV_OBJ;
ctx->verify_cmp = pss_verify_cmp;