aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/mac/poly1305
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-26 20:31:30 -0400
committerJack Lloyd <[email protected]>2017-10-26 22:26:15 -0400
commite6d45052efedfe49e99adb6318aaf56e0a9e8d7b (patch)
treec6c3ccd3cff3d04285940bf1d518c809e0653947 /src/lib/mac/poly1305
parent315b002ecf00f6b6bb0f0d5200d1f39a83527e8f (diff)
Add checks that keyed algorithms are actually keyed before use
Previously calling update or encrypt without calling set_key first would result in invalid outputs or else crashing.
Diffstat (limited to 'src/lib/mac/poly1305')
-rw-r--r--src/lib/mac/poly1305/poly1305.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/mac/poly1305/poly1305.cpp b/src/lib/mac/poly1305/poly1305.cpp
index 9fe0bad0a..639aa88c0 100644
--- a/src/lib/mac/poly1305/poly1305.cpp
+++ b/src/lib/mac/poly1305/poly1305.cpp
@@ -155,7 +155,7 @@ void Poly1305::key_schedule(const uint8_t key[], size_t)
void Poly1305::add_data(const uint8_t input[], size_t length)
{
- BOTAN_ASSERT_EQUAL(m_poly.size(), 8, "Initialized");
+ verify_key_set(m_poly.size() == 8);
if(m_buf_pos)
{
@@ -182,7 +182,7 @@ void Poly1305::add_data(const uint8_t input[], size_t length)
void Poly1305::final_result(uint8_t out[])
{
- BOTAN_ASSERT_EQUAL(m_poly.size(), 8, "Initialized");
+ verify_key_set(m_poly.size() == 8);
if(m_buf_pos != 0)
{