[FFmpeg-devel] [PATCH] Salsa20 algorithm
pross at xvid.org
Fri Jul 20 13:20:34 CEST 2012
On Thu, Jul 19, 2012 at 04:50:03PM +0200, Nicolas George wrote:
> 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.
True. I'll see about supportnig the streamed use case also.
> > +/**
> > + * 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.
Salsa20 is an xor-based cipher.
BTW: this was supposed to be an RFC-type patch. Appologies for messing up the subject line.
(The PCoIP protocol demuxer is still work in progress.)
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel