Skip to content

Commit 85ac466

Browse files
authored
Merge pull request duckdb#12 from dentiny/hjiang/resolve-switch-case-warning
[no-op] Resolve switch case warning
2 parents e21cc39 + 5934520 commit 85ac466

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

extension/httpfs/crypto.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ size_t AESGCMStateSSL::Finalize(data_ptr_t out, idx_t out_len, data_ptr_t tag, i
112112

113113
switch (mode) {
114114
case ENCRYPT:
115+
{
115116
if (1 != EVP_EncryptFinal_ex(gcm_context, data_ptr_cast(out) + out_len, reinterpret_cast<int *>(&out_len))) {
116117
throw InternalException("EncryptFinal failed");
117118
}
@@ -121,7 +122,9 @@ size_t AESGCMStateSSL::Finalize(data_ptr_t out, idx_t out_len, data_ptr_t tag, i
121122
throw InternalException("Calculating the tag failed");
122123
}
123124
return text_len;
125+
}
124126
case DECRYPT:
127+
{
125128
// Set expected tag value
126129
if (!EVP_CIPHER_CTX_ctrl(gcm_context, EVP_CTRL_GCM_SET_TAG, tag_len, tag)) {
127130
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
136139
}
137140
throw InvalidInputException("Computed AES tag differs from read AES tag, are you using the right key?");
138141
}
142+
default:
143+
throw InternalException("Unhandled encryption mode %d", static_cast<int>(mode));
144+
}
139145
}
140146

141147
} // namespace duckdb

0 commit comments

Comments
 (0)