Re: Adding cSHAKE digest

Werner Koch via Gcrypt-devel <[email protected]>
Newsgroups gmane.comp.encryption.gpg.libgcrypt.devel
Message-ID <[email protected]>
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

_______________________________________________
Gcrypt-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
openpgp-digital-signature.asc (application/pgp-signature, 247 B)
-----BEGIN PGP SIGNATURE-----

iIMEARYIACsWIQSHd0YfKgdOvEgNNZQZzByeCFsQegUCZgVruQ0cd2tAZ251cGcu
b3JnAAoJEBnMHJ4IWxB6gmkA/2ZuyWp9ZWxj41XuCjYEJDoJ040OD/uMeM5EZ0UV
WI+9AQCEOFGT+APuuR4+g0b6IvHkt8Mu8qlbAWfUGnueTp2cDQ==
=hG9x
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.