]> git.sesse.net Git - ffmpeg/commitdiff
rc4: add av_rc4_alloc()
authorJames Almer <jamrial@gmail.com>
Tue, 28 Jul 2015 19:57:47 +0000 (16:57 -0300)
committerAnton Khirnov <anton@khirnov.net>
Fri, 31 Jul 2015 07:04:12 +0000 (09:04 +0200)
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
doc/APIchanges
libavutil/rc4.c
libavutil/rc4.h

index 42f13fa8804d43a8b62131829122601f798ea2d7..de22fa5dfbda55a63cfbe57e505799540445d2b5 100644 (file)
@@ -15,6 +15,7 @@ API changes, most recent first:
 
 2015-xx-xx - lavu 54.17.0
   xxxxxxx -  Add av_blowfish_alloc().
+  xxxxxxx -  Add av_rc4_alloc().
 
 2015-07-29 - 7e38340 - lavu 54.16.0 - hmac.h
   Add AV_HMAC_SHA224 and AV_HMAC_SHA256.
index 3bf710f3f1738642d88ba9e3da4ebe978e7f5def..36b0de9f534e21d8a2591acce388c488c7699e56 100644 (file)
  */
 #include "avutil.h"
 #include "common.h"
+#include "mem.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 i, j;
index ec3b47cc8a82b57534caa480b990d1ec59d110a9..f6d2d44504787c25b16bc9109feceb861ef20a86 100644 (file)
 #define AVUTIL_RC4_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];
     int x, y;
-};
+} AVRC4;
+#else
+typedef struct AVRC4 AVRC4;
+#endif
+
+/**
+ * Allocate an AVRC4 context.
+ */
+AVRC4 *av_rc4_alloc(void);
 
 /**
  * @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);
 
+/**
+ * @}
+ */
+
 #endif /* AVUTIL_RC4_H */