Explicit int32 -> int64 conversions

This commit is contained in:
Frank Denis 2014-10-29 08:37:21 -07:00
parent 26d7b9c14c
commit 63ee1abf82
6 changed files with 42 additions and 42 deletions

View File

@ -75,7 +75,7 @@ decode64_one(uint32_t * dst, uint8_t src)
const char *ptr = strchr(itoa64, src); const char *ptr = strchr(itoa64, src);
if (ptr) { if (ptr) {
*dst = ptr - itoa64; *dst = (uint32_t) (ptr - itoa64);
return 0; return 0;
} }
*dst = 0; *dst = 0;

View File

@ -379,7 +379,7 @@ escrypt_kdf_sse(escrypt_local_t * local,
/* 2: for i = 0 to p - 1 do */ /* 2: for i = 0 to p - 1 do */
for (i = 0; i < p; i++) { for (i = 0; i < p; i++) {
/* 3: B_i <-- MF(B_i, N) */ /* 3: B_i <-- MF(B_i, N) */
smix(&B[(size_t)128 * i * r], r, N, V, XY); smix(&B[(size_t)128 * i * r], r, (uint32_t) N, V, XY);
} }
/* 5: DK <-- PBKDF2(P, B, 1, dkLen) */ /* 5: DK <-- PBKDF2(P, B, 1, dkLen) */

View File

@ -60,14 +60,14 @@ void fe_frombytes(fe h,const unsigned char *s)
carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26; carry6 = (h6 + (crypto_int64) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26; carry8 = (h8 + (crypto_int64) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
h[0] = h0; h[0] = (crypto_int32) h0;
h[1] = h1; h[1] = (crypto_int32) h1;
h[2] = h2; h[2] = (crypto_int32) h2;
h[3] = h3; h[3] = (crypto_int32) h3;
h[4] = h4; h[4] = (crypto_int32) h4;
h[5] = h5; h[5] = (crypto_int32) h5;
h[6] = h6; h[6] = (crypto_int32) h6;
h[7] = h7; h[7] = (crypto_int32) h7;
h[8] = h8; h[8] = (crypto_int32) h8;
h[9] = h9; h[9] = (crypto_int32) h9;
} }

View File

@ -240,14 +240,14 @@ void fe_mul(fe h,const fe f,const fe g)
/* |h0| <= 2^25; from now on fits into int32 unchanged */ /* |h0| <= 2^25; from now on fits into int32 unchanged */
/* |h1| <= 1.01*2^24 */ /* |h1| <= 1.01*2^24 */
h[0] = h0; h[0] = (crypto_int32) h0;
h[1] = h1; h[1] = (crypto_int32) h1;
h[2] = h2; h[2] = (crypto_int32) h2;
h[3] = h3; h[3] = (crypto_int32) h3;
h[4] = h4; h[4] = (crypto_int32) h4;
h[5] = h5; h[5] = (crypto_int32) h5;
h[6] = h6; h[6] = (crypto_int32) h6;
h[7] = h7; h[7] = (crypto_int32) h7;
h[8] = h8; h[8] = (crypto_int32) h8;
h[9] = h9; h[9] = (crypto_int32) h9;
} }

View File

@ -136,14 +136,14 @@ void fe_sq(fe h,const fe f)
carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26; carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
h[0] = h0; h[0] = (crypto_int32) h0;
h[1] = h1; h[1] = (crypto_int32) h1;
h[2] = h2; h[2] = (crypto_int32) h2;
h[3] = h3; h[3] = (crypto_int32) h3;
h[4] = h4; h[4] = (crypto_int32) h4;
h[5] = h5; h[5] = (crypto_int32) h5;
h[6] = h6; h[6] = (crypto_int32) h6;
h[7] = h7; h[7] = (crypto_int32) h7;
h[8] = h8; h[8] = (crypto_int32) h8;
h[9] = h9; h[9] = (crypto_int32) h9;
} }

View File

@ -147,14 +147,14 @@ void fe_sq2(fe h,const fe f)
carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26; carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
h[0] = h0; h[0] = (crypto_int32) h0;
h[1] = h1; h[1] = (crypto_int32) h1;
h[2] = h2; h[2] = (crypto_int32) h2;
h[3] = h3; h[3] = (crypto_int32) h3;
h[4] = h4; h[4] = (crypto_int32) h4;
h[5] = h5; h[5] = (crypto_int32) h5;
h[6] = h6; h[6] = (crypto_int32) h6;
h[7] = h7; h[7] = (crypto_int32) h7;
h[8] = h8; h[8] = (crypto_int32) h8;
h[9] = h9; h[9] = (crypto_int32) h9;
} }