SF 3538786: Use size_t for describing data-blocks in DigestEngine

This commit is contained in:
Aleksandar Fabijanic 2012-07-20 02:48:41 +00:00
parent 2512b7a366
commit c48b06221a
12 changed files with 36 additions and 36 deletions

View File

@ -68,7 +68,7 @@ public:
/// Returns the name of the digest algorithm.
// DigestEngine
unsigned digestLength() const;
std::size_t digestLength() const;
void reset();
const Poco::DigestEngine::Digest& digest();

View File

@ -82,7 +82,7 @@ public:
~RSADigestEngine();
/// Destroys the RSADigestEngine.
unsigned digestLength() const;
std::size_t digestLength() const;
/// Returns the length of the digest in bytes.
void reset();
@ -109,7 +109,7 @@ public:
/// Returns true if the signature can be verified, false otherwise.
protected:
void updateImpl(const void* data, unsigned length);
void updateImpl(const void* data, std::size_t length);
private:
RSAKey _key;

View File

@ -58,7 +58,7 @@ DigestEngine::~DigestEngine()
}
unsigned DigestEngine::digestLength() const
std::size_t DigestEngine::digestLength() const
{
return EVP_MD_CTX_size(_ctx);
}

View File

@ -55,7 +55,7 @@ RSADigestEngine::~RSADigestEngine()
}
unsigned RSADigestEngine::digestLength() const
std::size_t RSADigestEngine::digestLength() const
{
return _engine.digestLength();
}
@ -104,7 +104,7 @@ bool RSADigestEngine::verify(const DigestEngine::Digest& sig)
}
void RSADigestEngine::updateImpl(const void* data, unsigned length)
void RSADigestEngine::updateImpl(const void* data, std::size_t length)
{
_engine.update(data, length);
}

View File

@ -63,12 +63,12 @@ public:
DigestEngine();
virtual ~DigestEngine();
void update(const void* data, unsigned length);
void update(const void* data, std::size_t length);
void update(char data);
void update(const std::string& data);
/// Updates the digest with the given data.
virtual unsigned digestLength() const = 0;
virtual std::size_t digestLength() const = 0;
/// Returns the length of the digest in bytes.
virtual void reset() = 0;
@ -89,7 +89,7 @@ public:
/// Converts a string created by digestToHex back to its Digest presentation
protected:
virtual void updateImpl(const void* data, unsigned length) = 0;
virtual void updateImpl(const void* data, std::size_t length) = 0;
/// Updates the digest with the given data. Must be implemented
/// by subclasses.
@ -104,7 +104,7 @@ private:
//
inline void DigestEngine::update(const void* data, unsigned length)
inline void DigestEngine::update(const void* data, std::size_t length)
{
updateImpl(data, length);
}
@ -118,7 +118,7 @@ inline void DigestEngine::update(char data)
inline void DigestEngine::update(const std::string& data)
{
updateImpl(data.data(), (unsigned) data.size());
updateImpl(data.data(), data.size());
}

View File

@ -68,10 +68,10 @@ public:
HMACEngine(const std::string& passphrase)
{
init(passphrase.data(), (unsigned) passphrase.length());
init(passphrase.data(), passphrase.length());
}
HMACEngine(const char* passphrase, unsigned length)
HMACEngine(const char* passphrase, std::size_t length)
{
poco_check_ptr (passphrase);
@ -86,7 +86,7 @@ public:
delete [] _opad;
}
unsigned digestLength() const
std::size_t digestLength() const
{
return DIGEST_SIZE;
}
@ -113,7 +113,7 @@ public:
}
protected:
void init(const char* passphrase, unsigned length)
void init(const char* passphrase, std::size_t length)
{
_ipad = new char[BLOCK_SIZE];
_opad = new char[BLOCK_SIZE];
@ -146,7 +146,7 @@ protected:
reset();
}
void updateImpl(const void* data, unsigned length)
void updateImpl(const void* data, std::size_t length)
{
_engine.update(data, length);
}

View File

