History

Merge commit 'd9e8b47e3144262d6bc4681740411d4bdafad6ac'

* commit 'd9e8b47e3144262d6bc4681740411d4bdafad6ac': des: add av_des_alloc() Conflicts: libavutil/des.c

Hendrik Leppkes committed 11 years ago

Commit 3cf08e92 parents 9ca1997 d9e8b473 files · +34 −3Browse files

Unified · Split

3 files
  1. doc/APIchanges +1 −0
  2. libavutil/des.c +12 −1
  3. libavutil/des.h +21 −2
doc/APIchanges+1−0
@@ -19,6 +19,7 @@ API changes, most recent first: · 18 unmodified lines
19 xxxxxxx - Add av_blowfish_alloc().19 xxxxxxx - Add av_blowfish_alloc().
20 xxxxxxx - Add av_rc4_alloc().20 xxxxxxx - Add av_rc4_alloc().
21 xxxxxxx - Add av_xtea_alloc().21 xxxxxxx - Add av_xtea_alloc().
22 xxxxxxx - Add av_des_alloc().
22 23
232015-xx-xx - lavc 56.35.0 - avcodec.h242015-xx-xx - lavc 56.35.0 - avcodec.h
24 xxxxxxxxx - Rename CODEC_FLAG* defines to AV_CODEC_FLAG*.25 xxxxxxxxx - Rename CODEC_FLAG* defines to AV_CODEC_FLAG*.
libavutil/des.c+12−1
@@ -22,9 +22,15 @@ · 21 unmodified lines
22#include "avutil.h"22#include "avutil.h"
23#include "common.h"23#include "common.h"
24#include "intreadwrite.h"24#include "intreadwrite.h"
25#include "mem.h"
25#include "des.h"26#include "des.h"
26 27
27typedef struct AVDES AVDES;28#if !FF_API_CRYPTO_CONTEXT
29struct AVDES {
30 uint64_t round_keys[3][16];
31 int triple_des;
32};
33#endif
28 34
29#define T(a, b, c, d, e, f, g, h) 64-a,64-b,64-c,64-d,64-e,64-f,64-g,64-h35#define T(a, b, c, d, e, f, g, h) 64-a,64-b,64-c,64-d,64-e,64-f,64-g,64-h
30static const uint8_t IP_shuffle[] = {36static const uint8_t IP_shuffle[] = {
@@ -286,6 +292,11 @@ static uint64_t des_encdec(uint64_t in, uint64_t K[16], int decrypt) { · 255 unmodified lines
286 return in;292 return in;
287}293}
288 294
295AVDES *av_des_alloc(void)
296{
297 return av_mallocz(sizeof(struct AVDES));
298}
299
289int av_des_init(AVDES *d, const uint8_t *key, int key_bits, av_unused int decrypt) {300int av_des_init(AVDES *d, const uint8_t *key, int key_bits, av_unused int decrypt) {
290 if (key_bits != 64 && key_bits != 192)301 if (key_bits != 64 && key_bits != 192)
291 return -1;302 return -1;
libavutil/des.h+21−2
@@ -24,10 +24,25 @@ · 23 unmodified lines
24 24
25#include <stdint.h>25#include <stdint.h>
26 26
27struct AVDES {27/**
28 * @defgroup lavu_des DES
29 * @ingroup lavu_crypto
30 * @{
31 */
32
33#if FF_API_CRYPTO_CONTEXT
34typedef struct AVDES {
28 uint64_t round_keys[3][16];35 uint64_t round_keys[3][16];
29 int triple_des;36 int triple_des;
30};37} AVDES;
38#else
39typedef struct AVDES AVDES;
40#endif
41
42/**
43 * Allocate an AVDES context.
44 */
45AVDES *av_des_alloc(void);
31 46
32/**47/**
33 * @brief Initializes an AVDES context.48 * @brief Initializes an AVDES context.
@@ -58,4 +73,8 @@ void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, · 24 unmodified lines
58 */73 */
59void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);74void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);
60 75
76/**
77 * @}
78 */
79
61#endif /* AVUTIL_DES_H */80#endif /* AVUTIL_DES_H */

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