]> wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_crypt.c
Reenable some hmac tests
[openssl-gost/engine.git] / gost_crypt.c
index ffb577db84dbae00eee4d700dc1b11c336faf8ed..2bede853fd617919f4d83bb239b0f9ffe1ae8692 100644 (file)
@@ -774,10 +774,11 @@ int magma_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out,
                 d[7 - i] = in_ptr[i];
             }
             gostdecrypt(&(c->cctx), d, b);
+            memcpy(d, in_ptr, 8);
             for (i = 0; i < 8; i++) {
                 out_ptr[i] = iv[i] ^ b[7 - i];
             }
-            memcpy(iv, in_ptr, 8);
+            memcpy(iv, d, 8);
             out_ptr += 8;
             in_ptr += 8;
             inl -= 8;
@@ -866,6 +867,9 @@ static int magma_cipher_do_ctr_acpkm_omac(EVP_CIPHER_CTX *ctx, unsigned char *ou
        if (in == NULL && inl == 0) /* Final call */
                return gost2015_final_call(ctx, c->omac_ctx, MAGMA_MAC_MAX_SIZE, c->tag, magma_cipher_do_ctr);
 
+  if (in == NULL)
+      return -1;
+
        /* As in and out can be the same pointer, process unencrypted here */
        if (EVP_CIPHER_CTX_encrypting(ctx))
                EVP_DigestSignUpdate(c->omac_ctx, in, inl);