Merge branch 'master' into ti

This commit is contained in:
toddouska 2014-05-13 15:52:33 -07:00
commit d92869067c
3 changed files with 37 additions and 0 deletions

View File

@ -804,6 +804,11 @@ int AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
iv = (byte*)aes->reg; iv = (byte*)aes->reg;
enc_key = (byte*)aes->key; enc_key = (byte*)aes->key;
if ((word)out % CYASSL_MMCAU_ALIGNMENT) {
CYASSL_MSG("Bad cau_aes_encrypt alignment");
return BAD_ALIGN_E;
}
while (len > 0) while (len > 0)
{ {
XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE); XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE);
@ -836,6 +841,11 @@ int AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
iv = (byte*)aes->reg; iv = (byte*)aes->reg;
dec_key = (byte*)aes->key; dec_key = (byte*)aes->key;
if ((word)out % CYASSL_MMCAU_ALIGNMENT) {
CYASSL_MSG("Bad cau_aes_decrypt alignment");
return BAD_ALIGN_E;
}
while (len > 0) while (len > 0)
{ {
XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE); XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE);

View File

@ -566,6 +566,11 @@ int Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
iv = (byte*)des->reg; iv = (byte*)des->reg;
if ((word)out % CYASSL_MMCAU_ALIGNMENT) {
CYASSL_MSG("Bad cau_des_encrypt alignment");
return BAD_ALIGN_E;
}
while (len > 0) while (len > 0)
{ {
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE); XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
@ -596,6 +601,11 @@ int Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
iv = (byte*)des->reg; iv = (byte*)des->reg;
if ((word)out % CYASSL_MMCAU_ALIGNMENT) {
CYASSL_MSG("Bad cau_des_decrypt alignment");
return BAD_ALIGN_E;
}
while (len > 0) while (len > 0)
{ {
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE); XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
@ -627,6 +637,11 @@ int Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
iv = (byte*)des->reg; iv = (byte*)des->reg;
if ((word)out % CYASSL_MMCAU_ALIGNMENT) {
CYASSL_MSG("Bad 3ede cau_des_encrypt alignment");
return BAD_ALIGN_E;
}
while (len > 0) while (len > 0)
{ {
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE); XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
@ -660,6 +675,11 @@ int Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
iv = (byte*)des->reg; iv = (byte*)des->reg;
if ((word)out % CYASSL_MMCAU_ALIGNMENT) {
CYASSL_MSG("Bad 3ede cau_des_decrypt alignment");
return BAD_ALIGN_E;
}
while (len > 0) while (len > 0)
{ {
XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE); XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);

View File

@ -676,6 +676,11 @@
#endif #endif
/* FreeScale MMCAU hardware crypto has 4 byte alignment */
#ifdef FREESCALE_MMCAU
#define CYASSL_MMCAU_ALIGNMENT 4
#endif
/* if using hardware crypto and have alignment requirements, specify the /* if using hardware crypto and have alignment requirements, specify the
requirement here. The record header of SSL/TLS will prvent easy alignment. requirement here. The record header of SSL/TLS will prvent easy alignment.
This hint tries to help as much as possible. */ This hint tries to help as much as possible. */
@ -684,6 +689,8 @@
#define CYASSL_GENERAL_ALIGNMENT 16 #define CYASSL_GENERAL_ALIGNMENT 16
#elif defined(XSTREAM_ALIGNMENT) #elif defined(XSTREAM_ALIGNMENT)
#define CYASSL_GENERAL_ALIGNMENT 4 #define CYASSL_GENERAL_ALIGNMENT 4
#elif defined(FREESCALE_MMCAU)
#define CYASSL_GENERAL_ALIGNMENT CYASSL_MMCAU_ALIGNMENT
#else #else
#define CYASSL_GENERAL_ALIGNMENT 0 #define CYASSL_GENERAL_ALIGNMENT 0
#endif #endif