aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_pad
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-08-13 20:40:47 +0000
committerlloyd <[email protected]>2012-08-13 20:40:47 +0000
commit404ae3514fbbdb51e32af1c2c1434acacf5ec20c (patch)
tree6f4107667adb924d763f6c6ab699e1ee416025d0 /src/pk_pad
parent53d53fbe291f1e049f55d9018d2b07cf62fbef24 (diff)
Fix various issues flagged by cppcheck. Nothing too interesting.
Diffstat (limited to 'src/pk_pad')
-rw-r--r--src/pk_pad/emsa1/emsa1.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pk_pad/emsa1/emsa1.cpp b/src/pk_pad/emsa1/emsa1.cpp
index 7f9a1885f..2358023f8 100644
--- a/src/pk_pad/emsa1/emsa1.cpp
+++ b/src/pk_pad/emsa1/emsa1.cpp
@@ -81,11 +81,11 @@ bool EMSA1::verify(const secure_vector<byte>& coded,
secure_vector<byte> our_coding = emsa1_encoding(raw, key_bits);
if(our_coding == coded) return true;
- if(our_coding[0] != 0) return false;
+ if(our_coding.empty() || our_coding[0] != 0) return false;
if(our_coding.size() <= coded.size()) return false;
size_t offset = 0;
- while(our_coding[offset] == 0 && offset < our_coding.size())
+ while(offset < our_coding.size() && our_coding[offset] == 0)
++offset;
if(our_coding.size() - offset != coded.size())
return false;