[FFmpeg-devel] Patch for Cast128 algorithm implementation

Michael Niedermayer michaelni at gmx.at
Fri Oct 17 05:51:42 CEST 2014


On Thu, Oct 16, 2014 at 11:09:27PM +0530, supraja reddy wrote:
> Updated the patch .
> Please let me know if there are any other changes needed .
> 
> Thanks ,
> 
> Supraja
> 
> On Thu, Oct 16, 2014 at 1:37 PM, Giorgio Vazzana <mywing81 at gmail.com> wrote:
> 
> > Hi,
> >
> > 2014-10-16 5:32 GMT+02:00 Michael Niedermayer <michaelni at gmx.at>:
> > > On Thu, Oct 16, 2014 at 03:25:42AM +0530, supraja reddy wrote:
> > >> Extremely sorry for resending the patch . There was a trailing
> > whitespace
> > >> which I hadn't corrected .
> > >> All the changes are done .
> > >> Please let me if any changes needed further .
> >
> > > also a test that enciphers and deciphers a larger amount of random
> > > data could be added
> >
> > The RFC defines a "Full Maintenance Test",
> >
> > http://tools.ietf.org/html/rfc2144#appendix-B.2
> >
> > it should probably be added (easy: just a few lines of code).
> >
> > >
> > >
> > >> +    return err;
> > >> +}
> > >> +#endif
> > >> diff --git a/libavutil/cast5.h b/libavutil/cast5.h
> > >> new file mode 100644
> > >> index 0000000..d151031
> > >> --- /dev/null
> > >> +++ b/libavutil/cast5.h
> > >> @@ -0,0 +1,60 @@
> > >> +/*
> > >> + * An implementation of the CAST128 algorithm as mentioned in RFC2144
> > >> + * Copyright (c) 2014 Supraja Meedinti
> > >> + *
> > >> + * This file is part of FFmpeg.
> > >> + *
> > >> + * FFmpeg is free software; you can redistribute it and/or
> > >> + * modify it under the terms of the GNU Lesser General Public
> > >> + * License as published by the Free Software Foundation; either
> > >> + * version 2.1 of the License, or (at your option) any later version.
> > >> + *
> > >> + * FFmpeg is distributed in the hope that it will be useful,
> > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > >> + * Lesser General Public License for more details.
> > >> + *
> > >> + * You should have received a copy of the GNU Lesser General Public
> > >> + * License along with FFmpeg; if not, write to the Free Software
> > >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> > 02110-1301 USA
> > >> + */
> > >> +
> > >> +#ifndef AVUTIL_CAST5_H
> > >> +#define AVUTIL_CAST5_H
> > >> +
> > >> +#include <stdint.h>
> > >> +
> >
> > >> +#include "attributes.h"
> > >> +#include "version.h"
> >
> > I think version.h is not needed and you can move attributes.h to cast5.c
> >
> > No more comments from me, apart from: well done! Another round of
> > revision and hopefully we'll soon be able to apply the patch :)
> >
> > Giorgio
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >

>  Changelog          |    1 
>  libavutil/Makefile |    3 
>  libavutil/cast5.c  |  541 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  libavutil/cast5.h  |   64 ++++++
>  4 files changed, 609 insertions(+)
> 2359679d575d9443532b2c97dced599d7bf1f847  0001-Add-CAST128-symmetric-block-cipher-to-libavutil-n-nO.patch
> From 0f00f635db3ca37bce4148c4df606e5fbe9f7948 Mon Sep 17 00:00:00 2001
> From: Supraja Meedinti <supraja0493 at gmail.com>
> Date: Thu, 16 Oct 2014 23:04:23 +0530
> Subject: [PATCH]  Add CAST128 symmetric block cipher to libavutil

we normally start the first line with the part that is changed
like
avutil: Add CAST128 symmetric block cipher
or
libavutil: Add CAST128 symmetric block cipher


> 
> Only ECB mode is supported at the moment
> 
> Signed-off-by: Supraja Meedinti <supraja0493 at gmail.com>
> ---
>  Changelog          |   1 +
>  libavutil/Makefile |   3 +
>  libavutil/cast5.c  | 541 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  libavutil/cast5.h  |  64 +++++++
>  4 files changed, 609 insertions(+)
>  create mode 100644 libavutil/cast5.c
>  create mode 100644 libavutil/cast5.h
> 
> diff --git a/Changelog b/Changelog
> index b59058b..8aa9a0d 100644
> --- a/Changelog
> +++ b/Changelog

> @@ -5,6 +5,7 @@ version <next>:
>  - HEVC/H.265 RTP payload format (draft v6) packetizer
>  - SUP/PGS subtitle demuxer
>  - ffprobe -show_pixel_formats option
> +- CAST128 symmetric block cipher

this could mention ECB mode


[...]

> diff --git a/libavutil/cast5.h b/libavutil/cast5.h
> new file mode 100644
> index 0000000..922a892
> --- /dev/null
> +++ b/libavutil/cast5.h
> @@ -0,0 +1,64 @@
> +/*
> + * An implementation of the CAST128 algorithm as mentioned in RFC2144
> + * Copyright (c) 2014 Supraja Meedinti
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVUTIL_CAST5_H
> +#define AVUTIL_CAST5_H
> +
> +#include <stdint.h>
> +
> +
> +/**
> +  * @file
> +  * @brief Public header for libavutil CAST5 algorithm
> +  * @defgroup lavu_cast5 CAST5
> +  * @ingroup lavu_crypto

> +  * @{

missing @}



> +  */
> +
> +extern const int av_cast5_size;
> +
> +struct AVCAST5;
> +
> +/**
> +  * Allocate an AVCAST5 context
> +  */

this should document how to free the structure

if you want, you could also add a fate test for cast128
see:
"git grep -C2 aes tests" for an example of that

[...]


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141017/e435f6a4/attachment.asc>


More information about the ffmpeg-devel mailing list