pqc-thunderbird / libgcrypt

GNU General Public License v2.0
1 stars 0 forks source link

SPHINCS Tasks #23

Closed TJ-91 closed 9 months ago

TJ-91 commented 1 year ago
falko-strenzke commented 1 year ago

Not sure what exactly you mean by "HMAC-512", but I assume "HMAC-SHA512". Libgcrypt features also HMAC-SHA512. From cipher/mac-hmac.c:

const gcry_mac_spec_t _gcry_mac_type_spec_hmac_sha512 = {
  GCRY_MAC_HMAC_SHA512, {0, 1}, "HMAC_SHA512",
  &hmac_ops
};
falko-strenzke commented 1 year ago
  • mgf1 is already implemented for RSA but only with static methods and not with a real interface. Now that SPHINCS+ also needs it, this might be turned into a real implementation with an interface (prefer the easy solution to just replace the hash calls from ref impl.)

Yes, definitely the existing implementation of MGF1 should be used. I propose to put it into a new file cipher/mgf.c and the corresponding header file. But it should not become accessible through the API, only offer an internal interface. As far as I can see, the single existing function

static gcry_err_code_t
mgf1 (unsigned char *output, size_t outlen, unsigned char *seed, size_t seedlen,
      int algo)

should suffice, right?

TJ-91 commented 1 year ago

Good suggestions.

Libgcrypt features also HMAC-SHA512

Ah, I was confused by hmac256.c and didn't see mac-hmac.c.

should suffice, right?

Yes that should work