@ -84,17 +84,17 @@ public:
MD4Engine();
~MD4Engine();
unsigned digestLength() const;
std::size_t digestLength() const;
void reset();
const DigestEngine::Digest& digest();
protected:
void updateImpl(const void* data, unsigned length);
void updateImpl(const void* data, std::size_t length);
private:
static void transform(UInt32 state[4], const unsigned char block[64]);
static void encode(unsigned char* output, const UInt32* input, unsigned int len);
static void decode(UInt32* output, const unsigned char* input, unsigned int len);
static void encode(unsigned char* output, const UInt32* input, std::size_t len);
static void decode(UInt32* output, const unsigned char* input, std::size_t len);
struct Context
{

View File

@ -84,17 +84,17 @@ public:
MD5Engine();
~MD5Engine();
unsigned digestLength() const;
std::size_t digestLength() const;
void reset();
const DigestEngine::Digest& digest();
protected:
void updateImpl(const void* data, unsigned length);
void updateImpl(const void* data, std::size_t length);
private:
static void transform(UInt32 state[4], const unsigned char block[64]);
static void encode(unsigned char* output, const UInt32* input, unsigned int len);
static void decode(UInt32* output, const unsigned char* input, unsigned int len);
static void encode(unsigned char* output, const UInt32* input, std::size_t len);
static void decode(UInt32* output, const unsigned char* input, std::size_t len);
struct Context
{

View File

@ -67,12 +67,12 @@ public:
SHA1Engine();
~SHA1Engine();
unsigned digestLength() const;
std::size_t digestLength() const;
void reset();
const DigestEngine::Digest& digest();
protected:
void updateImpl(const void* data, unsigned length);
void updateImpl(const void* data, std::size_t length);
private:
void transform();

View File

@ -77,7 +77,7 @@ MD4Engine::~MD4Engine()
}
void MD4Engine::updateImpl(const void* input_, unsigned inputLen)
void MD4Engine::updateImpl(const void* input_, std::size_t inputLen)
{
const unsigned char* input = (const unsigned char*) input_;
unsigned int i, index, partLen;
@ -110,7 +110,7 @@ void MD4Engine::updateImpl(const void* input_, unsigned inputLen)
}
unsigned MD4Engine::digestLength() const
std::size_t MD4Engine::digestLength() const
{
return DIGEST_SIZE;
}
@ -273,7 +273,7 @@ void MD4Engine::transform (UInt32 state[4], const unsigned char block[64])
}
void MD4Engine::encode(unsigned char* output, const UInt32* input, unsigned int len)
void MD4Engine::encode(unsigned char* output, const UInt32* input, std::size_t len)
{
unsigned int i, j;
@ -287,7 +287,7 @@ void MD4Engine::encode(unsigned char* output, const UInt32* input, unsigned int
}
void MD4Engine::decode(UInt32* output, const unsigned char* input, unsigned int len)
void MD4Engine::decode(UInt32* output, const unsigned char* input, std::size_t len)
{
unsigned int i, j;

View File

@ -77,7 +77,7 @@ MD5Engine::~MD5Engine()
}
void MD5Engine::updateImpl(const void* input_, unsigned inputLen)
void MD5Engine::updateImpl(const void* input_, std::size_t inputLen)
{
const unsigned char* input = (const unsigned char*) input_;
unsigned int i, index, partLen;
@ -110,7 +110,7 @@ void MD5Engine::updateImpl(const void* input_, unsigned inputLen)
}
unsigned MD5Engine::digestLength() const
std::size_t MD5Engine::digestLength() const
{
return DIGEST_SIZE;
}
@ -304,7 +304,7 @@ void MD5Engine::transform (UInt32 state[4], const unsigned char block[64])
}
void MD5Engine::encode(unsigned char* output, const UInt32* input, unsigned int len)
void MD5Engine::encode(unsigned char* output, const UInt32* input, std::size_t len)
{
unsigned int i, j;
@ -318,7 +318,7 @@ void MD5Engine::encode(unsigned char* output, const UInt32* input, unsigned int
}
void MD5Engine::decode(UInt32* output, const unsigned char* input, unsigned int len)
void MD5Engine::decode(UInt32* output, const unsigned char* input, std::size_t len)
{
unsigned int i, j;

View File

@ -77,7 +77,7 @@ inline void SHA1Engine::byteReverse(UInt32* buffer, int byteCount)
}
void SHA1Engine::updateImpl(const void* buffer_, unsigned count)
void SHA1Engine::updateImpl(const void* buffer_, std::size_t count)
{
const BYTE* buffer = (const BYTE*) buffer_;
BYTE* db = (BYTE*) &_context.data[0];
@ -103,7 +103,7 @@ void SHA1Engine::updateImpl(const void* buffer_, unsigned count)
}
unsigned SHA1Engine::digestLength() const
std::size_t SHA1Engine::digestLength() const
{
return DIGEST_SIZE;
}