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;
74 typedef struct cx_sha3_s cx_sha3_t;
94 WARN_UNUSED_RESULT cx_err_t cx_sha3_init_no_throw(cx_sha3_t *hash,
size_t size);
100 DEPRECATED
static inline int cx_sha3_init(cx_sha3_t *hash,
size_t size)
102 CX_THROW(cx_sha3_init_no_throw(hash, size));
118 cx_err_t cx_sha3_224_hash_iovec(
const cx_iovec_t *iovec,
120 uint8_t digest[
static CX_SHA3_224_SIZE]);
134 static 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);
155 cx_err_t cx_sha3_256_hash_iovec(
const cx_iovec_t *iovec,
157 uint8_t digest[
static CX_SHA3_256_SIZE]);
171 static 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);
192 cx_err_t cx_sha3_384_hash_iovec(
const cx_iovec_t *iovec,
194 uint8_t digest[
static CX_SHA3_384_SIZE]);
208 static 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);
229 cx_err_t cx_sha3_512_hash_iovec(
const cx_iovec_t *iovec,
231 uint8_t digest[
static CX_SHA3_512_SIZE]);
245 static 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);
273 WARN_UNUSED_RESULT cx_err_t cx_keccak_init_no_throw(cx_sha3_t *hash,
size_t size);
279 DEPRECATED
static inline int cx_keccak_init(cx_sha3_t *hash,
size_t size)
281 CX_THROW(cx_keccak_init_no_throw(hash, size));
297 cx_err_t cx_keccak_224_hash_iovec(
const cx_iovec_t *iovec,
299 uint8_t digest[
static CX_KECCAK_224_SIZE]);
313 static 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);
334 cx_err_t cx_keccak_256_hash_iovec(
const cx_iovec_t *iovec,
336 uint8_t digest[
static CX_KECCAK_256_SIZE]);
350 static 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);
371 cx_err_t cx_keccak_384_hash_iovec(
const cx_iovec_t *iovec,
373 uint8_t digest[
static CX_KECCAK_384_SIZE]);
387 static 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);
408 cx_err_t cx_keccak_512_hash_iovec(
const cx_iovec_t *iovec,
410 uint8_t digest[
static CX_KECCAK_512_SIZE]);
424 static 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);
451 WARN_UNUSED_RESULT cx_err_t cx_shake128_init_no_throw(cx_sha3_t *hash,
size_t out_size);
457 DEPRECATED
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));
477 cx_err_t cx_shake128_hash_iovec(
const cx_iovec_t *iovec,
496 static inline cx_err_t cx_shake128_hash(
const uint8_t *in,
503 return cx_shake128_hash_iovec(&iovec, 1, digest, out_length);
524 WARN_UNUSED_RESULT cx_err_t cx_shake256_init_no_throw(cx_sha3_t *hash,
size_t out_size);
530 DEPRECATED
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));
549 cx_err_t cx_shake256_hash_iovec(
const cx_iovec_t *iovec,
568 static inline cx_err_t cx_shake256_hash(
const uint8_t *in,
575 return cx_shake256_hash_iovec(&iovec, 1, digest, out_length);
598 WARN_UNUSED_RESULT cx_err_t cx_sha3_xof_init_no_throw(cx_sha3_t *hash,
606 DEPRECATED
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.