void sha256_block_data_order(void *c, const void *p, size_t len);
void sha512_block_data_order(void *c, const void *p, size_t len);
-typedef void (*update_func)(void *, size_t, const uint8_t *);
-typedef void (*digest_func)(void *, size_t, uint8_t *);
+/* Can't use nettle_set_key_func as it doesn't have the second argument */
typedef void (*set_key_func)(void *, size_t, const uint8_t *);
-typedef void (*init_func)(void *);
struct aarch64_hash_ctx {
union {
void *ctx_ptr;
gnutls_digest_algorithm_t algo;
size_t length;
- update_func update;
- digest_func digest;
- init_func init;
+ nettle_hash_update_func *update;
+ nettle_hash_digest_func *digest;
+ nettle_hash_init_func *init;
};
static int wrap_aarch64_hash_update(void *_ctx, const void *text,
switch (algo) {
case GNUTLS_DIG_SHA1:
sha1_init(&ctx->ctx.sha1);
- ctx->update = (update_func)aarch64_sha1_update;
- ctx->digest = (digest_func)sha1_digest;
- ctx->init = (init_func)sha1_init;
+ ctx->update = (nettle_hash_update_func *)aarch64_sha1_update;
+ ctx->digest = (nettle_hash_digest_func *)sha1_digest;
+ ctx->init = (nettle_hash_init_func *)sha1_init;
ctx->ctx_ptr = &ctx->ctx.sha1;
ctx->length = SHA1_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA224:
sha224_init(&ctx->ctx.sha224);
- ctx->update = (update_func)aarch64_sha256_update;
- ctx->digest = (digest_func)sha224_digest;
- ctx->init = (init_func)sha224_init;
+ ctx->update = (nettle_hash_update_func *)aarch64_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha224_digest;
+ ctx->init = (nettle_hash_init_func *)sha224_init;
ctx->ctx_ptr = &ctx->ctx.sha224;
ctx->length = SHA224_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA256:
sha256_init(&ctx->ctx.sha256);
- ctx->update = (update_func)aarch64_sha256_update;
- ctx->digest = (digest_func)sha256_digest;
- ctx->init = (init_func)sha256_init;
+ ctx->update = (nettle_hash_update_func *)aarch64_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha256_digest;
+ ctx->init = (nettle_hash_init_func *)sha256_init;
ctx->ctx_ptr = &ctx->ctx.sha256;
ctx->length = SHA256_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA384:
sha384_init(&ctx->ctx.sha384);
- ctx->update = (update_func)aarch64_sha512_update;
- ctx->digest = (digest_func)sha384_digest;
- ctx->init = (init_func)sha384_init;
+ ctx->update = (nettle_hash_update_func *)aarch64_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)sha384_digest;
+ ctx->init = (nettle_hash_init_func *)sha384_init;
ctx->ctx_ptr = &ctx->ctx.sha384;
ctx->length = SHA384_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA512:
sha512_init(&ctx->ctx.sha512);
- ctx->update = (update_func)aarch64_sha512_update;
- ctx->digest = (digest_func)sha512_digest;
- ctx->init = (init_func)sha512_init;
+ ctx->update = (nettle_hash_update_func *)aarch64_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)sha512_digest;
+ ctx->init = (nettle_hash_init_func *)sha512_init;
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
#ifdef HAVE_LIBNETTLE
-typedef void (*update_func)(void *, size_t, const uint8_t *);
-typedef void (*digest_func)(void *, size_t, uint8_t *);
+/* Can't use nettle_set_key_func as it doesn't have the second argument */
typedef void (*set_key_func)(void *, size_t, const uint8_t *);
-typedef void (*init_func)(void *);
struct padlock_hash_ctx {
union {
void *ctx_ptr;
gnutls_digest_algorithm_t algo;
size_t length;
- update_func update;
- digest_func digest;
- init_func init;
+ nettle_hash_update_func *update;
+ nettle_hash_digest_func *digest;
+ nettle_hash_init_func *init;
};
static int wrap_padlock_hash_update(void *_ctx, const void *text,
switch (algo) {
case GNUTLS_DIG_SHA1:
sha1_init(&ctx->ctx.sha1);
- ctx->update = (update_func)padlock_sha1_update;
- ctx->digest = (digest_func)padlock_sha1_digest;
- ctx->init = (init_func)sha1_init;
+ ctx->update = (nettle_hash_update_func *)padlock_sha1_update;
+ ctx->digest = (nettle_hash_digest_func *)padlock_sha1_digest;
+ ctx->init = (nettle_hash_init_func *)sha1_init;
ctx->ctx_ptr = &ctx->ctx.sha1;
ctx->length = SHA1_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA224:
sha224_init(&ctx->ctx.sha224);
- ctx->update = (update_func)padlock_sha256_update;
- ctx->digest = (digest_func)padlock_sha256_digest;
- ctx->init = (init_func)sha224_init;
+ ctx->update = (nettle_hash_update_func *)padlock_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)padlock_sha256_digest;
+ ctx->init = (nettle_hash_init_func *)sha224_init;
ctx->ctx_ptr = &ctx->ctx.sha224;
ctx->length = SHA224_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA256:
sha256_init(&ctx->ctx.sha256);
- ctx->update = (update_func)padlock_sha256_update;
- ctx->digest = (digest_func)padlock_sha256_digest;
- ctx->init = (init_func)sha256_init;
+ ctx->update = (nettle_hash_update_func *)padlock_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)padlock_sha256_digest;
+ ctx->init = (nettle_hash_init_func *)sha256_init;
ctx->ctx_ptr = &ctx->ctx.sha256;
ctx->length = SHA256_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA384:
sha384_init(&ctx->ctx.sha384);
- ctx->update = (update_func)padlock_sha512_update;
- ctx->digest = (digest_func)padlock_sha512_digest;
- ctx->init = (init_func)sha384_init;
+ ctx->update = (nettle_hash_update_func *)padlock_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)padlock_sha512_digest;
+ ctx->init = (nettle_hash_init_func *)sha384_init;
ctx->ctx_ptr = &ctx->ctx.sha384;
ctx->length = SHA384_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA512:
sha512_init(&ctx->ctx.sha512);
- ctx->update = (update_func)padlock_sha512_update;
- ctx->digest = (digest_func)padlock_sha512_digest;
- ctx->init = (init_func)sha512_init;
+ ctx->update = (nettle_hash_update_func *)padlock_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)padlock_sha512_digest;
+ ctx->init = (nettle_hash_init_func *)sha512_init;
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
void sha256_block_data_order(void *c, const void *p, size_t len);
void sha512_block_data_order(void *c, const void *p, size_t len);
-typedef void (*update_func)(void *, size_t, const uint8_t *);
-typedef void (*digest_func)(void *, size_t, uint8_t *);
+/* Can't use nettle_set_key_func as it doesn't have the second argument */
typedef void (*set_key_func)(void *, size_t, const uint8_t *);
-typedef void (*init_func)(void *);
struct x86_hash_ctx {
union {
void *ctx_ptr;
gnutls_digest_algorithm_t algo;
size_t length;
- update_func update;
- digest_func digest;
- init_func init;
+ nettle_hash_update_func *update;
+ nettle_hash_digest_func *digest;
+ nettle_hash_init_func *init;
};
static int wrap_x86_hash_update(void *_ctx, const void *text, size_t textsize)
switch (algo) {
case GNUTLS_DIG_SHA1:
sha1_init(&ctx->ctx.sha1);
- ctx->update = (update_func)x86_sha1_update;
- ctx->digest = (digest_func)sha1_digest;
- ctx->init = (init_func)sha1_init;
+ ctx->update = (nettle_hash_update_func *)x86_sha1_update;
+ ctx->digest = (nettle_hash_digest_func *)sha1_digest;
+ ctx->init = (nettle_hash_init_func *)sha1_init;
ctx->ctx_ptr = &ctx->ctx.sha1;
ctx->length = SHA1_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA224:
sha224_init(&ctx->ctx.sha224);
- ctx->update = (update_func)x86_sha256_update;
- ctx->digest = (digest_func)sha224_digest;
- ctx->init = (init_func)sha224_init;
+ ctx->update = (nettle_hash_update_func *)x86_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha224_digest;
+ ctx->init = (nettle_hash_init_func *)sha224_init;
ctx->ctx_ptr = &ctx->ctx.sha224;
ctx->length = SHA224_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA256:
sha256_init(&ctx->ctx.sha256);
- ctx->update = (update_func)x86_sha256_update;
- ctx->digest = (digest_func)sha256_digest;
- ctx->init = (init_func)sha256_init;
+ ctx->update = (nettle_hash_update_func *)x86_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha256_digest;
+ ctx->init = (nettle_hash_init_func *)sha256_init;
ctx->ctx_ptr = &ctx->ctx.sha256;
ctx->length = SHA256_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA384:
sha384_init(&ctx->ctx.sha384);
- ctx->update = (update_func)x86_sha512_update;
- ctx->digest = (digest_func)sha384_digest;
- ctx->init = (init_func)sha384_init;
+ ctx->update = (nettle_hash_update_func *)x86_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)sha384_digest;
+ ctx->init = (nettle_hash_init_func *)sha384_init;
ctx->ctx_ptr = &ctx->ctx.sha384;
ctx->length = SHA384_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA512:
sha512_init(&ctx->ctx.sha512);
- ctx->update = (update_func)x86_sha512_update;
- ctx->digest = (digest_func)sha512_digest;
- ctx->init = (init_func)sha512_init;
+ ctx->update = (nettle_hash_update_func *)x86_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)sha512_digest;
+ ctx->init = (nettle_hash_init_func *)sha512_init;
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
#endif
#include <nettle/gcm.h>
-typedef void (*update_func)(void *, size_t, const uint8_t *);
-typedef void (*digest_func)(void *, size_t, uint8_t *);
+/* Can't use nettle_set_key_func as it doesn't have the second argument */
typedef void (*set_key_func)(void *, size_t, const uint8_t *);
typedef void (*set_nonce_func)(void *, size_t, const uint8_t *);
-typedef void (*init_func)(void *);
typedef bool (*finished_func)(void *);
static int wrap_nettle_hash_init(gnutls_digest_algorithm_t algo, void **_ctx);
void *ctx_ptr;
gnutls_digest_algorithm_t algo;
size_t length;
- update_func update;
- digest_func digest;
- init_func init;
+ nettle_hash_update_func *update;
+ nettle_hash_digest_func *digest;
+ nettle_hash_init_func *init;
finished_func finished;
};
void *ctx_ptr;
gnutls_mac_algorithm_t algo;
size_t length;
- update_func update;
- digest_func digest;
+ nettle_hash_update_func *update;
+ nettle_hash_digest_func *digest;
set_key_func set_key;
set_nonce_func set_nonce;
};
ctx->set_nonce = NULL;
switch (algo) {
case GNUTLS_MAC_MD5:
- ctx->update = (update_func)hmac_md5_update;
- ctx->digest = (digest_func)hmac_md5_digest;
+ ctx->update = (nettle_hash_update_func *)hmac_md5_update;
+ ctx->digest = (nettle_hash_digest_func *)hmac_md5_digest;
ctx->set_key = (set_key_func)hmac_md5_set_key;
ctx->ctx_ptr = &ctx->ctx.md5;
ctx->length = MD5_DIGEST_SIZE;
break;
case GNUTLS_MAC_SHA1:
- ctx->update = (update_func)hmac_sha1_update;
- ctx->digest = (digest_func)hmac_sha1_digest;
+ ctx->update = (nettle_hash_update_func *)hmac_sha1_update;
+ ctx->digest = (nettle_hash_digest_func *)hmac_sha1_digest;
ctx->set_key = (set_key_func)hmac_sha1_set_key;
ctx->ctx_ptr = &ctx->ctx.sha1;
ctx->length = SHA1_DIGEST_SIZE;
break;
case GNUTLS_MAC_SHA224:
- ctx->update = (update_func)hmac_sha224_update;
- ctx->digest = (digest_func)hmac_sha224_digest;
+ ctx->update = (nettle_hash_update_func *)hmac_sha224_update;
+ ctx->digest = (nettle_hash_digest_func *)hmac_sha224_digest;
ctx->set_key = (set_key_func)hmac_sha224_set_key;
ctx->ctx_ptr = &ctx->ctx.sha224;
ctx->length = SHA224_DIGEST_SIZE;
break;
case GNUTLS_MAC_SHA256:
- ctx->update = (update_func)hmac_sha256_update;
- ctx->digest = (digest_func)hmac_sha256_digest;
+ ctx->update = (nettle_hash_update_func *)hmac_sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)hmac_sha256_digest;
ctx->set_key = (set_key_func)hmac_sha256_set_key;
ctx->ctx_ptr = &ctx->ctx.sha256;
ctx->length = SHA256_DIGEST_SIZE;
break;
case GNUTLS_MAC_SHA384:
- ctx->update = (update_func)hmac_sha384_update;
- ctx->digest = (digest_func)hmac_sha384_digest;
+ ctx->update = (nettle_hash_update_func *)hmac_sha384_update;
+ ctx->digest = (nettle_hash_digest_func *)hmac_sha384_digest;
ctx->set_key = (set_key_func)hmac_sha384_set_key;
ctx->ctx_ptr = &ctx->ctx.sha384;
ctx->length = SHA384_DIGEST_SIZE;
break;
case GNUTLS_MAC_SHA512:
- ctx->update = (update_func)hmac_sha512_update;
- ctx->digest = (digest_func)hmac_sha512_digest;
+ ctx->update = (nettle_hash_update_func *)hmac_sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)hmac_sha512_digest;
ctx->set_key = (set_key_func)hmac_sha512_set_key;
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
#if ENABLE_GOST
case GNUTLS_MAC_GOSTR_94:
- ctx->update = (update_func)hmac_gosthash94cp_update;
- ctx->digest = (digest_func)hmac_gosthash94cp_digest;
+ ctx->update =
+ (nettle_hash_update_func *)hmac_gosthash94cp_update;
+ ctx->digest =
+ (nettle_hash_digest_func *)hmac_gosthash94cp_digest;
ctx->set_key = (set_key_func)hmac_gosthash94cp_set_key;
ctx->ctx_ptr = &ctx->ctx.gosthash94cp;
ctx->length = GOSTHASH94CP_DIGEST_SIZE;
break;
case GNUTLS_MAC_STREEBOG_256:
- ctx->update = (update_func)hmac_streebog256_update;
- ctx->digest = (digest_func)hmac_streebog256_digest;
+ ctx->update =
+ (nettle_hash_update_func *)hmac_streebog256_update;
+ ctx->digest =
+ (nettle_hash_digest_func *)hmac_streebog256_digest;
ctx->set_key = (set_key_func)hmac_streebog256_set_key;
ctx->ctx_ptr = &ctx->ctx.streebog256;
ctx->length = STREEBOG256_DIGEST_SIZE;
break;
case GNUTLS_MAC_STREEBOG_512:
- ctx->update = (update_func)hmac_streebog512_update;
- ctx->digest = (digest_func)hmac_streebog512_digest;
+ ctx->update =
+ (nettle_hash_update_func *)hmac_streebog512_update;
+ ctx->digest =
+ (nettle_hash_digest_func *)hmac_streebog512_digest;
ctx->set_key = (set_key_func)hmac_streebog512_set_key;
ctx->ctx_ptr = &ctx->ctx.streebog512;
ctx->length = STREEBOG512_DIGEST_SIZE;
break;
case GNUTLS_MAC_GOST28147_TC26Z_IMIT:
- ctx->update = (update_func)gost28147_imit_update;
- ctx->digest = (digest_func)gost28147_imit_digest;
+ ctx->update = (nettle_hash_update_func *)gost28147_imit_update;
+ ctx->digest = (nettle_hash_digest_func *)gost28147_imit_digest;
ctx->set_key = _wrap_gost28147_imit_set_key_tc26z;
ctx->ctx_ptr = &ctx->ctx.gost28147_imit;
ctx->length = GOST28147_IMIT_DIGEST_SIZE;
break;
case GNUTLS_MAC_MAGMA_OMAC:
- ctx->update = (update_func)cmac_magma_update;
- ctx->digest = (digest_func)cmac_magma_digest;
+ ctx->update = (nettle_hash_update_func *)cmac_magma_update;
+ ctx->digest = (nettle_hash_digest_func *)cmac_magma_digest;
ctx->set_key = _wrap_cmac_magma_set_key;
ctx->ctx_ptr = &ctx->ctx.magma;
ctx->length = CMAC64_DIGEST_SIZE;
break;
case GNUTLS_MAC_KUZNYECHIK_OMAC:
- ctx->update = (update_func)cmac_kuznyechik_update;
- ctx->digest = (digest_func)cmac_kuznyechik_digest;
+ ctx->update = (nettle_hash_update_func *)cmac_kuznyechik_update;
+ ctx->digest = (nettle_hash_digest_func *)cmac_kuznyechik_digest;
ctx->set_key = _wrap_cmac_kuznyechik_set_key;
ctx->ctx_ptr = &ctx->ctx.kuznyechik;
ctx->length = CMAC128_DIGEST_SIZE;
break;
#endif
case GNUTLS_MAC_UMAC_96:
- ctx->update = (update_func)umac96_update;
- ctx->digest = (digest_func)umac96_digest;
+ ctx->update = (nettle_hash_update_func *)umac96_update;
+ ctx->digest = (nettle_hash_digest_func *)umac96_digest;
ctx->set_key = _wrap_umac96_set_key;
ctx->set_nonce = (set_nonce_func)umac96_set_nonce;
ctx->ctx_ptr = &ctx->ctx.umac96;
ctx->length = 12;
break;
case GNUTLS_MAC_UMAC_128:
- ctx->update = (update_func)umac128_update;
- ctx->digest = (digest_func)umac128_digest;
+ ctx->update = (nettle_hash_update_func *)umac128_update;
+ ctx->digest = (nettle_hash_digest_func *)umac128_digest;
ctx->set_key = _wrap_umac128_set_key;
ctx->set_nonce = (set_nonce_func)umac128_set_nonce;
ctx->ctx_ptr = &ctx->ctx.umac128;
ctx->length = 16;
break;
case GNUTLS_MAC_AES_CMAC_128:
- ctx->update = (update_func)cmac_aes128_update;
- ctx->digest = (digest_func)cmac_aes128_digest;
+ ctx->update = (nettle_hash_update_func *)cmac_aes128_update;
+ ctx->digest = (nettle_hash_digest_func *)cmac_aes128_digest;
ctx->set_key = _wrap_cmac128_set_key;
ctx->ctx_ptr = &ctx->ctx.cmac128;
ctx->length = CMAC128_DIGEST_SIZE;
break;
case GNUTLS_MAC_AES_CMAC_256:
- ctx->update = (update_func)cmac_aes256_update;
- ctx->digest = (digest_func)cmac_aes256_digest;
+ ctx->update = (nettle_hash_update_func *)cmac_aes256_update;
+ ctx->digest = (nettle_hash_digest_func *)cmac_aes256_digest;
ctx->set_key = _wrap_cmac256_set_key;
ctx->ctx_ptr = &ctx->ctx.cmac256;
ctx->length = CMAC128_DIGEST_SIZE;
ctx->finished = NULL;
switch (algo) {
case GNUTLS_DIG_MD5:
- ctx->init = (init_func)md5_init;
- ctx->update = (update_func)md5_update;
- ctx->digest = (digest_func)md5_digest;
+ ctx->init = (nettle_hash_init_func *)md5_init;
+ ctx->update = (nettle_hash_update_func *)md5_update;
+ ctx->digest = (nettle_hash_digest_func *)md5_digest;
ctx->ctx_ptr = &ctx->ctx.md5;
ctx->length = MD5_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA1:
- ctx->init = (init_func)sha1_init;
- ctx->update = (update_func)sha1_update;
- ctx->digest = (digest_func)sha1_digest;
+ ctx->init = (nettle_hash_init_func *)sha1_init;
+ ctx->update = (nettle_hash_update_func *)sha1_update;
+ ctx->digest = (nettle_hash_digest_func *)sha1_digest;
ctx->ctx_ptr = &ctx->ctx.sha1;
ctx->length = SHA1_DIGEST_SIZE;
break;
case GNUTLS_DIG_MD5_SHA1:
- ctx->init = (init_func)_md5_sha1_init;
- ctx->update = (update_func)_md5_sha1_update;
- ctx->digest = (digest_func)_md5_sha1_digest;
+ ctx->init = (nettle_hash_init_func *)_md5_sha1_init;
+ ctx->update = (nettle_hash_update_func *)_md5_sha1_update;
+ ctx->digest = (nettle_hash_digest_func *)_md5_sha1_digest;
ctx->ctx_ptr = &ctx->ctx.md5_sha1;
ctx->length = MD5_DIGEST_SIZE + SHA1_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA224:
- ctx->init = (init_func)sha224_init;
- ctx->update = (update_func)sha224_update;
- ctx->digest = (digest_func)sha224_digest;
+ ctx->init = (nettle_hash_init_func *)sha224_init;
+ ctx->update = (nettle_hash_update_func *)sha224_update;
+ ctx->digest = (nettle_hash_digest_func *)sha224_digest;
ctx->ctx_ptr = &ctx->ctx.sha224;
ctx->length = SHA224_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA256:
- ctx->init = (init_func)sha256_init;
- ctx->update = (update_func)sha256_update;
- ctx->digest = (digest_func)sha256_digest;
+ ctx->init = (nettle_hash_init_func *)sha256_init;
+ ctx->update = (nettle_hash_update_func *)sha256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha256_digest;
ctx->ctx_ptr = &ctx->ctx.sha256;
ctx->length = SHA256_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA384:
- ctx->init = (init_func)sha384_init;
- ctx->update = (update_func)sha384_update;
- ctx->digest = (digest_func)sha384_digest;
+ ctx->init = (nettle_hash_init_func *)sha384_init;
+ ctx->update = (nettle_hash_update_func *)sha384_update;
+ ctx->digest = (nettle_hash_digest_func *)sha384_digest;
ctx->ctx_ptr = &ctx->ctx.sha384;
ctx->length = SHA384_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA512:
- ctx->init = (init_func)sha512_init;
- ctx->update = (update_func)sha512_update;
- ctx->digest = (digest_func)sha512_digest;
+ ctx->init = (nettle_hash_init_func *)sha512_init;
+ ctx->update = (nettle_hash_update_func *)sha512_update;
+ ctx->digest = (nettle_hash_digest_func *)sha512_digest;
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
#ifdef NETTLE_SHA3_FIPS202
case GNUTLS_DIG_SHA3_224:
- ctx->init = (init_func)sha3_224_init;
- ctx->update = (update_func)sha3_224_update;
- ctx->digest = (digest_func)sha3_224_digest;
+ ctx->init = (nettle_hash_init_func *)sha3_224_init;
+ ctx->update = (nettle_hash_update_func *)sha3_224_update;
+ ctx->digest = (nettle_hash_digest_func *)sha3_224_digest;
ctx->ctx_ptr = &ctx->ctx.sha3_224;
ctx->length = SHA3_224_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA3_256:
- ctx->init = (init_func)sha3_256_init;
- ctx->update = (update_func)sha3_256_update;
- ctx->digest = (digest_func)sha3_256_digest;
+ ctx->init = (nettle_hash_init_func *)sha3_256_init;
+ ctx->update = (nettle_hash_update_func *)sha3_256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha3_256_digest;
ctx->ctx_ptr = &ctx->ctx.sha3_256;
ctx->length = SHA3_256_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA3_384:
- ctx->init = (init_func)sha3_384_init;
- ctx->update = (update_func)sha3_384_update;
- ctx->digest = (digest_func)sha3_384_digest;
+ ctx->init = (nettle_hash_init_func *)sha3_384_init;
+ ctx->update = (nettle_hash_update_func *)sha3_384_update;
+ ctx->digest = (nettle_hash_digest_func *)sha3_384_digest;
ctx->ctx_ptr = &ctx->ctx.sha3_384;
ctx->length = SHA3_384_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHA3_512:
- ctx->init = (init_func)sha3_512_init;
- ctx->update = (update_func)sha3_512_update;
- ctx->digest = (digest_func)sha3_512_digest;
+ ctx->init = (nettle_hash_init_func *)sha3_512_init;
+ ctx->update = (nettle_hash_update_func *)sha3_512_update;
+ ctx->digest = (nettle_hash_digest_func *)sha3_512_digest;
ctx->ctx_ptr = &ctx->ctx.sha3_512;
ctx->length = SHA3_512_DIGEST_SIZE;
break;
case GNUTLS_DIG_SHAKE_128:
- ctx->init = (init_func)sha3_128_init;
- ctx->update = (update_func)sha3_128_update;
- ctx->digest = (digest_func)sha3_128_shake_output;
+ ctx->init = (nettle_hash_init_func *)sha3_128_init;
+ ctx->update = (nettle_hash_update_func *)sha3_128_update;
+ ctx->digest = (nettle_hash_digest_func *)sha3_128_shake_output;
ctx->finished = _wrap_sha3_128_shake_finished;
ctx->ctx_ptr = &ctx->ctx.sha3_128;
ctx->length = 0; /* unused */
break;
case GNUTLS_DIG_SHAKE_256:
- ctx->init = (init_func)sha3_256_init;
- ctx->update = (update_func)sha3_256_update;
- ctx->digest = (digest_func)sha3_256_shake_output;
+ ctx->init = (nettle_hash_init_func *)sha3_256_init;
+ ctx->update = (nettle_hash_update_func *)sha3_256_update;
+ ctx->digest = (nettle_hash_digest_func *)sha3_256_shake_output;
ctx->finished = _wrap_sha3_256_shake_finished;
ctx->ctx_ptr = &ctx->ctx.sha3_256;
ctx->length = 0; /* unused */
break;
#endif
case GNUTLS_DIG_MD2:
- ctx->init = (init_func)md2_init;
- ctx->update = (update_func)md2_update;
- ctx->digest = (digest_func)md2_digest;
+ ctx->init = (nettle_hash_init_func *)md2_init;
+ ctx->update = (nettle_hash_update_func *)md2_update;
+ ctx->digest = (nettle_hash_digest_func *)md2_digest;
ctx->ctx_ptr = &ctx->ctx.md2;
ctx->length = MD2_DIGEST_SIZE;
break;
case GNUTLS_DIG_RMD160:
- ctx->init = (init_func)ripemd160_init;
- ctx->update = (update_func)ripemd160_update;
- ctx->digest = (digest_func)ripemd160_digest;
+ ctx->init = (nettle_hash_init_func *)ripemd160_init;
+ ctx->update = (nettle_hash_update_func *)ripemd160_update;
+ ctx->digest = (nettle_hash_digest_func *)ripemd160_digest;
ctx->ctx_ptr = &ctx->ctx.ripemd160;
ctx->length = RIPEMD160_DIGEST_SIZE;
break;
#if ENABLE_GOST
case GNUTLS_DIG_GOSTR_94:
- ctx->init = (init_func)gosthash94cp_init;
- ctx->update = (update_func)gosthash94cp_update;
- ctx->digest = (digest_func)gosthash94cp_digest;
+ ctx->init = (nettle_hash_init_func *)gosthash94cp_init;
+ ctx->update = (nettle_hash_update_func *)gosthash94cp_update;
+ ctx->digest = (nettle_hash_digest_func *)gosthash94cp_digest;
ctx->ctx_ptr = &ctx->ctx.gosthash94cp;
ctx->length = GOSTHASH94_DIGEST_SIZE;
break;
case GNUTLS_DIG_STREEBOG_256:
- ctx->init = (init_func)streebog256_init;
- ctx->update = (update_func)streebog256_update;
- ctx->digest = (digest_func)streebog256_digest;
+ ctx->init = (nettle_hash_init_func *)streebog256_init;
+ ctx->update = (nettle_hash_update_func *)streebog256_update;
+ ctx->digest = (nettle_hash_digest_func *)streebog256_digest;
ctx->ctx_ptr = &ctx->ctx.streebog256;
ctx->length = STREEBOG256_DIGEST_SIZE;
break;
case GNUTLS_DIG_STREEBOG_512:
- ctx->init = (init_func)streebog512_init;
- ctx->update = (update_func)streebog512_update;
- ctx->digest = (digest_func)streebog512_digest;
+ ctx->init = (nettle_hash_init_func *)streebog512_init;
+ ctx->update = (nettle_hash_update_func *)streebog512_update;
+ ctx->digest = (nettle_hash_digest_func *)streebog512_digest;
ctx->ctx_ptr = &ctx->ctx.streebog512;
ctx->length = STREEBOG512_DIGEST_SIZE;
break;