summaryrefslogtreecommitdiffstats
path: root/src/lib/crypto
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-06-07 15:17:31 -0400
committerGreg Hudson <ghudson@mit.edu>2013-06-07 15:19:37 -0400
commite51c089b745161dd6e1d64998e99d065fc22377e (patch)
tree5e792dd53ed48f3c5d0a0aa78c0ce8e777f385a2 /src/lib/crypto
parent4f551a7ec126c52ee1f8fea4c3954015b70987bd (diff)
downloadkrb5-e51c089b745161dd6e1d64998e99d065fc22377e.tar.gz
krb5-e51c089b745161dd6e1d64998e99d065fc22377e.tar.xz
krb5-e51c089b745161dd6e1d64998e99d065fc22377e.zip
Fix various warnings
Diffstat (limited to 'src/lib/crypto')
-rw-r--r--src/lib/crypto/builtin/camellia/camellia-gen.c31
-rw-r--r--src/lib/crypto/crypto_tests/aes-test.c2
-rw-r--r--src/lib/crypto/crypto_tests/t_cts.c4
-rw-r--r--src/lib/crypto/crypto_tests/t_hmac.c5
-rw-r--r--src/lib/crypto/krb/aead.c2
5 files changed, 24 insertions, 20 deletions
diff --git a/src/lib/crypto/builtin/camellia/camellia-gen.c b/src/lib/crypto/builtin/camellia/camellia-gen.c
index 1446d779e6..23b69c1741 100644
--- a/src/lib/crypto/builtin/camellia/camellia-gen.c
+++ b/src/lib/crypto/builtin/camellia/camellia-gen.c
@@ -21,7 +21,8 @@ camellia_ctx ctx, dctx;
static void init ()
{
- int i, j, r;
+ size_t i, j;
+ cam_rval r;
srand(42);
for (i = 0; i < 16; i++)
@@ -40,7 +41,7 @@ static void init ()
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]);
}
@@ -89,7 +90,7 @@ static void fips_test ()
static void
xor (unsigned char *out, const unsigned char *a, const unsigned char *b)
{
- int i;
+ size_t i;
for (i = 0; i < B; i++)
out[i] = a[i] ^ b[i];
}
@@ -97,7 +98,8 @@ xor (unsigned char *out, const unsigned char *a, const unsigned char *b)
static void
ecb_enc (unsigned char *out, unsigned char *in, unsigned int len)
{
- int i, r;
+ size_t i;
+ cam_rval r;
for (i = 0; i < len; i += 16) {
r = camellia_enc_blk (in + i, out + i, &ctx);
if (!r) fprintf(stderr, "error, line %d\n", __LINE__), exit(1);
@@ -108,7 +110,8 @@ ecb_enc (unsigned char *out, unsigned char *in, unsigned int len)
static void
ecb_dec (unsigned char *out, unsigned char *in, unsigned int len)
{
- int i, r;
+ size_t i;
+ cam_rval r;
for (i = 0; i < len; i += 16) {
r = camellia_dec_blk (in + i, out + i, &dctx);
if (!r) fprintf(stderr, "error, line %d\n", __LINE__), exit(1);
@@ -125,7 +128,8 @@ static void
cbc_enc (unsigned char *out, unsigned char *in, unsigned char *iv,
unsigned int len)
{
- int i, r;
+ size_t i;
+ cam_rval r;
unsigned char tmp[B];
D(iv);
memcpy (tmp, iv, B);
@@ -145,7 +149,8 @@ static void
cbc_dec (unsigned char *out, unsigned char *in, unsigned char *iv,
unsigned int len)
{
- int i, r;
+ size_t i;
+ cam_rval r;
unsigned char tmp[B];
memcpy (tmp, iv, B);
for (i = 0; i < len; i += B) {
@@ -231,7 +236,7 @@ cts_dec (unsigned char *out, unsigned char *in, unsigned char *iv,
static void ecb_test ()
{
- int testno;
+ size_t testno;
unsigned char tmp[4*B];
printf ("ECB tests:\n");
@@ -239,7 +244,7 @@ static void ecb_test ()
hexdump (key, sizeof(key));
for (testno = 0; testno < NTESTS; testno++) {
unsigned len = (test_case_len[testno] + 15) & ~15;
- printf ("\ntest %d - %d bytes\n", testno, len);
+ printf ("\ntest %d - %d bytes\n", (int)testno, len);
printf ("input:");
hexdump (test_case[testno].input, len);
printf ("\n");
@@ -262,7 +267,7 @@ unsigned char ivec[16] = { 0 };
static void cbc_test ()
{
- int testno;
+ size_t testno;
unsigned char tmp[4*B];
printf ("CBC tests:\n");
@@ -270,7 +275,7 @@ static void cbc_test ()
hexdump (ivec, sizeof(ivec));
for (testno = 0; testno < NTESTS; testno++) {
unsigned len = (test_case_len[testno] + 15) & ~15;
- printf ("\ntest %d - %d bytes\n", testno, len);
+ printf ("\ntest %d - %d bytes\n", (int)testno, len);
printf ("input:");
hexdump (test_case[testno].input, len);
printf ("\n");
@@ -291,7 +296,7 @@ static void cbc_test ()
static void cts_test ()
{
- int testno;
+ size_t testno;
unsigned char tmp[4*B];
printf ("CTS tests:\n");
@@ -299,7 +304,7 @@ static void cts_test ()
hexdump (ivec, sizeof(ivec));
for (testno = 0; testno < NTESTS; testno++) {
unsigned int len = test_case_len[testno];
- printf ("\ntest %d - %d bytes\n", testno, len);
+ printf ("\ntest %d - %d bytes\n", (int)testno, len);
printf ("input:");
hexdump (test_case[testno].input, len);
printf ("\n");
diff --git a/src/lib/crypto/crypto_tests/aes-test.c b/src/lib/crypto/crypto_tests/aes-test.c
index 1ed033b112..a7382a48ad 100644
--- a/src/lib/crypto/crypto_tests/aes-test.c
+++ b/src/lib/crypto/crypto_tests/aes-test.c
@@ -39,7 +39,7 @@ static krb5_keyblock enc_key;
static krb5_data ivec;
static void init()
{
- enc_key.contents = key;
+ enc_key.contents = (krb5_octet *)key;
enc_key.length = 16;
ivec.data = zero;
ivec.length = 16;
diff --git a/src/lib/crypto/crypto_tests/t_cts.c b/src/lib/crypto/crypto_tests/t_cts.c
index f2a3012b2e..2b022b4aca 100644
--- a/src/lib/crypto/crypto_tests/t_cts.c
+++ b/src/lib/crypto/crypto_tests/t_cts.c
@@ -121,11 +121,11 @@ static void test_cts()
iov.flags = KRB5_CRYPTO_TYPE_DATA;
iov.data.data = outbuf;
- in.data = input;
+ in.data = (char *)input;
enciv.length = deciv.length = 16;
enciv.data = encivbuf;
deciv.data = decivbuf;
- keyblock.contents = aeskey;
+ keyblock.contents = (krb5_octet *)aeskey;
keyblock.length = 16;
keyblock.enctype = ENCTYPE_AES128_CTS_HMAC_SHA1_96;
diff --git a/src/lib/crypto/crypto_tests/t_hmac.c b/src/lib/crypto/crypto_tests/t_hmac.c
index cd79dc3eeb..65efa604fe 100644
--- a/src/lib/crypto/crypto_tests/t_hmac.c
+++ b/src/lib/crypto/crypto_tests/t_hmac.c
@@ -233,10 +233,9 @@ static void test_hmac()
};
for (i = 0; i < sizeof(md5tests)/sizeof(md5tests[0]); i++) {
- key.contents = md5tests[i].key;
+ key.contents = (krb5_octet *)md5tests[i].key;
key.length = md5tests[i].key_len;
- in.data = md5tests[i].data;
- in.length = md5tests[i].data_len;
+ in = make_data((char *)md5tests[i].data, md5tests[i].data_len);
out.data = outbuf;
out.length = 20;
diff --git a/src/lib/crypto/krb/aead.c b/src/lib/crypto/krb/aead.c
index 935125d9d0..9d4e206ab7 100644
--- a/src/lib/crypto/krb/aead.c
+++ b/src/lib/crypto/krb/aead.c
@@ -141,7 +141,7 @@ krb5int_c_padding_length(const struct krb5_keytypes *ktp, size_t data_length)
static size_t
next_iov_to_process(struct iov_cursor *cursor, size_t ind)
{
- krb5_crypto_iov *iov;
+ const krb5_crypto_iov *iov;
for (; ind < cursor->iov_count; ind++) {
iov = &cursor->iov[ind];