bugfix to ensure that incoming SPA data in AES mode is a multiple of the Rjindael blocksize (16)
This commit is contained in:
+2
-2
@@ -249,8 +249,8 @@ rij_decrypt(unsigned char *in, size_t in_len,
|
||||
/* Remove the first block since it contains the salt (it was consumed
|
||||
* by the rijndael_init() function above).
|
||||
*/
|
||||
in_len -= 16;
|
||||
memmove(in, in+16, in_len);
|
||||
in_len -= RIJNDAEL_BLOCKSIZE;
|
||||
memmove(in, in+RIJNDAEL_BLOCKSIZE, in_len);
|
||||
|
||||
block_decrypt(&ctx, in, in_len, out, ctx.iv);
|
||||
|
||||
|
||||
@@ -139,6 +139,15 @@ _rijndael_decrypt(fko_ctx_t ctx, const char *dec_key, int encryption_mode)
|
||||
|
||||
cipher_len = b64_decode(ctx->encrypted_msg, cipher);
|
||||
|
||||
/* Since we're using AES, make sure the incoming data is a multiple of
|
||||
* the blocksize
|
||||
*/
|
||||
if((cipher_len % RIJNDAEL_BLOCKSIZE) != 0)
|
||||
{
|
||||
free(cipher);
|
||||
return(FKO_ERROR_INVALID_DATA);
|
||||
}
|
||||
|
||||
/* Create a bucket for the plaintext data and decrypt the message
|
||||
* data into it.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user