return ENOMEM;
/* make the string. start by creating the unicode version of the password*/
- asctouni(copystr, string->data, slen );
+ asctouni(copystr, (unsigned char *) string->data, slen);
/* the actual MD4 hash of the data */
krb5_MD4Init(&md4_context);
return(ENOMEM);
}
- inblock.data = inblockdata;
+ inblock.data = (char *) inblockdata;
inblock.length = blocksize;
- outblock.data = outblockdata;
+ outblock.data = (char *) outblockdata;
outblock.length = blocksize;
/* initialize the input block */
if (in_constant->length == inblock.length) {
memcpy(inblock.data, in_constant->data, inblock.length);
} else {
- krb5_nfold(in_constant->length*8, in_constant->data,
- inblock.length*8, inblock.data);
+ krb5_nfold(in_constant->length*8, (unsigned char *) in_constant->data,
+ inblock.length*8, (unsigned char *) inblock.data);
}
/* loop encrypting the blocks until enough key bytes are generated */
/* postprocess the key */
- inblock.data = rawkey;
+ inblock.data = (char *) rawkey;
inblock.length = keybytes;
(*(enc->make_key))(&inblock, outkey);
return(ENOMEM);
}
- inblock.data = inblockdata;
+ inblock.data = (char *) inblockdata;
inblock.length = blocksize;
- outblock.data = outblockdata;
+ outblock.data = (char *) outblockdata;
outblock.length = blocksize;
/* initialize the input block */
if (in_constant->length == inblock.length) {
memcpy(inblock.data, in_constant->data, inblock.length);
} else {
- krb5_nfold(in_constant->length*8, in_constant->data,
- inblock.length*8, inblock.data);
+ krb5_nfold(in_constant->length*8, (unsigned char *) in_constant->data,
+ inblock.length*8, (unsigned char *) inblock.data);
}
/* loop encrypting the blocks until enough key bytes are generated */
krb5_error_code ret;
unsigned char constantdata[K5CLENGTH];
krb5_data d1, d2;
- unsigned char *plaintext, *kedata, *kidata, *cn;
+ unsigned char *plaintext, *kedata, *kidata;
+ char *cn;
krb5_keyblock ke, ki;
/* allocate and set up plaintext and to-be-derived keys */
/* derive the keys */
- d1.data = constantdata;
+ d1.data = (char *) constantdata;
d1.length = K5CLENGTH;
d1.data[0] = (usage>>24)&0xff;
/* put together the plaintext */
d1.length = blocksize;
- d1.data = plaintext;
+ d1.data = (char *) plaintext;
if ((ret = krb5_c_random_make_octets(/* XXX */ 0, &d1)))
goto cleanup;
/* encrypt the plaintext */
d1.length = plainlen;
- d1.data = plaintext;
+ d1.data = (char *) plaintext;
d2.length = plainlen;
d2.data = output->data;
krb5_error_code ret;
unsigned char constantdata[K5CLENGTH];
krb5_data d1, d2;
- unsigned char *plaintext, *kedata, *kidata, *cn;
+ unsigned char *plaintext, *kedata, *kidata;
+ char *cn;
krb5_keyblock ke, ki;
/* allocate and set up plaintext and to-be-derived keys */
/* derive the keys */
- d1.data = constantdata;
+ d1.data = (char *) constantdata;
d1.length = K5CLENGTH;
d1.data[0] = (usage>>24)&0xff;
/* put together the plaintext */
d1.length = blocksize;
- d1.data = plaintext;
+ d1.data = (char *) plaintext;
if ((ret = krb5_c_random_make_octets(/* XXX */ 0, &d1)))
goto cleanup;
/* encrypt the plaintext */
d1.length = plainlen;
- d1.data = plaintext;
+ d1.data = (char *) plaintext;
d2.length = plainlen;
d2.data = output->data;
}
#endif
-#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 inline void enc(char *out, const char *in, aes_ctx *ctx)
+{
+ if (aes_enc_blk((const unsigned char *)in, (unsigned char *)out, ctx)
+ != aes_good)
+ abort();
+}
+static inline void dec(char *out, const char *in, aes_ctx *ctx)
+{
+ if (aes_dec_blk((const unsigned char *)in, (unsigned char *)out, ctx)
+ != aes_good)
+ abort();
+}
static void xorblock(char *out, const char *in)
{
const krb5_data *input, krb5_data *output)
{
aes_ctx ctx;
- unsigned char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
+ char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
int nblocks = 0, blockno;
/* CHECK_SIZES; */
const krb5_data *input, krb5_data *output)
{
aes_ctx ctx;
- unsigned char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
+ char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
int nblocks = 0, blockno;
CHECK_SIZES;
(krb5_pointer) output->data, input->length,
schedule,
(ivec
- ? (unsigned char *) ivec->data
- : (unsigned char *) mit_des_zeroblock),
+ ? (const unsigned char *) ivec->data
+ : (const unsigned char *) mit_des_zeroblock),
enc);
memset(schedule, 0, sizeof(schedule));
krb5int_des3_cbc_encrypt((krb5_pointer) input->data,
(krb5_pointer) output->data, input->length,
schedule[0], schedule[1], schedule[2],
- ivec?(unsigned char *) ivec->data:(unsigned char *)mit_des_zeroblock);
+ ivec?(const unsigned char *) ivec->data:(const unsigned char *)mit_des_zeroblock);
zap(schedule, sizeof(schedule));
krb5int_des3_cbc_decrypt((krb5_pointer) input->data,
(krb5_pointer) output->data, input->length,
schedule[0], schedule[1], schedule[2],
- ivec?(unsigned char *) ivec->data:(unsigned char *)mit_des_zeroblock);
+ ivec?(const unsigned char *) ivec->data:(const unsigned char *)mit_des_zeroblock);
zap(schedule, sizeof(schedule));
mit_des_cbc_cksum((unsigned char *) input->data,
(unsigned char *) output->data, input->length,
schedule,
- ivec? (unsigned char *)ivec->data:
- (unsigned char *)mit_des_zeroblock);
+ ivec? (const unsigned char *)ivec->data:
+ (const unsigned char *)mit_des_zeroblock);
memset(schedule, 0, sizeof(schedule));
mit_des_cbc_encrypt((krb5_pointer) output->data,
(krb5_pointer) output->data, output->length,
- schedule, (unsigned char *) mit_des_zeroblock, 1);
+ schedule, (const unsigned char *) mit_des_zeroblock,
+ 1);
return(0);
}
if (!compathash) {
mit_des_cbc_encrypt((krb5_pointer) hash->data,
(krb5_pointer) plaintext, hash->length,
- schedule, (unsigned char *) mit_des_zeroblock, 0);
+ schedule,
+ (const unsigned char *) mit_des_zeroblock, 0);
} else {
mit_des_cbc_encrypt((krb5_pointer) hash->data,
(krb5_pointer) plaintext, hash->length,
mit_des_cbc_encrypt((krb5_pointer) output->data,
(krb5_pointer) output->data, output->length,
- schedule, (unsigned char *) mit_des_zeroblock, 1);
+ schedule, (const unsigned char *) mit_des_zeroblock,
+ 1);
return(0);
}
if (!compathash) {
mit_des_cbc_encrypt((krb5_pointer) hash->data,
(krb5_pointer) plaintext, hash->length,
- schedule, (unsigned char *) mit_des_zeroblock, 0);
+ schedule,
+ (const unsigned char *) mit_des_zeroblock, 0);
} else {
mit_des_cbc_encrypt((krb5_pointer) hash->data,
(krb5_pointer) plaintext, hash->length,
/*
* lib/crypto/yarrow/ycipher.c
*
- * Copyright (C) 2001 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2001, 2007 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
const struct krb5_enc_provider *enc = &yarrow_enc_provider;
ind.data = (char *) in;
ind.length = CIPHER_BLOCK_SIZE;
- outd.data = out;
+ outd.data = (char *) out;
outd.length = CIPHER_BLOCK_SIZE;
ret = enc->encrypt (&ctx->key, 0, &ind, &outd);
if (ret)
/*
* src/lib/krb5/asn.1/asn1_k_decode.c
*
- * Copyright 1994 by the Massachusetts Institute of Technology.
+ * Copyright 1994, 2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
{ begin_structure();
get_field(val->etype,0,asn1_decode_enctype);
if (tagnum == 1) {
- get_lenfield(val->length,val->salt,1,asn1_decode_generalstring);
+ char *salt;
+ get_lenfield(val->length,salt,1,asn1_decode_generalstring);
+ val->salt = (krb5_octet *) salt;
} else {
val->length = KRB5_ETYPE_NO_SALT;
val->salt = 0;