diff options
author | lloyd <[email protected]> | 2006-09-30 06:13:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-30 06:13:18 +0000 |
commit | e52d871393f180042822950966597d160b9adf70 (patch) | |
tree | f9ae4e2b368eb7390da2fffc6aefbc4de0a6ec4d /src | |
parent | 2d823dfaee1f3fe329f5b2eaf79eb3d9c27943a9 (diff) |
Throw Encoding_Error instead of Invalid_Argument if a signature encoding
operation fails for some reason (typically parameters that the scheme can't
handle).
Diffstat (limited to 'src')
-rw-r--r-- | src/emsa1.cpp | 2 | ||||
-rw-r--r-- | src/emsa2.cpp | 6 | ||||
-rw-r--r-- | src/emsa3.cpp | 4 | ||||
-rw-r--r-- | src/emsa4.cpp | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/emsa1.cpp b/src/emsa1.cpp index 047d6bdbf..e4704ee3d 100644 --- a/src/emsa1.cpp +++ b/src/emsa1.cpp @@ -31,7 +31,7 @@ SecureVector<byte> EMSA1::encoding_of(const MemoryRegion<byte>& msg, u32bit output_bits) { if(msg.size() != hash->OUTPUT_LENGTH) - throw Invalid_Argument("EMSA1::encoding_of: Invalid size for input"); + throw Encoding_Error("EMSA1::encoding_of: Invalid size for input"); if(8*msg.size() <= output_bits) return msg; diff --git a/src/emsa2.cpp b/src/emsa2.cpp index ab805f335..d30ee8170 100644 --- a/src/emsa2.cpp +++ b/src/emsa2.cpp @@ -34,9 +34,9 @@ SecureVector<byte> EMSA2::encoding_of(const MemoryRegion<byte>& msg, u32bit output_length = (output_bits + 1) / 8; if(msg.size() != hash->OUTPUT_LENGTH) - throw Invalid_Argument("EMSA2::encoding_of: Bad input length"); + throw Encoding_Error("EMSA2::encoding_of: Bad input length"); if(output_length < hash->OUTPUT_LENGTH + 4) - throw Invalid_Argument("EMSA2::encoding_of: Output length is too small"); + throw Encoding_Error("EMSA2::encoding_of: Output length is too small"); bool empty = true; for(u32bit j = 0; j != hash->OUTPUT_LENGTH; ++j) @@ -62,7 +62,7 @@ EMSA2::EMSA2(const std::string& hash_name) { hash_id = ieee1363_hash_id(hash_name); if(hash_id == 0) - throw Invalid_Argument("EMSA2 cannot be used with " + hash->name()); + throw Encoding_Error("EMSA2 cannot be used with " + hash->name()); hash = get_hash(hash_name); empty_hash = hash->final(); } diff --git a/src/emsa3.cpp b/src/emsa3.cpp index 566e55c62..dc55d16ba 100644 --- a/src/emsa3.cpp +++ b/src/emsa3.cpp @@ -32,11 +32,11 @@ SecureVector<byte> EMSA3::encoding_of(const MemoryRegion<byte>& msg, u32bit output_bits) { if(msg.size() != hash->OUTPUT_LENGTH) - throw Invalid_Argument("EMSA3::encoding_of: Bad input length"); + throw Encoding_Error("EMSA3::encoding_of: Bad input length"); u32bit output_length = output_bits / 8; if(output_length < hash_id.size() + hash->OUTPUT_LENGTH + 10) - throw Invalid_Argument("EMSA3::pad: Output length is too small"); + throw Encoding_Error("EMSA3::pad: Output length is too small"); SecureVector<byte> T(output_length); const u32bit P_LENGTH = output_length - hash->OUTPUT_LENGTH - diff --git a/src/emsa4.cpp b/src/emsa4.cpp index 075089239..e541b9e7d 100644 --- a/src/emsa4.cpp +++ b/src/emsa4.cpp @@ -36,9 +36,9 @@ SecureVector<byte> EMSA4::encoding_of(const MemoryRegion<byte>& msg, const u32bit HASH_SIZE = hash->OUTPUT_LENGTH; if(msg.size() != HASH_SIZE) - throw Invalid_Argument("EMSA4::encoding_of: Bad input length"); + throw Encoding_Error("EMSA4::encoding_of: Bad input length"); if(output_bits < 8*HASH_SIZE + 8*SALT_SIZE + 9) - throw Invalid_Argument("EMSA4::encoding_of: Output length is too small"); + throw Encoding_Error("EMSA4::encoding_of: Output length is too small"); const u32bit output_length = (output_bits + 7) / 8; |