44 #include "cx_errors.h"
78 typedef enum cx_md_e cx_md_t;
84 #define CX_HASH_MAX_BLOCK_COUNT 65535
87 typedef struct cx_hash_header_s cx_hash_t;
97 cx_err_t (*init_func)(cx_hash_t *ctx);
98 cx_err_t (*update_func)(cx_hash_t *ctx,
101 cx_err_t (*finish_func)(cx_hash_t *ctx,
uint8_t *digest);
102 cx_err_t (*init_ex_func)(
105 size_t (*output_size_func)(
const cx_hash_t *ctx);
111 struct cx_hash_header_s {
112 const cx_hash_info_t *info;
116 size_t cx_hash_get_size(
const cx_hash_t *ctx);
146 WARN_UNUSED_RESULT cx_err_t cx_hash_no_throw(cx_hash_t *hash,
157 DEPRECATED
static inline size_t cx_hash(cx_hash_t *hash,
159 const unsigned char *in,
162 unsigned int out_len)
164 CX_THROW(cx_hash_no_throw(hash, mode, in, len, out, out_len));
165 return cx_hash_get_size(hash);
180 WARN_UNUSED_RESULT cx_err_t cx_hash_init(cx_hash_t *hash, cx_md_t hash_id);
202 WARN_UNUSED_RESULT cx_err_t cx_hash_init_ex(cx_hash_t *hash, cx_md_t hash_id,
size_t output_size);
221 WARN_UNUSED_RESULT cx_err_t cx_hash_update(cx_hash_t *hash,
const uint8_t *in,
size_t in_len);
236 WARN_UNUSED_RESULT cx_err_t cx_hash_final(cx_hash_t *hash,
uint8_t *digest);