opencryptoki/opencryptoki-openssl3-5cceead028ec8e0c244b01d38c9096c96d98f96b.patch
2021-08-23 13:00:44 +02:00

85 lines
2.5 KiB
Diff

commit 5cceead028ec8e0c244b01d38c9096c96d98f96b
Author: Ingo Franzki <ifranzki@linux.ibm.com>
Date: Mon Jul 5 10:46:52 2021 +0200
ICSF: Remove support for OpenSSL < v1.1.1
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
diff --git a/usr/lib/icsf_stdll/pbkdf.c b/usr/lib/icsf_stdll/pbkdf.c
index 4ddd0fd7..6ec4128a 100644
--- a/usr/lib/icsf_stdll/pbkdf.c
+++ b/usr/lib/icsf_stdll/pbkdf.c
@@ -82,7 +82,6 @@ CK_RV encrypt_aes(CK_BYTE * inbuf, int inbuflen, CK_BYTE * dkey,
const EVP_CIPHER *cipher = EVP_aes_256_cbc();
int tmplen;
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
EVP_EncryptInit_ex(ctx, cipher, NULL, dkey, iv);
@@ -98,24 +97,6 @@ CK_RV encrypt_aes(CK_BYTE * inbuf, int inbuflen, CK_BYTE * dkey,
*outbuflen = (*outbuflen) + tmplen;
EVP_CIPHER_CTX_free(ctx);
-#else
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
-
- EVP_EncryptInit_ex(&ctx, cipher, NULL, dkey, iv);
- if (!EVP_EncryptUpdate(&ctx, outbuf, outbuflen, inbuf, inbuflen)) {
- TRACE_ERROR("EVP_EncryptUpdate failed.\n");
- return CKR_FUNCTION_FAILED;
- }
- if (!EVP_EncryptFinal_ex(&ctx, outbuf + (*outbuflen), &tmplen)) {
- TRACE_ERROR("EVP_EncryptFinal failed.\n");
- return CKR_FUNCTION_FAILED;
- }
-
- *outbuflen = (*outbuflen) + tmplen;
- EVP_CIPHER_CTX_cleanup(&ctx);
-#endif
-
return CKR_OK;
}
@@ -125,7 +106,6 @@ CK_RV decrypt_aes(CK_BYTE * inbuf, int inbuflen, CK_BYTE * dkey,
int size;
const EVP_CIPHER *cipher = EVP_aes_256_cbc();
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
EVP_DecryptInit_ex(ctx, cipher, NULL, dkey, iv);
@@ -147,30 +127,6 @@ CK_RV decrypt_aes(CK_BYTE * inbuf, int inbuflen, CK_BYTE * dkey,
EVP_CIPHER_CTX_free(ctx);
-#else
- EVP_CIPHER_CTX ctx;
- EVP_CIPHER_CTX_init(&ctx);
-
- EVP_DecryptInit_ex(&ctx, cipher, NULL, dkey, iv);
- if (!EVP_DecryptUpdate(&ctx, outbuf, outbuflen, inbuf, inbuflen)) {
- TRACE_ERROR("EVP_DecryptUpdate failed.\n");
- return CKR_FUNCTION_FAILED;
- }
- if (!EVP_DecryptFinal_ex(&ctx, outbuf + (*outbuflen), &size)) {
- TRACE_ERROR("EVP_DecryptFinal failed.\n");
- return CKR_FUNCTION_FAILED;
- }
-
- /* total length of the decrypted data */
- *outbuflen = (*outbuflen) + size;
-
- /* EVP_DecryptFinal removes any padding. The final length
- * is the length of the decrypted data without padding.
- */
-
- EVP_CIPHER_CTX_cleanup(&ctx);
-#endif
-
return CKR_OK;
}