aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/blowfish.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2015-07-28 16:57:46 -0300
committerAnton Khirnov <anton@khirnov.net>2015-07-31 09:04:09 +0200
commit7a7df34c91e16ea8936f59524145a2cdd6b790f9 (patch)
treeb19bbe820373398e3bae2a0da87167c628d54dac /libavutil/blowfish.c
parentcd4d9df22738e6f147521ccb72c7930db6050914 (diff)
downloadffmpeg-7a7df34c91e16ea8936f59524145a2cdd6b790f9.tar.gz
blowfish: add av_blowfish_alloc()
Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavutil/blowfish.c')
-rw-r--r--libavutil/blowfish.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/blowfish.c b/libavutil/blowfish.c
index 8437dd6f94..a392459397 100644
--- a/libavutil/blowfish.c
+++ b/libavutil/blowfish.c
@@ -24,8 +24,18 @@
#include "avutil.h"
#include "common.h"
#include "intreadwrite.h"
+#include "mem.h"
#include "blowfish.h"
+#if !FF_API_CRYPTO_CONTEXT
+#define AV_BF_ROUNDS 16
+
+struct AVBlowfish {
+ uint32_t p[AV_BF_ROUNDS + 2];
+ uint32_t s[4][256];
+};
+#endif
+
static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
@@ -312,6 +322,11 @@ static void F(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, int i)
*xr = Xl;
}
+AVBlowfish *av_blowfish_alloc(void)
+{
+ return av_mallocz(sizeof(struct AVBlowfish));
+}
+
av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len)
{
uint32_t data, data_l, data_r;