Update formatting for HAVE_COLDFIRE_SEC in aes.c, 80 char line limit

This commit is contained in:
Chris Conlon
2014-07-16 11:11:41 -06:00
parent 237bde7918
commit e76c5cc59e

View File

@@ -632,7 +632,8 @@ static CyaSSL_Mutex Mutex_AesSEC ;
extern volatile unsigned char __MBAR[]; extern volatile unsigned char __MBAR[];
static int AesCbcCrypt(Aes* aes, byte* po, const byte* pi, word32 sz, word32 descHeader) static int AesCbcCrypt(Aes* aes, byte* po, const byte* pi, word32 sz,
word32 descHeader)
{ {
#ifdef DEBUG_CYASSL #ifdef DEBUG_CYASSL
int i; int stat1, stat2; int ret; int i; int stat1, stat2; int ret;
@@ -684,7 +685,8 @@ static int AesCbcCrypt(Aes* aes, byte* po, const byte* pi, word32 sz, word32 des
XMEMCPY(AESBuffIn, pi, size); XMEMCPY(AESBuffIn, pi, size);
if(descHeader == SEC_DESC_AES_CBC_DECRYPT) { if(descHeader == SEC_DESC_AES_CBC_DECRYPT) {
XMEMCPY((void*)aes->tmp, (void*)&(pi[size-AES_BLOCK_SIZE]), AES_BLOCK_SIZE) ; XMEMCPY((void*)aes->tmp, (void*)&(pi[size-AES_BLOCK_SIZE]),
AES_BLOCK_SIZE);
} }
/* Point SEC to the location of the descriptor */ /* Point SEC to the location of the descriptor */
@@ -693,22 +695,24 @@ static int AesCbcCrypt(Aes* aes, byte* po, const byte* pi, word32 sz, word32 des
MCF_SEC_CCCR0 = 0x0000001a; MCF_SEC_CCCR0 = 0x0000001a;
/* poll SISR to determine when channel is complete */ /* poll SISR to determine when channel is complete */
v=0; v=0;
while ((secDesc->header>> 24) != 0xff) v++; while ((secDesc->header>> 24) != 0xff) v++;
#ifdef DEBUG_CYASSL #ifdef DEBUG_CYASSL
ret = MCF_SEC_SISRH; ret = MCF_SEC_SISRH;
stat1 = MCF_SEC_AESSR; stat1 = MCF_SEC_AESSR;
stat2 = MCF_SEC_AESISR; stat2 = MCF_SEC_AESISR;
if(ret & 0xe0000000) if (ret & 0xe0000000) {
{ db_printf("Aes_Cbc(i=%d):ISRH=%08x, AESSR=%08x, "
db_printf("Aes_Cbc(i=%d):ISRH=%08x, AESSR=%08x, AESISR=%08x\n", i, ret, stat1, stat2) ; "AESISR=%08x\n", i, ret, stat1, stat2);
} }
#endif #endif
XMEMCPY(po, AESBuffOut, size); XMEMCPY(po, AESBuffOut, size);
if (descHeader == SEC_DESC_AES_CBC_ENCRYPT) { if (descHeader == SEC_DESC_AES_CBC_ENCRYPT) {
XMEMCPY((void*)aes->reg, (void*)&(po[size-AES_BLOCK_SIZE]), AES_BLOCK_SIZE) ; XMEMCPY((void*)aes->reg, (void*)&(po[size-AES_BLOCK_SIZE]),
AES_BLOCK_SIZE);
} else { } else {
XMEMCPY((void*)aes->reg, (void*)aes->tmp, AES_BLOCK_SIZE); XMEMCPY((void*)aes->reg, (void*)aes->tmp, AES_BLOCK_SIZE);
} }
@@ -716,6 +720,7 @@ static int AesCbcCrypt(Aes* aes, byte* po, const byte* pi, word32 sz, word32 des
pi += size; pi += size;
po += size; po += size;
} }
UnLockMutex(&Mutex_AesSEC); UnLockMutex(&Mutex_AesSEC);
return 0; return 0;
} }
@@ -733,19 +738,22 @@ int AesCbcDecrypt(Aes* aes, byte* po, const byte* pi, word32 sz)
int AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv, int AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
int dir) int dir)
{ {
if (AESBuffIn == NULL) { if (AESBuffIn == NULL) {
#if defined (HAVE_THREADX) #if defined (HAVE_THREADX)
int s1, s2, s3, s4, s5 ; int s1, s2, s3, s4, s5 ;
s5 = tx_byte_allocate(&mp_ncached,(void *)&secDesc, sizeof(SECdescriptorType), TX_NO_WAIT); s5 = tx_byte_allocate(&mp_ncached,(void *)&secDesc,
s1 = tx_byte_allocate(&mp_ncached,(void *)&AESBuffIn, AES_BUFFER_SIZE, TX_NO_WAIT); sizeof(SECdescriptorType), TX_NO_WAIT);
s2 = tx_byte_allocate(&mp_ncached,(void *)&AESBuffOut, AES_BUFFER_SIZE, TX_NO_WAIT); s1 = tx_byte_allocate(&mp_ncached, (void *)&AESBuffIn,
s3 = tx_byte_allocate(&mp_ncached,(void *)&secKey, AES_BLOCK_SIZE*2,TX_NO_WAIT); AES_BUFFER_SIZE, TX_NO_WAIT);
s4 = tx_byte_allocate(&mp_ncached,(void *)&secReg, AES_BLOCK_SIZE, TX_NO_WAIT); s2 = tx_byte_allocate(&mp_ncached, (void *)&AESBuffOut,
AES_BUFFER_SIZE, TX_NO_WAIT);
s3 = tx_byte_allocate(&mp_ncached, (void *)&secKey,
AES_BLOCK_SIZE*2, TX_NO_WAIT);
s4 = tx_byte_allocate(&mp_ncached, (void *)&secReg,
AES_BLOCK_SIZE, TX_NO_WAIT);
if(s1 || s2 || s3 || s4 || s5) if(s1 || s2 || s3 || s4 || s5)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
#else #else
#warning "Allocate non-Cache buffers" #warning "Allocate non-Cache buffers"
#endif #endif
@@ -755,12 +763,13 @@ int AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
if (!((keylen == 16) || (keylen == 24) || (keylen == 32))) if (!((keylen == 16) || (keylen == 24) || (keylen == 32)))
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
if (aes == NULL) if (aes == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
aes->rounds = keylen/4 + 6; aes->rounds = keylen/4 + 6;
XMEMCPY(aes->key, userKey, keylen); XMEMCPY(aes->key, userKey, keylen);
if (iv) if (iv)
XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE); XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE);