Commit 75afcaa1 authored by Davide Galassi's avatar Davide Galassi

unsigned int to size_t rename finalization

parent 9d95b615
Pipeline #55042131 passed with stages
in 1 minute and 37 seconds
......@@ -128,7 +128,7 @@ void cry_gcm_iv_set(struct cry_gcm_ctx *ctx, const unsigned char *iv,
}
static void gcm_operate(struct cry_gcm_ctx *ctx, unsigned char *dst,
const unsigned char *src, unsigned int size)
const unsigned char *src, size_t size)
{
void *ciph = ctx->ciph_ctx;
cry_ciph_encrypt_f encrypt = ctx->ciph_itf->encrypt;
......
......@@ -50,10 +50,11 @@
* dst : [----------]
*/
void cry_memxor2(unsigned char *dst, const unsigned char *src1,
const unsigned char *src2, unsigned int n)
const unsigned char *src2, size_t size)
{
size_t i, j;
unsigned char *tmp, t;
size_t n = size;
if (src2 < src1) {
tmp = (unsigned char *)src1;
......@@ -100,8 +101,10 @@ void cry_memxor2(unsigned char *dst, const unsigned char *src1,
}
void cry_memxor(unsigned char *dst, const unsigned char *src,
unsigned int n)
size_t size)
{
size_t n = size;
if (dst <= src) {
while (n--)
*dst++ ^= *src++;
......
#ifndef CRY_MEMXOR_H_
#define CRY_MEMXOR_H_
#include <stddef.h>
#ifdef __cplusplus
extern "C"{
#endif
......@@ -16,7 +18,7 @@ extern "C"{
* @param size Number of bytes to XOR.
*/
void cry_memxor(unsigned char *dst, const unsigned char *src,
unsigned int size);
size_t size);
/**
* XOR two memory regions.
......@@ -29,7 +31,7 @@ void cry_memxor(unsigned char *dst, const unsigned char *src,
* @param size Number of bytes to XOR.
*/
void cry_memxor2(unsigned char *dst, const unsigned char *src1,
const unsigned char *src2, unsigned int size);
const unsigned char *src2, size_t size);
#ifdef __cplusplus
}
......
......@@ -122,7 +122,7 @@ void cry_trivium_iv_set(cry_trivium_ctx *ctx, const unsigned char *iv,
static void operate(cry_trivium_ctx *ctx, unsigned char *dst,
const unsigned char *src, unsigned int size)
const unsigned char *src, size_t size)
{
size_t i;
......
......@@ -13,12 +13,12 @@ static const cry_ciph_itf aes_itf = {
};
struct aes_param {
unsigned int keylen;
unsigned int ivlen;
unsigned int aadlen;
unsigned int srclen;
unsigned int dstlen;
unsigned int maclen;
size_t keylen;
size_t ivlen;
size_t aadlen;
size_t srclen;
size_t dstlen;
size_t maclen;
unsigned char key[32];
unsigned char iv[16];
unsigned char mac[16];
......
......@@ -4,9 +4,9 @@
struct cmac_param {
unsigned int keylen;
unsigned int msglen;
unsigned int maclen;
size_t keylen;
size_t msglen;
size_t maclen;
unsigned char key[256];
unsigned char msg[256];
unsigned char mac[64];
......
......@@ -11,12 +11,12 @@ static const cry_ciph_itf des_itf = {
};
struct des_param {
unsigned int keylen;
unsigned int ivlen;
unsigned int aadlen;
unsigned int srclen;
unsigned int dstlen;
unsigned int maclen;
size_t keylen;
size_t ivlen;
size_t aadlen;
size_t srclen;
size_t dstlen;
size_t maclen;
unsigned char key[32];
unsigned char iv[16];
unsigned char mac[16];
......
......@@ -12,12 +12,12 @@ static const struct cry_ciph_itf aes_itf = {
void cry_aes_128_gcm_encrypt(unsigned char *dst,
const unsigned char *src,
const unsigned int src_size,
size_t src_size,
const unsigned char *key,
const unsigned char *iv,
unsigned char *mac,
const unsigned char *aad,
unsigned int aad_size)
size_t aad_size)
{
struct cry_aes_ctx aes;
struct cry_gcm_ctx gcm;
......@@ -35,12 +35,12 @@ void cry_aes_128_gcm_encrypt(unsigned char *dst,
void cry_aes_128_gcm_decrypt(unsigned char *dst,
const unsigned char *src,
const unsigned int src_size,
size_t src_size,
const unsigned char *key,
const unsigned char *iv,
unsigned char *mac,
const unsigned char *aad,
unsigned int aad_size)
size_t aad_size)
{
struct cry_aes_ctx aes;
struct cry_gcm_ctx gcm;
......
......@@ -3,9 +3,9 @@
#include <cry/sha256.h>
struct hmac_param {
unsigned int keylen;
unsigned int msglen;
unsigned int maclen;
size_t keylen;
size_t msglen;
size_t maclen;
unsigned char key[256];
unsigned char msg[256];
unsigned char mac[64];
......
......@@ -14,7 +14,7 @@ static const char md5_hash[] = {
void md5_test(void)
{
struct cry_md5_ctx md5;
unsigned int len, i;
size_t len, i;
cry_md5_init(&md5);
for (i = 0; i < ARLEN(input); i++) {
......
......@@ -124,10 +124,10 @@ static void sign_verify(void)
}
struct rsa_param {
unsigned int mlen;
unsigned int elen;
unsigned int clrlen;
unsigned int ciplen;
size_t mlen;
size_t elen;
size_t clrlen;
size_t ciplen;
unsigned char *mraw;
unsigned char *eraw;
unsigned char *clrraw;
......
......@@ -16,7 +16,7 @@ static const char sha256_hash[] = {
void sha256_test(void)
{
struct cry_sha256_ctx sha256;
unsigned int len, i;
size_t len, i;
cry_sha256_init(&sha256);
for (i = 0; i < ARLEN(input); i++) {
......
......@@ -182,7 +182,7 @@ void asc_to_raw(const char *asc, size_t size, unsigned char *raw)
#define EMPTY_STRING "NULL"
int raw_init(unsigned char *raw, unsigned int rawlen, const char *asc)
int raw_init(unsigned char *raw, size_t rawlen, const char *asc)
{
int len;
......
......@@ -23,7 +23,7 @@ void func_test(const char *datafile, dispatch_func_t dispatch);
void asc_to_raw(const char *asc, size_t size, unsigned char *raw);
int raw_init(unsigned char *raw, unsigned int rawlen, const char *asc);
int raw_init(unsigned char *raw, size_t rawlen, const char *asc);
#define ARLEN(ar) (sizeof(ar)/sizeof(ar[0]))
......
......@@ -3,9 +3,9 @@
struct trivium_param {
unsigned int keylen;
unsigned int ivlen;
unsigned int buflen;
size_t keylen;
size_t ivlen;
size_t buflen;
unsigned char key[10];
unsigned char iv[10];
unsigned char buf[512];
......
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