static void init ()
{
- int i, j, r;
+ unsigned int i, j, r;
srand(42);
for (i = 0; i < 16; i++)
static void hexdump(const unsigned char *ptr, size_t len)
{
- int i;
+ size_t i;
for (i = 0; i < len; i++)
printf ("%s%02X", (i % 16 == 0) ? "\n " : " ", ptr[i]);
}
static void
xor (unsigned char *out, const unsigned char *a, const unsigned char *b)
{
- int i;
+ unsigned int i;
for (i = 0; i < B; i++)
out[i] = a[i] ^ b[i];
}
static void
ecb_enc (unsigned char *out, unsigned char *in, unsigned int len)
{
- int i, r;
+ unsigned int i, r;
for (i = 0; i < len; i += 16) {
r = aes_enc_blk (in + i, out + i, &ctx);
if (!r) fprintf(stderr, "error, line %d\n", __LINE__), exit(1);
static void
ecb_dec (unsigned char *out, unsigned char *in, unsigned int len)
{
- int i, r;
+ unsigned int i, r;
for (i = 0; i < len; i += 16) {
r = aes_dec_blk (in + i, out + i, &dctx);
if (!r) fprintf(stderr, "error, line %d\n", __LINE__), exit(1);
cbc_enc (unsigned char *out, unsigned char *in, unsigned char *iv,
unsigned int len)
{
- int i, r;
+ unsigned int i, r;
unsigned char tmp[B];
D(iv);
memcpy (tmp, iv, B);
cbc_dec (unsigned char *out, unsigned char *in, unsigned char *iv,
unsigned int len)
{
- int i, r;
+ unsigned int i, r;
unsigned char tmp[B];
memcpy (tmp, iv, B);
for (i = 0; i < len; i += B) {
static void ecb_test ()
{
- int testno;
+ unsigned int testno;
unsigned char tmp[4*B];
printf ("ECB tests:\n");
static void cbc_test ()
{
- int testno;
+ unsigned int testno;
unsigned char tmp[4*B];
printf ("CBC tests:\n");
static void cts_test ()
{
- int testno;
+ unsigned int testno;
unsigned char tmp[4*B];
printf ("CTS tests:\n");