Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions be/src/vec/functions/function_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ struct EncryptionAndDecryptTwoImpl {
if (mode_arg.size != 0) {
if (!aes_mode_map.contains(mode_str)) {
all_insert_null = true;
} else {
encryption_mode = aes_mode_map.at(mode_str);
}
encryption_mode = aes_mode_map.at(mode_str);
}
const ColumnString::Offsets* offsets_column = &column->get_offsets();
const ColumnString::Chars* chars_column = &column->get_chars();
Expand Down Expand Up @@ -371,13 +372,15 @@ struct EncryptionAndDecryptMultiImpl {
if constexpr (is_sm_mode) {
if (sm4_mode_map.count(mode_str) == 0) {
all_insert_null = true;
} else {
encryption_mode = sm4_mode_map.at(mode_str);
}
encryption_mode = sm4_mode_map.at(mode_str);
} else {
if (aes_mode_map.count(mode_str) == 0) {
all_insert_null = true;
} else {
encryption_mode = aes_mode_map.at(mode_str);
}
encryption_mode = aes_mode_map.at(mode_str);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,6 @@ zhang
-- !sql56 --
zhang

-- !sql57 --
\N

Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,7 @@ suite("test_encryption_function") {
qt_sql54 """ select aes_decrypt(aes_encrypt(k,k1,k2, "AES_256_CFB"),k1,k2, "AES_256_CFB") from quantile_table2; """
qt_sql55 """ select aes_decrypt(aes_encrypt("zhang",k1,k2, "AES_256_CFB"),k1,k2, "AES_256_CFB") from quantile_table2; """
qt_sql56 """ select aes_decrypt(aes_encrypt("zhang",k1,k2, "AES_256_CFB"),k1,k2, "AES_256_CFB") from quantile_table2; """

//four arg (column/const) with wrong mode
qt_sql57 """ select sm4_decrypt(sm4_encrypt(k,"doris","abcdefghij", "SM4_128_CBC"),"doris","abcdefghij","SM4_555_CBC") from quantile_table2; """
}