aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_pad/emsa1/emsa1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pk_pad/emsa1/emsa1.cpp')
-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;