forked from wolfSSL/wolfssl
Fixes for build with STM32 Standard Periperal Library (StdPeriLib).
This commit is contained in:
@ -5927,11 +5927,15 @@ static int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz
|
|||||||
word32 keyCopy[AES_256_KEY_SIZE/sizeof(word32)];
|
word32 keyCopy[AES_256_KEY_SIZE/sizeof(word32)];
|
||||||
#endif
|
#endif
|
||||||
word32 keySize;
|
word32 keySize;
|
||||||
|
#ifdef WOLFSSL_STM32_CUBEMX
|
||||||
int status = HAL_OK;
|
int status = HAL_OK;
|
||||||
word32 blocks = sz / AES_BLOCK_SIZE;
|
word32 blocks = sz / AES_BLOCK_SIZE;
|
||||||
|
word32 partialBlock[AES_BLOCK_SIZE/sizeof(word32)];
|
||||||
|
#else
|
||||||
|
int status = SUCCESS;
|
||||||
|
#endif
|
||||||
word32 partial = sz % AES_BLOCK_SIZE;
|
word32 partial = sz % AES_BLOCK_SIZE;
|
||||||
word32 tag[AES_BLOCK_SIZE/sizeof(word32)];
|
word32 tag[AES_BLOCK_SIZE/sizeof(word32)];
|
||||||
word32 partialBlock[AES_BLOCK_SIZE/sizeof(word32)];
|
|
||||||
word32 ctr[AES_BLOCK_SIZE/sizeof(word32)];
|
word32 ctr[AES_BLOCK_SIZE/sizeof(word32)];
|
||||||
byte* authInPadded = NULL;
|
byte* authInPadded = NULL;
|
||||||
int authPadSz;
|
int authPadSz;
|
||||||
@ -6065,7 +6069,7 @@ static int wc_AesGcmEncrypt_STM32(Aes* aes, byte* out, const byte* in, word32 sz
|
|||||||
(uint8_t*)keyCopy, keySize * 8,
|
(uint8_t*)keyCopy, keySize * 8,
|
||||||
(uint8_t*)in, sz,
|
(uint8_t*)in, sz,
|
||||||
(uint8_t*)authInPadded, authInSz,
|
(uint8_t*)authInPadded, authInSz,
|
||||||
(uint8_t*)out, tag);
|
(uint8_t*)out, (uint8_t*)tag);
|
||||||
if (status != SUCCESS)
|
if (status != SUCCESS)
|
||||||
ret = AES_GCM_AUTH_E;
|
ret = AES_GCM_AUTH_E;
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
@ -6360,13 +6364,14 @@ static int wc_AesGcmDecrypt_STM32(Aes* aes, byte* out,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
#ifdef WOLFSSL_STM32_CUBEMX
|
#ifdef WOLFSSL_STM32_CUBEMX
|
||||||
|
int status = HAL_OK;
|
||||||
CRYP_HandleTypeDef hcryp;
|
CRYP_HandleTypeDef hcryp;
|
||||||
|
word32 blocks = sz / AES_BLOCK_SIZE;
|
||||||
#else
|
#else
|
||||||
|
int status = SUCCESS;
|
||||||
word32 keyCopy[AES_256_KEY_SIZE/sizeof(word32)];
|
word32 keyCopy[AES_256_KEY_SIZE/sizeof(word32)];
|
||||||
#endif
|
#endif
|
||||||
word32 keySize;
|
word32 keySize;
|
||||||
int status = HAL_OK;
|
|
||||||
word32 blocks = sz / AES_BLOCK_SIZE;
|
|
||||||
word32 partial = sz % AES_BLOCK_SIZE;
|
word32 partial = sz % AES_BLOCK_SIZE;
|
||||||
word32 tag[AES_BLOCK_SIZE/sizeof(word32)];
|
word32 tag[AES_BLOCK_SIZE/sizeof(word32)];
|
||||||
word32 partialBlock[AES_BLOCK_SIZE/sizeof(word32)];
|
word32 partialBlock[AES_BLOCK_SIZE/sizeof(word32)];
|
||||||
@ -6508,7 +6513,7 @@ static int wc_AesGcmDecrypt_STM32(Aes* aes, byte* out,
|
|||||||
(uint8_t*)keyCopy, keySize * 8,
|
(uint8_t*)keyCopy, keySize * 8,
|
||||||
(uint8_t*)in, sz,
|
(uint8_t*)in, sz,
|
||||||
(uint8_t*)authInPadded, authInSz,
|
(uint8_t*)authInPadded, authInSz,
|
||||||
(uint8_t*)out, tag);
|
(uint8_t*)out, (uint8_t*)tag);
|
||||||
if (status != SUCCESS)
|
if (status != SUCCESS)
|
||||||
ret = AES_GCM_AUTH_E;
|
ret = AES_GCM_AUTH_E;
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
|
@ -345,7 +345,7 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Des3Crypt(Des3* des, byte* out, const byte* in, word32 sz,
|
static int Des3Crypt(Des3* des, byte* out, const byte* in, word32 sz,
|
||||||
int dir)
|
int dir)
|
||||||
{
|
{
|
||||||
if (des == NULL || out == NULL || in == NULL)
|
if (des == NULL || out == NULL || in == NULL)
|
||||||
@ -460,18 +460,17 @@
|
|||||||
CRYP_Cmd(DISABLE);
|
CRYP_Cmd(DISABLE);
|
||||||
}
|
}
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||||
{
|
{
|
||||||
Des3Crypt(des, out, in, sz, DES_ENCRYPTION);
|
return Des3Crypt(des, out, in, sz, DES_ENCRYPTION);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wc_Des3_CbcDecrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
int wc_Des3_CbcDecrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||||
{
|
{
|
||||||
Des3Crypt(des, out, in, sz, DES_DECRYPTION);
|
return Des3Crypt(des, out, in, sz, DES_DECRYPTION);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_COLDFIRE_SEC)
|
#elif defined(HAVE_COLDFIRE_SEC)
|
||||||
|
@ -987,7 +987,7 @@ const ecc_set_type ecc_sets[] = {
|
|||||||
"FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", /* order */
|
"FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", /* order */
|
||||||
"6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", /* Gx */
|
"6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", /* Gx */
|
||||||
"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", /* Gy */
|
"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", /* Gy */
|
||||||
ecc_oid_secp256r1, /* oid/oidSz */
|
ecc_oid_secp256r1, /* oid/oidSz */
|
||||||
ecc_oid_secp256r1_sz,
|
ecc_oid_secp256r1_sz,
|
||||||
ECC_SECP256R1_OID, /* oid sum */
|
ECC_SECP256R1_OID, /* oid sum */
|
||||||
1, /* cofactor */
|
1, /* cofactor */
|
||||||
|
Reference in New Issue
Block a user