struct hmac_sha1_ctx sha1;
} ctx;
- /* this is the context just after
- * the set_key. Used in reset().
- */
- union
- {
- struct hmac_sha224_ctx sha224;
- struct hmac_sha256_ctx sha256;
- struct hmac_sha384_ctx sha384;
- struct hmac_sha512_ctx sha512;
- struct hmac_sha1_ctx sha1;
- } init_ctx;
void *ctx_ptr;
gnutls_mac_algorithm_t algo;
size_t length;
ctx->setkey (ctx->ctx_ptr, keylen, key);
- memcpy (&ctx->init_ctx, &ctx->ctx, sizeof (ctx->ctx));
-
return GNUTLS_E_SUCCESS;
}
-static void
-wrap_padlock_hmac_reset (void *_ctx)
-{
- struct padlock_hmac_ctx *ctx = _ctx;
-
- memcpy (&ctx->ctx, &ctx->init_ctx, sizeof (ctx->ctx));
-}
-
static int
wrap_padlock_hmac_update (void *_ctx, const void *text, size_t textsize)
{
.setkey = NULL,
.setnonce = NULL,
.hash = NULL,
- .reset = NULL,
.output = NULL,
.deinit = NULL,
.fast = wrap_padlock_hmac_fast
.setkey = wrap_padlock_hmac_setkey,
.setnonce = NULL,
.hash = wrap_padlock_hmac_update,
- .reset = wrap_padlock_hmac_reset,
.output = wrap_padlock_hmac_output,
.deinit = wrap_padlock_hmac_deinit,
.fast = wrap_padlock_hmac_fast,
int (*init) (gnutls_mac_algorithm_t, void **ctx);
int (*setkey) (void *ctx, const void *key, size_t keysize);
int (*setnonce) (void *ctx, const void *nonce, size_t noncesize);
- void (*reset) (void *ctx);
int (*hash) (void *ctx, const void *text, size_t textsize);
int (*output) (void *src_ctx, void *digest, size_t digestsize);
void (*deinit) (void *ctx);
else
{
_gnutls_mac_output (&handle->mac.mac, tag);
- _gnutls_mac_reset (&handle->mac.mac);
}
}
else if (_gnutls_cipher_is_aead(&handle->cipher))
mac->setnonce = cc->setnonce;
mac->output = cc->output;
mac->deinit = cc->deinit;
- mac->reset = cc->reset;
return 0;
}
mac->setnonce = _gnutls_mac_ops.setnonce;
mac->output = _gnutls_mac_ops.output;
mac->deinit = _gnutls_mac_ops.deinit;
- mac->reset = _gnutls_mac_ops.reset;
if (_gnutls_mac_ops.setkey (mac->handle, key, keylen) < 0)
{
int mac_len;
hash_func hash;
- reset_func reset;
nonce_func setnonce;
output_func output;
deinit_func deinit;
void
_gnutls_mac_deinit (mac_hd_st * handle, void *digest);
-inline static void
-_gnutls_mac_reset (mac_hd_st * handle)
-{
- if (handle->handle == NULL)
- {
- return;
- }
-
- handle->reset (handle->handle);
-}
-
-
/* Hash interface */
int _gnutls_hash_init (digest_hd_st *, gnutls_digest_algorithm_t algorithm);
struct umac96_ctx umac;
} ctx;
- /* this is the context just after
- * the set_key. Used in reset().
- */
- union
- {
- struct hmac_md5_ctx md5;
- struct hmac_sha224_ctx sha224;
- struct hmac_sha256_ctx sha256;
- struct hmac_sha384_ctx sha384;
- struct hmac_sha512_ctx sha512;
- struct hmac_sha1_ctx sha1;
- struct umac96_ctx umac;
- } init_ctx;
void *ctx_ptr;
gnutls_mac_algorithm_t algo;
size_t length;
ctx->set_key (ctx->ctx_ptr, keylen, key);
- memcpy(&ctx->init_ctx, &ctx->ctx, sizeof(ctx->ctx));
-
return GNUTLS_E_SUCCESS;
}
return GNUTLS_E_SUCCESS;
}
-static void
-wrap_nettle_mac_reset (void *_ctx)
-{
- struct nettle_mac_ctx *ctx = _ctx;
-
- memcpy(&ctx->ctx, &ctx->init_ctx, sizeof(ctx->ctx));
-}
-
static int
wrap_nettle_mac_update (void *_ctx, const void *text, size_t textsize)
{
.setkey = wrap_nettle_mac_set_key,
.setnonce = wrap_nettle_mac_set_nonce,
.hash = wrap_nettle_mac_update,
- .reset = wrap_nettle_mac_reset,
.output = wrap_nettle_mac_output,
.deinit = wrap_nettle_mac_deinit,
.fast = wrap_nettle_mac_fast,