[FFmpeg-devel] [RFC] Public API for RC4 and DES

Michael Niedermayer michaelni
Mon Feb 2 15:58:44 CET 2009


On Mon, Feb 02, 2009 at 01:38:43PM +0000, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
> 
> > On Mon, Feb 02, 2009 at 12:53:55PM +0100, Michael Niedermayer wrote:
> >> On Mon, Feb 02, 2009 at 11:15:28AM +0000, M?ns Rullg?rd wrote:
> >> > Michael Niedermayer <michaelni at gmx.at> writes:
> >> > 
> >> > > On Mon, Feb 02, 2009 at 10:22:50AM +0000, M?ns Rullg?rd wrote:
> >> > >> Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
> >> > >> 
> >> > >> > On Mon, Feb 02, 2009 at 10:59:16AM +0100, Marc Mason wrote:
> >> > >> >> Then, why not just declare rc4 on the stack, and pass its address?
> >> > >> >> 
> >> > >> >> struct AVRC4 rc4;
> >> > >> >> [...]
> >> > >> >> /* rc4 = av_malloc(av_rc4_size); UNNECESSARY */
> >> > >> >> /* pass &rc4 around */
> >> > >> >> [...]
> >> > >> >> /* av_free(rc4); UNNECESSARY */
> >> > >> >> 
> >> > >> >> I must be missing something?
> >> > >> >
> >> > >> > You miss that the size of struct AVRC4 is not known to the compiler.
> >> > >> 
> >> > >> Why is the interface done in such a twisted way?
> >> > >
> >> > > so the struct can be changed without breaking ABI
> >> > 
> >> > How likely is the struct to change?
> >> 
> >> i dont know, maybe reimar can guess ...
> >
> > When someone wants to optimize e.g. DES.
> > So probably never ;-).
> > It was just done in the same way as AES, and it is not a big issue if
> > you already have a context.
> > It wouldn't be such a big deal to change asfcrypt.c and its usages to
> > work better with this API.
> > Probably making the struct public isn't such an issue either, except
> > that the current way also makes it very clear that users are not
> > supposed to touch it.
> 
> Users seem able to stay away from the internals of the FILE type from
> stdio.h and other standard library structs that are visible but
> undocumented.
> 
> Either way, the size alone is not sufficient information.  The user
> must know the required alignment as well.

16 bytes or the max of what the platform needs


> 
> > I would prefer if these (AES, DES, RC4) would share the same API if we
> > make it public...
> 
> Using the same API for all the encryption types makes sense.

yes and no

if it slows 2 of 3 down by a significant amount it wouldnt be that ideal

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090202/996ba5a5/attachment.pgp>



More information about the ffmpeg-devel mailing list