Commit 651ee934 authored by Clément Bœsch's avatar Clément Bœsch

Merge commit 'e435beb1'

* commit 'e435beb1':
  crypto: consistently use size_t as type for length parameters
Merged-by: 's avatarClément Bœsch <cboesch@gopro.com>
parents 20e72fae e435beb1
...@@ -15,6 +15,10 @@ libavutil: 2015-08-28 ...@@ -15,6 +15,10 @@ libavutil: 2015-08-28
API changes, most recent first: API changes, most recent first:
2017-xx-xx - xxxxxxxxxx
Change av_sha_update() and av_md5_sum()/av_md5_update() length
parameter type to size_t at next major bump.
2017-05-05 - xxxxxxxxxx - lavc 57.94.100 - avcodec.h 2017-05-05 - xxxxxxxxxx - lavc 57.94.100 - avcodec.h
The cuvid decoders now support AVCodecContext.hw_device_ctx, which removes The cuvid decoders now support AVCodecContext.hw_device_ctx, which removes
the requirement to set an incomplete AVCodecContext.hw_frames_ctx only to the requirement to set an incomplete AVCodecContext.hw_frames_ctx only to
......
...@@ -150,7 +150,11 @@ void av_md5_init(AVMD5 *ctx) ...@@ -150,7 +150,11 @@ void av_md5_init(AVMD5 *ctx)
ctx->ABCD[3] = 0x67452301; ctx->ABCD[3] = 0x67452301;
} }
#if FF_API_CRYPTO_SIZE_T
void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len) void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)
#else
void av_md5_update(AVMD5 *ctx, const uint8_t *src, size_t len)
#endif
{ {
const uint8_t *end; const uint8_t *end;
int j; int j;
...@@ -200,7 +204,11 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst) ...@@ -200,7 +204,11 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst)
AV_WL32(dst + 4 * i, ctx->ABCD[3 - i]); AV_WL32(dst + 4 * i, ctx->ABCD[3 - i]);
} }
#if FF_API_CRYPTO_SIZE_T
void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len) void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len)
#else
void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len)
#endif
{ {
AVMD5 ctx; AVMD5 ctx;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#ifndef AVUTIL_MD5_H #ifndef AVUTIL_MD5_H
#define AVUTIL_MD5_H #define AVUTIL_MD5_H
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "attributes.h" #include "attributes.h"
...@@ -63,7 +64,11 @@ void av_md5_init(struct AVMD5 *ctx); ...@@ -63,7 +64,11 @@ void av_md5_init(struct AVMD5 *ctx);
* @param src input data to update hash with * @param src input data to update hash with
* @param len input data length * @param len input data length
*/ */
#if FF_API_CRYPTO_SIZE_T
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
#else
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len);
#endif
/** /**
* Finish hashing and output digest value. * Finish hashing and output digest value.
...@@ -80,7 +85,11 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); ...@@ -80,7 +85,11 @@ void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
* @param src The data to hash * @param src The data to hash
* @param len The length of the data, in bytes * @param len The length of the data, in bytes
*/ */
#if FF_API_CRYPTO_SIZE_T
void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
#else
void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len);
#endif
/** /**
* @} * @}
......
...@@ -311,7 +311,11 @@ av_cold int av_sha_init(AVSHA *ctx, int bits) ...@@ -311,7 +311,11 @@ av_cold int av_sha_init(AVSHA *ctx, int bits)
return 0; return 0;
} }
void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len) #if FF_API_CRYPTO_SIZE_T
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len)
#else
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len)
#endif
{ {
unsigned int i, j; unsigned int i, j;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#ifndef AVUTIL_SHA_H #ifndef AVUTIL_SHA_H
#define AVUTIL_SHA_H #define AVUTIL_SHA_H
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "attributes.h" #include "attributes.h"
...@@ -69,11 +70,15 @@ int av_sha_init(struct AVSHA* context, int bits); ...@@ -69,11 +70,15 @@ int av_sha_init(struct AVSHA* context, int bits);
/** /**
* Update hash value. * Update hash value.
* *
* @param context hash function context * @param ctx hash function context
* @param data input data to update hash with * @param data input data to update hash with
* @param len input data length * @param len input data length
*/ */
void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); #if FF_API_CRYPTO_SIZE_T
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len);
#else
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len);
#endif
/** /**
* Finish hashing and output digest value. * Finish hashing and output digest value.
......
...@@ -135,6 +135,9 @@ ...@@ -135,6 +135,9 @@
#ifndef FF_API_PKT_PTS #ifndef FF_API_PKT_PTS
#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56) #define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56)
#endif #endif
#ifndef FF_API_CRYPTO_SIZE_T
#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 56)
#endif
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment