Get encryption/decryption algorithms.
| 97 | |
| 98 | /// Get encryption/decryption algorithms. |
| 99 | const char * getMethod(EncryptionMethod Method) |
| 100 | { |
| 101 | /// The encrypting codecs were originally implemented using boringssl's API. At a later point and for FIPS-related reasons, an |
| 102 | /// implementation based on OpenSSL was added specifically for s390/x. At that time, OpenSSL did not provide *-SIV ciphers (they were |
| 103 | /// only added with OpenSSL 3.2), whereas boringssl provided them for ages. As a result, s390/x used non-SIV ciphers instead (leading to |
| 104 | /// a different ciphertext / persistence). When ClickHouse migrated to OpenSSL on all platforms, this twist for s390/x needed to be kept, |
| 105 | /// otherwise encrypted data on s390/x can no longer be read. |
| 106 | if (Method == AES_128_GCM_SIV) |
| 107 | #if defined(__s390x__) |
| 108 | return "AES-128-GCM"; |
| 109 | #else |
| 110 | return "AES-128-GCM-SIV"; |
| 111 | #endif |
| 112 | else if (Method == AES_256_GCM_SIV) |
| 113 | #if defined(__s390x__) |
| 114 | return "AES-256-GCM"; |
| 115 | #else |
| 116 | return "AES-256-GCM-SIV"; |
| 117 | #endif |
| 118 | else |
| 119 | throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown encryption method. Got {}", getMethodName(Method)); |
| 120 | } |
| 121 | |
| 122 | /// Encrypt plaintext with particular algorithm and put result into ciphertext_and_tag. |
| 123 | /// This function get key and nonce and encrypt text with their help. |
no test coverage detected