Commit de38a9e4 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

rsaenh: Use the ARRAY_SIZE() macro and better types.

parent 4600169f
...@@ -3378,9 +3378,9 @@ static const struct { ...@@ -3378,9 +3378,9 @@ static const struct {
/* returns # of RM trials required for a given bit size */ /* returns # of RM trials required for a given bit size */
int mp_prime_rabin_miller_trials(int size) int mp_prime_rabin_miller_trials(int size)
{ {
int x; unsigned int x;
for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { for (x = 0; x < ARRAY_SIZE(sizes); x++) {
if (sizes[x].k == size) { if (sizes[x].k == size) {
return sizes[x].t; return sizes[x].t;
} else if (sizes[x].k > size) { } else if (sizes[x].k > size) {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*/ */
#include "tomcrypt.h" #include "tomcrypt.h"
#include "windef.h"
static const struct { static const struct {
int mpi_code, ltc_code; int mpi_code, ltc_code;
...@@ -41,9 +42,9 @@ static const struct { ...@@ -41,9 +42,9 @@ static const struct {
/* convert a MPI error to a LTC error (Possibly the most powerful function ever! Oh wait... no) */ /* convert a MPI error to a LTC error (Possibly the most powerful function ever! Oh wait... no) */
static int mpi_to_ltc_error(int err) static int mpi_to_ltc_error(int err)
{ {
int x; unsigned int x;
for (x = 0; x < (int)(sizeof(mpi_to_ltc_codes)/sizeof(mpi_to_ltc_codes[0])); x++) { for (x = 0; x < ARRAY_SIZE(mpi_to_ltc_codes); x++) {
if (err == mpi_to_ltc_codes[x].mpi_code) { if (err == mpi_to_ltc_codes[x].mpi_code) {
return mpi_to_ltc_codes[x].ltc_code; return mpi_to_ltc_codes[x].ltc_code;
} }
......
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