[FFmpeg-cvslog] Add a protocol handler for AES CBC decryption with PKCS7 padding
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Apr 24 11:37:09 CEST 2011
On Sun, Apr 24, 2011 at 03:50:08AM +0200, Martin Storsjö wrote:
> + // We avoid using the last block until we've found EOF,
> + // since we'll remove PKCS7 padding at the end. So make
> + // sure we've got at least 2 blocks, so we can decrypt
> + // at least one.
> + while (c->indata - c->indata_used < 2*BLOCKSIZE) {
> + int n = ffurl_read(c->hd, c->inbuffer + c->indata,
> + sizeof(c->inbuffer) - c->indata);
> + if (n <= 0) {
> + c->eof = 1;
Huh? That doesn't necessarily indicate EOF to my knowledge.
Of course doing it correct means a risk of very high CPU usage,
so this would have to copy or reuse retry_transfer_wrapper
from avio.c
> + if (c->indata_used >= sizeof(c->inbuffer)/2) {
> + memmove(c->inbuffer, c->inbuffer + c->indata_used,
> + c->indata - c->indata_used);
Why memmove? I see no way those memory ranges could overlap.
> + if (c->hd)
> + ffurl_close(c->hd);
> + av_free(c->aes);
> + av_free(c->key);
> + av_free(c->iv);
Why not av_freep?
More information about the ffmpeg-cvslog
mailing list