fix ONE_AND_ZEROS_PADDING

pull/2/head
weidai 2004-02-05 03:35:13 +00:00
parent 94f405b94b
commit 735020666b
1 changed files with 3 additions and 3 deletions

View File

@ -617,7 +617,7 @@ void StreamTransformationFilter::LastPut(const byte *inString, unsigned int leng
} }
else else
{ {
space[length] = 1; space[length] = 0x80;
memset(space+length+1, 0, s-length-1); memset(space+length+1, 0, s-length-1);
} }
m_cipher.ProcessData(space, space, s); m_cipher.ProcessData(space, space, s);
@ -637,9 +637,9 @@ void StreamTransformationFilter::LastPut(const byte *inString, unsigned int leng
} }
else else
{ {
while (length > 1 && space[length-1] == '\0') while (length > 1 && space[length-1] == 0)
--length; --length;
if (space[--length] != '\1') if (space[--length] != 0x80)
throw InvalidCiphertext("StreamTransformationFilter: invalid ones-and-zeros padding found"); throw InvalidCiphertext("StreamTransformationFilter: invalid ones-and-zeros padding found");
} }
AttachedTransformation()->Put(space, length); AttachedTransformation()->Put(space, length);