39#define CX_SHA3_224_SIZE 28
42#define CX_SHA3_256_SIZE 32
45#define CX_SHA3_384_SIZE 48
48#define CX_SHA3_512_SIZE 64
51#define CX_KECCAK_224_SIZE 28
54#define CX_KECCAK_256_SIZE 32
57#define CX_KECCAK_384_SIZE 48
60#define CX_KECCAK_512_SIZE 64
66 struct cx_hash_header_s header;
74typedef struct cx_sha3_s cx_sha3_t;
94WARN_UNUSED_RESULT cx_err_t cx_sha3_init_no_throw(cx_sha3_t *hash,
size_t size);
100DEPRECATED
static inline int cx_sha3_init(cx_sha3_t *hash,
size_t size)
102 CX_THROW(cx_sha3_init_no_throw(hash, size));
118cx_err_t cx_sha3_224_hash_iovec(
const cx_iovec_t *iovec,
120 uint8_t digest[
static CX_SHA3_224_SIZE]);
134static inline cx_err_t cx_sha3_224_hash(
const uint8_t *in,
136 uint8_t digest[
static CX_SHA3_224_SIZE])
140 return cx_sha3_224_hash_iovec(&iovec, 1, digest);
155cx_err_t cx_sha3_256_hash_iovec(
const cx_iovec_t *iovec,
157 uint8_t digest[
static CX_SHA3_256_SIZE]);
171static inline cx_err_t cx_sha3_256_hash(
const uint8_t *in,
173 uint8_t digest[
static CX_SHA3_256_SIZE])
177 return cx_sha3_256_hash_iovec(&iovec, 1, digest);
192cx_err_t cx_sha3_384_hash_iovec(
const cx_iovec_t *iovec,
194 uint8_t digest[
static CX_SHA3_384_SIZE]);
208static inline cx_err_t cx_sha3_384_hash(
const uint8_t *in,
210 uint8_t digest[
static CX_SHA3_384_SIZE])
214 return cx_sha3_384_hash_iovec(&iovec, 1, digest);
229cx_err_t cx_sha3_512_hash_iovec(
const cx_iovec_t *iovec,
231 uint8_t digest[
static CX_SHA3_512_SIZE]);
245static inline cx_err_t cx_sha3_512_hash(
const uint8_t *in,
247 uint8_t digest[
static CX_SHA3_512_SIZE])
251 return cx_sha3_512_hash_iovec(&iovec, 1, digest);
273WARN_UNUSED_RESULT cx_err_t cx_keccak_init_no_throw(cx_sha3_t *hash,
size_t size);
279DEPRECATED
static inline int cx_keccak_init(cx_sha3_t *hash,
size_t size)
281 CX_THROW(cx_keccak_init_no_throw(hash, size));
297cx_err_t cx_keccak_224_hash_iovec(
const cx_iovec_t *iovec,
299 uint8_t digest[
static CX_KECCAK_224_SIZE]);
313static inline cx_err_t cx_keccak_224_hash(
const uint8_t *in,
315 uint8_t digest[
static CX_KECCAK_224_SIZE])
319 return cx_keccak_224_hash_iovec(&iovec, 1, digest);
334cx_err_t cx_keccak_256_hash_iovec(
const cx_iovec_t *iovec,
336 uint8_t digest[
static CX_KECCAK_256_SIZE]);
350static inline cx_err_t cx_keccak_256_hash(
const uint8_t *in,
352 uint8_t digest[
static CX_KECCAK_256_SIZE])
356 return cx_keccak_256_hash_iovec(&iovec, 1, digest);
371cx_err_t cx_keccak_384_hash_iovec(
const cx_iovec_t *iovec,
373 uint8_t digest[
static CX_KECCAK_384_SIZE]);
387static inline cx_err_t cx_keccak_384_hash(
const uint8_t *in,
389 uint8_t digest[
static CX_KECCAK_384_SIZE])
393 return cx_keccak_384_hash_iovec(&iovec, 1, digest);
408cx_err_t cx_keccak_512_hash_iovec(
const cx_iovec_t *iovec,
410 uint8_t digest[
static CX_KECCAK_512_SIZE]);
424static inline cx_err_t cx_keccak_512_hash(
const uint8_t *in,
426 uint8_t digest[
static CX_KECCAK_512_SIZE])
430 return cx_keccak_512_hash_iovec(&iovec, 1, digest);
451WARN_UNUSED_RESULT cx_err_t cx_shake128_init_no_throw(cx_sha3_t *hash,
size_t out_size);
457DEPRECATED
static inline int cx_shake128_init(cx_sha3_t *hash,
unsigned int out_size)
459 CX_THROW(cx_shake128_init_no_throw(hash, out_size));
477cx_err_t cx_shake128_hash_iovec(
const cx_iovec_t *iovec,
496static inline cx_err_t cx_shake128_hash(
const uint8_t *in,
503 return cx_shake128_hash_iovec(&iovec, 1, digest, out_length);
524WARN_UNUSED_RESULT cx_err_t cx_shake256_init_no_throw(cx_sha3_t *hash,
size_t out_size);
530DEPRECATED
static inline int cx_shake256_init(cx_sha3_t *hash,
unsigned int out_length)
532 CX_THROW(cx_shake256_init_no_throw(hash, out_length));
549cx_err_t cx_shake256_hash_iovec(
const cx_iovec_t *iovec,
568static inline cx_err_t cx_shake256_hash(
const uint8_t *in,
575 return cx_shake256_hash_iovec(&iovec, 1, digest, out_length);
598WARN_UNUSED_RESULT cx_err_t cx_sha3_xof_init_no_throw(cx_sha3_t *hash,
606DEPRECATED
static inline int cx_sha3_xof_init(cx_sha3_t *hash,
608 unsigned int out_length)
610 CX_THROW(cx_sha3_xof_init_no_throw(hash, size, out_length));
Similar to libc iovec type.
64-bit types, native or by-hands, depending on target and/or compiler support.