addition to aes and alteration to md files
This commit is contained in:
parent
88e32c6c5a
commit
f81ee9e4d3
@ -32,41 +32,10 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/md2.h>
|
||||
|
||||
//#include <cyassl/ctaocrypt/types.h>
|
||||
//
|
||||
//#ifdef __cplusplus
|
||||
// extern "C" {
|
||||
//#endif
|
||||
//
|
||||
//
|
||||
///* in bytes */
|
||||
//enum {
|
||||
// MD2 = 6, /* hash type unique */
|
||||
// MD2_BLOCK_SIZE = 16,
|
||||
// MD2_DIGEST_SIZE = 16,
|
||||
// MD2_PAD_SIZE = 16,
|
||||
// MD2_X_SIZE = 48
|
||||
//};
|
||||
//
|
||||
//
|
||||
///* Md2 digest */
|
||||
//typedef struct Md2 {
|
||||
// word32 count; /* bytes % PAD_SIZE */
|
||||
// byte X[MD2_X_SIZE];
|
||||
// byte C[MD2_BLOCK_SIZE];
|
||||
// byte buffer[MD2_BLOCK_SIZE];
|
||||
//} Md2;
|
||||
//
|
||||
//
|
||||
//CYASSL_API void InitMd2(Md2*);
|
||||
//CYASSL_API void Md2Update(Md2*, const byte*, word32);
|
||||
//CYASSL_API void Md2Final(Md2*, byte*);
|
||||
//CYASSL_API int Md2Hash(const byte*, word32, byte*);
|
||||
//
|
||||
//
|
||||
//#ifdef __cplusplus
|
||||
// } /* extern "C" */
|
||||
//#endif
|
||||
#define InitMd2 wc_InitMd2
|
||||
#define Md2Update wc_Md2Update
|
||||
#define Md2Final wc_Md2Final
|
||||
#define Md2Hash wc_Md2Hash
|
||||
|
||||
#endif /* CTAO_CRYPT_MD2_H */
|
||||
#endif /* CYASSL_MD2 */
|
||||
|
@ -27,39 +27,9 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/md4.h>
|
||||
|
||||
//#include <cyassl/ctaocrypt/types.h>
|
||||
//
|
||||
//#ifdef __cplusplus
|
||||
// extern "C" {
|
||||
//#endif
|
||||
//
|
||||
//
|
||||
///* in bytes */
|
||||
//enum {
|
||||
// MD4_BLOCK_SIZE = 64,
|
||||
// MD4_DIGEST_SIZE = 16,
|
||||
// MD4_PAD_SIZE = 56
|
||||
//};
|
||||
//
|
||||
//
|
||||
///* MD4 digest */
|
||||
//typedef struct Md4 {
|
||||
// word32 buffLen; /* in bytes */
|
||||
// word32 loLen; /* length in bytes */
|
||||
// word32 hiLen; /* length in bytes */
|
||||
// word32 digest[MD4_DIGEST_SIZE / sizeof(word32)];
|
||||
// word32 buffer[MD4_BLOCK_SIZE / sizeof(word32)];
|
||||
//} Md4;
|
||||
//
|
||||
//
|
||||
//CYASSL_API void InitMd4(Md4*);
|
||||
//CYASSL_API void Md4Update(Md4*, const byte*, word32);
|
||||
//CYASSL_API void Md4Final(Md4*, byte*);
|
||||
//
|
||||
//
|
||||
//#ifdef __cplusplus
|
||||
// } /* extern "C" */
|
||||
//#endif
|
||||
#define InitMd4 wc_InitMd4
|
||||
#define Md4Update wc_Md4Update
|
||||
#define Md4Final wc_Md4Final
|
||||
|
||||
#endif /* CTAO_CRYPT_MD4_H */
|
||||
|
||||
|
@ -33,12 +33,14 @@
|
||||
#define Md5Final wc_Md5Final
|
||||
#define Md5Hash wc_Md5Hash
|
||||
#else
|
||||
/* redfined name so that hmac is calling same function names with fips */
|
||||
#define wc_InitMd5 InitMd5
|
||||
#define wc_Md5Update Md5Update
|
||||
#define wc_Md5Final Md5Final
|
||||
#define wc_Md5Hash Md5Hash
|
||||
#endif
|
||||
|
||||
/* commented out until clarification on 2nd removed fips calls discussed */
|
||||
//#ifdef __cplusplus
|
||||
// extern "C" {
|
||||
//#endif
|
||||
|
28
src/keys.c
28
src/keys.c
@ -2085,13 +2085,13 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (devId != NO_CAVIUM_DEVICE) {
|
||||
if (enc) {
|
||||
if (AesInitCavium(enc->aes, devId) != 0) {
|
||||
if (wc_AesInitCavium(enc->aes, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInitCavium failed in SetKeys");
|
||||
return CAVIUM_INIT_E;
|
||||
}
|
||||
}
|
||||
if (dec) {
|
||||
if (AesInitCavium(dec->aes, devId) != 0) {
|
||||
if (wc_AesInitCavium(dec->aes, devId) != 0) {
|
||||
WOLFSSL_MSG("AesInitCavium failed in SetKeys");
|
||||
return CAVIUM_INIT_E;
|
||||
}
|
||||
@ -2100,13 +2100,13 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
#endif
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
aesRet = AesSetKey(enc->aes, keys->client_write_key,
|
||||
aesRet = wc_AesSetKey(enc->aes, keys->client_write_key,
|
||||
specs->key_size, keys->client_write_IV,
|
||||
AES_ENCRYPTION);
|
||||
if (aesRet != 0) return aesRet;
|
||||
}
|
||||
if (dec) {
|
||||
aesRet = AesSetKey(dec->aes, keys->server_write_key,
|
||||
aesRet = wc_AesSetKey(dec->aes, keys->server_write_key,
|
||||
specs->key_size, keys->server_write_IV,
|
||||
AES_DECRYPTION);
|
||||
if (aesRet != 0) return aesRet;
|
||||
@ -2114,13 +2114,13 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
}
|
||||
else {
|
||||
if (enc) {
|
||||
aesRet = AesSetKey(enc->aes, keys->server_write_key,
|
||||
aesRet = wc_AesSetKey(enc->aes, keys->server_write_key,
|
||||
specs->key_size, keys->server_write_IV,
|
||||
AES_ENCRYPTION);
|
||||
if (aesRet != 0) return aesRet;
|
||||
}
|
||||
if (dec) {
|
||||
aesRet = AesSetKey(dec->aes, keys->client_write_key,
|
||||
aesRet = wc_AesSetKey(dec->aes, keys->client_write_key,
|
||||
specs->key_size, keys->client_write_IV,
|
||||
AES_DECRYPTION);
|
||||
if (aesRet != 0) return aesRet;
|
||||
@ -2148,14 +2148,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
gcmRet = AesGcmSetKey(enc->aes, keys->client_write_key,
|
||||
gcmRet = wc_AesGcmSetKey(enc->aes, keys->client_write_key,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV,
|
||||
AEAD_IMP_IV_SZ);
|
||||
}
|
||||
if (dec) {
|
||||
gcmRet = AesGcmSetKey(dec->aes, keys->server_write_key,
|
||||
gcmRet = wc_AesGcmSetKey(dec->aes, keys->server_write_key,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_dec_imp_IV, keys->server_write_IV,
|
||||
@ -2164,14 +2164,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
}
|
||||
else {
|
||||
if (enc) {
|
||||
gcmRet = AesGcmSetKey(enc->aes, keys->server_write_key,
|
||||
gcmRet = wc_AesGcmSetKey(enc->aes, keys->server_write_key,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV,
|
||||
AEAD_IMP_IV_SZ);
|
||||
}
|
||||
if (dec) {
|
||||
gcmRet = AesGcmSetKey(dec->aes, keys->client_write_key,
|
||||
gcmRet = wc_AesGcmSetKey(dec->aes, keys->client_write_key,
|
||||
specs->key_size);
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_dec_imp_IV, keys->client_write_IV,
|
||||
@ -2198,24 +2198,24 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
if (side == WOLFSSL_CLIENT_END) {
|
||||
if (enc) {
|
||||
AesCcmSetKey(enc->aes, keys->client_write_key, specs->key_size);
|
||||
wc_AesCcmSetKey(enc->aes, keys->client_write_key, specs->key_size);
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV,
|
||||
AEAD_IMP_IV_SZ);
|
||||
}
|
||||
if (dec) {
|
||||
AesCcmSetKey(dec->aes, keys->server_write_key, specs->key_size);
|
||||
wc_AesCcmSetKey(dec->aes, keys->server_write_key, specs->key_size);
|
||||
XMEMCPY(keys->aead_dec_imp_IV, keys->server_write_IV,
|
||||
AEAD_IMP_IV_SZ);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (enc) {
|
||||
AesCcmSetKey(enc->aes, keys->server_write_key, specs->key_size);
|
||||
wc_AesCcmSetKey(enc->aes, keys->server_write_key, specs->key_size);
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV,
|
||||
AEAD_IMP_IV_SZ);
|
||||
}
|
||||
if (dec) {
|
||||
AesCcmSetKey(dec->aes, keys->client_write_key, specs->key_size);
|
||||
wc_AesCcmSetKey(dec->aes, keys->client_write_key, specs->key_size);
|
||||
XMEMCPY(keys->aead_dec_imp_IV, keys->client_write_IV,
|
||||
AEAD_IMP_IV_SZ);
|
||||
}
|
||||
|
3748
wolfcrypt/src/aes.c
3748
wolfcrypt/src/aes.c
File diff suppressed because it is too large
Load Diff
@ -2960,7 +2960,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
switch (sigOID) {
|
||||
#ifndef NO_MD5
|
||||
case CTC_MD5wRSA:
|
||||
if (Md5Hash(buf, bufSz, digest) == 0) {
|
||||
if (wc_Md5Hash(buf, bufSz, digest) == 0) {
|
||||
typeH = MD5h;
|
||||
digestSz = MD5_DIGEST_SIZE;
|
||||
}
|
||||
@ -2968,7 +2968,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
#endif
|
||||
#if defined(WOLFSSL_MD2)
|
||||
case CTC_MD2wRSA:
|
||||
if (Md2Hash(buf, bufSz, digest) == 0) {
|
||||
if (wc_Md2Hash(buf, bufSz, digest) == 0) {
|
||||
typeH = MD2h;
|
||||
digestSz = MD2_DIGEST_SIZE;
|
||||
}
|
||||
@ -2978,7 +2978,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
case CTC_SHAwRSA:
|
||||
case CTC_SHAwDSA:
|
||||
case CTC_SHAwECDSA:
|
||||
if (ShaHash(buf, bufSz, digest) == 0) {
|
||||
if (wc_ShaHash(buf, bufSz, digest) == 0) {
|
||||
typeH = SHAh;
|
||||
digestSz = SHA_DIGEST_SIZE;
|
||||
}
|
||||
@ -2996,7 +2996,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
#ifdef WOLFSSL_SHA512
|
||||
case CTC_SHA512wRSA:
|
||||
case CTC_SHA512wECDSA:
|
||||
if (Sha512Hash(buf, bufSz, digest) == 0) {
|
||||
if (wc_Sha512Hash(buf, bufSz, digest) == 0) {
|
||||
typeH = SHA512h;
|
||||
digestSz = SHA512_DIGEST_SIZE;
|
||||
}
|
||||
@ -3005,7 +3005,7 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
|
||||
#ifdef WOLFSSL_SHA384
|
||||
case CTC_SHA384wRSA:
|
||||
case CTC_SHA384wECDSA:
|
||||
if (Sha384Hash(buf, bufSz, digest) == 0) {
|
||||
if (wc_Sha384Hash(buf, bufSz, digest) == 0) {
|
||||
typeH = SHA384h;
|
||||
digestSz = SHA384_DIGEST_SIZE;
|
||||
}
|
||||
|
@ -31,17 +31,6 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
|
||||
|
||||
/* for md2 reverse compatibility */
|
||||
#ifdef WOLFSSL_MD2
|
||||
#define InitMd2 wc_InitMd2
|
||||
#define Md2Update wc_Md2Update
|
||||
#define Md2Final wc_Md2Final
|
||||
#define Md2Hash wc_Md2Hash
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user