[FFmpeg-cvslog] Merge commit '00b6a765430e5c5cacf0bd1be8b318d631cd4e14'

Clément Bœsch git at videolan.org
Fri May 5 14:28:39 EEST 2017


ffmpeg | branch: master | Clément Bœsch <cboesch at gopro.com> | Fri May  5 13:27:03 2017 +0200| [90fe0800fb84d46994c351e0c0ff200a14d27168] | committer: Clément Bœsch

Merge commit '00b6a765430e5c5cacf0bd1be8b318d631cd4e14'

* commit '00b6a765430e5c5cacf0bd1be8b318d631cd4e14':
  hmac: Explicitly convert types at function pointer assignment

Merged-by: Clément Bœsch <cboesch at gopro.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=90fe0800fb84d46994c351e0c0ff200a14d27168
---

 libavutil/hmac.c | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/libavutil/hmac.c b/libavutil/hmac.c
index 8ec6d70406..d064a105f4 100644
--- a/libavutil/hmac.c
+++ b/libavutil/hmac.c
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
+#include <stdint.h>
 #include <string.h>
 
 #include "attributes.h"
@@ -26,16 +28,25 @@
 #include "sha.h"
 #include "sha512.h"
 #include "mem.h"
+#include "version.h"
 
 #define MAX_HASHLEN 64
 #define MAX_BLOCKLEN 128
 
+typedef void (*hmac_final)(void *ctx, uint8_t *dst);
+#if FF_API_CRYPTO_SIZE_T
+typedef void (*hmac_update)(void *ctx, const uint8_t *src, int len);
+#else
+typedef void (*hmac_update)(void *ctx, const uint8_t *src, size_t len);
+#endif
+typedef void (*hmac_init)(void *ctx);
+
 struct AVHMAC {
     void *hash;
     int blocklen, hashlen;
-    void (*final)(void*, uint8_t*);
-    void (*update)(void*, const uint8_t*, int len);
-    void (*init)(void*);
+    hmac_final  final;
+    hmac_update update;
+    hmac_init   init;
     uint8_t key[MAX_BLOCKLEN];
     int keylen;
 };
@@ -67,49 +78,49 @@ AVHMAC *av_hmac_alloc(enum AVHMACType type)
     case AV_HMAC_MD5:
         c->blocklen = 64;
         c->hashlen  = 16;
-        c->init     = (void*)av_md5_init;
-        c->update   = (void*)av_md5_update;
-        c->final    = (void*)av_md5_final;
+        c->init     = (hmac_init) av_md5_init;
+        c->update   = (hmac_update) av_md5_update;
+        c->final    = (hmac_final) av_md5_final;
         c->hash     = av_md5_alloc();
         break;
     case AV_HMAC_SHA1:
         c->blocklen = 64;
         c->hashlen  = 20;
         c->init     = sha160_init;
-        c->update   = (void*)av_sha_update;
-        c->final    = (void*)av_sha_final;
+        c->update   = (hmac_update) av_sha_update;
+        c->final    = (hmac_final) av_sha_final;
         c->hash     = av_sha_alloc();
         break;
     case AV_HMAC_SHA224:
         c->blocklen = 64;
         c->hashlen  = 28;
         c->init     = sha224_init;
-        c->update   = (void*)av_sha_update;
-        c->final    = (void*)av_sha_final;
+        c->update   = (hmac_update) av_sha_update;
+        c->final    = (hmac_final) av_sha_final;
         c->hash     = av_sha_alloc();
         break;
     case AV_HMAC_SHA256:
         c->blocklen = 64;
         c->hashlen  = 32;
         c->init     = sha256_init;
-        c->update   = (void*)av_sha_update;
-        c->final    = (void*)av_sha_final;
+        c->update   = (hmac_update) av_sha_update;
+        c->final    = (hmac_final) av_sha_final;
         c->hash     = av_sha_alloc();
         break;
     case AV_HMAC_SHA384:
         c->blocklen = 128;
         c->hashlen  = 48;
         c->init     = sha384_init;
-        c->update   = (void*)av_sha512_update;
-        c->final    = (void*)av_sha512_final;
+        c->update   = (hmac_update) av_sha512_update;
+        c->final    = (hmac_final) av_sha512_final;
         c->hash     = av_sha512_alloc();
         break;
     case AV_HMAC_SHA512:
         c->blocklen = 128;
         c->hashlen  = 64;
         c->init     = sha512_init;
-        c->update   = (void*)av_sha512_update;
-        c->final    = (void*)av_sha512_final;
+        c->update   = (hmac_update) av_sha512_update;
+        c->final    = (hmac_final) av_sha512_final;
         c->hash     = av_sha512_alloc();
         break;
     default:


======================================================================

diff --cc libavutil/hmac.c
index 8ec6d70406,7528fd3b82..d064a105f4
--- a/libavutil/hmac.c
+++ b/libavutil/hmac.c
@@@ -24,12 -26,20 +26,21 @@@
  #include "hmac.h"
  #include "md5.h"
  #include "sha.h"
 +#include "sha512.h"
  #include "mem.h"
+ #include "version.h"
  
 -#define MAX_HASHLEN 32
 -#define MAX_BLOCKLEN 64
 +#define MAX_HASHLEN 64
 +#define MAX_BLOCKLEN 128
  
+ typedef void (*hmac_final)(void *ctx, uint8_t *dst);
+ #if FF_API_CRYPTO_SIZE_T
+ typedef void (*hmac_update)(void *ctx, const uint8_t *src, int len);
+ #else
+ typedef void (*hmac_update)(void *ctx, const uint8_t *src, size_t len);
+ #endif
+ typedef void (*hmac_init)(void *ctx);
+ 
  struct AVHMAC {
      void *hash;
      int blocklen, hashlen;
@@@ -92,26 -94,10 +103,26 @@@ AVHMAC *av_hmac_alloc(enum AVHMACType t
          c->blocklen = 64;
          c->hashlen  = 32;
          c->init     = sha256_init;
-         c->update   = (void*)av_sha_update;
-         c->final    = (void*)av_sha_final;
+         c->update   = (hmac_update) av_sha_update;
+         c->final    = (hmac_final) av_sha_final;
          c->hash     = av_sha_alloc();
          break;
 +    case AV_HMAC_SHA384:
 +        c->blocklen = 128;
 +        c->hashlen  = 48;
 +        c->init     = sha384_init;
-         c->update   = (void*)av_sha512_update;
-         c->final    = (void*)av_sha512_final;
++        c->update   = (hmac_update) av_sha512_update;
++        c->final    = (hmac_final) av_sha512_final;
 +        c->hash     = av_sha512_alloc();
 +        break;
 +    case AV_HMAC_SHA512:
 +        c->blocklen = 128;
 +        c->hashlen  = 64;
 +        c->init     = sha512_init;
-         c->update   = (void*)av_sha512_update;
-         c->final    = (void*)av_sha512_final;
++        c->update   = (hmac_update) av_sha512_update;
++        c->final    = (hmac_final) av_sha512_final;
 +        c->hash     = av_sha512_alloc();
 +        break;
      default:
          av_free(c);
          return NULL;



More information about the ffmpeg-cvslog mailing list