diff options
author | Jack Lloyd <[email protected]> | 2016-12-11 15:28:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-18 16:48:24 -0500 |
commit | f3cb3edb512bdcab498d825886c3366c341b3f78 (patch) | |
tree | 645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/pk_pad/eme_pkcs1 | |
parent | c1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff) |
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
Diffstat (limited to 'src/lib/pk_pad/eme_pkcs1')
-rw-r--r-- | src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp | 26 | ||||
-rw-r--r-- | src/lib/pk_pad/eme_pkcs1/eme_pkcs.h | 6 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp index 2b5ee4ba0..5d4f950f5 100644 --- a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp +++ b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp @@ -13,7 +13,7 @@ namespace Botan { /* * PKCS1 Pad Operation */ -secure_vector<byte> EME_PKCS1v15::pad(const byte in[], size_t inlen, +secure_vector<uint8_t> EME_PKCS1v15::pad(const uint8_t in[], size_t inlen, size_t key_length, RandomNumberGenerator& rng) const { @@ -24,7 +24,7 @@ secure_vector<byte> EME_PKCS1v15::pad(const byte in[], size_t inlen, throw Invalid_Argument("PKCS1: Input is too large"); } - secure_vector<byte> out(key_length); + secure_vector<uint8_t> out(key_length); out[0] = 0x02; rng.randomize(out.data() + 1, (key_length - inlen - 2)); @@ -45,31 +45,31 @@ secure_vector<byte> EME_PKCS1v15::pad(const byte in[], size_t inlen, /* * PKCS1 Unpad Operation */ -secure_vector<byte> EME_PKCS1v15::unpad(byte& valid_mask, - const byte in[], size_t inlen) const +secure_vector<uint8_t> EME_PKCS1v15::unpad(uint8_t& valid_mask, + const uint8_t in[], size_t inlen) const { if(inlen < 2) { valid_mask = false; - return secure_vector<byte>(); + return secure_vector<uint8_t>(); } CT::poison(in, inlen); - byte bad_input_m = 0; - byte seen_zero_m = 0; + uint8_t bad_input_m = 0; + uint8_t seen_zero_m = 0; size_t delim_idx = 0; - bad_input_m |= ~CT::is_equal<byte>(in[0], 0); - bad_input_m |= ~CT::is_equal<byte>(in[1], 2); + bad_input_m |= ~CT::is_equal<uint8_t>(in[0], 0); + bad_input_m |= ~CT::is_equal<uint8_t>(in[1], 2); for(size_t i = 2; i < inlen; ++i) { - const byte is_zero_m = CT::is_zero<byte>(in[i]); + const uint8_t is_zero_m = CT::is_zero<uint8_t>(in[i]); - delim_idx += CT::select<byte>(~seen_zero_m, 1, 0); + delim_idx += CT::select<uint8_t>(~seen_zero_m, 1, 0); - bad_input_m |= is_zero_m & CT::expand_mask<byte>(i < 10); + bad_input_m |= is_zero_m & CT::expand_mask<uint8_t>(i < 10); seen_zero_m |= is_zero_m; } @@ -80,7 +80,7 @@ secure_vector<byte> EME_PKCS1v15::unpad(byte& valid_mask, CT::unpoison(bad_input_m); CT::unpoison(delim_idx); - secure_vector<byte> output(&in[delim_idx + 2], &in[inlen]); + secure_vector<uint8_t> output(&in[delim_idx + 2], &in[inlen]); CT::cond_zero_mem(bad_input_m, output.data(), output.size()); valid_mask = ~bad_input_m; return output; diff --git a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.h b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.h index 006b39997..9e06403ac 100644 --- a/src/lib/pk_pad/eme_pkcs1/eme_pkcs.h +++ b/src/lib/pk_pad/eme_pkcs1/eme_pkcs.h @@ -20,11 +20,11 @@ class BOTAN_DLL EME_PKCS1v15 final : public EME public: size_t maximum_input_size(size_t) const override; private: - secure_vector<byte> pad(const byte[], size_t, size_t, + secure_vector<uint8_t> pad(const uint8_t[], size_t, size_t, RandomNumberGenerator&) const override; - secure_vector<byte> unpad(byte& valid_mask, - const byte in[], + secure_vector<uint8_t> unpad(uint8_t& valid_mask, + const uint8_t in[], size_t in_len) const override; }; |