From 242d67fb17619670d9b757c442dcf2e26d8478a1 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 20 Jan 2005 04:19:35 +0000 Subject: changes done for FIPS-140 lab code drop git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@195 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- secblock.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'secblock.h') diff --git a/secblock.h b/secblock.h index 6797144..2b254e4 100644 --- a/secblock.h +++ b/secblock.h @@ -286,12 +286,28 @@ public: memcpy(m_ptr, t.m_ptr, m_size*sizeof(T)); } - SecBlock& operator=(const SecBlock &t) + SecBlock& operator=(const SecBlock &t) { Assign(t); return *this; } + SecBlock& operator+=(const SecBlock &t) + { + unsigned int oldSize = m_size; + Grow(m_size+t.m_size); + memcpy(m_ptr+oldSize, t.m_ptr, t.m_size*sizeof(T)); + return *this; + } + + SecBlock operator+(const SecBlock &t) + { + SecBlock result(m_size+t.m_size); + memcpy(result.m_ptr, m_ptr, m_size*sizeof(T)); + memcpy(result.m_ptr+m_size, t.m_ptr, t.m_size*sizeof(T)); + return result; + } + bool operator==(const SecBlock &t) const { return m_size == t.m_size && memcmp(m_ptr, t.m_ptr, m_size*sizeof(T)) == 0; -- cgit v1.2.1