From 2e9af1b0f74a906baa4a26408385548cf92e8b83 Mon Sep 17 00:00:00 2001 From: jakcron Date: Mon, 17 Jul 2017 18:25:41 +1000 Subject: [PATCH] [crypto] Made rsakey comparisions const. --- lib/crypto/rsa.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/crypto/rsa.h b/lib/crypto/rsa.h index d188083..eba43e0 100644 --- a/lib/crypto/rsa.h +++ b/lib/crypto/rsa.h @@ -33,14 +33,14 @@ namespace crypto memcpy(this->public_exponent, other.public_exponent, kRsaPublicExponentSize); } - bool operator==(const sRsa1024Key& other) + bool operator==(const sRsa1024Key& other) const { return memcmp(this->modulus, other.modulus, kRsa1024Size) == 0 \ && memcmp(this->priv_exponent, other.priv_exponent, kRsa1024Size) == 0 \ - && memcpy(this->public_exponent, other.public_exponent, kRsaPublicExponentSize) == 0; + && memcmp(this->public_exponent, other.public_exponent, kRsaPublicExponentSize) == 0; } - bool operator!=(const sRsa1024Key& other) + bool operator!=(const sRsa1024Key& other) const { return !operator==(other); } @@ -59,12 +59,12 @@ namespace crypto memcpy(this->public_exponent, other.public_exponent, kRsaPublicExponentSize); } - bool operator==(const sRsa2048Key& other) + bool operator==(const sRsa2048Key& other) const { - return memcmp(this->modulus, other.modulus, kRsa2048Size) == 0 && memcmp(this->priv_exponent, other.priv_exponent, kRsa2048Size) == 0 && memcpy(this->public_exponent, other.public_exponent, kRsaPublicExponentSize) == 0; + return memcmp(this->modulus, other.modulus, kRsa2048Size) == 0 && memcmp(this->priv_exponent, other.priv_exponent, kRsa2048Size) == 0 && memcmp(this->public_exponent, other.public_exponent, kRsaPublicExponentSize) == 0; } - bool operator!=(const sRsa2048Key& other) + bool operator!=(const sRsa2048Key& other) const { return !operator==(other); } @@ -83,12 +83,12 @@ namespace crypto memcpy(this->public_exponent, other.public_exponent, kRsaPublicExponentSize); } - bool operator==(const sRsa4096Key& other) + bool operator==(const sRsa4096Key& other) const { - return memcmp(this->modulus, other.modulus, kRsa4096Size) == 0 && memcmp(this->priv_exponent, other.priv_exponent, kRsa4096Size) == 0 && memcpy(this->public_exponent, other.public_exponent, kRsaPublicExponentSize) == 0; + return memcmp(this->modulus, other.modulus, kRsa4096Size) == 0 && memcmp(this->priv_exponent, other.priv_exponent, kRsa4096Size) == 0 && memcmp(this->public_exponent, other.public_exponent, kRsaPublicExponentSize) == 0; } - bool operator!=(const sRsa4096Key& other) + bool operator!=(const sRsa4096Key& other) const { return !operator==(other); }