From d254c3402660f4d81390560513b7fced2d9f4e46 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 4 Sep 2023 15:14:51 +0200 Subject: [PATCH] fix code configuring the asymetric crypto mechanisms should allow usage of USB token based end-to-end encryption Signed-off-by: Matthieu Gallien --- src/libsync/clientsideencryption.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index afbc7b4a54bac..2e8ea9c57b6d2 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -886,12 +886,12 @@ std::optional decryptStringAsymmetric(ENGINE *sslEngine, return {}; } - if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) { + if (pad_mode != RSA_PKCS1_PADDING && EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) { qCInfo(lcCseDecryption()) << "Error setting OAEP SHA 256" << handleErrors(); return {}; } - if (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, EVP_sha256()) <= 0) { + if (pad_mode != RSA_PKCS1_PADDING && EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, EVP_sha256()) <= 0) { qCInfo(lcCseDecryption()) << "Error setting MGF1 padding" << handleErrors(); return {}; } @@ -946,12 +946,12 @@ std::optional encryptStringAsymmetric(ENGINE *sslEngine, return {}; } - if (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) { + if (pad_mode != RSA_PKCS1_PADDING && EVP_PKEY_CTX_set_rsa_oaep_md(ctx, EVP_sha256()) <= 0) { qCInfo(lcCseEncryption()) << "Error setting OAEP SHA 256"; return {}; } - if (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, EVP_sha256()) <= 0) { + if (pad_mode != RSA_PKCS1_PADDING && EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, EVP_sha256()) <= 0) { qCInfo(lcCseEncryption()) << "Error setting MGF1 padding"; return {}; }