mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
fix for OpenSSL 1.0
This commit is contained in:
parent
943595c937
commit
e7d2b4593a
@ -45,12 +45,12 @@ public:
|
||||
/// Returns the block size for this CryptoTransform.
|
||||
|
||||
virtual int setPadding(int padding);
|
||||
/// Enables or disables padding. By default encryption operations are padded using standard block
|
||||
/// padding and the padding is checked and removed when decrypting. If the padding parameter is zero then
|
||||
/// no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of
|
||||
/// Enables or disables padding. By default encryption operations are padded using standard block
|
||||
/// padding and the padding is checked and removed when decrypting. If the padding parameter is zero then
|
||||
/// no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of
|
||||
/// the block size or an error will occur.
|
||||
|
||||
virtual std::string getTag(std::size_t tagSize = 16) const = 0;
|
||||
virtual std::string getTag(std::size_t tagSize = 16) = 0;
|
||||
/// Returns the GCM tag after encrypting using GCM mode.
|
||||
///
|
||||
/// Must be called after finalize().
|
||||
|
@ -29,7 +29,7 @@ namespace
|
||||
{
|
||||
unsigned long err;
|
||||
std::string msg;
|
||||
|
||||
|
||||
while ((err = ERR_get_error()))
|
||||
{
|
||||
if (!msg.empty())
|
||||
@ -59,10 +59,10 @@ namespace
|
||||
Direction dir);
|
||||
|
||||
~CryptoTransformImpl();
|
||||
|
||||
|
||||
std::size_t blockSize() const;
|
||||
int setPadding(int padding);
|
||||
std::string getTag(std::size_t tagSize) const;
|
||||
int setPadding(int padding);
|
||||
std::string getTag(std::size_t tagSize);
|
||||
void setTag(const std::string& tag);
|
||||
|
||||
std::streamsize transform(
|
||||
@ -70,7 +70,7 @@ namespace
|
||||
std::streamsize inputLength,
|
||||
unsigned char* output,
|
||||
std::streamsize outputLength);
|
||||
|
||||
|
||||
std::streamsize finalize(
|
||||
unsigned char* output,
|
||||
std::streamsize length);
|
||||
@ -147,7 +147,7 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CryptoTransformImpl::setPadding(int padding)
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
@ -156,9 +156,9 @@ namespace
|
||||
return EVP_CIPHER_CTX_set_padding(&_context, padding);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
std::string CryptoTransformImpl::getTag(std::size_t tagSize) const
|
||||
|
||||
std::string CryptoTransformImpl::getTag(std::size_t tagSize)
|
||||
{
|
||||
std::string tag;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||
@ -224,7 +224,7 @@ namespace
|
||||
std::streamsize length)
|
||||
{
|
||||
poco_assert (length >= blockSize());
|
||||
|
||||
|
||||
int len = static_cast<int>(length);
|
||||
|
||||
// Use the '_ex' version that does not perform implicit cleanup since we
|
||||
@ -238,7 +238,7 @@ namespace
|
||||
|
||||
if (rc == 0)
|
||||
throwError();
|
||||
|
||||
|
||||
return static_cast<std::streamsize>(len);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace
|
||||
{
|
||||
unsigned long err;
|
||||
std::string msg;
|
||||
|
||||
|
||||
while ((err = ERR_get_error()))
|
||||
{
|
||||
if (!msg.empty())
|
||||
@ -66,10 +66,10 @@ namespace
|
||||
public:
|
||||
RSAEncryptImpl(const RSA* pRSA, RSAPaddingMode paddingMode);
|
||||
~RSAEncryptImpl();
|
||||
|
||||
|
||||
std::size_t blockSize() const;
|
||||
std::size_t maxDataSize() const;
|
||||
std::string getTag(std::size_t) const;
|
||||
std::string getTag(std::size_t);
|
||||
void setTag(const std::string&);
|
||||
|
||||
std::streamsize transform(
|
||||
@ -77,7 +77,7 @@ namespace
|
||||
std::streamsize inputLength,
|
||||
unsigned char* output,
|
||||
std::streamsize outputLength);
|
||||
|
||||
|
||||
std::streamsize finalize(unsigned char* output, std::streamsize length);
|
||||
|
||||
private:
|
||||
@ -129,7 +129,7 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
std::string RSAEncryptImpl::getTag(std::size_t) const
|
||||
std::string RSAEncryptImpl::getTag(std::size_t)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
@ -167,7 +167,7 @@ namespace
|
||||
output += n;
|
||||
outputLength -= n;
|
||||
_pos = 0;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -203,9 +203,9 @@ namespace
|
||||
public:
|
||||
RSADecryptImpl(const RSA* pRSA, RSAPaddingMode paddingMode);
|
||||
~RSADecryptImpl();
|
||||
|
||||
|
||||
std::size_t blockSize() const;
|
||||
std::string getTag(std::size_t) const;
|
||||
std::string getTag(std::size_t);
|
||||
void setTag(const std::string&);
|
||||
|
||||
std::streamsize transform(
|
||||
@ -213,7 +213,7 @@ namespace
|
||||
std::streamsize inputLength,
|
||||
unsigned char* output,
|
||||
std::streamsize outputLength);
|
||||
|
||||
|
||||
std::streamsize finalize(
|
||||
unsigned char* output,
|
||||
std::streamsize length);
|
||||
@ -248,7 +248,7 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
std::string RSADecryptImpl::getTag(std::size_t) const
|
||||
std::string RSADecryptImpl::getTag(std::size_t)
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
@ -265,7 +265,7 @@ namespace
|
||||
unsigned char* output,
|
||||
std::streamsize outputLength)
|
||||
{
|
||||
|
||||
|
||||
// always fill up the buffer before decrypting!
|
||||
std::streamsize rsaSize = static_cast<std::streamsize>(blockSize());
|
||||
poco_assert_dbg(_pos <= rsaSize);
|
||||
@ -285,7 +285,7 @@ namespace
|
||||
output += tmp;
|
||||
outputLength -= tmp;
|
||||
_pos = 0;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user