This test will need to be updated if new ciphers are added.
Unified · Split
| @@ -241,6 +241,31 @@ TEST_F(tls_basic, base_base) · 240 unmodified lines | ||
| 241 | 241 | EXPECT_EQ(memcmp(buf, test_str, send_len), 0); |
| 242 | 242 | }; |
| 243 | 243 | |
| 244 | +TEST_F(tls_basic, bad_cipher) | |
| 245 | +{ | |
| 246 | + struct tls_crypto_info_keys tls12; | |
| 247 | + | |
| 248 | + tls12.crypto_info.version = 200; | |
| 249 | + tls12.crypto_info.cipher_type = TLS_CIPHER_AES_GCM_128; | |
| 250 | + EXPECT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, sizeof(struct tls12_crypto_info_aes_gcm_128)), -1); | |
| 251 | + | |
| 252 | + tls12.crypto_info.version = TLS_1_2_VERSION; | |
| 253 | + tls12.crypto_info.cipher_type = 50; | |
| 254 | + EXPECT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, sizeof(struct tls12_crypto_info_aes_gcm_128)), -1); | |
| 255 | + | |
| 256 | + tls12.crypto_info.version = TLS_1_2_VERSION; | |
| 257 | + tls12.crypto_info.cipher_type = 59; | |
| 258 | + EXPECT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, sizeof(struct tls12_crypto_info_aes_gcm_128)), -1); | |
| 259 | + | |
| 260 | + tls12.crypto_info.version = TLS_1_2_VERSION; | |
| 261 | + tls12.crypto_info.cipher_type = 10; | |
| 262 | + EXPECT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, sizeof(struct tls12_crypto_info_aes_gcm_128)), -1); | |
| 263 | + | |
| 264 | + tls12.crypto_info.version = TLS_1_2_VERSION; | |
| 265 | + tls12.crypto_info.cipher_type = 70; | |
| 266 | + EXPECT_EQ(setsockopt(self->fd, SOL_TLS, TLS_TX, &tls12, sizeof(struct tls12_crypto_info_aes_gcm_128)), -1); | |
| 267 | +} | |
| 268 | + | |
| 244 | 269 | FIXTURE(tls) |
| 245 | 270 | { |
| 246 | 271 | int fd, cfd; |