summaryrefslogtreecommitdiff
path: root/lib/privkey.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-06-06 09:23:53 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-07-17 17:08:01 +0200
commitc7882d14411b5f24d859283c3c930fdf295eadd5 (patch)
treee0830400147a6fdd762d86b9eb3d6230a8820e53 /lib/privkey.c
parent53313e4d670a11e972cab2d1feea37605d47b048 (diff)
downloadgnutls-c7882d14411b5f24d859283c3c930fdf295eadd5.tar.gz
privkey_sign_and_hash_data: handle prehashed signatures
This allows this function to handle ed25519, i.e., allows it to operate for PKCS#7 signatures. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/privkey.c')
-rw-r--r--lib/privkey.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/privkey.c b/lib/privkey.c
index 6dc33e9e22..05fd8b362d 100644
--- a/lib/privkey.c
+++ b/lib/privkey.c
@@ -1007,11 +1007,7 @@ gnutls_privkey_sign_data(gnutls_privkey_t signer,
return ret;
}
- if (_gnutls_pk_is_not_prehashed(signer->pk_algorithm)) {
- return privkey_sign_raw_data(signer, data, signature, &params);
- } else {
- return privkey_sign_and_hash_data(signer, data, signature, &params);
- }
+ return privkey_sign_and_hash_data(signer, data, signature, &params);
}
/**
@@ -1133,8 +1129,12 @@ privkey_sign_and_hash_data(gnutls_privkey_t signer,
{
int ret;
gnutls_datum_t digest;
- const mac_entry_st *me = hash_to_entry(params->dig);
+ const mac_entry_st *me;
+
+ if (_gnutls_pk_is_not_prehashed(signer->pk_algorithm))
+ return privkey_sign_raw_data(signer, data, signature, params);
+ me = hash_to_entry(params->dig);
if (me == NULL)
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);