Merge pull request #3658 from SparkiDev/curve25519_uint64_t

Curve25519: replace uint64_t with word64
This commit is contained in:
toddouska
2021-01-18 13:29:16 -08:00
committed by GitHub
25 changed files with 3246 additions and 3243 deletions

View File

@@ -7587,8 +7587,8 @@ ProtocolVersion MakeDTLSv1_2(void)
word32 LowResTimer(void)
{
const uint32_t systemTickTimeInHz = 1000000 / systemTickInMicroseconds();
uint32_t *systemTickPtr = systemTickPointer();
const word32 systemTickTimeInHz = 1000000 / systemTickInMicroseconds();
word32 *systemTickPtr = systemTickPointer();
return (word32) *systemTickPtr/systemTickTimeInHz;
}

View File

@@ -33886,14 +33886,14 @@ void *wolfSSL_OPENSSL_malloc(size_t a)
return (void *)XMALLOC(a, NULL, DYNAMIC_TYPE_OPENSSL);
}
int wolfSSL_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
int wolfSSL_OPENSSL_init_ssl(word64 opts, const OPENSSL_INIT_SETTINGS *settings)
{
(void)opts;
(void)settings;
return wolfSSL_library_init();
}
int wolfSSL_OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS* settings)
int wolfSSL_OPENSSL_init_crypto(word64 opts, const OPENSSL_INIT_SETTINGS* settings)
{
(void)opts;
(void)settings;

View File

@@ -1221,8 +1221,8 @@ end:
#elif defined(WOLFSSL_DEOS)
word32 TimeNowInMilliseconds(void)
{
const uint32_t systemTickTimeInHz = 1000000 / systemTickInMicroseconds();
uint32_t *systemTickPtr = systemTickPointer();
const word32 systemTickTimeInHz = 1000000 / systemTickInMicroseconds();
word32 *systemTickPtr = systemTickPointer();
return (word32) (*systemTickPtr/systemTickTimeInHz) * 1000;
}

View File

@@ -2142,7 +2142,7 @@ int Mynewt_Receive(WOLFSSL *ssl, char *buf, int sz, void *ctx)
struct mn_sockaddr_in from;
struct os_mbuf *m;
int read_sz = 0;
uint16_t total;
word16 total;
if (mynewt_ctx == NULL || mynewt_ctx->mnSocket == NULL) {
WOLFSSL_MSG("Mynewt Recv NULL parameters");
@@ -2385,7 +2385,7 @@ int GNRC_ReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *_ctx)
{
sock_udp_ep_t ep;
int ret;
uint32_t timeout = wolfSSL_dtls_get_current_timeout(ssl) * 1000000;
word32 timeout = wolfSSL_dtls_get_current_timeout(ssl) * 1000000;
sock_tls_t *ctx = (sock_tls_t *)_ctx;
if (!ctx)
return WOLFSSL_CBIO_ERR_GENERAL;

View File

@@ -340,13 +340,13 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
HAL_CRYP_Init(&hcryp);
#if defined(STM32_HAL_V2)
ret = HAL_CRYP_Encrypt(&hcryp, (uint32_t*)inBlock, AES_BLOCK_SIZE,
(uint32_t*)outBlock, STM32_HAL_TIMEOUT);
ret = HAL_CRYP_Encrypt(&hcryp, (word32*)inBlock, AES_BLOCK_SIZE,
(word32*)outBlock, STM32_HAL_TIMEOUT);
#elif defined(STM32_CRYPTO_AES_ONLY)
ret = HAL_CRYPEx_AES(&hcryp, (uint8_t*)inBlock, AES_BLOCK_SIZE,
ret = HAL_CRYPEx_AES(&hcryp, (byte*)inBlock, AES_BLOCK_SIZE,
outBlock, STM32_HAL_TIMEOUT);
#else
ret = HAL_CRYP_AESECB_Encrypt(&hcryp, (uint8_t*)inBlock, AES_BLOCK_SIZE,
ret = HAL_CRYP_AESECB_Encrypt(&hcryp, (byte*)inBlock, AES_BLOCK_SIZE,
outBlock, STM32_HAL_TIMEOUT);
#endif
if (ret != HAL_OK) {
@@ -380,18 +380,18 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
/* flush IN/OUT FIFOs */
CRYP_FIFOFlush();
CRYP_DataIn(*(uint32_t*)&inBlock[0]);
CRYP_DataIn(*(uint32_t*)&inBlock[4]);
CRYP_DataIn(*(uint32_t*)&inBlock[8]);
CRYP_DataIn(*(uint32_t*)&inBlock[12]);
CRYP_DataIn(*(word32*)&inBlock[0]);
CRYP_DataIn(*(word32*)&inBlock[4]);
CRYP_DataIn(*(word32*)&inBlock[8]);
CRYP_DataIn(*(word32*)&inBlock[12]);
/* wait until the complete message has been processed */
while (CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&outBlock[0] = CRYP_DataOut();
*(uint32_t*)&outBlock[4] = CRYP_DataOut();
*(uint32_t*)&outBlock[8] = CRYP_DataOut();
*(uint32_t*)&outBlock[12] = CRYP_DataOut();
*(word32*)&outBlock[0] = CRYP_DataOut();
*(word32*)&outBlock[4] = CRYP_DataOut();
*(word32*)&outBlock[8] = CRYP_DataOut();
*(word32*)&outBlock[12] = CRYP_DataOut();
/* disable crypto processor */
CRYP_Cmd(DISABLE);
@@ -433,13 +433,13 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
HAL_CRYP_Init(&hcryp);
#if defined(STM32_HAL_V2)
ret = HAL_CRYP_Decrypt(&hcryp, (uint32_t*)inBlock, AES_BLOCK_SIZE,
(uint32_t*)outBlock, STM32_HAL_TIMEOUT);
ret = HAL_CRYP_Decrypt(&hcryp, (word32*)inBlock, AES_BLOCK_SIZE,
(word32*)outBlock, STM32_HAL_TIMEOUT);
#elif defined(STM32_CRYPTO_AES_ONLY)
ret = HAL_CRYPEx_AES(&hcryp, (uint8_t*)inBlock, AES_BLOCK_SIZE,
ret = HAL_CRYPEx_AES(&hcryp, (byte*)inBlock, AES_BLOCK_SIZE,
outBlock, STM32_HAL_TIMEOUT);
#else
ret = HAL_CRYP_AESECB_Decrypt(&hcryp, (uint8_t*)inBlock, AES_BLOCK_SIZE,
ret = HAL_CRYP_AESECB_Decrypt(&hcryp, (byte*)inBlock, AES_BLOCK_SIZE,
outBlock, STM32_HAL_TIMEOUT);
#endif
if (ret != HAL_OK) {
@@ -482,18 +482,18 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
/* flush IN/OUT FIFOs */
CRYP_FIFOFlush();
CRYP_DataIn(*(uint32_t*)&inBlock[0]);
CRYP_DataIn(*(uint32_t*)&inBlock[4]);
CRYP_DataIn(*(uint32_t*)&inBlock[8]);
CRYP_DataIn(*(uint32_t*)&inBlock[12]);
CRYP_DataIn(*(word32*)&inBlock[0]);
CRYP_DataIn(*(word32*)&inBlock[4]);
CRYP_DataIn(*(word32*)&inBlock[8]);
CRYP_DataIn(*(word32*)&inBlock[12]);
/* wait until the complete message has been processed */
while (CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&outBlock[0] = CRYP_DataOut();
*(uint32_t*)&outBlock[4] = CRYP_DataOut();
*(uint32_t*)&outBlock[8] = CRYP_DataOut();
*(uint32_t*)&outBlock[12] = CRYP_DataOut();
*(word32*)&outBlock[0] = CRYP_DataOut();
*(word32*)&outBlock[4] = CRYP_DataOut();
*(word32*)&outBlock[8] = CRYP_DataOut();
*(word32*)&outBlock[12] = CRYP_DataOut();
/* disable crypto processor */
CRYP_Cmd(DISABLE);
@@ -522,7 +522,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
/* if LTC doesn't have GCM, use software with LTC AES ECB mode */
static int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
{
uint32_t keySize = 0;
word32 keySize = 0;
byte* key = (byte*)aes->key;
wc_AesGetKeySize(aes, &keySize);
@@ -536,7 +536,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
#ifdef HAVE_AES_DECRYPT
static int wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
{
uint32_t keySize = 0;
word32 keySize = 0;
byte* key = (byte*)aes->key;
wc_AesGetKeySize(aes, &keySize);
@@ -852,7 +852,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
static int AES_ECB_encrypt(Aes* aes, const byte* inBlock, byte* outBlock,
int sz)
{
uint32_t ret;
word32 ret;
if (WOLFSSL_SCE_GSCE_HANDLE.p_cfg->endian_flag ==
CRYPTO_WORD_ENDIAN_BIG) {
@@ -910,7 +910,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
static int AES_ECB_decrypt(Aes* aes, const byte* inBlock, byte* outBlock,
int sz)
{
uint32_t ret;
word32 ret;
if (WOLFSSL_SCE_GSCE_HANDLE.p_cfg->endian_flag ==
CRYPTO_WORD_ENDIAN_BIG) {
@@ -2646,7 +2646,7 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
aes->rounds = keylen/4 + 6;
XMEMCPY(aes->key, userKey, keylen);
aes->ctx.key.pKey = (uint8_t*)aes->key;
aes->ctx.key.pKey = (byte*)aes->key;
aes->ctx.key.keySize= keylen;
ret = SaSi_AesSetKey(&aes->ctx.user_ctx,
@@ -3085,13 +3085,13 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
HAL_CRYP_Init(&hcryp);
#if defined(STM32_HAL_V2)
ret = HAL_CRYP_Encrypt(&hcryp, (uint32_t*)in, blocks * AES_BLOCK_SIZE,
(uint32_t*)out, STM32_HAL_TIMEOUT);
ret = HAL_CRYP_Encrypt(&hcryp, (word32*)in, blocks * AES_BLOCK_SIZE,
(word32*)out, STM32_HAL_TIMEOUT);
#elif defined(STM32_CRYPTO_AES_ONLY)
ret = HAL_CRYPEx_AES(&hcryp, (uint8_t*)in, blocks * AES_BLOCK_SIZE,
ret = HAL_CRYPEx_AES(&hcryp, (byte*)in, blocks * AES_BLOCK_SIZE,
out, STM32_HAL_TIMEOUT);
#else
ret = HAL_CRYP_AESCBC_Encrypt(&hcryp, (uint8_t*)in, blocks * AES_BLOCK_SIZE,
ret = HAL_CRYP_AESCBC_Encrypt(&hcryp, (byte*)in, blocks * AES_BLOCK_SIZE,
out, STM32_HAL_TIMEOUT);
#endif
if (ret != HAL_OK) {
@@ -3139,13 +3139,13 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
HAL_CRYP_Init(&hcryp);
#if defined(STM32_HAL_V2)
ret = HAL_CRYP_Decrypt(&hcryp, (uint32_t*)in, blocks * AES_BLOCK_SIZE,
(uint32_t*)out, STM32_HAL_TIMEOUT);
ret = HAL_CRYP_Decrypt(&hcryp, (word32*)in, blocks * AES_BLOCK_SIZE,
(word32*)out, STM32_HAL_TIMEOUT);
#elif defined(STM32_CRYPTO_AES_ONLY)
ret = HAL_CRYPEx_AES(&hcryp, (uint8_t*)in, blocks * AES_BLOCK_SIZE,
ret = HAL_CRYPEx_AES(&hcryp, (byte*)in, blocks * AES_BLOCK_SIZE,
out, STM32_HAL_TIMEOUT);
#else
ret = HAL_CRYP_AESCBC_Decrypt(&hcryp, (uint8_t*)in, blocks * AES_BLOCK_SIZE,
ret = HAL_CRYP_AESCBC_Decrypt(&hcryp, (byte*)in, blocks * AES_BLOCK_SIZE,
out, STM32_HAL_TIMEOUT);
#endif
if (ret != HAL_OK) {
@@ -3209,18 +3209,18 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
/* flush IN/OUT FIFOs */
CRYP_FIFOFlush();
CRYP_DataIn(*(uint32_t*)&in[0]);
CRYP_DataIn(*(uint32_t*)&in[4]);
CRYP_DataIn(*(uint32_t*)&in[8]);
CRYP_DataIn(*(uint32_t*)&in[12]);
CRYP_DataIn(*(word32*)&in[0]);
CRYP_DataIn(*(word32*)&in[4]);
CRYP_DataIn(*(word32*)&in[8]);
CRYP_DataIn(*(word32*)&in[12]);
/* wait until the complete message has been processed */
while (CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&out[0] = CRYP_DataOut();
*(uint32_t*)&out[4] = CRYP_DataOut();
*(uint32_t*)&out[8] = CRYP_DataOut();
*(uint32_t*)&out[12] = CRYP_DataOut();
*(word32*)&out[0] = CRYP_DataOut();
*(word32*)&out[4] = CRYP_DataOut();
*(word32*)&out[8] = CRYP_DataOut();
*(word32*)&out[12] = CRYP_DataOut();
/* store iv for next call */
XMEMCPY(aes->reg, out + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
@@ -3296,18 +3296,18 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
/* flush IN/OUT FIFOs */
CRYP_FIFOFlush();
CRYP_DataIn(*(uint32_t*)&in[0]);
CRYP_DataIn(*(uint32_t*)&in[4]);
CRYP_DataIn(*(uint32_t*)&in[8]);
CRYP_DataIn(*(uint32_t*)&in[12]);
CRYP_DataIn(*(word32*)&in[0]);
CRYP_DataIn(*(word32*)&in[4]);
CRYP_DataIn(*(word32*)&in[8]);
CRYP_DataIn(*(word32*)&in[12]);
/* wait until the complete message has been processed */
while (CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&out[0] = CRYP_DataOut();
*(uint32_t*)&out[4] = CRYP_DataOut();
*(uint32_t*)&out[8] = CRYP_DataOut();
*(uint32_t*)&out[12] = CRYP_DataOut();
*(word32*)&out[0] = CRYP_DataOut();
*(word32*)&out[4] = CRYP_DataOut();
*(word32*)&out[8] = CRYP_DataOut();
*(word32*)&out[12] = CRYP_DataOut();
/* store iv for next call */
XMEMCPY(aes->reg, aes->tmp, AES_BLOCK_SIZE);
@@ -3434,7 +3434,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
#elif defined(FREESCALE_LTC)
int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
uint32_t keySize;
word32 keySize;
status_t status;
byte *iv, *enc_key;
word32 blocks = (sz / AES_BLOCK_SIZE);
@@ -3465,7 +3465,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
#ifdef HAVE_AES_DECRYPT
int wc_AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
uint32_t keySize;
word32 keySize;
status_t status;
byte* iv, *dec_key;
word32 blocks = (sz / AES_BLOCK_SIZE);
@@ -3618,11 +3618,11 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
#elif defined(WOLFSSL_CRYPTOCELL) && defined(WOLFSSL_CRYPTOCELL_AES)
int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
return SaSi_AesBlock(&aes->ctx.user_ctx, (uint8_t* )in, sz, out);
return SaSi_AesBlock(&aes->ctx.user_ctx, (byte* )in, sz, out);
}
int wc_AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
return SaSi_AesBlock(&aes->ctx.user_ctx, (uint8_t* )in, sz, out);
return SaSi_AesBlock(&aes->ctx.user_ctx, (byte* )in, sz, out);
}
#elif defined(WOLFSSL_IMX6_CAAM) && !defined(NO_IMX6_CAAM_AES)
/* implemented in wolfcrypt/src/port/caam/caam_aes.c */
@@ -3898,8 +3898,8 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
HAL_CRYP_Init(&hcryp);
#if defined(STM32_HAL_V2)
ret = HAL_CRYP_Encrypt(&hcryp, (uint32_t*)in, AES_BLOCK_SIZE,
(uint32_t*)out, STM32_HAL_TIMEOUT);
ret = HAL_CRYP_Encrypt(&hcryp, (word32*)in, AES_BLOCK_SIZE,
(word32*)out, STM32_HAL_TIMEOUT);
#elif defined(STM32_CRYPTO_AES_ONLY)
ret = HAL_CRYPEx_AES(&hcryp, (byte*)in, AES_BLOCK_SIZE,
out, STM32_HAL_TIMEOUT);
@@ -3949,18 +3949,18 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
/* flush IN/OUT FIFOs */
CRYP_FIFOFlush();
CRYP_DataIn(*(uint32_t*)&in[0]);
CRYP_DataIn(*(uint32_t*)&in[4]);
CRYP_DataIn(*(uint32_t*)&in[8]);
CRYP_DataIn(*(uint32_t*)&in[12]);
CRYP_DataIn(*(word32*)&in[0]);
CRYP_DataIn(*(word32*)&in[4]);
CRYP_DataIn(*(word32*)&in[8]);
CRYP_DataIn(*(word32*)&in[12]);
/* wait until the complete message has been processed */
while (CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&out[0] = CRYP_DataOut();
*(uint32_t*)&out[4] = CRYP_DataOut();
*(uint32_t*)&out[8] = CRYP_DataOut();
*(uint32_t*)&out[12] = CRYP_DataOut();
*(word32*)&out[0] = CRYP_DataOut();
*(word32*)&out[4] = CRYP_DataOut();
*(word32*)&out[8] = CRYP_DataOut();
*(word32*)&out[12] = CRYP_DataOut();
/* disable crypto processor */
CRYP_Cmd(DISABLE);
@@ -3993,7 +3993,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
int wc_AesCtrEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
{
int ret = 0;
uint32_t keySize;
word32 keySize;
byte *iv, *enc_key;
byte* tmp;
@@ -4020,7 +4020,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
return ret;
LTC_AES_CryptCtr(LTC_BASE, in, out, sz,
iv, enc_key, keySize, (byte*)aes->tmp,
(uint32_t*)&aes->left);
(word32*)&aes->left);
wolfSSL_CryptHwMutexUnLock();
}
@@ -6520,11 +6520,11 @@ static int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz
HAL_CRYP_Init(&hcryp);
/* GCM payload phase - can handle partial blocks */
status = HAL_CRYP_Encrypt(&hcryp, (uint32_t*)in,
(blocks * AES_BLOCK_SIZE) + partial, (uint32_t*)out, STM32_HAL_TIMEOUT);
status = HAL_CRYP_Encrypt(&hcryp, (word32*)in,
(blocks * AES_BLOCK_SIZE) + partial, (word32*)out, STM32_HAL_TIMEOUT);
if (status == HAL_OK) {
/* Compute the authTag */
status = HAL_CRYPEx_AESGCM_GenerateAuthTAG(&hcryp, (uint32_t*)tag,
status = HAL_CRYPEx_AESGCM_GenerateAuthTAG(&hcryp, (word32*)tag,
STM32_HAL_TIMEOUT);
}
#elif defined(STM32_CRYPTO_AES_ONLY)
@@ -6556,14 +6556,14 @@ static int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz
/* GCM payload phase - partial remainder */
XMEMSET(partialBlock, 0, sizeof(partialBlock));
XMEMCPY(partialBlock, in + (blocks * AES_BLOCK_SIZE), partial);
status = HAL_CRYPEx_AES_Auth(&hcryp, (uint8_t*)partialBlock, partial,
(uint8_t*)partialBlock, STM32_HAL_TIMEOUT);
status = HAL_CRYPEx_AES_Auth(&hcryp, (byte*)partialBlock, partial,
(byte*)partialBlock, STM32_HAL_TIMEOUT);
XMEMCPY(out + (blocks * AES_BLOCK_SIZE), partialBlock, partial);
}
if (status == HAL_OK) {
/* GCM final phase */
hcryp.Init.GCMCMACPhase = CRYP_FINAL_PHASE;
status = HAL_CRYPEx_AES_Auth(&hcryp, NULL, sz, (uint8_t*)tag, STM32_HAL_TIMEOUT);
status = HAL_CRYPEx_AES_Auth(&hcryp, NULL, sz, (byte*)tag, STM32_HAL_TIMEOUT);
}
#else
hcryp.Init.HeaderSize = authPadSz;
@@ -6577,13 +6577,13 @@ static int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz
/* GCM payload phase - partial remainder */
XMEMSET(partialBlock, 0, sizeof(partialBlock));
XMEMCPY(partialBlock, in + (blocks * AES_BLOCK_SIZE), partial);
status = HAL_CRYPEx_AESGCM_Encrypt(&hcryp, (uint8_t*)partialBlock, partial,
(uint8_t*)partialBlock, STM32_HAL_TIMEOUT);
status = HAL_CRYPEx_AESGCM_Encrypt(&hcryp, (byte*)partialBlock, partial,
(byte*)partialBlock, STM32_HAL_TIMEOUT);
XMEMCPY(out + (blocks * AES_BLOCK_SIZE), partialBlock, partial);
}
if (status == HAL_OK) {
/* Compute the authTag */
status = HAL_CRYPEx_AESGCM_Finish(&hcryp, sz, (uint8_t*)tag, STM32_HAL_TIMEOUT);
status = HAL_CRYPEx_AESGCM_Finish(&hcryp, sz, (byte*)tag, STM32_HAL_TIMEOUT);
}
#endif
@@ -6593,11 +6593,11 @@ static int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz
#else /* Standard Peripheral Library */
ByteReverseWords(keyCopy, (word32*)aes->key, keySize);
status = CRYP_AES_GCM(MODE_ENCRYPT, (uint8_t*)ctr,
(uint8_t*)keyCopy, keySize * 8,
(uint8_t*)in, sz,
(uint8_t*)authInPadded, authInSz,
(uint8_t*)out, (uint8_t*)tag);
status = CRYP_AES_GCM(MODE_ENCRYPT, (byte*)ctr,
(byte*)keyCopy, keySize * 8,
(byte*)in, sz,
(byte*)authInPadded, authInSz,
(byte*)out, (byte*)tag);
if (status != SUCCESS)
ret = AES_GCM_AUTH_E;
#endif /* WOLFSSL_STM32_CUBEMX */
@@ -6989,11 +6989,11 @@ static int wc_AesGcmDecrypt_STM32(Aes* aes, byte* out,
HAL_CRYP_Init(&hcryp);
/* GCM payload phase - can handle partial blocks */
status = HAL_CRYP_Decrypt(&hcryp, (uint32_t*)in,
(blocks * AES_BLOCK_SIZE) + partial, (uint32_t*)out, STM32_HAL_TIMEOUT);
status = HAL_CRYP_Decrypt(&hcryp, (word32*)in,
(blocks * AES_BLOCK_SIZE) + partial, (word32*)out, STM32_HAL_TIMEOUT);
if (status == HAL_OK && tagComputed == 0) {
/* Compute the authTag */
status = HAL_CRYPEx_AESGCM_GenerateAuthTAG(&hcryp, (uint32_t*)tag,
status = HAL_CRYPEx_AESGCM_GenerateAuthTAG(&hcryp, (word32*)tag,
STM32_HAL_TIMEOUT);
}
#elif defined(STM32_CRYPTO_AES_ONLY)
@@ -7068,11 +7068,11 @@ static int wc_AesGcmDecrypt_STM32(Aes* aes, byte* out,
* they are not block aligned, because this length (in bits) is used
* in the final GHASH. */
XMEMSET(partialBlock, 0, sizeof(partialBlock)); /* use this to get tag */
status = CRYP_AES_GCM(MODE_DECRYPT, (uint8_t*)ctr,
(uint8_t*)keyCopy, keySize * 8,
(uint8_t*)in, sz,
(uint8_t*)authInPadded, authInSz,
(uint8_t*)out, (uint8_t*)partialBlock);
status = CRYP_AES_GCM(MODE_DECRYPT, (byte*)ctr,
(byte*)keyCopy, keySize * 8,
(byte*)in, sz,
(byte*)authInPadded, authInSz,
(byte*)out, (byte*)partialBlock);
if (status != SUCCESS)
ret = AES_GCM_AUTH_E;
if (tagComputed == 0)
@@ -7596,7 +7596,7 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
const byte* authIn, word32 authInSz)
{
byte *key;
uint32_t keySize;
word32 keySize;
status_t status;
/* sanity check on arguments */
@@ -7634,7 +7634,7 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
const byte* authIn, word32 authInSz)
{
byte *key;
uint32_t keySize;
word32 keySize;
status_t status;
/* sanity check on arguments */

View File

@@ -216,8 +216,8 @@
hcryp.Instance = CRYP;
hcryp.Init.KeySize = CRYP_KEYSIZE_128B;
hcryp.Init.DataType = CRYP_DATATYPE_8B;
hcryp.Init.pKey = (uint8_t*)des->key;
hcryp.Init.pInitVect = (uint8_t*)des->reg;
hcryp.Init.pKey = (byte*)des->key;
hcryp.Init.pInitVect = (byte*)des->reg;
HAL_CRYP_Init(&hcryp);
@@ -227,21 +227,21 @@
if (mode == DES_CBC) {
if (dir == DES_ENCRYPTION) {
HAL_CRYP_DESCBC_Encrypt(&hcryp, (uint8_t*)in,
HAL_CRYP_DESCBC_Encrypt(&hcryp, (byte*)in,
DES_BLOCK_SIZE, out, STM32_HAL_TIMEOUT);
}
else {
HAL_CRYP_DESCBC_Decrypt(&hcryp, (uint8_t*)in,
HAL_CRYP_DESCBC_Decrypt(&hcryp, (byte*)in,
DES_BLOCK_SIZE, out, STM32_HAL_TIMEOUT);
}
}
else {
if (dir == DES_ENCRYPTION) {
HAL_CRYP_DESECB_Encrypt(&hcryp, (uint8_t*)in,
HAL_CRYP_DESECB_Encrypt(&hcryp, (byte*)in,
DES_BLOCK_SIZE, out, STM32_HAL_TIMEOUT);
}
else {
HAL_CRYP_DESECB_Decrypt(&hcryp, (uint8_t*)in,
HAL_CRYP_DESECB_Decrypt(&hcryp, (byte*)in,
DES_BLOCK_SIZE, out, STM32_HAL_TIMEOUT);
}
}
@@ -304,14 +304,14 @@
/* if input and output same will overwrite input iv */
XMEMCPY(des->tmp, in + sz - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
CRYP_DataIn(*(uint32_t*)&in[0]);
CRYP_DataIn(*(uint32_t*)&in[4]);
CRYP_DataIn(*(word32*)&in[0]);
CRYP_DataIn(*(word32*)&in[4]);
/* wait until the complete message has been processed */
while(CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&out[0] = CRYP_DataOut();
*(uint32_t*)&out[4] = CRYP_DataOut();
*(word32*)&out[0] = CRYP_DataOut();
*(word32*)&out[4] = CRYP_DataOut();
/* store iv for next call */
XMEMCPY(des->reg, des->tmp, DES_BLOCK_SIZE);
@@ -359,8 +359,8 @@
hcryp.Instance = CRYP;
hcryp.Init.KeySize = CRYP_KEYSIZE_128B;
hcryp.Init.DataType = CRYP_DATATYPE_8B;
hcryp.Init.pKey = (uint8_t*)des->key;
hcryp.Init.pInitVect = (uint8_t*)des->reg;
hcryp.Init.pKey = (byte*)des->key;
hcryp.Init.pInitVect = (byte*)des->reg;
HAL_CRYP_Init(&hcryp);
@@ -439,14 +439,14 @@
/* flush IN/OUT FIFOs */
CRYP_FIFOFlush();
CRYP_DataIn(*(uint32_t*)&in[0]);
CRYP_DataIn(*(uint32_t*)&in[4]);
CRYP_DataIn(*(word32*)&in[0]);
CRYP_DataIn(*(word32*)&in[4]);
/* wait until the complete message has been processed */
while(CRYP_GetFlagStatus(CRYP_FLAG_BUSY) != RESET) {}
*(uint32_t*)&out[0] = CRYP_DataOut();
*(uint32_t*)&out[4] = CRYP_DataOut();
*(word32*)&out[0] = CRYP_DataOut();
*(word32*)&out[4] = CRYP_DataOut();
/* store iv for next call */
XMEMCPY(des->reg, out + sz - DES_BLOCK_SIZE, DES_BLOCK_SIZE);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/* fe_x25519_128.i
*
* Copyright (C) 2006-2020 wolfSSL Inc.
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
@@ -31,42 +31,42 @@ void fe_init(void)
*/
void fe_frombytes(fe out, const unsigned char *in)
{
out[0] = (((int64_t)((in[ 0] ) )) )
| (((int64_t)((in[ 1] ) )) << 8)
| (((int64_t)((in[ 2] ) )) << 16)
| (((int64_t)((in[ 3] ) )) << 24)
| (((int64_t)((in[ 4] ) )) << 32)
| (((int64_t)((in[ 5] ) )) << 40)
| (((int64_t)((in[ 6] ) & 0x07)) << 48);
out[1] = (((int64_t)((in[ 6] >> 3) & 0x1f)) )
| (((int64_t)((in[ 7] ) )) << 5)
| (((int64_t)((in[ 8] ) )) << 13)
| (((int64_t)((in[ 9] ) )) << 21)
| (((int64_t)((in[10] ) )) << 29)
| (((int64_t)((in[11] ) )) << 37)
| (((int64_t)((in[12] ) & 0x3f)) << 45);
out[2] = (((int64_t)((in[12] >> 6) & 0x03)) )
| (((int64_t)((in[13] ) )) << 2)
| (((int64_t)((in[14] ) )) << 10)
| (((int64_t)((in[15] ) )) << 18)
| (((int64_t)((in[16] ) )) << 26)
| (((int64_t)((in[17] ) )) << 34)
| (((int64_t)((in[18] ) )) << 42)
| (((int64_t)((in[19] ) & 0x01)) << 50);
out[3] = (((int64_t)((in[19] >> 1) & 0x7f)) )
| (((int64_t)((in[20] ) )) << 7)
| (((int64_t)((in[21] ) )) << 15)
| (((int64_t)((in[22] ) )) << 23)
| (((int64_t)((in[23] ) )) << 31)
| (((int64_t)((in[24] ) )) << 39)
| (((int64_t)((in[25] ) & 0x0f)) << 47);
out[4] = (((int64_t)((in[25] >> 4) & 0x0f)) )
| (((int64_t)((in[26] ) )) << 4)
| (((int64_t)((in[27] ) )) << 12)
| (((int64_t)((in[28] ) )) << 20)
| (((int64_t)((in[29] ) )) << 28)
| (((int64_t)((in[30] ) )) << 36)
| (((int64_t)((in[31] ) & 0x7f)) << 44);
out[0] = (((sword64)((in[ 0] ) )) )
| (((sword64)((in[ 1] ) )) << 8)
| (((sword64)((in[ 2] ) )) << 16)
| (((sword64)((in[ 3] ) )) << 24)
| (((sword64)((in[ 4] ) )) << 32)
| (((sword64)((in[ 5] ) )) << 40)
| (((sword64)((in[ 6] ) & 0x07)) << 48);
out[1] = (((sword64)((in[ 6] >> 3) & 0x1f)) )
| (((sword64)((in[ 7] ) )) << 5)
| (((sword64)((in[ 8] ) )) << 13)
| (((sword64)((in[ 9] ) )) << 21)
| (((sword64)((in[10] ) )) << 29)
| (((sword64)((in[11] ) )) << 37)
| (((sword64)((in[12] ) & 0x3f)) << 45);
out[2] = (((sword64)((in[12] >> 6) & 0x03)) )
| (((sword64)((in[13] ) )) << 2)
| (((sword64)((in[14] ) )) << 10)
| (((sword64)((in[15] ) )) << 18)
| (((sword64)((in[16] ) )) << 26)
| (((sword64)((in[17] ) )) << 34)
| (((sword64)((in[18] ) )) << 42)
| (((sword64)((in[19] ) & 0x01)) << 50);
out[3] = (((sword64)((in[19] >> 1) & 0x7f)) )
| (((sword64)((in[20] ) )) << 7)
| (((sword64)((in[21] ) )) << 15)
| (((sword64)((in[22] ) )) << 23)
| (((sword64)((in[23] ) )) << 31)
| (((sword64)((in[24] ) )) << 39)
| (((sword64)((in[25] ) & 0x0f)) << 47);
out[4] = (((sword64)((in[25] >> 4) & 0x0f)) )
| (((sword64)((in[26] ) )) << 4)
| (((sword64)((in[27] ) )) << 12)
| (((sword64)((in[28] ) )) << 20)
| (((sword64)((in[29] ) )) << 28)
| (((sword64)((in[30] ) )) << 36)
| (((sword64)((in[31] ) & 0x7f)) << 44);
}
/* Convert a number represented as an array of words to an array of bytes.
@@ -79,7 +79,7 @@ void fe_frombytes(fe out, const unsigned char *in)
void fe_tobytes(unsigned char *out, const fe n)
{
fe in;
int64_t c;
sword64 c;
in[0] = n[0];
in[1] = n[1];
@@ -195,8 +195,8 @@ void fe_copy(fe r, const fe a)
*/
void fe_cswap(fe a, fe b, int c)
{
int64_t m = c;
int64_t t0, t1, t2, t3, t4;
sword64 m = c;
sword64 t0, t1, t2, t3, t4;
/* Convert conditional into mask. */
m = -m;
@@ -507,8 +507,8 @@ void fe_neg(fe r, const fe a)
*/
void fe_cmov(fe a, const fe b, int c)
{
int64_t m = c;
int64_t t0, t1, t2, t3, t4;
sword64 m = c;
sword64 t0, t1, t2, t3, t4;
/* Convert conditional into mask. */
m = -m;
@@ -595,13 +595,13 @@ void fe_sq2(fe r, const fe a)
* in An array of bytes.
* returns a 64-bit word.
*/
uint64_t load_3(const unsigned char *in)
word64 load_3(const unsigned char *in)
{
uint64_t result;
word64 result;
result = ((((uint64_t)in[0]) ) |
(((uint64_t)in[1]) << 8) |
(((uint64_t)in[2]) << 16));
result = ((((word64)in[0]) ) |
(((word64)in[1]) << 8) |
(((word64)in[2]) << 16));
return result;
}
@@ -611,14 +611,14 @@ uint64_t load_3(const unsigned char *in)
* in An array of bytes.
* returns a 64-bit word.
*/
uint64_t load_4(const unsigned char *in)
word64 load_4(const unsigned char *in)
{
uint64_t result;
word64 result;
result = ((((uint64_t)in[0]) ) |
(((uint64_t)in[1]) << 8) |
(((uint64_t)in[2]) << 16) |
(((uint64_t)in[3]) << 24));
result = ((((word64)in[0]) ) |
(((word64)in[1]) << 8) |
(((word64)in[2]) << 16) |
(((word64)in[3]) << 24));
return result;
}

File diff suppressed because it is too large Load Diff

View File

@@ -96,23 +96,23 @@ Representations:
#define ORDER_5 0xa6f7c
#ifdef CURVED25519_ASM_32BIT
uint64_t load_3(const unsigned char *in)
word64 load_3(const unsigned char *in)
{
uint64_t result;
result = (uint64_t) in[0];
result |= ((uint64_t) in[1]) << 8;
result |= ((uint64_t) in[2]) << 16;
word64 result;
result = (word64) in[0];
result |= ((word64) in[1]) << 8;
result |= ((word64) in[2]) << 16;
return result;
}
uint64_t load_4(const unsigned char *in)
word64 load_4(const unsigned char *in)
{
uint64_t result;
result = (uint64_t) in[0];
result |= ((uint64_t) in[1]) << 8;
result |= ((uint64_t) in[2]) << 16;
result |= ((uint64_t) in[3]) << 24;
word64 result;
result = (word64) in[0];
result |= ((word64) in[1]) << 8;
result |= ((word64) in[2]) << 16;
result |= ((word64) in[3]) << 24;
return result;
}
#endif
@@ -128,8 +128,8 @@ Output:
*/
void sc_reduce(byte* s)
{
int64_t t[24];
int64_t carry;
sword64 t[24];
sword64 carry;
t[ 0] = MASK_21 & (load_3(s + 0) >> 0);
t[ 1] = MASK_21 & (load_4(s + 2) >> 5);
@@ -331,9 +331,9 @@ Output:
*/
void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c)
{
uint32_t ad[12], bd[12], cd[12];
int64_t t[24];
int64_t carry;
word32 ad[12], bd[12], cd[12];
sword64 t[24];
sword64 carry;
ad[ 0] = MASK_21 & (load_3(a + 0) >> 0);
ad[ 1] = MASK_21 & (load_4(a + 2) >> 5);
@@ -346,7 +346,7 @@ void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c)
ad[ 8] = MASK_21 & (load_3(a + 21) >> 0);
ad[ 9] = MASK_21 & (load_4(a + 23) >> 5);
ad[10] = MASK_21 & (load_3(a + 26) >> 2);
ad[11] = (uint32_t)(load_4(a + 28) >> 7);
ad[11] = (word32)(load_4(a + 28) >> 7);
bd[ 0] = MASK_21 & (load_3(b + 0) >> 0);
bd[ 1] = MASK_21 & (load_4(b + 2) >> 5);
bd[ 2] = MASK_21 & (load_3(b + 5) >> 2);
@@ -358,7 +358,7 @@ void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c)
bd[ 8] = MASK_21 & (load_3(b + 21) >> 0);
bd[ 9] = MASK_21 & (load_4(b + 23) >> 5);
bd[10] = MASK_21 & (load_3(b + 26) >> 2);
bd[11] = (uint32_t)(load_4(b + 28) >> 7);
bd[11] = (word32)(load_4(b + 28) >> 7);
cd[ 0] = MASK_21 & (load_3(c + 0) >> 0);
cd[ 1] = MASK_21 & (load_4(c + 2) >> 5);
cd[ 2] = MASK_21 & (load_3(c + 5) >> 2);
@@ -370,86 +370,86 @@ void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c)
cd[ 8] = MASK_21 & (load_3(c + 21) >> 0);
cd[ 9] = MASK_21 & (load_4(c + 23) >> 5);
cd[10] = MASK_21 & (load_3(c + 26) >> 2);
cd[11] = (uint32_t)(load_4(c + 28) >> 7);
cd[11] = (word32)(load_4(c + 28) >> 7);
t[ 0] = cd[ 0] + (int64_t)ad[ 0] * bd[ 0];
t[ 1] = cd[ 1] + (int64_t)ad[ 0] * bd[ 1] + (int64_t)ad[ 1] * bd[ 0];
t[ 2] = cd[ 2] + (int64_t)ad[ 0] * bd[ 2] + (int64_t)ad[ 1] * bd[ 1] +
(int64_t)ad[ 2] * bd[ 0];
t[ 3] = cd[ 3] + (int64_t)ad[ 0] * bd[ 3] + (int64_t)ad[ 1] * bd[ 2] +
(int64_t)ad[ 2] * bd[ 1] + (int64_t)ad[ 3] * bd[ 0];
t[ 4] = cd[ 4] + (int64_t)ad[ 0] * bd[ 4] + (int64_t)ad[ 1] * bd[ 3] +
(int64_t)ad[ 2] * bd[ 2] + (int64_t)ad[ 3] * bd[ 1] +
(int64_t)ad[ 4] * bd[ 0];
t[ 5] = cd[ 5] + (int64_t)ad[ 0] * bd[ 5] + (int64_t)ad[ 1] * bd[ 4] +
(int64_t)ad[ 2] * bd[ 3] + (int64_t)ad[ 3] * bd[ 2] +
(int64_t)ad[ 4] * bd[ 1] + (int64_t)ad[ 5] * bd[ 0];
t[ 6] = cd[ 6] + (int64_t)ad[ 0] * bd[ 6] + (int64_t)ad[ 1] * bd[ 5] +
(int64_t)ad[ 2] * bd[ 4] + (int64_t)ad[ 3] * bd[ 3] +
(int64_t)ad[ 4] * bd[ 2] + (int64_t)ad[ 5] * bd[ 1] +
(int64_t)ad[ 6] * bd[ 0];
t[ 7] = cd[ 7] + (int64_t)ad[ 0] * bd[ 7] + (int64_t)ad[ 1] * bd[ 6] +
(int64_t)ad[ 2] * bd[ 5] + (int64_t)ad[ 3] * bd[ 4] +
(int64_t)ad[ 4] * bd[ 3] + (int64_t)ad[ 5] * bd[ 2] +
(int64_t)ad[ 6] * bd[ 1] + (int64_t)ad[ 7] * bd[ 0];
t[ 8] = cd[ 8] + (int64_t)ad[ 0] * bd[ 8] + (int64_t)ad[ 1] * bd[ 7] +
(int64_t)ad[ 2] * bd[ 6] + (int64_t)ad[ 3] * bd[ 5] +
(int64_t)ad[ 4] * bd[ 4] + (int64_t)ad[ 5] * bd[ 3] +
(int64_t)ad[ 6] * bd[ 2] + (int64_t)ad[ 7] * bd[ 1] +
(int64_t)ad[ 8] * bd[ 0];
t[ 9] = cd[ 9] + (int64_t)ad[ 0] * bd[ 9] + (int64_t)ad[ 1] * bd[ 8] +
(int64_t)ad[ 2] * bd[ 7] + (int64_t)ad[ 3] * bd[ 6] +
(int64_t)ad[ 4] * bd[ 5] + (int64_t)ad[ 5] * bd[ 4] +
(int64_t)ad[ 6] * bd[ 3] + (int64_t)ad[ 7] * bd[ 2] +
(int64_t)ad[ 8] * bd[ 1] + (int64_t)ad[ 9] * bd[ 0];
t[10] = cd[10] + (int64_t)ad[ 0] * bd[10] + (int64_t)ad[ 1] * bd[ 9] +
(int64_t)ad[ 2] * bd[ 8] + (int64_t)ad[ 3] * bd[ 7] +
(int64_t)ad[ 4] * bd[ 6] + (int64_t)ad[ 5] * bd[ 5] +
(int64_t)ad[ 6] * bd[ 4] + (int64_t)ad[ 7] * bd[ 3] +
(int64_t)ad[ 8] * bd[ 2] + (int64_t)ad[ 9] * bd[ 1] +
(int64_t)ad[10] * bd[ 0];
t[11] = cd[11] + (int64_t)ad[ 0] * bd[11] + (int64_t)ad[ 1] * bd[10] +
(int64_t)ad[ 2] * bd[ 9] + (int64_t)ad[ 3] * bd[ 8] +
(int64_t)ad[ 4] * bd[ 7] + (int64_t)ad[ 5] * bd[ 6] +
(int64_t)ad[ 6] * bd[ 5] + (int64_t)ad[ 7] * bd[ 4] +
(int64_t)ad[ 8] * bd[ 3] + (int64_t)ad[ 9] * bd[ 2] +
(int64_t)ad[10] * bd[ 1] + (int64_t)ad[11] * bd[ 0];
t[12] = (int64_t)ad[ 1] * bd[11] + (int64_t)ad[ 2] * bd[10] +
(int64_t)ad[ 3] * bd[ 9] + (int64_t)ad[ 4] * bd[ 8] +
(int64_t)ad[ 5] * bd[ 7] + (int64_t)ad[ 6] * bd[ 6] +
(int64_t)ad[ 7] * bd[ 5] + (int64_t)ad[ 8] * bd[ 4] +
(int64_t)ad[ 9] * bd[ 3] + (int64_t)ad[10] * bd[ 2] +
(int64_t)ad[11] * bd[ 1];
t[13] = (int64_t)ad[ 2] * bd[11] + (int64_t)ad[ 3] * bd[10] +
(int64_t)ad[ 4] * bd[ 9] + (int64_t)ad[ 5] * bd[ 8] +
(int64_t)ad[ 6] * bd[ 7] + (int64_t)ad[ 7] * bd[ 6] +
(int64_t)ad[ 8] * bd[ 5] + (int64_t)ad[ 9] * bd[ 4] +
(int64_t)ad[10] * bd[ 3] + (int64_t)ad[11] * bd[ 2];
t[14] = (int64_t)ad[ 3] * bd[11] + (int64_t)ad[ 4] * bd[10] +
(int64_t)ad[ 5] * bd[ 9] + (int64_t)ad[ 6] * bd[ 8] +
(int64_t)ad[ 7] * bd[ 7] + (int64_t)ad[ 8] * bd[ 6] +
(int64_t)ad[ 9] * bd[ 5] + (int64_t)ad[10] * bd[ 4] +
(int64_t)ad[11] * bd[ 3];
t[15] = (int64_t)ad[ 4] * bd[11] + (int64_t)ad[ 5] * bd[10] +
(int64_t)ad[ 6] * bd[ 9] + (int64_t)ad[ 7] * bd[ 8] +
(int64_t)ad[ 8] * bd[ 7] + (int64_t)ad[ 9] * bd[ 6] +
(int64_t)ad[10] * bd[ 5] + (int64_t)ad[11] * bd[ 4];
t[16] = (int64_t)ad[ 5] * bd[11] + (int64_t)ad[ 6] * bd[10] +
(int64_t)ad[ 7] * bd[ 9] + (int64_t)ad[ 8] * bd[ 8] +
(int64_t)ad[ 9] * bd[ 7] + (int64_t)ad[10] * bd[ 6] +
(int64_t)ad[11] * bd[ 5];
t[17] = (int64_t)ad[ 6] * bd[11] + (int64_t)ad[ 7] * bd[10] +
(int64_t)ad[ 8] * bd[ 9] + (int64_t)ad[ 9] * bd[ 8] +
(int64_t)ad[10] * bd[ 7] + (int64_t)ad[11] * bd[ 6];
t[18] = (int64_t)ad[ 7] * bd[11] + (int64_t)ad[ 8] * bd[10] +
(int64_t)ad[ 9] * bd[ 9] + (int64_t)ad[10] * bd[ 8] +
(int64_t)ad[11] * bd[ 7];
t[19] = (int64_t)ad[ 8] * bd[11] + (int64_t)ad[ 9] * bd[10] +
(int64_t)ad[10] * bd[ 9] + (int64_t)ad[11] * bd[ 8];
t[20] = (int64_t)ad[ 9] * bd[11] + (int64_t)ad[10] * bd[10] +
(int64_t)ad[11] * bd[ 9];
t[21] = (int64_t)ad[10] * bd[11] + (int64_t)ad[11] * bd[10];
t[22] = (int64_t)ad[11] * bd[11];
t[ 0] = cd[ 0] + (sword64)ad[ 0] * bd[ 0];
t[ 1] = cd[ 1] + (sword64)ad[ 0] * bd[ 1] + (sword64)ad[ 1] * bd[ 0];
t[ 2] = cd[ 2] + (sword64)ad[ 0] * bd[ 2] + (sword64)ad[ 1] * bd[ 1] +
(sword64)ad[ 2] * bd[ 0];
t[ 3] = cd[ 3] + (sword64)ad[ 0] * bd[ 3] + (sword64)ad[ 1] * bd[ 2] +
(sword64)ad[ 2] * bd[ 1] + (sword64)ad[ 3] * bd[ 0];
t[ 4] = cd[ 4] + (sword64)ad[ 0] * bd[ 4] + (sword64)ad[ 1] * bd[ 3] +
(sword64)ad[ 2] * bd[ 2] + (sword64)ad[ 3] * bd[ 1] +
(sword64)ad[ 4] * bd[ 0];
t[ 5] = cd[ 5] + (sword64)ad[ 0] * bd[ 5] + (sword64)ad[ 1] * bd[ 4] +
(sword64)ad[ 2] * bd[ 3] + (sword64)ad[ 3] * bd[ 2] +
(sword64)ad[ 4] * bd[ 1] + (sword64)ad[ 5] * bd[ 0];
t[ 6] = cd[ 6] + (sword64)ad[ 0] * bd[ 6] + (sword64)ad[ 1] * bd[ 5] +
(sword64)ad[ 2] * bd[ 4] + (sword64)ad[ 3] * bd[ 3] +
(sword64)ad[ 4] * bd[ 2] + (sword64)ad[ 5] * bd[ 1] +
(sword64)ad[ 6] * bd[ 0];
t[ 7] = cd[ 7] + (sword64)ad[ 0] * bd[ 7] + (sword64)ad[ 1] * bd[ 6] +
(sword64)ad[ 2] * bd[ 5] + (sword64)ad[ 3] * bd[ 4] +
(sword64)ad[ 4] * bd[ 3] + (sword64)ad[ 5] * bd[ 2] +
(sword64)ad[ 6] * bd[ 1] + (sword64)ad[ 7] * bd[ 0];
t[ 8] = cd[ 8] + (sword64)ad[ 0] * bd[ 8] + (sword64)ad[ 1] * bd[ 7] +
(sword64)ad[ 2] * bd[ 6] + (sword64)ad[ 3] * bd[ 5] +
(sword64)ad[ 4] * bd[ 4] + (sword64)ad[ 5] * bd[ 3] +
(sword64)ad[ 6] * bd[ 2] + (sword64)ad[ 7] * bd[ 1] +
(sword64)ad[ 8] * bd[ 0];
t[ 9] = cd[ 9] + (sword64)ad[ 0] * bd[ 9] + (sword64)ad[ 1] * bd[ 8] +
(sword64)ad[ 2] * bd[ 7] + (sword64)ad[ 3] * bd[ 6] +
(sword64)ad[ 4] * bd[ 5] + (sword64)ad[ 5] * bd[ 4] +
(sword64)ad[ 6] * bd[ 3] + (sword64)ad[ 7] * bd[ 2] +
(sword64)ad[ 8] * bd[ 1] + (sword64)ad[ 9] * bd[ 0];
t[10] = cd[10] + (sword64)ad[ 0] * bd[10] + (sword64)ad[ 1] * bd[ 9] +
(sword64)ad[ 2] * bd[ 8] + (sword64)ad[ 3] * bd[ 7] +
(sword64)ad[ 4] * bd[ 6] + (sword64)ad[ 5] * bd[ 5] +
(sword64)ad[ 6] * bd[ 4] + (sword64)ad[ 7] * bd[ 3] +
(sword64)ad[ 8] * bd[ 2] + (sword64)ad[ 9] * bd[ 1] +
(sword64)ad[10] * bd[ 0];
t[11] = cd[11] + (sword64)ad[ 0] * bd[11] + (sword64)ad[ 1] * bd[10] +
(sword64)ad[ 2] * bd[ 9] + (sword64)ad[ 3] * bd[ 8] +
(sword64)ad[ 4] * bd[ 7] + (sword64)ad[ 5] * bd[ 6] +
(sword64)ad[ 6] * bd[ 5] + (sword64)ad[ 7] * bd[ 4] +
(sword64)ad[ 8] * bd[ 3] + (sword64)ad[ 9] * bd[ 2] +
(sword64)ad[10] * bd[ 1] + (sword64)ad[11] * bd[ 0];
t[12] = (sword64)ad[ 1] * bd[11] + (sword64)ad[ 2] * bd[10] +
(sword64)ad[ 3] * bd[ 9] + (sword64)ad[ 4] * bd[ 8] +
(sword64)ad[ 5] * bd[ 7] + (sword64)ad[ 6] * bd[ 6] +
(sword64)ad[ 7] * bd[ 5] + (sword64)ad[ 8] * bd[ 4] +
(sword64)ad[ 9] * bd[ 3] + (sword64)ad[10] * bd[ 2] +
(sword64)ad[11] * bd[ 1];
t[13] = (sword64)ad[ 2] * bd[11] + (sword64)ad[ 3] * bd[10] +
(sword64)ad[ 4] * bd[ 9] + (sword64)ad[ 5] * bd[ 8] +
(sword64)ad[ 6] * bd[ 7] + (sword64)ad[ 7] * bd[ 6] +
(sword64)ad[ 8] * bd[ 5] + (sword64)ad[ 9] * bd[ 4] +
(sword64)ad[10] * bd[ 3] + (sword64)ad[11] * bd[ 2];
t[14] = (sword64)ad[ 3] * bd[11] + (sword64)ad[ 4] * bd[10] +
(sword64)ad[ 5] * bd[ 9] + (sword64)ad[ 6] * bd[ 8] +
(sword64)ad[ 7] * bd[ 7] + (sword64)ad[ 8] * bd[ 6] +
(sword64)ad[ 9] * bd[ 5] + (sword64)ad[10] * bd[ 4] +
(sword64)ad[11] * bd[ 3];
t[15] = (sword64)ad[ 4] * bd[11] + (sword64)ad[ 5] * bd[10] +
(sword64)ad[ 6] * bd[ 9] + (sword64)ad[ 7] * bd[ 8] +
(sword64)ad[ 8] * bd[ 7] + (sword64)ad[ 9] * bd[ 6] +
(sword64)ad[10] * bd[ 5] + (sword64)ad[11] * bd[ 4];
t[16] = (sword64)ad[ 5] * bd[11] + (sword64)ad[ 6] * bd[10] +
(sword64)ad[ 7] * bd[ 9] + (sword64)ad[ 8] * bd[ 8] +
(sword64)ad[ 9] * bd[ 7] + (sword64)ad[10] * bd[ 6] +
(sword64)ad[11] * bd[ 5];
t[17] = (sword64)ad[ 6] * bd[11] + (sword64)ad[ 7] * bd[10] +
(sword64)ad[ 8] * bd[ 9] + (sword64)ad[ 9] * bd[ 8] +
(sword64)ad[10] * bd[ 7] + (sword64)ad[11] * bd[ 6];
t[18] = (sword64)ad[ 7] * bd[11] + (sword64)ad[ 8] * bd[10] +
(sword64)ad[ 9] * bd[ 9] + (sword64)ad[10] * bd[ 8] +
(sword64)ad[11] * bd[ 7];
t[19] = (sword64)ad[ 8] * bd[11] + (sword64)ad[ 9] * bd[10] +
(sword64)ad[10] * bd[ 9] + (sword64)ad[11] * bd[ 8];
t[20] = (sword64)ad[ 9] * bd[11] + (sword64)ad[10] * bd[10] +
(sword64)ad[11] * bd[ 9];
t[21] = (sword64)ad[10] * bd[11] + (sword64)ad[11] * bd[10];
t[22] = (sword64)ad[11] * bd[11];
t[23] = 0;
carry = t[ 0] >> 21; t[ 1] += carry; t[ 0] &= MASK_21;
@@ -639,28 +639,28 @@ void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c)
s[31] = (byte)(t[11] >> 17);
}
#else
static uint64_t load_6(const byte* a)
static word64 load_6(const byte* a)
{
uint64_t n;
n = ((uint64_t)a[0] << 0) |
((uint64_t)a[1] << 8) |
((uint64_t)a[2] << 16) |
((uint64_t)a[3] << 24) |
((uint64_t)a[4] << 32) |
((uint64_t)a[5] << 40);
word64 n;
n = ((word64)a[0] << 0) |
((word64)a[1] << 8) |
((word64)a[2] << 16) |
((word64)a[3] << 24) |
((word64)a[4] << 32) |
((word64)a[5] << 40);
return n;
}
static uint64_t load_7(const byte* a)
static word64 load_7(const byte* a)
{
uint64_t n;
n = ((uint64_t)a[0] << 0) |
((uint64_t)a[1] << 8) |
((uint64_t)a[2] << 16) |
((uint64_t)a[3] << 24) |
((uint64_t)a[4] << 32) |
((uint64_t)a[5] << 40) |
((uint64_t)a[6] << 48);
word64 n;
n = ((word64)a[0] << 0) |
((word64)a[1] << 8) |
((word64)a[2] << 16) |
((word64)a[3] << 24) |
((word64)a[4] << 32) |
((word64)a[5] << 40) |
((word64)a[6] << 48);
return n;
}
@@ -790,7 +790,7 @@ Output:
*/
void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c)
{
uint64_t ad[6], bd[6], cd[6];
word64 ad[6], bd[6], cd[6];
__int128_t t[12];
__int128_t carry;
@@ -990,7 +990,7 @@ static unsigned char equal(signed char b,signed char c)
unsigned char ub = b;
unsigned char uc = c;
unsigned char x = ub ^ uc; /* 0: yes; 1..255: no */
uint32_t y = x; /* 0: yes; 1..255: no */
word32 y = x; /* 0: yes; 1..255: no */
y -= 1; /* 4294967295: yes; 0..254: no */
y >>= 31; /* 1: yes; 0: no */
return (unsigned char)y;

View File

@@ -127,7 +127,7 @@ static int Transform(wc_Md5* md5, const byte* data)
#ifdef FREESCALE_MMCAU_CLASSIC_SHA
cau_md5_hash_n((byte*)data, 1, (unsigned char*)md5->digest);
#else
MMCAU_MD5_HashN((byte*)data, 1, (uint32_t*)md5->digest);
MMCAU_MD5_HashN((byte*)data, 1, (word32*)md5->digest);
#endif
wolfSSL_CryptHwMutexUnLock();
}
@@ -148,7 +148,7 @@ static int Transform_Len(wc_Md5* md5, const byte* data, word32 len)
#ifdef FREESCALE_MMCAU_CLASSIC_SHA
cau_md5_hash_n(local, 1, (unsigned char*)md5->digest);
#else
MMCAU_MD5_HashN(local, 1, (uint32_t*)md5->digest);
MMCAU_MD5_HashN(local, 1, (word32*)md5->digest);
#endif
data += WC_MD5_BLOCK_SIZE;
len -= WC_MD5_BLOCK_SIZE;
@@ -162,7 +162,7 @@ static int Transform_Len(wc_Md5* md5, const byte* data, word32 len)
(unsigned char*)md5->digest);
#else
MMCAU_MD5_HashN((byte*)data, len / WC_MD5_BLOCK_SIZE,
(uint32_t*)md5->digest);
(word32*)md5->digest);
#endif
}
wolfSSL_CryptHwMutexUnLock();

View File

@@ -1957,7 +1957,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
((wolfssl_word)&output[i] % sizeof(word32)) != 0
) {
/* Single byte at a time */
uint32_t tmpRng = 0;
word32 tmpRng = 0;
if (HAL_RNG_GenerateRandomNumber(&hrng, &tmpRng) != HAL_OK) {
wolfSSL_CryptHwMutexUnLock();
return RAN_BLOCK_E;
@@ -1966,7 +1966,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
}
else {
/* Use native 32 instruction */
if (HAL_RNG_GenerateRandomNumber(&hrng, (uint32_t*)&output[i]) != HAL_OK) {
if (HAL_RNG_GenerateRandomNumber(&hrng, (word32*)&output[i]) != HAL_OK) {
wolfSSL_CryptHwMutexUnLock();
return RAN_BLOCK_E;
}
@@ -2169,9 +2169,9 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int remaining = sz, length, pos = 0;
uint32_t err_code;
uint8_t available;
static uint8_t initialized = 0;
word32 err_code;
byte available;
static byte initialized = 0;
(void)os;
@@ -2410,10 +2410,10 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int ret;
uint32_t buffer[4];
word32 buffer[4];
while (sz > 0) {
uint32_t len = sizeof(buffer);
word32 len = sizeof(buffer);
if (sz < len) {
len = sz;
@@ -2439,9 +2439,9 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
uint32_t ret;
uint32_t blocks;
word32 len = sz;
word32 ret;
word32 blocks;
word32 len = sz;
ret = WOLFSSL_SCE_TRNG_HANDLE.p_api->open(WOLFSSL_SCE_TRNG_HANDLE.p_ctrl,
WOLFSSL_SCE_TRNG_HANDLE.p_cfg);
@@ -2450,28 +2450,28 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
return -1;
}
blocks = sz / sizeof(uint32_t);
blocks = sz / sizeof(word32);
if (blocks > 0) {
ret = WOLFSSL_SCE_TRNG_HANDLE.p_api->read(WOLFSSL_SCE_TRNG_HANDLE.p_ctrl,
(uint32_t*)output, blocks);
(word32*)output, blocks);
if (ret != SSP_SUCCESS) {
return -1;
}
}
len = len - (blocks * sizeof(uint32_t));
len = len - (blocks * sizeof(word32));
if (len > 0) {
uint32_t tmp;
word32 tmp;
if (len > sizeof(uint32_t)) {
if (len > sizeof(word32)) {
return -1;
}
ret = WOLFSSL_SCE_TRNG_HANDLE.p_api->read(WOLFSSL_SCE_TRNG_HANDLE.p_ctrl,
(uint32_t*)tmp, 1);
(word32*)tmp, 1);
if (ret != SSP_SUCCESS) {
return -1;
}
XMEMCPY(output + (blocks * sizeof(uint32_t)), (byte*)&tmp, len);
XMEMCPY(output + (blocks * sizeof(word32)), (byte*)&tmp, len);
}
ret = WOLFSSL_SCE_TRNG_HANDLE.p_api->close(WOLFSSL_SCE_TRNG_HANDLE.p_ctrl);

View File

@@ -505,14 +505,14 @@ static int cc310_RSA_GenerateKeyPair(RsaKey* key, int size, long e)
CRYS_RSAKGData_t KeyGenData;
CRYS_RSAKGFipsContext_t FipsCtx;
byte ex[3];
uint16_t eSz = sizeof(ex);
word16 eSz = sizeof(ex);
byte n[256];
uint16_t nSz = sizeof(n);
word16 nSz = sizeof(n);
ret = CRYS_RSA_KG_GenerateKeyPair(&wc_rndState,
wc_rndGenVectFunc,
(byte*)&e,
3*sizeof(uint8_t),
3*sizeof(byte),
size,
&key->ctx.privKey,
&key->ctx.pubKey,
@@ -2679,7 +2679,7 @@ static int cc310_RsaPublicDecrypt(const byte* in, word32 inLen, byte* out,
{
CRYSError_t ret = 0;
CRYS_RSAPrimeData_t primeData;
uint16_t actualOutLen = outLen;
word16 actualOutLen = outLen;
ret = CRYS_RSA_PKCS1v15_Decrypt(&key->ctx.privKey,
&primeData,
@@ -2699,7 +2699,7 @@ int cc310_RsaSSL_Sign(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key, CRYS_RSA_HASH_OpMode_t mode)
{
CRYSError_t ret = 0;
uint16_t actualOutLen = outLen*sizeof(byte);
word16 actualOutLen = outLen*sizeof(byte);
CRYS_RSAPrivUserContext_t contextPrivate;
ret = CRYS_RSA_PKCS1v15_Sign(&wc_rndState,

View File

@@ -190,7 +190,7 @@
int wc_ShaFinal(wc_Sha* sha, byte* hash)
{
uint32_t hashlen = WC_SHA_DIGEST_SIZE;
word32 hashlen = WC_SHA_DIGEST_SIZE;
LTC_HASH_Finish(&sha->ctx, hash, &hashlen);
return wc_InitSha(sha); /* reset state */
}
@@ -224,7 +224,7 @@
#ifdef FREESCALE_MMCAU_CLASSIC_SHA
cau_sha1_initialize_output(sha->digest);
#else
MMCAU_SHA1_InitializeOutput((uint32_t*)sha->digest);
MMCAU_SHA1_InitializeOutput((word32*)sha->digest);
#endif
wolfSSL_CryptHwMutexUnLock();
@@ -242,7 +242,7 @@
#ifdef FREESCALE_MMCAU_CLASSIC_SHA
cau_sha1_hash_n((byte*)data, 1, sha->digest);
#else
MMCAU_SHA1_HashN((byte*)data, 1, (uint32_t*)sha->digest);
MMCAU_SHA1_HashN((byte*)data, 1, (word32*)sha->digest);
#endif
wolfSSL_CryptHwMutexUnLock();
}
@@ -276,7 +276,7 @@
cau_sha1_hash_n((byte*)data, len/WC_SHA_BLOCK_SIZE, sha->digest);
#else
MMCAU_SHA1_HashN((byte*)data, len/WC_SHA_BLOCK_SIZE,
(uint32_t*)sha->digest);
(word32*)sha->digest);
#endif
}
wolfSSL_CryptHwMutexUnLock();

View File

@@ -461,7 +461,7 @@ static int InitSha256(wc_Sha256* sha256)
#ifdef FREESCALE_MMCAU_CLASSIC_SHA
cau_sha256_initialize_output(sha256->digest);
#else
MMCAU_SHA256_InitializeOutput((uint32_t*)sha256->digest);
MMCAU_SHA256_InitializeOutput((word32*)sha256->digest);
#endif
wolfSSL_CryptHwMutexUnLock();

View File

@@ -2163,7 +2163,7 @@ time_t pic32_time(time_t* timer)
#ifdef MICROCHIP_TCPIP_V5
DWORD sec = 0;
#else
uint32_t sec = 0;
word32 sec = 0;
#endif
time_t localTime;
@@ -2186,8 +2186,8 @@ time_t pic32_time(time_t* timer)
time_t deos_time(time_t* timer)
{
const uint32_t systemTickTimeInHz = 1000000 / systemTickInMicroseconds();
uint32_t *systemTickPtr = systemTickPointer();
const word32 systemTickTimeInHz = 1000000 / systemTickInMicroseconds();
word32 *systemTickPtr = systemTickPointer();
if (timer != NULL)
*timer = *systemTickPtr/systemTickTimeInHz;

View File

@@ -44,12 +44,10 @@ WOLFSSL_API unsigned long wolfSSLeay(void);
WOLFSSL_API unsigned long wolfSSL_OpenSSL_version_num(void);
#ifdef OPENSSL_EXTRA
#include <stdint.h>
WOLFSSL_API void wolfSSL_OPENSSL_free(void*);
WOLFSSL_API void *wolfSSL_OPENSSL_malloc(size_t a);
WOLFSSL_API int wolfSSL_OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
WOLFSSL_API int wolfSSL_OPENSSL_init_crypto(word64 opts, const OPENSSL_INIT_SETTINGS *settings);
#endif
#define CRYPTO_THREADID void

View File

@@ -70,8 +70,7 @@
#endif
#ifdef OPENSSL_EXTRA
#include <stdint.h>
WOLFSSL_API int wolfSSL_OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
WOLFSSL_API int wolfSSL_OPENSSL_init_ssl(word64 opts, const OPENSSL_INIT_SETTINGS *settings);
#endif
typedef WOLFSSL SSL;

View File

@@ -27,10 +27,6 @@
#if defined(HAVE_CURVE448) || defined(HAVE_ED448)
#ifndef WOLFSSL_LINUXKM
#include <stdint.h>
#endif
#include <wolfssl/wolfcrypt/types.h>
#if defined(HAVE___UINT128_T) && !defined(NO_CURVED448_128BIT)
@@ -45,19 +41,23 @@
#if !defined(CURVE448_SMALL) && !defined(ED448_SMALL)
#if defined(CURVED448_128BIT)
typedef int64_t fe448;
typedef sword64 fe448;
#ifndef WOLFSSL_UINT128_T_DEFINED
#ifdef __SIZEOF_INT128__
typedef __uint128_t uint128_t;
typedef __int128_t int128_t;
typedef __uint128_t word128;
typedef __int128_t sword128;
#else
typedef unsigned long uint128_t __attribute__ ((mode(TI)));
typedef long int128_t __attribute__ ((mode(TI)));
typedef uint128_t word128;
typedef int128_t sword128;
#endif
#define WOLFSSL_UINT128_T_DEFINED
#endif
#else
typedef int32_t fe448;
typedef sword32 fe448;
#endif
WOLFSSL_LOCAL void fe448_init(void);
@@ -94,21 +94,21 @@ WOLFSSL_LOCAL void fe448_init(void);
WOLFSSL_LOCAL int curve448(byte* r, const byte* n, const byte* a);
#define fe448_reduce(a)
WOLFSSL_LOCAL void fe448_neg(uint8_t*,const uint8_t*);
WOLFSSL_LOCAL void fe448_add(uint8_t*, const uint8_t*, const uint8_t*);
WOLFSSL_LOCAL void fe448_sub(uint8_t*, const uint8_t*, const uint8_t*);
WOLFSSL_LOCAL void fe448_mul(uint8_t*,const uint8_t*,const uint8_t*);
WOLFSSL_LOCAL void fe448_sqr(uint8_t*, const uint8_t*);
WOLFSSL_LOCAL void fe448_mul39081(uint8_t*, const uint8_t*);
WOLFSSL_LOCAL void fe448_invert(uint8_t*, const uint8_t*);
WOLFSSL_LOCAL void fe448_neg(word8*,const word8*);
WOLFSSL_LOCAL void fe448_add(word8*, const word8*, const word8*);
WOLFSSL_LOCAL void fe448_sub(word8*, const word8*, const word8*);
WOLFSSL_LOCAL void fe448_mul(word8*,const word8*,const word8*);
WOLFSSL_LOCAL void fe448_sqr(word8*, const word8*);
WOLFSSL_LOCAL void fe448_mul39081(word8*, const word8*);
WOLFSSL_LOCAL void fe448_invert(word8*, const word8*);
WOLFSSL_LOCAL void fe448_copy(uint8_t*, const uint8_t*);
WOLFSSL_LOCAL int fe448_isnonzero(const uint8_t*);
WOLFSSL_LOCAL void fe448_copy(word8*, const word8*);
WOLFSSL_LOCAL int fe448_isnonzero(const word8*);
WOLFSSL_LOCAL void fe448_norm(byte *a);
WOLFSSL_LOCAL void fe448_cmov(uint8_t*,const uint8_t*, int);
WOLFSSL_LOCAL void fe448_pow_2_446_222_1(uint8_t*,const uint8_t*);
WOLFSSL_LOCAL void fe448_cmov(word8*,const word8*, int);
WOLFSSL_LOCAL void fe448_pow_2_446_222_1(word8*,const word8*);
#endif /* !CURVE448_SMALL || !ED448_SMALL */

View File

@@ -27,12 +27,6 @@
#if defined(HAVE_CURVE25519) || defined(HAVE_ED25519)
#if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL)
#ifndef WOLFSSL_LINUXKM
#include <stdint.h>
#endif
#endif
#include <wolfssl/wolfcrypt/types.h>
#if defined(USE_INTEL_SPEEDUP) && !defined(NO_CURVED25519_X64)
@@ -88,13 +82,13 @@ WOLFSSL_LOCAL int curve25519(byte * q, const byte * n, const byte * p);
#if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL)
#ifdef CURVED25519_ASM_64BIT
typedef int64_t fe[4];
typedef sword64 fe[4];
#elif defined(CURVED25519_ASM_32BIT)
typedef int32_t fe[8];
typedef sword32 fe[8];
#elif defined(CURVED25519_128BIT)
typedef int64_t fe[5];
typedef sword64 fe[5];
#else
typedef int32_t fe[10];
typedef sword32 fe[10];
#endif
WOLFSSL_LOCAL void fe_copy(fe, const fe);
@@ -122,8 +116,8 @@ WOLFSSL_LOCAL void fe_cmov(fe,const fe, int);
WOLFSSL_LOCAL void fe_pow22523(fe,const fe);
/* 64 type needed for SHA512 */
WOLFSSL_LOCAL uint64_t load_3(const unsigned char *in);
WOLFSSL_LOCAL uint64_t load_4(const unsigned char *in);
WOLFSSL_LOCAL word64 load_3(const unsigned char *in);
WOLFSSL_LOCAL word64 load_4(const unsigned char *in);
#ifdef CURVED25519_ASM
WOLFSSL_LOCAL void fe_ge_to_p2(fe rx, fe ry, fe rz, const fe px, const fe py,

View File

@@ -45,10 +45,10 @@ Representations:
typedef byte ge448;
#define GE448_WORDS 56
#elif defined(CURVED448_128BIT)
typedef int64_t ge448;
typedef sword64 ge448;
#define GE448_WORDS 8
#else
typedef int32_t ge448;
typedef sword32 ge448;
#define GE448_WORDS 16
#endif

View File

@@ -48,13 +48,13 @@ Representations:
#ifdef ED25519_SMALL
typedef byte ge[F25519_SIZE];
#elif defined(CURVED25519_ASM_64BIT)
typedef int64_t ge[4];
typedef sword64 ge[4];
#elif defined(CURVED25519_ASM_32BIT)
typedef int32_t ge[8];
typedef sword32 ge[8];
#elif defined(CURVED25519_128BIT)
typedef int64_t ge[5];
typedef sword64 ge[5];
#else
typedef int32_t ge[10];
typedef sword32 ge[10];
#endif
typedef struct {

View File

@@ -64,12 +64,18 @@ decouple library dependencies with standard string, memory and so on.
#ifndef WOLFSSL_TYPES
#ifndef byte
typedef unsigned char byte;
typedef char sword8;
typedef unsigned char word8;
#endif
#ifdef WC_16BIT_CPU
typedef int sword16;
typedef unsigned int word16;
typedef long sword32;
typedef unsigned long word32;
#else
typedef short sword16;
typedef unsigned short word16;
typedef int sword32;
typedef unsigned int word32;
#endif
typedef byte word24[3];
@@ -114,22 +120,27 @@ decouple library dependencies with standard string, memory and so on.
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE
#define W64LIT(x) x##ui64
typedef __int64 sword64;
typedef unsigned __int64 word64;
#elif defined(__EMSCRIPTEN__)
#define WORD64_AVAILABLE
#define W64LIT(x) x##ull
typedef long long sword64;
typedef unsigned long long word64;
#elif defined(SIZEOF_LONG) && SIZEOF_LONG == 8
#define WORD64_AVAILABLE
#define W64LIT(x) x##LL
typedef long sword64;
typedef unsigned long word64;
#elif defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG == 8
#define WORD64_AVAILABLE
#define W64LIT(x) x##LL
typedef long long sword64;
typedef unsigned long long word64;
#elif defined(__SIZEOF_LONG_LONG__) && __SIZEOF_LONG_LONG__ == 8
#define WORD64_AVAILABLE
#define W64LIT(x) x##LL
typedef long long sword64;
typedef unsigned long long word64;
#endif

View File

@@ -502,9 +502,9 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
} conn;
WOLFSSL_CTX *ctx;
WOLFSSL *ssl;
uint8_t *input_databuf;
uint8_t *output_databuf;
uint8_t *ssl_rx_databuf;
byte *input_databuf;
byte *output_databuf;
byte *ssl_rx_databuf;
int ssl_rb_len;
int ssl_rb_off;
struct process *process;
@@ -512,7 +512,7 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
tcp_socket_event_callback_t event_callback;
int closing;
uip_ipaddr_t peer_addr;
uint16_t peer_port;
word16 peer_port;
};
typedef struct uip_wolfssl_ctx uip_wolfssl_ctx;