]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Some fixes of OMAC processing
authorDmitry Belyavskiy <beldmit@gmail.com>
Fri, 31 Aug 2018 10:02:52 +0000 (13:02 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Fri, 31 Aug 2018 10:02:52 +0000 (13:02 +0300)
gost_omac.c
gost_omac_acpkm.c

index 49113a5cf24da75be3bbe01202d8cf6889c1a1a6..daf5750354beaddafd20e6ae68922d68adc94c90 100644 (file)
@@ -72,8 +72,7 @@ int omac_imit_final(EVP_MD_CTX *ctx, unsigned char *md)
 
     CMAC_Final(c->cmac_ctx, mac, &mac_size);
 
-    int md_size = EVP_MD_meth_get_result_size(EVP_MD_CTX_md(ctx));
-    memcpy(md, mac, min(md_size, c->dgst_size));
+    memcpy(md, mac, c->dgst_size);
     return 1;
 }
 
index 9bdb05f0e510ae2be0957531bfa777e329e79788..3061e36f8d13f3cb84e5d337ef184a86b6a58d52 100644 (file)
@@ -475,6 +475,13 @@ int omac_acpkm_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr)
                 }
                 c->dgst_size = arg;
                 break;
+            case NID_magma_cbc:
+                if (arg < 1 || arg > 8) {
+                    GOSTerr(GOST_F_OMAC_ACPKM_IMIT_CTRL, GOST_R_INVALID_MAC_SIZE);
+                    return 0;
+                }
+                c->dgst_size = arg;
+                break;
             default:
                 return 0;
             }