On Wed, Aug 26, 2009, Johan Foglemark wrote:

> Hi, this is a two part question. First in the cipherEncrypt16b function
> below I try to encrypt a signle block with aes128, but I cant really use
> EVP_CipherFinal_ex since it seems to put out and extra block of data even
> tho its only 16bytes put in.. This part works tho when EVP_CipherFinal_ex is
> commented out. The part that I find really strange here is in the secound
> function called cipherDecrypt16b. When the EVP_CipherUpdate is run the data
> is correctly added to the char array but the data length is set to 0.
> 

That is the way standard block padding works. When you encrypt up to one extra
block of padding is added, on decrypt the padding is stripped off. However a
block is buffered in case it is the final block.

If you do not want padding disable it with:

EVP_CIPHER_CTX_set_padding(ctx, 0);

see manual pages for more info.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to