On Mon, Jul 02, 2012 at 10:12:16AM +0200, Diego Biurrun wrote:
> On Sun, Jul 01, 2012 at 06:28:18PM +0200, Samuel Pitoiset wrote:
> > --- /dev/null
> > +++ b/libavutil/blowfish.c
> > @@ -0,0 +1,506 @@
> > +/*
> > + * Blowfish algorithm
> > + * Copyright (c) 2012 Samuel Pitoiset
> > + *
> > + * loosely based on Paul Kocher's implementation
>
> Which is licensed as ..?
>
> > +static const uint32_t orig_s[4][256] = {
> > + {
> > + 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
>
> { 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
>
> > +static void F(AVBlowfish *bf, uint32_t *xl, uint32_t *xr, int i)
>
> F?
That's strong-box function and it's called so officially.
> > + Xl ^= bf->p[i];
> > + y = bf->s[0][(Xl >> 24) & 0xFF];
> > + y += bf->s[1][(Xl >> 16) & 0xFF];
> > + y ^= bf->s[2][(Xl >> 8) & 0xFF];
> > + y += bf->s[3][ Xl & 0xFF];
> > + Xr ^= y;
>
> Vertical alignment is off.
>
> > +void av_blowfish_init(AVBlowfish *bf, const uint8_t *key, int key_len)
>
> av_cold
>
> > +/* plaintext bytes -- left halves */
> > +static const uint32_t plaintext_l[NUM_VARIABLE_KEY_TESTS] = {
> > + 0x00000000, 0xFFFFFFFF, 0x10000000, 0x11111111, 0x11111111,
> > + 0x01234567, 0x00000000, 0x01234567, 0x01A1D6D0, 0x5CD54CA8,
> > + 0x0248D438, 0x51454B58, 0x42FD4430, 0x059B5E08, 0x0756D8E0,
> > + 0x762514B8, 0x3BDD1190, 0x26955F68, 0x164D5E40, 0x6B056E18,
> > + 0x004BD6EF, 0x480D3900, 0x437540C8, 0x072D43A0, 0x02FE5577,
> > + 0x1D9D5C50, 0x30553228, 0x01234567, 0x01234567, 0x01234567,
> > + 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF };
>
> Move the closing } to the next line.
>
> > +int main(void)
> > +{
> > + AVBlowfish bf;
> > + uint32_t tmptext_l[NUM_VARIABLE_KEY_TESTS];
> > + uint32_t tmptext_r[NUM_VARIABLE_KEY_TESTS];
> > + int i;
> > +
> > + memcpy(tmptext_l, plaintext_l, sizeof(uint32_t) *
> > NUM_VARIABLE_KEY_TESTS);
> > + memcpy(tmptext_r, plaintext_r, sizeof(uint32_t) *
> > NUM_VARIABLE_KEY_TESTS);
>
> sizeof(variable is preferable to sizeof(type).
>
> > --- /dev/null
> > +++ b/libavutil/blowfish.h
> > @@ -0,0 +1,64 @@
> > +/**
> > + * @brief Initializes an AVBlowfish context.
> > + *
> > + * @parma bf an AVBlowfish context
>
> param
or Torino
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel