1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

avutil: Switch crypto APIs to size_t

Announced in e435beb1ea.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Andreas Rheinhardt
2021-03-06 21:56:20 +01:00
committed by James Almer
parent 6e30b35b85
commit a240097ecd
17 changed files with 40 additions and 103 deletions

View File

@@ -511,13 +511,10 @@ av_cold int av_ripemd_init(AVRIPEMD *ctx, int bits)
return 0;
}
#if FF_API_CRYPTO_SIZE_T
void av_ripemd_update(AVRIPEMD* ctx, const uint8_t* data, unsigned int len)
#else
void av_ripemd_update(AVRIPEMD* ctx, const uint8_t* data, size_t len)
#endif
{
unsigned int i, j;
unsigned int j;
size_t i;
j = ctx->count & 63;
ctx->count += len;
@@ -530,15 +527,19 @@ void av_ripemd_update(AVRIPEMD* ctx, const uint8_t* data, size_t len)
}
}
#else
if ((j + len) > 63) {
if (len >= 64 - j) {
const uint8_t *end;
memcpy(&ctx->buffer[j], data, (i = 64 - j));
ctx->transform(ctx->state, ctx->buffer);
for (; i + 63 < len; i += 64)
ctx->transform(ctx->state, &data[i]);
data += i;
len -= i;
end = data + (len & ~63);
len = len % 64;
for (; data < end; data += 64)
ctx->transform(ctx->state, data);
j = 0;
} else
i = 0;
memcpy(&ctx->buffer[j], &data[i], len - i);
}
memcpy(&ctx->buffer[j], data, len);
#endif
}