From 1de5fc1419add86884df97580d7a2e745ad43bff Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Mon, 29 Jun 2015 14:02:37 +0200 Subject: More changes for use with debug STL --- src/lib/mac/poly1305/poly1305.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lib/mac/poly1305/poly1305.cpp') 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); } -- cgit v1.2.3