Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSupraja Meedinti <supraja0493@gmail.com>2014-10-17 22:22:25 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-10-18 03:33:45 +0400
commit0eabbe2101f1cd54ff961ebbff7b3f9ffb599208 (patch)
tree7016a77b04fe190ddf9ba6599fcd932cc56c47d5 /libavutil/cast5.h
parent2c4d6a342d4f91ddf8be3463da5ee1bd2cecb2c9 (diff)
libavutil: Add CAST128 symmetric block cipher
Only ECB mode is supported at the moment Signed-off-by: Supraja Meedinti <supraja0493@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/cast5.h')
-rw-r--r--libavutil/cast5.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/libavutil/cast5.h b/libavutil/cast5.h
new file mode 100644
index 0000000000..a4df6d8576
--- /dev/null
+++ b/libavutil/cast5.h
@@ -0,0 +1,67 @@
+/*
+ * 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 */