From f3cb3edb512bdcab498d825886c3366c341b3f78 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 11 Dec 2016 15:28:38 -0500 Subject: 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. --- src/lib/pk_pad/eme_pkcs1/eme_pkcs.cpp | 26 +++++++++++++------------- src/lib/pk_pad/eme_pkcs1/eme_pkcs.h | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/lib/pk_pad/eme_pkcs1') 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 EME_PKCS1v15::pad(const byte in[], size_t inlen, +secure_vector EME_PKCS1v15::pad(const uint8_t in[], size_t inlen, size_t key_length, RandomNumberGenerator& rng) const { @@ -24,7 +24,7 @@ secure_vector EME_PKCS1v15::pad(const byte in[], size_t inlen, throw Invalid_Argument("PKCS1: Input is too large"); } - secure_vector out(key_length); + secure_vector out(key_length); out[0] = 0x02; rng.randomize(out.data() + 1, (key_length - inlen - 2)); @@ -45,31 +45,31 @@ secure_vector EME_PKCS1v15::pad(const byte in[], size_t inlen, /* * PKCS1 Unpad Operation */ -secure_vector EME_PKCS1v15::unpad(byte& valid_mask, - const byte in[], size_t inlen) const +secure_vector EME_PKCS1v15::unpad(uint8_t& valid_mask, + const uint8_t in[], size_t inlen) const { if(inlen < 2) { valid_mask = false; - return secure_vector(); + return secure_vector(); } 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(in[0], 0); - bad_input_m |= ~CT::is_equal(in[1], 2); + bad_input_m |= ~CT::is_equal(in[0], 0); + bad_input_m |= ~CT::is_equal(in[1], 2); for(size_t i = 2; i < inlen; ++i) { - const byte is_zero_m = CT::is_zero(in[i]); + const uint8_t is_zero_m = CT::is_zero(in[i]); - delim_idx += CT::select(~seen_zero_m, 1, 0); + delim_idx += CT::select(~seen_zero_m, 1, 0); - bad_input_m |= is_zero_m & CT::expand_mask(i < 10); + bad_input_m |= is_zero_m & CT::expand_mask(i < 10); seen_zero_m |= is_zero_m; } @@ -80,7 +80,7 @@ secure_vector EME_PKCS1v15::unpad(byte& valid_mask, CT::unpoison(bad_input_m); CT::unpoison(delim_idx); - secure_vector output(&in[delim_idx + 2], &in[inlen]); + secure_vector 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 pad(const byte[], size_t, size_t, + secure_vector pad(const uint8_t[], size_t, size_t, RandomNumberGenerator&) const override; - secure_vector unpad(byte& valid_mask, - const byte in[], + secure_vector unpad(uint8_t& valid_mask, + const uint8_t in[], size_t in_len) const override; }; -- cgit v1.2.3