35#ifdef HAVE_RNG_RFC6979
36#define CX_RFC6979_BUFFER_LENGTH 64
37#define CX_RFC6979_MAX_RLEN 66
40 uint8_t v[CX_RFC6979_BUFFER_LENGTH + 1];
41 uint8_t k[CX_RFC6979_BUFFER_LENGTH];
42 uint8_t q[CX_RFC6979_MAX_RLEN];
45 uint8_t tmp[CX_RFC6979_MAX_RLEN];
50#if (!defined(HAVE_SHA512) && !defined(HAVE_SHA384) && !defined(HAVE_SHA256) \
51 && !defined(HAVE_SHA224)) \
52 || !defined(HAVE_HMAC)
53#error No hmac defined for rfc6979 support
58#if defined(HAVE_SHA512) || defined(HAVE_SHA384)
59 cx_hmac_sha512_t hmac_sha512;
62#if defined(HAVE_SHA256) || defined(HAVE_SHA224)
63 cx_hmac_sha256_t hmac_sha256;
66} cx_rnd_rfc6979_ctx_t;
79void cx_rng_no_throw(uint8_t *buffer,
size_t len);
92static inline unsigned char *cx_rng(uint8_t *buffer,
size_t len)
94 cx_rng_no_throw(buffer, len);
103static inline uint32_t cx_rng_u32(
void)
106 cx_rng_no_throw((uint8_t *) &r,
sizeof(uint32_t));
115static inline uint8_t cx_rng_u8(
void)
118 cx_rng_no_throw((uint8_t *) &r,
sizeof(uint8_t));
122typedef uint32_t (*cx_rng_u32_range_randfunc_t)(void);
139uint32_t cx_rng_u32_range_func(uint32_t a, uint32_t b, cx_rng_u32_range_randfunc_t randfunc);
153static inline uint32_t cx_rng_u32_range(uint32_t a, uint32_t b)
155 return cx_rng_u32_range_func(a, b, cx_rng_u32);
184WARN_UNUSED_RESULT cx_err_t cx_rng_rfc6979(cx_md_t hash_id,
195#ifdef HAVE_RNG_RFC6979
220WARN_UNUSED_RESULT cx_err_t cx_rng_rfc6979_init(cx_rnd_rfc6979_ctx_t *rfc_ctx,
245WARN_UNUSED_RESULT cx_err_t cx_rng_rfc6979_next(cx_rnd_rfc6979_ctx_t *rfc_ctx,
Include cryptography files.