mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-27 03:40:22 +00:00
Add W3C_PADDING to encryption path
This commit is contained in:
parent
061f272da3
commit
8e088b4865
10
filters.cpp
10
filters.cpp
@ -700,8 +700,8 @@ void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
||||
break;
|
||||
|
||||
case PKCS_PADDING:
|
||||
case ONE_AND_ZEROS_PADDING:
|
||||
case W3C_PADDING:
|
||||
case ONE_AND_ZEROS_PADDING:
|
||||
unsigned int s;
|
||||
s = m_cipher.MandatoryBlockSize();
|
||||
CRYPTOPP_ASSERT(s > 1);
|
||||
@ -713,9 +713,15 @@ void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
||||
if (m_padding == PKCS_PADDING)
|
||||
{
|
||||
CRYPTOPP_ASSERT(s < 256);
|
||||
byte pad = byte(s-length);
|
||||
byte pad = static_cast<byte>(s-length);
|
||||
memset(space+length, pad, s-length);
|
||||
}
|
||||
else if (m_padding == W3C_PADDING)
|
||||
{
|
||||
CRYPTOPP_ASSERT(s < 256);
|
||||
memset(space+length, 0, s-length-1);
|
||||
space[s-1] = static_cast<byte>(s-length);
|
||||
}
|
||||
else
|
||||
{
|
||||
space[length] = 0x80;
|
||||
|
@ -480,7 +480,7 @@ struct BlockPaddingSchemeDef
|
||||
PKCS_PADDING,
|
||||
//! \brief 1 and 0's padding added to a block
|
||||
ONE_AND_ZEROS_PADDING,
|
||||
//! \brief [Random bytes (0 ~ N-2) and padding's length (N-1)]'s padding to a block
|
||||
//! \brief W3C padding added to a block
|
||||
W3C_PADDING,
|
||||
//! \brief Default padding scheme
|
||||
DEFAULT_PADDING
|
||||
|
Loading…
Reference in New Issue
Block a user