+
+uint8_t hfal_hmac_ctxcopy(hfhmacgen_ctx_t* dest, hfhmacgen_ctx_t* src){
+ dest->desc = src->desc;
+ dest->ctx = malloc(dest->desc->ctxsize_B);
+ if(dest->ctx == NULL){
+ return 1;
+ }
+ memcpy(dest->ctx, src->ctx, dest->desc->ctxsize_B);
+ dest->finctx = malloc(dest->desc->ctxsize_B);
+ if(dest->finctx == NULL){
+ free(dest->ctx);
+ return 1;
+ }
+ memcpy(dest->finctx, src->finctx, dest->desc->ctxsize_B);
+ return 0;
+}
+