diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-09-06 13:51:55 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-09-06 13:51:55 +0900 |
commit | 1e9d4b474bafec3e087c7ab1bfa433af52129a7f (patch) | |
tree | 0a1097de61df4b6b6903c2d6e077de85c378bbd5 | |
parent | 0fa9a7d42ff4dcf87b91de196ec10510a9f0eee2 (diff) | |
download | libgcrypt-1e9d4b474bafec3e087c7ab1bfa433af52129a7f.tar.gz |
experiment: Implement Ed25519ph.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | cipher/pkey.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/cipher/pkey.c b/cipher/pkey.c index 82bc4b3f..b3891918 100644 --- a/cipher/pkey.c +++ b/cipher/pkey.c @@ -148,7 +148,8 @@ _gcry_pkey_ctl (gcry_pkey_hd_t h, int cmd, void *buffer, size_t buflen) } /* For now, it uses SEXP implementation, because the purpose is - to test the API, but the implementation. Will be rewritten soon. */ + to test the API (but not the implementation). + Will be rewritten soon. */ gcry_error_t _gcry_pkey_op (gcry_pkey_hd_t h, int cmd, int num_in, const unsigned char *const in[], @@ -165,9 +166,6 @@ _gcry_pkey_op (gcry_pkey_hd_t h, int cmd, { gcry_sexp_t s_tmp, s_tmp2; - if ((h->flags & GCRY_PKEY_FLAG_PREHASH)) - return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - if ((h->flags & GCRY_PKEY_FLAG_CONTEXT)) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); @@ -198,11 +196,18 @@ _gcry_pkey_op (gcry_pkey_hd_t h, int cmd, if (err) return err; - err = sexp_build (&s_msg, NULL, - "(data" - " (flags eddsa)" - " (hash-algo sha512)" - " (value %b))", (int)in_len[0], in[0]); + if ((h->flags & GCRY_PKEY_FLAG_PREHASH)) + err = sexp_build (&s_msg, NULL, + "(data" + " (flags eddsa prehash)" + " (hash-algo sha512)" + " (value %b))", (int)in_len[0], in[0]); + else + err = sexp_build (&s_msg, NULL, + "(data" + " (flags eddsa)" + " (hash-algo sha512)" + " (value %b))", (int)in_len[0], in[0]); if (err) { sexp_release (s_sk); @@ -262,11 +267,18 @@ _gcry_pkey_op (gcry_pkey_hd_t h, int cmd, if (err) return err; - err = sexp_build (&s_msg, NULL, - "(data" - " (flags eddsa)" - " (hash-algo sha512)" - " (value %b))", (int)in_len[0], in[0]); + if ((h->flags & GCRY_PKEY_FLAG_PREHASH)) + err = sexp_build (&s_msg, NULL, + "(data" + " (flags eddsa prehash)" + " (hash-algo sha512)" + " (value %b))", (int)in_len[0], in[0]); + else + err = sexp_build (&s_msg, NULL, + "(data" + " (flags eddsa)" + " (hash-algo sha512)" + " (value %b))", (int)in_len[0], in[0]); if (err) { sexp_release (s_pk); |