Adding cSHAKE digest
Werner Koch
wk at gnupg.org
Thu Mar 28 14:08:09 CET 2024
Hi,
I looked at the cSHAKE changes and wondered whether we should replace
the
struct gcry_cshake_customization
{
const void *n;
unsigned int n_len;
const void *s;
unsigned int s_len;
};
by the already existing
typedef struct
{
size_t size; /* The allocated size of the buffer or 0. */
size_t off; /* Offset into the buffer. */
size_t len; /* The used length of the buffer. */
void *data; /* The buffer. */
} gcry_buffer_t;
Or a new
typedef struct
{
size_t size; /* The allocated size of the buffer or 0. */
size_t off; /* Offset into the buffer. */
size_t len; /* The used length of the buffer. */
const void *data; /* The buffer. */
} gcry_cbuffer_t;
the only disadvantge I see is that it won't be possible to have a sanity
check like
if (buflen != sizeof (struct gcry_cshake_customization))
rc = GPG_ERR_INV_ARG;
But this check could be done if we also define a
typedef struct
{
size_t count;
union {
gcry_buffer_t v[1];
gcry_cbuffer_t c[1];
} io;
} gcry_buffer_desc_t;
Or if one prefers better checks drop the union.
What do you think?
Shalom-Salam,
Werner
--
The pioneers of a warless world are the youth that
refuse military service. - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 247 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20240328/021ef4e5/attachment.sig>
More information about the Gcrypt-devel
mailing list