]> wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_omac.c
Fix EVP_MD_CTX_copy_ex for OMAC
[openssl-gost/engine.git] / gost_omac.c
index 23872bc8f72d21e52bd594998618c2f3597a2d17..af6eb2a9e9e6e9cf2260754db5c7b147b2c912d8 100644 (file)
@@ -89,6 +89,10 @@ int omac_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
                {
                        return 0;
                }
+               if (c_to->cmac_ctx == c_from->cmac_ctx)
+               {
+                   c_to->cmac_ctx = CMAC_CTX_new();
+               }
                return CMAC_CTX_copy(c_to->cmac_ctx, c_from->cmac_ctx);
 }
 
@@ -248,7 +252,7 @@ EVP_MD *grasshopper_omac(void)
         EVP_MD *md;
 
         if ((md = EVP_MD_meth_new(NID_grasshopper_mac, NID_undef)) == NULL
-            || !EVP_MD_meth_set_result_size(md, 4)
+            || !EVP_MD_meth_set_result_size(md, 8)
             || !EVP_MD_meth_set_input_blocksize(md, 8)
             || !EVP_MD_meth_set_app_datasize(md, sizeof(OMAC_CTX))
             || !EVP_MD_meth_set_flags(md, 0)