diff --git a/tests/api.c b/tests/api.c index 8b6a5b671..b8c7411da 100644 --- a/tests/api.c +++ b/tests/api.c @@ -11866,7 +11866,7 @@ static int test_wc_Rc2SetKey(void) { int ret = 0; #ifdef WC_RC2 - RC2 rc2; + Rc2 rc2; byte key40[] = { 0x01, 0x02, 0x03, 0x04, 0x05 }; byte iv[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; @@ -11883,7 +11883,7 @@ static int test_wc_Rc2SetKey(void) /* bad arguments */ if (ret == 0) { - /* null RC2 struct */ + /* null Rc2 struct */ ret = wc_Rc2SetKey(NULL, key40, (word32) sizeof(key40) / sizeof(byte), iv, 40); if (ret == BAD_FUNC_ARG) { @@ -11947,7 +11947,7 @@ static int test_wc_Rc2SetIV(void) { int ret = 0; #ifdef WC_RC2 - RC2 rc2; + Rc2 rc2; byte iv[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; printf(testingFmt, "wc_Rc2SetIV()"); @@ -11980,7 +11980,7 @@ static int test_wc_Rc2EcbEncryptDecrypt(void) { int ret = 0; #ifdef WC_RC2 - RC2 rc2; + Rc2 rc2; int effectiveKeyBits = 63; byte cipher[RC2_BLOCK_SIZE]; @@ -12013,7 +12013,7 @@ static int test_wc_Rc2EcbEncryptDecrypt(void) /* Rc2EcbEncrypt bad arguments */ if (ret == 0) { - /* null RC2 struct */ + /* null Rc2 struct */ ret = wc_Rc2EcbEncrypt(NULL, cipher, input, RC2_BLOCK_SIZE); if (ret == BAD_FUNC_ARG) { ret = 0; @@ -12046,7 +12046,7 @@ static int test_wc_Rc2EcbEncryptDecrypt(void) /* Rc2EcbDecrypt bad arguments */ if (ret == 0) { - /* null RC2 struct */ + /* null Rc2 struct */ ret = wc_Rc2EcbDecrypt(NULL, plain, output, RC2_BLOCK_SIZE); if (ret == BAD_FUNC_ARG) { ret = 0; @@ -12090,7 +12090,7 @@ static int test_wc_Rc2CbcEncryptDecrypt(void) { int ret = 0; #ifdef WC_RC2 - RC2 rc2; + Rc2 rc2; int effectiveKeyBits = 63; byte cipher[RC2_BLOCK_SIZE*2]; @@ -12138,7 +12138,7 @@ static int test_wc_Rc2CbcEncryptDecrypt(void) /* Rc2CbcEncrypt bad arguments */ if (ret == 0) { - /* null RC2 struct */ + /* null Rc2 struct */ ret = wc_Rc2CbcEncrypt(NULL, cipher, input, sizeof(input)); if (ret == BAD_FUNC_ARG) { ret = 0; @@ -12171,7 +12171,7 @@ static int test_wc_Rc2CbcEncryptDecrypt(void) } if (ret == 0) { - /* null RC2 struct */ + /* null Rc2 struct */ ret = wc_Rc2CbcDecrypt(NULL, plain, output, sizeof(output)); if (ret == BAD_FUNC_ARG) { ret = 0; diff --git a/wolfcrypt/src/rc2.c b/wolfcrypt/src/rc2.c index f52ff9caf..70e286937 100644 --- a/wolfcrypt/src/rc2.c +++ b/wolfcrypt/src/rc2.c @@ -85,7 +85,7 @@ static const byte pitable[256] = { iv IV, of size RC2_BLOCK_SIZE octets return 0 on success, negative on error */ -int wc_Rc2SetIV(RC2* rc2, const byte* iv) +int wc_Rc2SetIV(Rc2* rc2, const byte* iv) { if (rc2 == NULL) return BAD_FUNC_ARG; @@ -106,7 +106,7 @@ int wc_Rc2SetIV(RC2* rc2, const byte* iv) bits Effective RC2 key length in bits (max 1024 bits) return 0 on success, negative on error */ -int wc_Rc2SetKey(RC2* rc2, const byte* key, word32 length, +int wc_Rc2SetKey(Rc2* rc2, const byte* key, word32 length, const byte* iv, word32 bits) { int i; @@ -160,7 +160,7 @@ int wc_Rc2SetKey(RC2* rc2, const byte* key, word32 length, sz Size of the output buffer, out return 0 on success, negative on error */ -int wc_Rc2EcbEncrypt(RC2* rc2, byte* out, const byte* in, word32 sz) +int wc_Rc2EcbEncrypt(Rc2* rc2, byte* out, const byte* in, word32 sz) { int i, j = 0; word16 r10, r32, r54, r76; @@ -225,7 +225,7 @@ int wc_Rc2EcbEncrypt(RC2* rc2, byte* out, const byte* in, word32 sz) sz Size of the output buffer, out return 0 on success, negative on error */ -int wc_Rc2EcbDecrypt(RC2* rc2, byte* out, const byte* in, word32 sz) +int wc_Rc2EcbDecrypt(Rc2* rc2, byte* out, const byte* in, word32 sz) { int i, j = 63; word16 r0, r1, r2, r3; @@ -280,7 +280,7 @@ int wc_Rc2EcbDecrypt(RC2* rc2, byte* out, const byte* in, word32 sz) return 0; } -int wc_Rc2CbcEncrypt(RC2* rc2, byte* out, const byte* in, word32 sz) +int wc_Rc2CbcEncrypt(Rc2* rc2, byte* out, const byte* in, word32 sz) { word32 blocks = (sz / RC2_BLOCK_SIZE); @@ -304,7 +304,7 @@ int wc_Rc2CbcEncrypt(RC2* rc2, byte* out, const byte* in, word32 sz) return 0; } -int wc_Rc2CbcDecrypt(RC2* rc2, byte* out, const byte* in, word32 sz) +int wc_Rc2CbcDecrypt(Rc2* rc2, byte* out, const byte* in, word32 sz) { word32 blocks = (sz / RC2_BLOCK_SIZE); diff --git a/wolfcrypt/src/wc_encrypt.c b/wolfcrypt/src/wc_encrypt.c index b24328bd2..634695459 100644 --- a/wolfcrypt/src/wc_encrypt.c +++ b/wolfcrypt/src/wc_encrypt.c @@ -650,7 +650,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt, #ifdef WC_RC2 case PBE_SHA1_40RC2_CBC: { - RC2 rc2; + Rc2 rc2; /* effective key size for RC2-40-CBC is 40 bits */ ret = wc_Rc2SetKey(&rc2, key, derivedLen, cbcIv, 40); if (ret == 0) { @@ -665,7 +665,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt, #endif return ret; } - ForceZero(&rc2, sizeof(RC2)); + ForceZero(&rc2, sizeof(Rc2)); break; } #endif diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 027d33a35..d8c334f99 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -4371,7 +4371,7 @@ static int rc2_ecb_test(void) test_rc2[7] = h; for (i = 0; i < times; ++i) { - RC2 enc; + Rc2 enc; XMEMSET(cipher, 0, RC2_BLOCK_SIZE); XMEMSET(plain, 0, RC2_BLOCK_SIZE); @@ -4549,7 +4549,7 @@ static int rc2_cbc_test(void) test_rc2[8] = i; for (j = 0; j < times; ++j) { - RC2 rc2; + Rc2 rc2; XMEMSET(cipher, 0, sizeof(cipher)); XMEMSET(plain, 0, sizeof(plain)); diff --git a/wolfssl/wolfcrypt/rc2.h b/wolfssl/wolfcrypt/rc2.h index d33e0ed0d..7b2330f6b 100644 --- a/wolfssl/wolfcrypt/rc2.h +++ b/wolfssl/wolfcrypt/rc2.h @@ -36,28 +36,28 @@ enum { }; /* RC2 encryption and decryption */ -typedef struct RC2 { +typedef struct Rc2 { word32 keylen; /* key length, octets */ word32 bits; /* effective key length, bits */ ALIGN16 word16 key[RC2_MAX_KEY_SIZE/2]; ALIGN16 word32 reg[RC2_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ ALIGN16 word32 tmp[RC2_BLOCK_SIZE / sizeof(word32)]; /* same */ -} RC2; +} Rc2; -WOLFSSL_API int wc_Rc2SetKey(RC2* rc2, const byte* key, word32 length, +WOLFSSL_API int wc_Rc2SetKey(Rc2* rc2, const byte* key, word32 length, const byte* iv, word32 bits); -WOLFSSL_API int wc_Rc2SetIV(RC2* rc2, const byte* iv); +WOLFSSL_API int wc_Rc2SetIV(Rc2* rc2, const byte* iv); /* RC2-ECB */ -WOLFSSL_API int wc_Rc2EcbEncrypt(RC2* rc2, byte* out, +WOLFSSL_API int wc_Rc2EcbEncrypt(Rc2* rc2, byte* out, const byte* in, word32 sz); -WOLFSSL_API int wc_Rc2EcbDecrypt(RC2* rc2, byte* out, +WOLFSSL_API int wc_Rc2EcbDecrypt(Rc2* rc2, byte* out, const byte* in, word32 sz); /* RC2-CBC */ -WOLFSSL_API int wc_Rc2CbcEncrypt(RC2* rc2, byte* out, +WOLFSSL_API int wc_Rc2CbcEncrypt(Rc2* rc2, byte* out, const byte* in, word32 sz); -WOLFSSL_API int wc_Rc2CbcDecrypt(RC2* rc2, byte* out, +WOLFSSL_API int wc_Rc2CbcDecrypt(Rc2* rc2, byte* out, const byte* in, word32 sz); #ifdef __cplusplus