From f542b5415453056d36587086ff2d8bc401a02b08 Mon Sep 17 00:00:00 2001 From: jakcron Date: Sat, 21 Apr 2018 17:17:54 +0800 Subject: [PATCH] [crypto] Add operators to sAesIvCtr --- lib/libcrypto/include/crypto/aes.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/libcrypto/include/crypto/aes.h b/lib/libcrypto/include/crypto/aes.h index bd77797..eb78ade 100644 --- a/lib/libcrypto/include/crypto/aes.h +++ b/lib/libcrypto/include/crypto/aes.h @@ -78,10 +78,23 @@ namespace aes memcpy(this->iv, iv, kAes128KeySize); } + bool compare(const sAesIvCtr& other) const + { + return memcmp(this->iv, other.iv, kAesBlockSize) == 0; + } + void operator=(const sAesIvCtr& other) { set(other.iv); } + bool operator==(const sAesIvCtr& other) const + { + return compare(other); + } + bool operator!=(const sAesIvCtr& other) const + { + return !compare(other); + } }; #pragma pack (pop)