Commit 0eabbe21 authored by Supraja Meedinti's avatar Supraja Meedinti Committed by Michael Niedermayer

libavutil: Add CAST128 symmetric block cipher

Only ECB mode is supported at the moment
Signed-off-by: 's avatarSupraja Meedinti <supraja0493@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2c4d6a34
......@@ -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, ECB mode
version 2.4:
- Icecast protocol
......
......@@ -15,6 +15,7 @@ HEADERS = adler32.h \
bprint.h \
bswap.h \
buffer.h \
cast5.h \
channel_layout.h \
common.h \
cpu.h \
......@@ -82,6 +83,7 @@ OBJS = adler32.o \
blowfish.o \
bprint.o \
buffer.o \
cast5.o \
channel_layout.o \
cpu.o \
crc.o \
......@@ -151,6 +153,7 @@ TESTPROGS = adler32 \
base64 \
blowfish \
bprint \
cast5 \
cpu \
crc \
des \
......
This diff is collapsed.
/*
* 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
* @{
*/
extern const int av_cast5_size;
struct AVCAST5;
/**
* Allocate an AVCAST5 context
* To free the struct: av_free(ptr)
*/
struct AVCAST5 *av_cast5_alloc(void);
/**
* Initialize an AVCAST5 context.
*
* @param ctx an AVCAST5 context
* @param key a key of 5,6,...16 bytes used for encryption/decryption
* @param key_bits number of keybits: possible are 40,48,...,128
*/
int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits);
/**
* Encrypt or decrypt a buffer using a previously initialized context
*
* @param ctx an AVCAST5 context
* @param dst destination array, can be equal to src
* @param src source array, can be equal to dst
* @param count number of 8 byte blocks
* @param decrypt 0 for encryption, 1 for decryption
*/
void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count,int decrypt);
/**
* @}
*/
#endif /* AVUTIL_CAST5_H */
......@@ -8,6 +8,11 @@ fate-aes: libavutil/aes-test$(EXESUF)
fate-aes: CMD = run libavutil/aes-test
fate-aes: REF = /dev/null
FATE_LIBAVUTIL += fate-cast5
fate-cast5: libavutil/cast5-test$(EXESUF)
fate-cast5: CMD = run libavutil/cast5-test
fate-cast5: REF = /dev/null
FATE_LIBAVUTIL += fate-atomic
fate-atomic: libavutil/atomic-test$(EXESUF)
fate-atomic: CMD = run libavutil/atomic-test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment