trim trailing spaces/clean up

This commit is contained in:
Steffen Jaeckel
2014-01-03 15:16:59 +01:00
committed by Steffen Jaeckel
parent d78aa37c10
commit 8e7777b554
80 changed files with 2073 additions and 2077 deletions
+4 -4
View File
@@ -95,7 +95,7 @@ int ccm_memory(int cipher,
nonce, noncelen,
header, headerlen,
pt, ptlen,
ct,
ct,
tag, taglen,
direction);
}
@@ -174,7 +174,7 @@ int ccm_memory(int cipher,
/* handle header */
if (headerlen > 0) {
x = 0;
/* store length */
if (headerlen < ((1UL<<16) - (1UL<<8))) {
PAD[x++] ^= (headerlen>>8) & 255;
@@ -213,7 +213,7 @@ int ccm_memory(int cipher,
/* flags */
ctr[x++] = (unsigned char)L-1;
/* nonce */
for (y = 0; y < (16 - (L+1)); ++y) {
ctr[x++] = nonce[y];
@@ -305,7 +305,7 @@ int ccm_memory(int cipher,
}
PAD[x++] ^= b;
}
if (x != 0) {
if ((err = cipher_descriptor[cipher].ecb_encrypt(PAD, PAD, skey)) != CRYPT_OK) {
goto error;
+11 -11
View File
@@ -15,7 +15,7 @@
CCM support, process a block of memory, Tom St Denis
*/
#ifdef CCM_MODE
#ifdef LTC_CCM_MODE
/**
CCM encrypt/decrypt and produce an authentication tag
@@ -98,7 +98,7 @@ int ccm_memory_ex(int cipher,
nonce, noncelen,
header, headerlen,
pt, ptlen,
ct,
ct,
tag, taglen,
direction);
}
@@ -184,7 +184,7 @@ if (B0 == NULL) {
/* handle header */
if (headerlen > 0) {
x = 0;
#if 0
/* store length */
if (headerlen < ((1UL<<16) - (1UL<<8))) {
@@ -221,12 +221,12 @@ if (B0 == NULL) {
}
/* setup the ctr counter */
if (CTR == NULL) {
if (CTR == NULL) {
x = 0;
/* flags */
ctr[x++] = (unsigned char)L-1;
/* nonce */
for (y = 0; y < (16 - (L+1)); ++y) {
ctr[x++] = nonce[y];
@@ -250,7 +250,7 @@ if (CTR == NULL) {
if (direction == CCM_ENCRYPT) {
for (; y < (ptlen & ~15); y += 16) {
/* increment the ctr? */
for (z = 15; z > 15-ctrwidth; z--) {
for (z = 15; (int)z > (int)(15-ctrwidth); z--) {
ctr[z] = (ctr[z] + 1) & 255;
if (ctr[z]) break;
}
@@ -270,7 +270,7 @@ if (CTR == NULL) {
} else {
for (; y < (ptlen & ~15); y += 16) {
/* increment the ctr? */
for (z = 15; z > 15-ctrwidth; z--) {
for (z = 15; (int)z > (int)(15-ctrwidth); z--) {
ctr[z] = (ctr[z] + 1) & 255;
if (ctr[z]) break;
}
@@ -294,7 +294,7 @@ if (CTR == NULL) {
for (; y < ptlen; y++) {
/* increment the ctr? */
if (CTRlen == 16) {
for (z = 15; z > 15-ctrwidth; z--) {
for (z = 15; (int)z > (int)(15-ctrwidth); z--) {
ctr[z] = (ctr[z] + 1) & 255;
if (ctr[z]) break;
}
@@ -321,7 +321,7 @@ if (CTR == NULL) {
}
PAD[x++] ^= b;
}
if (x != 0) {
if ((err = cipher_descriptor[cipher].ecb_encrypt(PAD, PAD, skey)) != CRYPT_OK) {
goto error;
@@ -329,7 +329,7 @@ if (CTR == NULL) {
}
}
// grab the CTR
// grab the CTR
memcpy(ctrcopy, ctr, 16);
/* setup CTR for the TAG (zero the count) */
@@ -356,7 +356,7 @@ if (CTR == NULL) {
*taglen = x;
if (CTR != NULL) {
for (z = 15; z > 15-ctrwidth; z--) {
for (z = 15; (int)z > (int)(15-ctrwidth); z--) {
ctrcopy[z] = (ctrcopy[z] + 1) & 255;
if (ctrcopy[z]) break;
}
+2 -2
View File
@@ -66,7 +66,7 @@ int gcm_add_aad(gcm_state *gcm,
}
gcm_mult_h(gcm, gcm->X);
/* copy counter out */
/* copy counter out */
XMEMCPY(gcm->Y, gcm->X, 16);
zeromem(gcm->X, 16);
} else {
@@ -117,7 +117,7 @@ int gcm_add_aad(gcm_state *gcm,
return CRYPT_OK;
}
#endif
/* $Source$ */
/* $Revision$ */
+3 -3
View File
@@ -24,7 +24,7 @@
@param IVlen The length of the IV
@return CRYPT_OK on success
*/
int gcm_add_iv(gcm_state *gcm,
int gcm_add_iv(gcm_state *gcm,
const unsigned char *IV, unsigned long IVlen)
{
unsigned long x, y;
@@ -39,7 +39,7 @@ int gcm_add_iv(gcm_state *gcm,
if (gcm->mode != LTC_GCM_MODE_IV) {
return CRYPT_INVALID_ARG;
}
if (gcm->buflen >= 16 || gcm->buflen < 0) {
return CRYPT_INVALID_ARG;
}
@@ -87,7 +87,7 @@ int gcm_add_iv(gcm_state *gcm,
}
#endif
/* $Source$ */
/* $Revision$ */
+2 -2
View File
@@ -46,8 +46,8 @@ void gcm_mult_h(gcm_state *gcm, unsigned char *I)
#endif /* LTC_FAST */
}
#endif /* LTC_GCM_TABLES_SSE2 */
#else
gcm_gf_mult(gcm->H, I, T);
#else
gcm_gf_mult(gcm->H, I, T);
#endif
XMEMCPY(I, T, 16);
}
+8 -8
View File
@@ -17,9 +17,9 @@
#ifdef LTC_GCM_MODE
/**
/**
Process plaintext/ciphertext through GCM
@param gcm The GCM state
@param gcm The GCM state
@param pt The plaintext
@param ptlen The plaintext length (ciphertext length is the same)
@param ct The ciphertext
@@ -44,7 +44,7 @@ int gcm_process(gcm_state *gcm,
if (gcm->buflen > 16 || gcm->buflen < 0) {
return CRYPT_INVALID_ARG;
}
if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) {
return err;
}
@@ -77,7 +77,7 @@ int gcm_process(gcm_state *gcm,
x = 0;
#ifdef LTC_FAST
if (gcm->buflen == 0) {
if (direction == GCM_ENCRYPT) {
if (direction == GCM_ENCRYPT) {
for (x = 0; x < (ptlen & ~15); x += 16) {
/* ctr encrypt */
for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
@@ -115,14 +115,14 @@ int gcm_process(gcm_state *gcm,
}
}
}
#endif
#endif
/* process text */
for (; x < ptlen; x++) {
if (gcm->buflen == 16) {
gcm->pttotlen += 128;
gcm_mult_h(gcm, gcm->X);
/* increment counter */
for (y = 15; y >= 12; y--) {
if (++gcm->Y[y] & 255) { break; }
@@ -134,12 +134,12 @@ int gcm_process(gcm_state *gcm,
}
if (direction == GCM_ENCRYPT) {
b = ct[x] = pt[x] ^ gcm->buf[gcm->buflen];
b = ct[x] = pt[x] ^ gcm->buf[gcm->buflen];
} else {
b = ct[x];
pt[x] = ct[x] ^ gcm->buf[gcm->buflen];
}
gcm->X[gcm->buflen++] ^= b;
gcm->X[gcm->buflen++] ^= b;
}
return CRYPT_OK;