openssl_ops_hmac (vlib_main_t * vm, vnet_crypto_op_t * ops[], u32 n_ops,
const EVP_MD * md)
{
openssl_ops_hmac (vlib_main_t * vm, vnet_crypto_op_t * ops[], u32 n_ops,
const EVP_MD * md)
{
openssl_per_thread_data_t *ptd = vec_elt_at_index (per_thread_data,
vm->thread_index);
HMAC_CTX *ctx = ptd->hmac_ctx;
openssl_per_thread_data_t *ptd = vec_elt_at_index (per_thread_data,
vm->thread_index);
HMAC_CTX *ctx = ptd->hmac_ctx;
HMAC_Init_ex (ctx, op->key, op->key_len, md, NULL);
HMAC_Update (ctx, op->src, op->len);
HMAC_Init_ex (ctx, op->key, op->key_len, md, NULL);
HMAC_Update (ctx, op->src, op->len);
- HMAC_Final (ctx, op->dst, &out_len);
+ if (op->hmac_trunc_len)
+ {
+ HMAC_Final (ctx, buffer, &out_len);
+ clib_memcpy_fast (op->dst, buffer, op->hmac_trunc_len);
+ }
+ else
+ HMAC_Final (ctx, op->dst, &out_len);
op->status = VNET_CRYPTO_OP_STATUS_COMPLETED;
}
return n_ops;
op->status = VNET_CRYPTO_OP_STATUS_COMPLETED;
}
return n_ops;
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
vnet_crypto_op_type_t op:16;
vnet_crypto_op_status_t status:8;
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
vnet_crypto_op_type_t op:16;
vnet_crypto_op_status_t status:8;
+ u8 key_len, hmac_trunc_len;
u16 flags;
#define VNET_CRYPTO_OP_FLAG_INIT_IV 1
u32 len;
u16 flags;
#define VNET_CRYPTO_OP_FLAG_INIT_IV 1
u32 len;
op->src = data;
op->len = data_len;
op->dst = signature;
op->src = data;
op->len = data_len;
op->dst = signature;
+ op->hmac_trunc_len = sa->integ_trunc_size;
#if 0
HMAC_Init_ex (ctx, key, key_len, md, NULL);
#if 0
HMAC_Init_ex (ctx, key, key_len, md, NULL);