aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/cast/cast256.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/block/cast/cast256.cpp')
-rw-r--r--src/lib/block/cast/cast256.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/block/cast/cast256.cpp b/src/lib/block/cast/cast256.cpp
index b4aa49166..cd5175dd7 100644
--- a/src/lib/block/cast/cast256.cpp
+++ b/src/lib/block/cast/cast256.cpp
@@ -50,6 +50,8 @@ void round3(uint32_t& out, uint32_t in, uint32_t MK, uint32_t RK)
*/
void CAST_256::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
+ verify_key_set(m_RK.empty() == false);
+
for(size_t i = 0; i != blocks; ++i)
{
uint32_t A = load_be<uint32_t>(in, 0);
@@ -94,6 +96,8 @@ void CAST_256::encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
*/
void CAST_256::decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const
{
+ verify_key_set(m_RK.empty() == false);
+
for(size_t i = 0; i != blocks; ++i)
{
uint32_t A = load_be<uint32_t>(in, 0);