aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_pad.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_pad.cpp')
-rw-r--r--src/tests/test_pad.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tests/test_pad.cpp b/src/tests/test_pad.cpp
index 6c9d1b85a..0eb14beb8 100644
--- a/src/tests/test_pad.cpp
+++ b/src/tests/test_pad.cpp
@@ -50,6 +50,21 @@ class Cipher_Mode_Padding_Tests : public Text_Based_Test
return result;
}
+
+ std::vector<Test::Result> run_final_tests()
+ {
+ Test::Result result("ESP negative tests");
+
+ std::vector<uint8_t> invalid1 { 0xFF, 0x01, 0x02, 0x02 };
+ result.test_throws("ESP invalid last pad", [&invalid1]()
+ { Botan::ESP_Padding().unpad(invalid1.data(), invalid1.size()); } );
+
+ std::vector<uint8_t> invalid2 { 0xFF, 0x01, 0x02, 0x04 };
+ result.test_throws("ESP invalid pad", [&invalid2]()
+ { Botan::ESP_Padding().unpad(invalid2.data(), invalid2.size()); } );
+
+ return {result};
+ }
};
BOTAN_REGISTER_TEST("bc_pad", Cipher_Mode_Padding_Tests);