aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/mac/poly1305
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-29 14:02:37 +0200
committerSimon Warta <[email protected]>2015-06-30 10:38:23 +0200
commit1de5fc1419add86884df97580d7a2e745ad43bff (patch)
tree295eafb79cab7843888133abbad07fb983915520 /src/lib/mac/poly1305
parent8668ce8753b10e944bdc72b6e66d752759c7e710 (diff)
More changes for use with debug STL
Diffstat (limited to 'src/lib/mac/poly1305')
-rw-r--r--src/lib/mac/poly1305/poly1305.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/mac/poly1305/poly1305.cpp b/src/lib/mac/poly1305/poly1305.cpp
index 545a749fa..506150b0f 100644
--- a/src/lib/mac/poly1305/poly1305.cpp
+++ b/src/lib/mac/poly1305/poly1305.cpp
@@ -190,7 +190,11 @@ void Poly1305::final_result(byte out[])
if(m_buf_pos != 0)
{
m_buf[m_buf_pos] = 1;
- clear_mem(&m_buf[m_buf_pos+1], m_buf.size() - m_buf_pos - 1);
+ const auto len = m_buf.size() - m_buf_pos - 1;
+ if (len > 0)
+ {
+ clear_mem(&m_buf[m_buf_pos+1], len);
+ }
poly1305_blocks(m_poly, m_buf.data(), 1, true);
}