Skip to content

Commit

Permalink
Use OSSL source directly, test still fails with off by-n errs in AES …
Browse files Browse the repository at this point in the history
…128 CBC
  • Loading branch information
WillChilds-Klein committed Sep 13, 2024
1 parent 94c275e commit 9a72ace
Show file tree
Hide file tree
Showing 2 changed files with 755 additions and 352 deletions.
25 changes: 11 additions & 14 deletions crypto/bio/bio_deprecated_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static const struct CipherParams Ciphers[] = {
{"AES_128_CTR", EVP_aes_128_ctr},
{"AES_128_GCM", EVP_aes_128_gcm},
{"AES_128_OFB", EVP_aes_128_ofb},
{"AES_128_CBC", EVP_aes_128_cbc},
{"AES_256_CTR", EVP_aes_256_ctr},
{"AES_256_GCM", EVP_aes_256_gcm},
{"AES_256_OFB", EVP_aes_256_ofb},
Expand Down Expand Up @@ -61,15 +62,15 @@ TEST_P(DeprecatedTest, Cipher) {
ASSERT_TRUE(RAND_bytes(iv, sizeof(iv)));

// Unsupported or unimplemented CTRL flags and cipher(s)
bio_cipher.reset(BIO_new(BIO_f_cipher()));
ASSERT_TRUE(bio_cipher);
EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_CTRL_DUP, 0, NULL));
EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_CTRL_GET_CALLBACK, 0, NULL));
EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_CTRL_SET_CALLBACK, 0, NULL));
EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_C_DO_STATE_MACHINE, 0, NULL));
EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_C_GET_CIPHER_CTX, 0, NULL));
EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_C_SSL_MODE, 0, NULL));
EXPECT_FALSE(BIO_set_cipher(bio_cipher.get(), EVP_rc4(), key, iv, /*enc*/ 1));
//bio_cipher.reset(BIO_new(BIO_f_cipher()));
//ASSERT_TRUE(bio_cipher);
//EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_CTRL_DUP, 0, bio_cipher.get()));
//EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_CTRL_GET_CALLBACK, 0, NULL));
//EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_CTRL_SET_CALLBACK, 0, NULL));
//EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_C_DO_STATE_MACHINE, 0, NULL));
//EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_C_GET_CIPHER_CTX, 0, NULL));
//EXPECT_FALSE(BIO_ctrl(bio_cipher.get(), BIO_C_SSL_MODE, 0, NULL));
//EXPECT_FALSE(BIO_set_cipher(bio_cipher.get(), EVP_rc4(), key, iv, /*enc*/ 1));

// Round-trip using only |BIO_read|, backing mem buffer with pt/ct. Fixed size
// IO.
Expand Down Expand Up @@ -137,11 +138,7 @@ TEST_P(DeprecatedTest, Cipher) {

// Test a number of different IO sizes around byte, word, cipher block,
// BIO internal buffer size, and other boundaries.
int io_sizes[] = {1,
3,
7,
8,
9,
int io_sizes[] = {
64,
923,
2 * ENC_BLOCK_SIZE,
Expand Down
Loading

0 comments on commit 9a72ace

Please sign in to comment.