[FFmpeg-devel] [PATCH] Salsa20 algorithm

Nicolas George nicolas.george at normalesup.org
Thu Jul 19 16:50:03 CEST 2012

Le duodi 2 thermidor, an CCXX, Peter Ross a écrit :
> All the current crypto algorithms within FFmpeg adhere to a quasi-standard
> xxx_crypt function prototype.

Not at all an objection, just a clarification: all the current crypto
algorithms are block-ciphers, working in CBC mode when an IV is given (and
duplicating the chaining code) or in ECB mode when IV is not given. Salsa20
is a stream cipher, and your code assumes that IV is always given.

> +/**
> + * Initialize an AVSalsa20 context
> + * @param kbits key bits (128 or 256)
> + */
> +void av_salsa20_init(struct AVSalsa20 *ctx, const uint8_t *key, int key_bits);
> +
> +/**
> + * Encrypt or decrypt a buffer using 12 round cipher and previously initialized context.
> + * @param dst destination buffer, can be equal to src
> + * @param src source buffer, can be equal to dst
> + * @param len buffer length (bytes)
> + * @param iv initialization vector (8 bytes)
> + */
> +void av_salsa20_crypt(struct AVSalsa20 *ctx, uint8_t *dst, const uint8_t *src, int len, const uint8_t *iv);

Maybe I am being dumb, but I do not see how the API user is supposed to
select between encrypt and decrypt.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120719/78da0665/attachment.asc>

More information about the ffmpeg-devel mailing list