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
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162015-xx-xx - lavu 54.17.0
17 xxxxxxx - Add av_blowfish_alloc().
18
162015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h192015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h
17 Add AV_HMAC_SHA224 and AV_HMAC_SHA256.20 Add AV_HMAC_SHA224 and AV_HMAC_SHA256.
18 21
libavutil/blowfish.c+15−0
@@ -24,8 +24,18 @@ · 23 unmodified lines
24#include "avutil.h"24#include "avutil.h"
25#include "common.h"25#include "common.h"
26#include "intreadwrite.h"26#include "intreadwrite.h"
27#include "mem.h"
27#include "blowfish.h"28#include "blowfish.h"
28 29
30#if !FF_API_CRYPTO_CONTEXT
31#define AV_BF_ROUNDS 16
32
33struct AVBlowfish {
34 uint32_t p[AV_BF_ROUNDS + 2];
35 uint32_t s[4][256];
36};
37#endif
38
29static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {39static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
30 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,40 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
31 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,41 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
@@ -312,6 +322,11 @@ static void F(AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, int i) · 280 unmodified lines
312 *xr = Xl;322 *xr = Xl;
313}323}
314 324
325AVBlowfish *av_blowfish_alloc(void)
326{
327 return av_mallocz(sizeof(struct AVBlowfish));
328}
329
315av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len)330av_cold void av_blowfish_init(AVBlowfish *ctx, const uint8_t *key, int key_len)
316{331{
317 uint32_t data, data_l, data_r;332 uint32_t data, data_l, data_r;
libavutil/blowfish.h+10−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
22#define AVUTIL_BLOWFISH_H22#define AVUTIL_BLOWFISH_H
23 23
24#include <stdint.h>24#include <stdint.h>
25#include "version.h"
25 26
26/**27/**
27 * @defgroup lavu_blowfish Blowfish28 * @defgroup lavu_blowfish Blowfish
@@ -29,12 +30,21 @@ · 1 unmodified line
29 * @{30 * @{
30 */31 */
31 32
33#if FF_API_CRYPTO_CONTEXT
32#define AV_BF_ROUNDS 1634#define AV_BF_ROUNDS 16
33 35
34typedef struct AVBlowfish {36typedef struct AVBlowfish {
35 uint32_t p[AV_BF_ROUNDS + 2];37 uint32_t p[AV_BF_ROUNDS + 2];
36 uint32_t s[4][256];38 uint32_t s[4][256];
37} AVBlowfish;39} AVBlowfish;
40#else
41typedef struct AVBlowfish AVBlowfish;
42#endif
43
44/**
45 * Allocate an AVBlowfish context.
46 */
47AVBlowfish *av_blowfish_alloc(void);
38 48
39/**49/**
40 * Initialize an AVBlowfish context.50 * Initialize an AVBlowfish context.
libavutil/version.h+4−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
54 */54 */
55 55
56#define LIBAVUTIL_VERSION_MAJOR 5456#define LIBAVUTIL_VERSION_MAJOR 54
57#define LIBAVUTIL_VERSION_MINOR 1657#define LIBAVUTIL_VERSION_MINOR 17
58#define LIBAVUTIL_VERSION_MICRO 058#define LIBAVUTIL_VERSION_MICRO 0
59 59
60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -114,6 +114,9 @@ · 53 unmodified lines
114#ifndef FF_API_DLOG114#ifndef FF_API_DLOG
115#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)115#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 55)
116#endif116#endif
117#ifndef FF_API_CRYPTO_CONTEXT
118#define FF_API_CRYPTO_CONTEXT (LIBAVUTIL_VERSION_MAJOR < 56)
119#endif
117 120
118 121
119/**122/**

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