History

blowfish: add av_blowfish_alloc()

James Almer committed 11 years ago

Commit 7a7df341 parent cd4d9df4 files · +32 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/blowfish.c +15 −0
  3. libavutil/blowfish.h +10 −0
  4. libavutil/version.h +4 −1
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2014-08-09 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2015-xx-xx - lavu 54.17.0
17+ xxxxxxx - Add av_blowfish_alloc().
18+
1619 2015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h
1720 Add AV_HMAC_SHA224 and AV_HMAC_SHA256.
1821
libavutil/blowfish.c+15−0
@@ -24,8 +24,18 @@ · 23 unmodified lines
2424 #include "avutil.h"
2525 #include "common.h"
2626 #include "intreadwrite.h"
27+#include "mem.h"
2728 #include "blowfish.h"
2829
30+#if !FF_API_CRYPTO_CONTEXT
31+#define AV_BF_ROUNDS 16
32+
33+struct AVBlowfish {
34+ uint32_t p[AV_BF_ROUNDS + 2];
35+ uint32_t s[4][256];
36+};
37+#endif
38+
2939 static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
3040 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
3141 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
@@ -312,6 +322,11 @@ static void F(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, int i) · 280 unmodified lines
312322 *xr = Xl;
313323 }
314324
325+AVBlowfish *av_blowfish_alloc(void)
326+{
327+ return av_mallocz(sizeof(struct AVBlowfish));
328+}
329+
315330 av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len)
316331 {
317332 uint32_t data, data_l, data_r;
libavutil/blowfish.h+10−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #define AVUTIL_BLOWFISH_H
2323
2424 #include <stdint.h>
25+#include "version.h"
2526
2627 /**
2728 * @defgroup lavu_blowfish Blowfish
@@ -29,12 +30,21 @@ · 1 unmodified line
2930 * @{
3031 */
3132
33+#if FF_API_CRYPTO_CONTEXT
3234 #define AV_BF_ROUNDS 16
3335
3436 typedef struct AVBlowfish {
3537 uint32_t p[AV_BF_ROUNDS + 2];
3638 uint32_t s[4][256];
3739 } AVBlowfish;
40+#else
41+typedef struct AVBlowfish AVBlowfish;
42+#endif
43+
44+/**
45+ * Allocate an AVBlowfish context.
46+ */
47+AVBlowfish *av_blowfish_alloc(void);
3848
3949 /**
4050 * Initialize an AVBlowfish context.
libavutil/version.h+4−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 */
5555
5656 #define LIBAVUTIL_VERSION_MAJOR 54
57−#define LIBAVUTIL_VERSION_MINOR 16
57+#define LIBAVUTIL_VERSION_MINOR 17
5858 #define LIBAVUTIL_VERSION_MICRO 0
5959
6060 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -114,6 +114,9 @@ · 53 unmodified lines
114114 #ifndef FF_API_DLOG
115115 #define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)
116116 #endif
117+#ifndef FF_API_CRYPTO_CONTEXT
118+#define FF_API_CRYPTO_CONTEXT (LIBAVUTIL_VERSION_MAJOR < 56)
119+#endif
117120
118121
119122 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t