SHA256
1
0
forked from pool/krb5
krb5/warning-fix-lib-crypto-enc_provider.dif

78 lines
4.0 KiB
Plaintext
Raw Normal View History

# fix warnings for:
# aes.c: In function 'krb5int_aes_encrypt':
# aes.c:72: warning: pointer targets in passing argument 1 of 'krb5int_aes_enc_blk' differ in signedness
# aes.c:72: warning: pointer targets in passing argument 2 of 'krb5int_aes_enc_blk' differ in signedness
# aes.c:77: warning: pointer targets in passing argument 1 of 'xorblock' differ in signedness
# aes.c:86: warning: pointer targets in passing argument 1 of 'xorblock' differ in signedness
# aes.c:94: warning: pointer targets in passing argument 1 of 'xorblock' differ in signedness
# aes.c:94: warning: pointer targets in passing argument 2 of 'xorblock' differ in signedness
# aes.c: In function 'krb5int_aes_decrypt':
# aes.c:127: warning: pointer targets in passing argument 1 of 'krb5int_aes_dec_blk' differ in signedness
# aes.c:127: warning: pointer targets in passing argument 2 of 'krb5int_aes_dec_blk' differ in signedness
# aes.c:131: warning: pointer targets in passing argument 1 of 'krb5int_aes_dec_blk' differ in signedness
# aes.c:132: warning: pointer targets in passing argument 1 of 'xorblock' differ in signedness
# aes.c:132: warning: pointer targets in passing argument 2 of 'xorblock' differ in signedness
# aes.c:138: warning: pointer targets in passing argument 1 of 'krb5int_aes_dec_blk' differ in signedness
# aes.c:145: warning: pointer targets in passing argument 1 of 'xorblock' differ in signedness
# aes.c:145: warning: pointer targets in passing argument 2 of 'xorblock' differ in signedness
# aes.c:154: warning: pointer targets in passing argument 1 of 'xorblock' differ in signedness
# aes.c:154: warning: pointer targets in passing argument 2 of 'xorblock' differ in signedness
#
--- src/lib/crypto/enc_provider/aes.c
+++ src/lib/crypto/enc_provider/aes.c 2006/06/21 10:50:23
@@ -40,7 +40,7 @@
#define enc(OUT, IN, CTX) (aes_enc_blk((IN),(OUT),(CTX)) == aes_good ? (void) 0 : abort())
#define dec(OUT, IN, CTX) (aes_dec_blk((IN),(OUT),(CTX)) == aes_good ? (void) 0 : abort())
-static void xorblock(char *out, const char *in)
+static void xorblock(unsigned char *out, const unsigned char *in)
{
int z;
for (z = 0; z < BLOCK_SIZE; z++)
@@ -69,12 +69,12 @@
if (nblocks == 1) {
/* XXX Used for DK function. */
- enc(output->data, input->data, &ctx);
+ enc((unsigned char*)output->data, (unsigned char*)input->data, &ctx);
} else {
unsigned int nleft;
for (blockno = 0; blockno < nblocks - 2; blockno++) {
- xorblock(tmp, input->data + blockno * BLOCK_SIZE);
+ xorblock(tmp, (unsigned char*) input->data + blockno * BLOCK_SIZE);
enc(tmp2, tmp, &ctx);
memcpy(output->data + blockno * BLOCK_SIZE, tmp2, BLOCK_SIZE);
@@ -83,7 +83,7 @@
}
/* Do final CTS step for last two blocks (the second of which
may or may not be incomplete). */
- xorblock(tmp, input->data + (nblocks - 2) * BLOCK_SIZE);
+ xorblock(tmp, (unsigned char*) input->data + (nblocks - 2) * BLOCK_SIZE);
enc(tmp2, tmp, &ctx);
nleft = input->length - (nblocks - 1) * BLOCK_SIZE;
memcpy(output->data + (nblocks - 1) * BLOCK_SIZE, tmp2, nleft);
@@ -124,18 +124,18 @@
if (nblocks == 1) {
if (input->length < BLOCK_SIZE)
abort();
- dec(output->data, input->data, &ctx);
+ dec((unsigned char*)output->data, (unsigned char*) input->data, &ctx);
} else {
for (blockno = 0; blockno < nblocks - 2; blockno++) {
- dec(tmp2, input->data + blockno * BLOCK_SIZE, &ctx);
+ dec(tmp2, (unsigned char*)input->data + blockno * BLOCK_SIZE, &ctx);
xorblock(tmp2, tmp);
memcpy(output->data + blockno * BLOCK_SIZE, tmp2, BLOCK_SIZE);
memcpy(tmp, input->data + blockno * BLOCK_SIZE, BLOCK_SIZE);
}
/* Do last two blocks, the second of which (next-to-last block
of plaintext) may be incomplete. */
- dec(tmp2, input->data + (nblocks - 2) * BLOCK_SIZE, &ctx);
+ dec(tmp2, (unsigned char*) input->data + (nblocks - 2) * BLOCK_SIZE, &ctx);
/* Set tmp3 to last ciphertext block, padded. */
memset(tmp3, 0, sizeof(tmp3));
memcpy(tmp3, input->data + (nblocks - 1) * BLOCK_SIZE,