[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/20] chacha: Use standard types
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: [PATCH 19/20] chacha: Use standard types
- From: Alberto Aguirre <albaguirre@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 28 Feb 2018 10:25:06 -0600
- To: libssh@xxxxxxxxxx
u_char, u_int typedefs are not available with Visual Studio compiler. Use standard types instead. Signed-off-by: Alberto Aguirre <albaguirre@xxxxxxxxx> --- include/libssh/chacha.h | 10 +++++----- include/libssh/poly1305.h | 4 ++-- src/external/chacha.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/libssh/chacha.h b/include/libssh/chacha.h index b63531e4..cd41fa8c 100644 --- a/include/libssh/chacha.h +++ b/include/libssh/chacha.h @@ -13,7 +13,7 @@ Public domain. #include <sys/types.h> struct chacha_ctx { - u_int input[16]; + unsigned int input[16]; }; #define CHACHA_MINKEYLEN 16 @@ -22,19 +22,19 @@ struct chacha_ctx { #define CHACHA_STATELEN (CHACHA_NONCELEN+CHACHA_CTRLEN) #define CHACHA_BLOCKLEN 64 -void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits) +void chacha_keysetup(struct chacha_ctx *x, const unsigned char *k, unsigned int kbits) #ifdef HAVE_GCC_BOUNDED_ATTRIBUTE __attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN))) #endif ; -void chacha_ivsetup(struct chacha_ctx *x, const u_char *iv, const u_char *ctr) +void chacha_ivsetup(struct chacha_ctx *x, const unsigned char *iv, const unsigned char *ctr) #ifdef HAVE_GCC_BOUNDED_ATTRIBUTE __attribute__((__bounded__(__minbytes__, 2, CHACHA_NONCELEN))) __attribute__((__bounded__(__minbytes__, 3, CHACHA_CTRLEN))) #endif ; -void chacha_encrypt_bytes(struct chacha_ctx *x, const u_char *m, - u_char *c, u_int bytes) +void chacha_encrypt_bytes(struct chacha_ctx *x, const unsigned char *m, + unsigned char *c, unsigned int bytes) #ifdef HAVE_GCC_BOUNDED_ATTRIBUTE __attribute__((__bounded__(__buffer__, 2, 4))) __attribute__((__bounded__(__buffer__, 3, 4))) diff --git a/include/libssh/poly1305.h b/include/libssh/poly1305.h index b2961486..81ad0f82 100644 --- a/include/libssh/poly1305.h +++ b/include/libssh/poly1305.h @@ -11,8 +11,8 @@ #define POLY1305_KEYLEN 32 #define POLY1305_TAGLEN 16 -void poly1305_auth(u_char out[POLY1305_TAGLEN], const u_char *m, size_t inlen, - const u_char key[POLY1305_KEYLEN]) +void poly1305_auth(unsigned char out[POLY1305_TAGLEN], const unsigned char *m, size_t inlen, + const unsigned char key[POLY1305_KEYLEN]) #ifdef HAVE_GCC_BOUNDED_ATTRIBUTE __attribute__((__bounded__(__minbytes__, 1, POLY1305_TAGLEN))) __attribute__((__bounded__(__buffer__, 2, 3))) diff --git a/src/external/chacha.c b/src/external/chacha.c index dfabfb17..d06a67fb 100644 --- a/src/external/chacha.c +++ b/src/external/chacha.c @@ -5,7 +5,7 @@ Public domain. */ #include "libssh/chacha.h" -#include <unistd.h> +#include <stdlib.h> typedef unsigned char u8; typedef unsigned int u32; @@ -90,7 +90,7 @@ chacha_encrypt_bytes(chacha_ctx *x,const u8 *m,u8 *c,u32 bytes) u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; u8 *ctarget = NULL; u8 tmp[64]; - u_int i; + unsigned int i; if (!bytes) return; -- 2.14.1
[PATCH 00/20] Add chacha20-poly1305 support | Alberto Aguirre <albaguirre@xxxxxxxxx> |