From 5934520b87869a33c6e939484c48d99bfad8e55f Mon Sep 17 00:00:00 2001 From: dentiny Date: Tue, 21 Jan 2025 06:15:04 +0000 Subject: [PATCH] resolve switch case warning --- extension/httpfs/crypto.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extension/httpfs/crypto.cpp b/extension/httpfs/crypto.cpp index 377c2bb..af56f11 100644 --- a/extension/httpfs/crypto.cpp +++ b/extension/httpfs/crypto.cpp @@ -112,6 +112,7 @@ size_t AESGCMStateSSL::Finalize(data_ptr_t out, idx_t out_len, data_ptr_t tag, i switch (mode) { case ENCRYPT: + { if (1 != EVP_EncryptFinal_ex(gcm_context, data_ptr_cast(out) + out_len, reinterpret_cast(&out_len))) { throw InternalException("EncryptFinal failed"); } @@ -121,7 +122,9 @@ size_t AESGCMStateSSL::Finalize(data_ptr_t out, idx_t out_len, data_ptr_t tag, i throw InternalException("Calculating the tag failed"); } return text_len; + } case DECRYPT: + { // Set expected tag value if (!EVP_CIPHER_CTX_ctrl(gcm_context, EVP_CTRL_GCM_SET_TAG, tag_len, tag)) { throw InternalException("Finalizing tag failed"); @@ -136,6 +139,9 @@ size_t AESGCMStateSSL::Finalize(data_ptr_t out, idx_t out_len, data_ptr_t tag, i } throw InvalidInputException("Computed AES tag differs from read AES tag, are you using the right key?"); } + default: + throw InternalException("Unhandled encryption mode %d", static_cast(mode)); + } } } // namespace duckdb