Skip to content

Commit

Permalink
protected CCI
Browse files Browse the repository at this point in the history
  • Loading branch information
reneme committed Jan 27, 2022
1 parent 5be1c9b commit 5719e1a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/tests/test_tls_record_layer_13.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <botan/tls_magic.h>
#include <botan/internal/stl_util.h>
#include <botan/internal/tls_reader.h>
#include <botan/tls_exceptn.h>

#include <botan/internal/tls_record_layer_13.h>

Expand Down Expand Up @@ -265,7 +266,7 @@ std::vector<Test::Result> write_records()
{
auto record = TLS::Record_Layer().prepare_protected_records(Botan::TLS::APPLICATION_DATA, nullptr, 0);

result.require("record header was added", record.size() > Botan::TLS::TLS_HEADER_SIZE);
result.require("record header was added", record.size() > Botan::TLS::TLS_HEADER_SIZE + 1 /* encrypted content type */);
}),
CHECK("prepare a client hello", [&](auto& result)
{
Expand Down Expand Up @@ -380,6 +381,14 @@ read_encrypted_records() {
{
TLS::Record_Layer().parse_records(short_record);
});
}),

CHECK("protected Change Cipher Spec message is illegal", [](Test::Result& result) {
// factored message, encrypted under the same key as `encrypted_record`
const auto protected_cci = Botan::hex_decode("00");
result.test_throws<Botan::TLS::TLS_Exception>("illegal state causes TLS alert", [&] {
TLS::Record_Layer().parse_records(protected_cci);
});
})
};
}
Expand Down

0 comments on commit 5719e1a

Please sign in to comment.