Commit 303bff28 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

rsaenh: Remove unneeded casts.

parent cb959648
...@@ -196,7 +196,7 @@ int release_handle_table(HANDLETABLE *lpTable) ...@@ -196,7 +196,7 @@ int release_handle_table(HANDLETABLE *lpTable)
release_all_handles(lpTable); release_all_handles(lpTable);
destroy_handle_table(lpTable); destroy_handle_table(lpTable);
return (int)HeapFree(GetProcessHeap(), 0, lpTable); return HeapFree(GetProcessHeap(), 0, lpTable);
} }
/****************************************************************************** /******************************************************************************
......
...@@ -1069,7 +1069,7 @@ int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) ...@@ -1069,7 +1069,7 @@ int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d)
/* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */
norm = mp_count_bits(&y) % DIGIT_BIT; norm = mp_count_bits(&y) % DIGIT_BIT;
if (norm < (int)(DIGIT_BIT-1)) { if (norm < DIGIT_BIT-1) {
norm = (DIGIT_BIT-1) - norm; norm = (DIGIT_BIT-1) - norm;
if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) {
goto __Y; goto __Y;
...@@ -1285,7 +1285,7 @@ int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d) ...@@ -1285,7 +1285,7 @@ int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d)
} }
/* shift by as many digits in the bit count */ /* shift by as many digits in the bit count */
if (b >= (int)DIGIT_BIT) { if (b >= DIGIT_BIT) {
mp_rshd (c, b / DIGIT_BIT); mp_rshd (c, b / DIGIT_BIT);
} }
...@@ -1390,7 +1390,7 @@ int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d) ...@@ -1390,7 +1390,7 @@ int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
} else { } else {
t = 0; t = 0;
} }
q.dp[ix] = (mp_digit)t; q.dp[ix] = t;
} }
if (d != NULL) { if (d != NULL) {
...@@ -1710,11 +1710,11 @@ mp_exptmod_fast (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y, int ...@@ -1710,11 +1710,11 @@ mp_exptmod_fast (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y, int
} }
/* read next digit and reset bitcnt */ /* read next digit and reset bitcnt */
buf = X->dp[digidx--]; buf = X->dp[digidx--];
bitcnt = (int)DIGIT_BIT; bitcnt = DIGIT_BIT;
} }
/* grab the next msb from the exponent */ /* grab the next msb from the exponent */
y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; y = (buf >> (DIGIT_BIT - 1)) & 1;
buf <<= (mp_digit)1; buf <<= (mp_digit)1;
/* if the bit is zero and mode == 0 then we ignore it /* if the bit is zero and mode == 0 then we ignore it
...@@ -2609,7 +2609,7 @@ mp_mod_2d (const mp_int * a, int b, mp_int * c) ...@@ -2609,7 +2609,7 @@ mp_mod_2d (const mp_int * a, int b, mp_int * c)
} }
/* if the modulus is larger than the value than return */ /* if the modulus is larger than the value than return */
if (b > (int) (a->used * DIGIT_BIT)) { if (b > a->used * DIGIT_BIT) {
res = mp_copy (a, c); res = mp_copy (a, c);
return res; return res;
} }
...@@ -2624,8 +2624,7 @@ mp_mod_2d (const mp_int * a, int b, mp_int * c) ...@@ -2624,8 +2624,7 @@ mp_mod_2d (const mp_int * a, int b, mp_int * c)
c->dp[x] = 0; c->dp[x] = 0;
} }
/* clear the digit that is not completely outside/inside the modulus */ /* clear the digit that is not completely outside/inside the modulus */
c->dp[b / DIGIT_BIT] &= c->dp[b / DIGIT_BIT] &= (1 << ((mp_digit)b % DIGIT_BIT)) - 1;
(mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1));
mp_clamp (c); mp_clamp (c);
return MP_OKAY; return MP_OKAY;
} }
...@@ -2661,7 +2660,7 @@ int mp_montgomery_calc_normalization (mp_int * a, const mp_int * b) ...@@ -2661,7 +2660,7 @@ int mp_montgomery_calc_normalization (mp_int * a, const mp_int * b)
/* now compute C = A * B mod b */ /* now compute C = A * B mod b */
for (x = bits - 1; x < (int)DIGIT_BIT; x++) { for (x = bits - 1; x < DIGIT_BIT; x++) {
if ((res = mp_mul_2 (a, a)) != MP_OKAY) { if ((res = mp_mul_2 (a, a)) != MP_OKAY) {
return res; return res;
} }
...@@ -2907,14 +2906,14 @@ int mp_mul_2d (const mp_int * a, int b, mp_int * c) ...@@ -2907,14 +2906,14 @@ int mp_mul_2d (const mp_int * a, int b, mp_int * c)
} }
} }
if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) { if (c->alloc < c->used + b/DIGIT_BIT + 1) {
if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) {
return res; return res;
} }
} }
/* shift by as many digits in the bit count */ /* shift by as many digits in the bit count */
if (b >= (int)DIGIT_BIT) { if (b >= DIGIT_BIT) {
if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) {
return res; return res;
} }
...@@ -4068,7 +4067,7 @@ int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y) ...@@ -4068,7 +4067,7 @@ int s_mp_exptmod (const mp_int * G, const mp_int * X, mp_int * P, mp_int * Y)
} }
/* read next digit and reset the bitcnt */ /* read next digit and reset the bitcnt */
buf = X->dp[digidx--]; buf = X->dp[digidx--];
bitcnt = (int) DIGIT_BIT; bitcnt = DIGIT_BIT;
} }
/* grab the next msb from the exponent */ /* grab the next msb from the exponent */
......
...@@ -828,7 +828,7 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK ...@@ -828,7 +828,7 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK
} }
} }
hCryptKey = (HCRYPTKEY)new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY, hCryptKey = new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY,
destroy_key, (OBJECTHDR**)&pCryptKey); destroy_key, (OBJECTHDR**)&pCryptKey);
if (hCryptKey != (HCRYPTKEY)INVALID_HANDLE_VALUE) if (hCryptKey != (HCRYPTKEY)INVALID_HANDLE_VALUE)
{ {
...@@ -1095,7 +1095,7 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const ...@@ -1095,7 +1095,7 @@ static HCRYPTPROV new_key_container(PCCH pszContainerName, DWORD dwFlags, const
KEYCONTAINER *pKeyContainer; KEYCONTAINER *pKeyContainer;
HCRYPTPROV hKeyContainer; HCRYPTPROV hKeyContainer;
hKeyContainer = (HCRYPTPROV)new_object(&handle_table, sizeof(KEYCONTAINER), RSAENH_MAGIC_CONTAINER, hKeyContainer = new_object(&handle_table, sizeof(KEYCONTAINER), RSAENH_MAGIC_CONTAINER,
destroy_key_container, (OBJECTHDR**)&pKeyContainer); destroy_key_container, (OBJECTHDR**)&pKeyContainer);
if (hKeyContainer != (HCRYPTPROV)INVALID_HANDLE_VALUE) if (hKeyContainer != (HCRYPTPROV)INVALID_HANDLE_VALUE)
{ {
...@@ -1670,7 +1670,7 @@ BOOL WINAPI RSAENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, ...@@ -1670,7 +1670,7 @@ BOOL WINAPI RSAENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
} }
} }
*phHash = (HCRYPTHASH)new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH, *phHash = new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH,
destroy_hash, (OBJECTHDR**)&pCryptHash); destroy_hash, (OBJECTHDR**)&pCryptHash);
if (!pCryptHash) return FALSE; if (!pCryptHash) return FALSE;
...@@ -1834,7 +1834,7 @@ BOOL WINAPI RSAENH_CPDuplicateHash(HCRYPTPROV hUID, HCRYPTHASH hHash, DWORD *pdw ...@@ -1834,7 +1834,7 @@ BOOL WINAPI RSAENH_CPDuplicateHash(HCRYPTPROV hUID, HCRYPTHASH hHash, DWORD *pdw
return FALSE; return FALSE;
} }
*phHash = (HCRYPTHASH)new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH, *phHash = new_object(&handle_table, sizeof(CRYPTHASH), RSAENH_MAGIC_HASH,
destroy_hash, (OBJECTHDR**)&pDestHash); destroy_hash, (OBJECTHDR**)&pDestHash);
if (*phHash != (HCRYPTHASH)INVALID_HANDLE_VALUE) if (*phHash != (HCRYPTHASH)INVALID_HANDLE_VALUE)
{ {
...@@ -1890,7 +1890,7 @@ BOOL WINAPI RSAENH_CPDuplicateKey(HCRYPTPROV hUID, HCRYPTKEY hKey, DWORD *pdwRes ...@@ -1890,7 +1890,7 @@ BOOL WINAPI RSAENH_CPDuplicateKey(HCRYPTPROV hUID, HCRYPTKEY hKey, DWORD *pdwRes
return FALSE; return FALSE;
} }
*phKey = (HCRYPTKEY)new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY, destroy_key, *phKey = new_object(&handle_table, sizeof(CRYPTKEY), RSAENH_MAGIC_KEY, destroy_key,
(OBJECTHDR**)&pDestKey); (OBJECTHDR**)&pDestKey);
if (*phKey != (HCRYPTKEY)INVALID_HANDLE_VALUE) if (*phKey != (HCRYPTKEY)INVALID_HANDLE_VALUE)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment