* commit 'ae365453c370c85f278bff7fbf9e20d9d335cb2a': rc4: add av_rc4_alloc() Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>tags/n2.8
@@ -17,6 +17,7 @@ API changes, most recent first: | |||||
2015-xx-xx - lavu 54.30.0 | 2015-xx-xx - lavu 54.30.0 | ||||
xxxxxxx - Add av_blowfish_alloc(). | xxxxxxx - Add av_blowfish_alloc(). | ||||
xxxxxxx - Add av_rc4_alloc(). | |||||
2015-xx-xx - lavc 56.35.0 - avcodec.h | 2015-xx-xx - lavc 56.35.0 - avcodec.h | ||||
xxxxxxxxx - Rename CODEC_FLAG* defines to AV_CODEC_FLAG*. | xxxxxxxxx - Rename CODEC_FLAG* defines to AV_CODEC_FLAG*. | ||||
@@ -22,9 +22,20 @@ | |||||
*/ | */ | ||||
#include "avutil.h" | #include "avutil.h" | ||||
#include "common.h" | #include "common.h" | ||||
#include "mem.h" | |||||
#include "rc4.h" | #include "rc4.h" | ||||
typedef struct AVRC4 AVRC4; | |||||
#if !FF_API_CRYPTO_CONTEXT | |||||
struct AVRC4 { | |||||
uint8_t state[256]; | |||||
int x, y; | |||||
}; | |||||
#endif | |||||
AVRC4 *av_rc4_alloc(void) | |||||
{ | |||||
return av_mallocz(sizeof(struct AVRC4)); | |||||
} | |||||
int av_rc4_init(AVRC4 *r, const uint8_t *key, int key_bits, int decrypt) { | int av_rc4_init(AVRC4 *r, const uint8_t *key, int key_bits, int decrypt) { | ||||
int i, j; | int i, j; | ||||
@@ -22,11 +22,27 @@ | |||||
#define AVUTIL_RC4_H | #define AVUTIL_RC4_H | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#include "version.h" | |||||
struct AVRC4 { | |||||
/** | |||||
* @defgroup lavu_rc4 RC4 | |||||
* @ingroup lavu_crypto | |||||
* @{ | |||||
*/ | |||||
#if FF_API_CRYPTO_CONTEXT | |||||
typedef struct AVRC4 { | |||||
uint8_t state[256]; | uint8_t state[256]; | ||||
int x, y; | int x, y; | ||||
}; | |||||
} AVRC4; | |||||
#else | |||||
typedef struct AVRC4 AVRC4; | |||||
#endif | |||||
/** | |||||
* Allocate an AVRC4 context. | |||||
*/ | |||||
AVRC4 *av_rc4_alloc(void); | |||||
/** | /** | ||||
* @brief Initializes an AVRC4 context. | * @brief Initializes an AVRC4 context. | ||||
@@ -47,4 +63,8 @@ int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); | |||||
*/ | */ | ||||
void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); | void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); | ||||
/** | |||||
* @} | |||||
*/ | |||||
#endif /* AVUTIL_RC4_H */ | #endif /* AVUTIL_RC4_H */ |