#include <openssl/proverr.h>
#include "cipher_tdes_default.h"
#include "crypto/evp.h"
+#include "crypto/sha.h"
#include "prov/implementations.h"
#include "prov/providercommon.h"
/* Decrypt again using new IV */
ctx->hw->cipher(ctx, out, out, inl - 16);
ctx->hw->cipher(ctx, icv, icv, 8);
- /* Work out SHA1 hash of first portion */
- SHA1(out, inl - 16, sha1tmp);
-
- if (!CRYPTO_memcmp(sha1tmp, icv, 8))
+ if (ossl_sha1(out, inl - 16, sha1tmp) /* Work out hash of first portion */
+ && CRYPTO_memcmp(sha1tmp, icv, 8) == 0)
rv = inl - 16;
OPENSSL_cleanse(icv, 8);
OPENSSL_cleanse(sha1tmp, SHA_DIGEST_LENGTH);
/* Copy input to output buffer + 8 so we have space for IV */
memmove(out + ivlen, in, inl);
/* Work out ICV */
- SHA1(in, inl, sha1tmp);
+ if (!ossl_sha1(in, inl, sha1tmp))
+ return 0;
memcpy(out + inl + ivlen, sha1tmp, icvlen);
OPENSSL_cleanse(sha1tmp, SHA_DIGEST_LENGTH);
/* Generate random IV */