From 87c6c7c0c2d5a3979c81da88aaa76b898b86cd85 Mon Sep 17 00:00:00 2001 From: zhenrong-wang Date: Tue, 16 Apr 2024 11:14:00 +0800 Subject: [PATCH] Added portability warnings and removed typedef 16bit --- hpcopr/now_md5.h | 9 ++++++++- hpcopr/now_sha256.h | 9 ++++++++- now-crypto/now-crypto-v3-aes.c | 10 ++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/hpcopr/now_md5.h b/hpcopr/now_md5.h index 52cc3e53..2220bc46 100644 --- a/hpcopr/now_md5.h +++ b/hpcopr/now_md5.h @@ -10,8 +10,15 @@ #define FILEIO_BUFFER_SIZE 67108864 /* 64MB maximum memory buffer*/ +/** + * Portability risk: The unsigned int does not always has 32 bits. It is *NOT* + * defined by standards. We assert that on all the target platforms of this + * project, that is, x86_64 with Windows/Linux/macOS, the unsigned int is 32 bit. + * This is an assertion! If you encounter any portability problems, please + * submit issues to this repository. + * + */ typedef unsigned char uint_8bit; -typedef unsigned short uint_16bit; typedef unsigned int uint_32bit; typedef unsigned long long int uint_64bit; typedef signed long long int int_64bit; diff --git a/hpcopr/now_sha256.h b/hpcopr/now_sha256.h index bccd204f..09d7477d 100644 --- a/hpcopr/now_sha256.h +++ b/hpcopr/now_sha256.h @@ -10,8 +10,15 @@ #define FILEIO_BUFFER_SIZE_SHA 67108864 /* 64MB maximum memory buffer*/ +/** + * Portability risk: The unsigned int does not always has 32 bits. It is *NOT* + * defined by standards. We assert that on all the target platforms of this + * project, that is, x86_64 with Windows/Linux/macOS, the unsigned int is 32 bit. + * This is an assertion! If you encounter any portability problems, please + * submit issues to this repository. + * + */ typedef unsigned char uint_8bit; -typedef unsigned short uint_16bit; typedef unsigned int uint_32bit; typedef unsigned long long int uint_64bit; typedef signed long long int int_64bit; diff --git a/now-crypto/now-crypto-v3-aes.c b/now-crypto/now-crypto-v3-aes.c index 6278279a..1429ef7f 100644 --- a/now-crypto/now-crypto-v3-aes.c +++ b/now-crypto/now-crypto-v3-aes.c @@ -25,10 +25,16 @@ #define CRYPTO_VERSION "0.3.0" +/** + * Portability risk: The unsigned int does not always has 32 bits. It is *NOT* + * defined by standards. We assert that on all the target platforms of this + * project, that is, x86_64 with Windows/Linux/macOS, the unsigned int is 32 bit. + * This is an assertion! If you encounter any portability problems, please + * submit issues to this repository. + * + */ typedef unsigned char uint_8bit; -typedef unsigned short uint_16bit; typedef unsigned int uint_32bit; -typedef unsigned long int uint_64bit; /* Each expanded key is in format of 0xAABBCCDD, so 4X8bit=32bit */ typedef struct{