diff options
| author | Greg Hudson <ghudson@mit.edu> | 2009-11-28 00:43:34 +0000 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2009-11-28 00:43:34 +0000 |
| commit | 65577cf37ab5831e736dd5db8459c0927cd3e224 (patch) | |
| tree | 49d60364bcfaa50cd849568b7313d92e1388d28c /src/lib/crypto/openssl | |
| parent | 9fde1f049d4f2205a9cccdc82278d93e6eaad748 (diff) | |
| download | krb5-65577cf37ab5831e736dd5db8459c0927cd3e224.tar.gz krb5-65577cf37ab5831e736dd5db8459c0927cd3e224.tar.xz krb5-65577cf37ab5831e736dd5db8459c0927cd3e224.zip | |
Mark and reindent lib/crypto
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23374 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/openssl')
26 files changed, 268 insertions, 243 deletions
diff --git a/src/lib/crypto/openssl/aes/aes_s2k.c b/src/lib/crypto/openssl/aes/aes_s2k.c index 9dd1402bd4..b2fa1f1d9f 100644 --- a/src/lib/crypto/openssl/aes/aes_s2k.c +++ b/src/lib/crypto/openssl/aes/aes_s2k.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/aes/aes_s2k.c * @@ -31,15 +32,15 @@ #include "dk.h" #include "aes_s2k.h" -#define DEFAULT_ITERATION_COUNT 4096 /* was 0xb000L in earlier drafts */ -#define MAX_ITERATION_COUNT 0x1000000L +#define DEFAULT_ITERATION_COUNT 4096 /* was 0xb000L in earlier drafts */ +#define MAX_ITERATION_COUNT 0x1000000L krb5_error_code krb5int_aes_string_to_key(const struct krb5_enc_provider *enc, - const krb5_data *string, - const krb5_data *salt, - const krb5_data *params, - krb5_keyblock *key) + const krb5_data *string, + const krb5_data *salt, + const krb5_data *params, + krb5_keyblock *key) { unsigned long iter_count; krb5_data out; @@ -48,44 +49,44 @@ krb5int_aes_string_to_key(const struct krb5_enc_provider *enc, krb5_error_code err; if (params) { - unsigned char *p = (unsigned char *) params->data; - if (params->length != 4) - return KRB5_ERR_BAD_S2K_PARAMS; - /* The first two need casts in case 'int' is 16 bits. */ - iter_count = load_32_be(p); - if (iter_count == 0) { - iter_count = (1UL << 16) << 16; - if (((iter_count >> 16) >> 16) != 1) - return KRB5_ERR_BAD_S2K_PARAMS; - } + unsigned char *p = (unsigned char *) params->data; + if (params->length != 4) + return KRB5_ERR_BAD_S2K_PARAMS; + /* The first two need casts in case 'int' is 16 bits. */ + iter_count = load_32_be(p); + if (iter_count == 0) { + iter_count = (1UL << 16) << 16; + if (((iter_count >> 16) >> 16) != 1) + return KRB5_ERR_BAD_S2K_PARAMS; + } } else - iter_count = DEFAULT_ITERATION_COUNT; + iter_count = DEFAULT_ITERATION_COUNT; /* This is not a protocol specification constraint; this is an implementation limit, which should eventually be controlled by a config file. */ if (iter_count >= MAX_ITERATION_COUNT) - return KRB5_ERR_BAD_S2K_PARAMS; + return KRB5_ERR_BAD_S2K_PARAMS; /* Use the output keyblock contents for temporary space. */ out.data = (char *) key->contents; out.length = key->length; if (out.length != 16 && out.length != 32) - return KRB5_CRYPTO_INTERNAL; + return KRB5_CRYPTO_INTERNAL; err = krb5int_pbkdf2_hmac_sha1 (&out, iter_count, string, salt); if (err) - goto cleanup; + goto cleanup; err = krb5_k_create_key (NULL, key, &tempkey); if (err) - goto cleanup; + goto cleanup; err = krb5int_derive_keyblock (enc, tempkey, key, &usage); cleanup: if (err) - memset (out.data, 0, out.length); + memset (out.data, 0, out.length); krb5_k_free_key (NULL, tempkey); return err; } diff --git a/src/lib/crypto/openssl/aes/aes_s2k.h b/src/lib/crypto/openssl/aes/aes_s2k.h index f39b95a31a..f9bb1fec13 100644 --- a/src/lib/crypto/openssl/aes/aes_s2k.h +++ b/src/lib/crypto/openssl/aes/aes_s2k.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/aes/aes_s2k.h */ @@ -5,5 +6,5 @@ extern krb5_error_code krb5int_aes_string_to_key (const struct krb5_enc_provider *, - const krb5_data *, const krb5_data *, - const krb5_data *, krb5_keyblock *key); + const krb5_data *, const krb5_data *, + const krb5_data *, krb5_keyblock *key); diff --git a/src/lib/crypto/openssl/des/des_int.h b/src/lib/crypto/openssl/des/des_int.h index 84d678c99b..6cb54fd274 100644 --- a/src/lib/crypto/openssl/des/des_int.h +++ b/src/lib/crypto/openssl/des/des_int.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/des/des_int.h * @@ -53,7 +54,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -/* only do the whole thing once */ +/* only do the whole thing once */ #ifndef DES_INTERNAL_DEFS #define DES_INTERNAL_DEFS @@ -91,7 +92,7 @@ #define DES_UINT32 unsigned long #endif -typedef unsigned char des_cblock[8] /* crypto-block size */ +typedef unsigned char des_cblock[8] /* crypto-block size */ KRB5INT_DES_DEPRECATED; /* @@ -119,11 +120,11 @@ typedef des_cblock mit_des_cblock; typedef des_key_schedule mit_des_key_schedule; /* Triple-DES structures */ -typedef mit_des_cblock mit_des3_cblock[3]; -typedef mit_des_key_schedule mit_des3_key_schedule[3]; +typedef mit_des_cblock mit_des3_cblock[3]; +typedef mit_des_key_schedule mit_des3_key_schedule[3]; -#define MIT_DES_ENCRYPT 1 -#define MIT_DES_DECRYPT 0 +#define MIT_DES_ENCRYPT 1 +#define MIT_DES_DECRYPT 0 typedef struct mit_des_ran_key_seed { krb5_encrypt_block eblock; @@ -132,22 +133,22 @@ typedef struct mit_des_ran_key_seed { /* the first byte of the key is already in the keyblock */ -#define MIT_DES_BLOCK_LENGTH (8*sizeof(krb5_octet)) -#define MIT_DES_CBC_CRC_PAD_MINIMUM CRC32_CKSUM_LENGTH +#define MIT_DES_BLOCK_LENGTH (8*sizeof(krb5_octet)) +#define MIT_DES_CBC_CRC_PAD_MINIMUM CRC32_CKSUM_LENGTH /* This used to be 8*sizeof(krb5_octet) */ -#define MIT_DES_KEYSIZE 8 +#define MIT_DES_KEYSIZE 8 -#define MIT_DES_CBC_CKSUM_LENGTH (4*sizeof(krb5_octet)) +#define MIT_DES_CBC_CKSUM_LENGTH (4*sizeof(krb5_octet)) /* * Check if k5-int.h has been included before us. If so, then check to see * that our view of the DES key size is the same as k5-int.h's. */ -#ifdef KRB5_MIT_DES_KEYSIZE -#if MIT_DES_KEYSIZE != KRB5_MIT_DES_KEYSIZE +#ifdef KRB5_MIT_DES_KEYSIZE +#if MIT_DES_KEYSIZE != KRB5_MIT_DES_KEYSIZE error(MIT_DES_KEYSIZE does not equal KRB5_MIT_DES_KEYSIZE) -#endif /* MIT_DES_KEYSIZE != KRB5_MIT_DES_KEYSIZE */ -#endif /* KRB5_MIT_DES_KEYSIZE */ +#endif /* MIT_DES_KEYSIZE != KRB5_MIT_DES_KEYSIZE */ +#endif /* KRB5_MIT_DES_KEYSIZE */ #endif /* KRB5_MIT_DES__ */ /* * End "mit-des.h" @@ -162,10 +163,10 @@ extern int mit_des_check_key_parity (mit_des_cblock ); /* string2key.c */ extern krb5_error_code mit_des_string_to_key - ( const krb5_encrypt_block *, - krb5_keyblock *, const krb5_data *, const krb5_data *); +( const krb5_encrypt_block *, + krb5_keyblock *, const krb5_data *, const krb5_data *); extern krb5_error_code mit_des_string_to_key_int - (krb5_keyblock *, const krb5_data *, const krb5_data *); +(krb5_keyblock *, const krb5_data *, const krb5_data *); /* weak_key.c */ extern int mit_des_is_weak_key (mit_des_cblock ); @@ -185,4 +186,4 @@ extern unsigned long swap_long_bytes_bit_number (unsigned long ); /* XXX depends on FILE being a #define! */ extern void test_set (FILE *, const char *, int, const char *, int); #endif -#endif /*DES_INTERNAL_DEFS*/ +#endif /*DES_INTERNAL_DEFS*/ diff --git a/src/lib/crypto/openssl/des/des_oldapis.c b/src/lib/crypto/openssl/des/des_oldapis.c index c931efc3df..eb1e586333 100644 --- a/src/lib/crypto/openssl/des/des_oldapis.c +++ b/src/lib/crypto/openssl/des/des_oldapis.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/des/des_oldapis.c * @@ -33,8 +34,8 @@ const mit_des_cblock mit_des_zeroblock /* = all zero */; unsigned long mit_des_cbc_cksum(const krb5_octet *in, krb5_octet *out, - unsigned long length, const mit_des_key_schedule schedule, - const krb5_octet *ivec) + unsigned long length, const mit_des_key_schedule schedule, + const krb5_octet *ivec) { /* Unsupported operation */ return KRB5_CRYPTO_INTERNAL; diff --git a/src/lib/crypto/openssl/des/f_parity.c b/src/lib/crypto/openssl/des/f_parity.c index bc33eb80c2..b8baac9d20 100644 --- a/src/lib/crypto/openssl/des/f_parity.c +++ b/src/lib/crypto/openssl/des/f_parity.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/des/f_parity.c * @@ -30,7 +31,7 @@ void mit_des_fixup_key_parity(mit_des_cblock key) { - DES_set_odd_parity(key); + DES_set_odd_parity(key); } /* @@ -42,6 +43,6 @@ int mit_des_check_key_parity(mit_des_cblock key) { if (!DES_check_key_parity(key)) - return(0); + return(0); return (1); } diff --git a/src/lib/crypto/openssl/des/string2key.c b/src/lib/crypto/openssl/des/string2key.c index 6034e86c7b..c192734ceb 100644 --- a/src/lib/crypto/openssl/des/string2key.c +++ b/src/lib/crypto/openssl/des/string2key.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/des/string2key.c * @@ -30,7 +31,7 @@ krb5_error_code mit_des_string_to_key_int (krb5_keyblock *key, - const krb5_data *pw, const krb5_data *salt) + const krb5_data *pw, const krb5_data *salt) { DES_cblock outkey; DES_string_to_key(pw->data, &outkey); diff --git a/src/lib/crypto/openssl/des/weak_key.c b/src/lib/crypto/openssl/des/weak_key.c index 4d7e99b8b6..eb49d5816f 100644 --- a/src/lib/crypto/openssl/des/weak_key.c +++ b/src/lib/crypto/openssl/des/weak_key.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/des/weak_key.c * @@ -76,11 +77,11 @@ mit_des_is_weak_key(mit_des_cblock key) const mit_des_cblock *weak_p = weak; for (i = 0; i < (sizeof(weak)/sizeof(mit_des_cblock)); i++) { - if (!memcmp(weak_p++,key,sizeof(mit_des_cblock))) - return 1; + if (!memcmp(weak_p++,key,sizeof(mit_des_cblock))) + return 1; } if ( DES_is_weak_key(key) == 1) /* Also OpenSSL's check */ - return 1; + return 1; return 0; } diff --git a/src/lib/crypto/openssl/enc_provider/aes.c b/src/lib/crypto/openssl/enc_provider/aes.c index 51ba8afa62..519a1b54a9 100644 --- a/src/lib/crypto/openssl/enc_provider/aes.c +++ b/src/lib/crypto/openssl/enc_provider/aes.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/enc_provider/aes.c * @@ -36,22 +37,22 @@ /* proto's */ static krb5_error_code cts_enc(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output); + const krb5_data *input, krb5_data *output); static krb5_error_code cbc_enc(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output); + const krb5_data *input, krb5_data *output); static krb5_error_code cts_decr(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output); + const krb5_data *input, krb5_data *output); static krb5_error_code cbc_decr(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output); + const krb5_data *input, krb5_data *output); static krb5_error_code cts_encr_iov(krb5_key key, const krb5_data *ivec, - krb5_crypto_iov *data, size_t num_data, size_t dlen); + krb5_crypto_iov *data, size_t num_data, size_t dlen); static krb5_error_code cts_decr_iov(krb5_key key, const krb5_data *ivec, - krb5_crypto_iov *data, size_t num_data, size_t dlen); + krb5_crypto_iov *data, size_t num_data, size_t dlen); #define BLOCK_SIZE 16 #define NUM_BITS 8 @@ -70,7 +71,7 @@ map_mode(unsigned int len) static krb5_error_code cbc_enc(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; unsigned char *tmp_buf = NULL; @@ -85,12 +86,12 @@ cbc_enc(krb5_key key, const krb5_data *ivec, EVP_CIPHER_CTX_init(&ciph_ctx); ret = EVP_EncryptInit_ex(&ciph_ctx, map_mode(key->keyblock.length), - NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); + NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); if (ret == 1){ EVP_CIPHER_CTX_set_padding(&ciph_ctx,0); ret = EVP_EncryptUpdate(&ciph_ctx, tmp_buf, &tmp_len, - (unsigned char *)input->data, input->length); + (unsigned char *)input->data, input->length); output->length = tmp_len; if(ret) ret = EVP_EncryptFinal_ex(&ciph_ctx,tmp_buf+tmp_len,&tmp_len); @@ -113,7 +114,7 @@ cbc_enc(krb5_key key, const krb5_data *ivec, static krb5_error_code cbc_decr(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; unsigned char *tmp_buf = NULL; @@ -128,11 +129,11 @@ cbc_decr(krb5_key key, const krb5_data *ivec, EVP_CIPHER_CTX_init(&ciph_ctx); ret = EVP_DecryptInit_ex(&ciph_ctx, map_mode(key->keyblock.length), - NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); + NULL, key->keyblock.contents, (ivec) ? (unsigned char*)ivec->data : NULL); if (ret == 1) { EVP_CIPHER_CTX_set_padding(&ciph_ctx,0); ret = EVP_EncryptUpdate(&ciph_ctx, tmp_buf, &tmp_len, - (unsigned char *)input->data, input->length); + (unsigned char *)input->data, input->length); output->length = tmp_len; if (ret == 1) ret = EVP_DecryptFinal_ex(&ciph_ctx,tmp_buf+tmp_len,&tmp_len); @@ -156,7 +157,7 @@ cbc_decr(krb5_key key, const krb5_data *ivec, static krb5_error_code cts_enc(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; size_t size = 0; @@ -177,7 +178,7 @@ cts_enc(krb5_key key, const krb5_data *ivec, tmp_len = input->length; AES_set_encrypt_key(key->keyblock.contents, - NUM_BITS * key->keyblock.length, &enck); + NUM_BITS * key->keyblock.length, &enck); size = CRYPTO_cts128_encrypt((unsigned char *)input->data, tmp_buf, input->length, &enck, @@ -201,7 +202,7 @@ cts_enc(krb5_key key, const krb5_data *ivec, static krb5_error_code cts_decr(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; size_t size = 0; @@ -222,7 +223,7 @@ cts_decr(krb5_key key, const krb5_data *ivec, tmp_len = input->length; AES_set_decrypt_key(key->keyblock.contents, - NUM_BITS * key->keyblock.length, &deck); + NUM_BITS * key->keyblock.length, &deck); size = CRYPTO_cts128_decrypt((unsigned char *)input->data, tmp_buf, input->length, &deck, @@ -246,9 +247,9 @@ cts_decr(krb5_key key, const krb5_data *ivec, static krb5_error_code cts_encr_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data, size_t dlen) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data, size_t dlen) { int ret = 0; int oblock_len = BLOCK_SIZE * num_data; @@ -285,20 +286,20 @@ cts_encr_iov(krb5_key key, tlen = 0; for (;;) { if (krb5int_c_iov_get_block(iblock, BLOCK_SIZE, - data, num_data, &input_pos)){ + data, num_data, &input_pos)){ memcpy(dbuf+tlen,iblock, BLOCK_SIZE); tlen += BLOCK_SIZE; - } else { + } else { memcpy(dbuf+tlen,iblock, dlen - tlen); break; - } + } if (tlen > dlen) break; } AES_set_encrypt_key(key->keyblock.contents, - NUM_BITS * key->keyblock.length, &enck); + NUM_BITS * key->keyblock.length, &enck); size = CRYPTO_cts128_encrypt((unsigned char *)dbuf, oblock, dlen, &enck, iv_cts, (cbc128_f)AES_cbc_encrypt); @@ -322,9 +323,9 @@ cts_encr_iov(krb5_key key, static krb5_error_code cts_decr_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data, size_t dlen) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data, size_t dlen) { int ret = 0; int oblock_len = BLOCK_SIZE*num_data; @@ -359,19 +360,19 @@ cts_decr_iov(krb5_key key, memset(dbuf, 0, dlen); AES_set_decrypt_key(key->keyblock.contents, - NUM_BITS * key->keyblock.length, &deck); + NUM_BITS * key->keyblock.length, &deck); tlen = 0; for (;;) { if (krb5int_c_iov_get_block(iblock, BLOCK_SIZE, - data, num_data, &input_pos)){ + data, num_data, &input_pos)){ memcpy(dbuf+tlen,iblock, BLOCK_SIZE); tlen += BLOCK_SIZE; - } else { + } else { memcpy(dbuf+tlen,iblock, dlen - tlen); break; - } + } if (tlen > dlen) break; } @@ -398,7 +399,7 @@ cts_decr_iov(krb5_key key, krb5_error_code krb5int_aes_encrypt(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0; @@ -413,7 +414,7 @@ krb5int_aes_encrypt(krb5_key key, const krb5_data *ivec, krb5_error_code krb5int_aes_decrypt(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0; int nblocks = 0; @@ -432,9 +433,9 @@ krb5int_aes_decrypt(krb5_key key, const krb5_data *ivec, static krb5_error_code krb5int_aes_encrypt_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data) { int ret = 0; int nblocks = 0; @@ -457,9 +458,9 @@ krb5int_aes_encrypt_iov(krb5_key key, static krb5_error_code krb5int_aes_decrypt_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data) { int ret = 0; int nblocks = 0; @@ -483,12 +484,12 @@ krb5int_aes_decrypt_iov(krb5_key key, static krb5_error_code krb5int_aes_init_state (const krb5_keyblock *key, krb5_keyusage usage, - krb5_data *state) + krb5_data *state) { state->length = 16; state->data = (void *) malloc(16); if (state->data == NULL) - return ENOMEM; + return ENOMEM; memset(state->data, 0, state->length); return 0; } diff --git a/src/lib/crypto/openssl/enc_provider/des.c b/src/lib/crypto/openssl/enc_provider/des.c index 9c30ef172c..5881291c94 100644 --- a/src/lib/crypto/openssl/enc_provider/des.c +++ b/src/lib/crypto/openssl/enc_provider/des.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/enc_provider/des.c * * Copyright (C) 2009 by the Massachusetts Institute of Technology. @@ -60,7 +61,7 @@ static krb5_error_code validate(krb5_key key, const krb5_data *ivec, - const krb5_data *input, const krb5_data *output) + const krb5_data *input, const krb5_data *output) { /* key->keyblock.enctype was checked by the caller */ if (key->keyblock.length != KRB5_MIT_DES_KEYSIZE) @@ -77,7 +78,7 @@ validate(krb5_key key, const krb5_data *ivec, static krb5_error_code validate_iov(krb5_key key, const krb5_data *ivec, - const krb5_crypto_iov *data, size_t num_data) + const krb5_crypto_iov *data, size_t num_data) { size_t i, input_length; @@ -99,7 +100,7 @@ validate_iov(krb5_key key, const krb5_data *ivec, static krb5_error_code k5_des_encrypt(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; unsigned int tmp_buf_len = 0; @@ -148,7 +149,7 @@ k5_des_encrypt(krb5_key key, const krb5_data *ivec, static krb5_error_code k5_des_decrypt(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { /* key->keyblock.enctype was checked by the caller */ int ret = 0, tmp_len = 0; @@ -194,9 +195,9 @@ k5_des_decrypt(krb5_key key, const krb5_data *ivec, static krb5_error_code k5_des_encrypt_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data) { int ret = 0, tmp_len = MIT_DES_BLOCK_LENGTH; int oblock_len = MIT_DES_BLOCK_LENGTH * num_data; @@ -268,9 +269,9 @@ k5_des_encrypt_iov(krb5_key key, static krb5_error_code k5_des_decrypt_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data) { int ret = 0; int tmp_len = MIT_DES_BLOCK_LENGTH; diff --git a/src/lib/crypto/openssl/enc_provider/des3.c b/src/lib/crypto/openssl/enc_provider/des3.c index 7228a46b2d..b299d3c290 100644 --- a/src/lib/crypto/openssl/enc_provider/des3.c +++ b/src/lib/crypto/openssl/enc_provider/des3.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/enc_provider/des3.c * * Copyright (C) 2009 by the Massachusetts Institute of Technology. @@ -59,47 +60,47 @@ static krb5_error_code validate(krb5_key key, const krb5_data *ivec, - const krb5_data *input, const krb5_data *output) + const krb5_data *input, const krb5_data *output) { /* key->keyblock.enctype was checked by the caller */ if (key->keyblock.length != KRB5_MIT_DES3_KEYSIZE) - return(KRB5_BAD_KEYSIZE); + return(KRB5_BAD_KEYSIZE); if ((input->length%DES_BLOCK_SIZE) != 0) - return(KRB5_BAD_MSIZE); + return(KRB5_BAD_MSIZE); if (ivec && (ivec->length != 8)) - return(KRB5_BAD_MSIZE); + return(KRB5_BAD_MSIZE); if (input->length != output->length) - return(KRB5_BAD_MSIZE); + return(KRB5_BAD_MSIZE); return 0; } static krb5_error_code validate_iov(krb5_key key, const krb5_data *ivec, - const krb5_crypto_iov *data, size_t num_data) + const krb5_crypto_iov *data, size_t num_data) { size_t i, input_length; for (i = 0, input_length = 0; i < num_data; i++) { - const krb5_crypto_iov *iov = &data[i]; - if (ENCRYPT_IOV(iov)) - input_length += iov->data.length; + const krb5_crypto_iov *iov = &data[i]; + if (ENCRYPT_IOV(iov)) + input_length += iov->data.length; } if (key->keyblock.length != KRB5_MIT_DES3_KEYSIZE) - return(KRB5_BAD_KEYSIZE); + return(KRB5_BAD_KEYSIZE); if ((input_length%DES_BLOCK_SIZE) != 0) - return(KRB5_BAD_MSIZE); + return(KRB5_BAD_MSIZE); if (ivec && (ivec->length != 8)) - return(KRB5_BAD_MSIZE); + return(KRB5_BAD_MSIZE); return 0; } static krb5_error_code k5_des3_encrypt(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; unsigned int tmp_buf_len = 0; @@ -108,7 +109,7 @@ k5_des3_encrypt(krb5_key key, const krb5_data *ivec, ret = validate(key, ivec, input, output); if (ret) - return ret; + return ret; tmp_buf_len = output->length * 2; tmp_buf = OPENSSL_malloc(tmp_buf_len); @@ -148,7 +149,7 @@ k5_des3_encrypt(krb5_key key, const krb5_data *ivec, static krb5_error_code k5_des3_decrypt(krb5_key key, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; unsigned int tmp_buf_len = 0; @@ -157,7 +158,7 @@ k5_des3_decrypt(krb5_key key, const krb5_data *ivec, ret = validate(key, ivec, input, output); if (ret) - return ret; + return ret; tmp_buf_len = output->length; @@ -197,9 +198,9 @@ k5_des3_decrypt(krb5_key key, const krb5_data *ivec, static krb5_error_code k5_des3_encrypt_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data) { int ret = 0; int tmp_len = MIT_DES_BLOCK_LENGTH; @@ -258,7 +259,7 @@ k5_des3_encrypt_iov(krb5_key key, if(ret) { /*if (ivec != NULL && ivec->data) - memcpy(ivec->data, oblock, MIT_DES_BLOCK_LENGTH); */ + memcpy(ivec->data, oblock, MIT_DES_BLOCK_LENGTH); */ ret = EVP_EncryptFinal_ex(&ciph_ctx, oblock+input_pos.data_pos, &tmp_len); } @@ -276,9 +277,9 @@ k5_des3_encrypt_iov(krb5_key key, static krb5_error_code k5_des3_decrypt_iov(krb5_key key, - const krb5_data *ivec, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *ivec, + krb5_crypto_iov *data, + size_t num_data) { int ret = 0; int tmp_len = MIT_DES_BLOCK_LENGTH; @@ -337,7 +338,7 @@ k5_des3_decrypt_iov(krb5_key key, if(ret) { /*if (ivec != NULL && ivec->data) - memcpy(ivec->data, oblock, MIT_DES_BLOCK_LENGTH); */ + memcpy(ivec->data, oblock, MIT_DES_BLOCK_LENGTH); */ ret = EVP_DecryptFinal_ex(&ciph_ctx, oblock + input_pos.data_pos, &tmp_len); } diff --git a/src/lib/crypto/openssl/enc_provider/enc_provider.h b/src/lib/crypto/openssl/enc_provider/enc_provider.h index 49ffaafeac..8144b6533e 100644 --- a/src/lib/crypto/openssl/enc_provider/enc_provider.h +++ b/src/lib/crypto/openssl/enc_provider/enc_provider.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 1998 by the FundsXpress, INC. * diff --git a/src/lib/crypto/openssl/enc_provider/rc4.c b/src/lib/crypto/openssl/enc_provider/rc4.c index b5e69ff672..edfbb32183 100644 --- a/src/lib/crypto/openssl/enc_provider/rc4.c +++ b/src/lib/crypto/openssl/enc_provider/rc4.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/enc_provider/rc4.c * * #include STD_DISCLAIMER @@ -61,12 +62,12 @@ typedef struct { /* prototypes */ static krb5_error_code k5_arcfour_docrypt(krb5_key, const krb5_data *, - const krb5_data *, krb5_data *); + const krb5_data *, krb5_data *); static krb5_error_code k5_arcfour_free_state ( krb5_data *state); static krb5_error_code k5_arcfour_init_state (const krb5_keyblock *key, - krb5_keyusage keyusage, krb5_data *new_state); + krb5_keyusage keyusage, krb5_data *new_state); /* The workhorse of the arcfour system, * this impliments the cipher @@ -75,7 +76,7 @@ k5_arcfour_init_state (const krb5_keyblock *key, /* In-place rc4 crypto */ static krb5_error_code k5_arcfour_docrypt(krb5_key key, const krb5_data *state, - const krb5_data *input, krb5_data *output) + const krb5_data *input, krb5_data *output) { int ret = 0, tmp_len = 0; unsigned char *tmp_buf = NULL; @@ -114,9 +115,9 @@ k5_arcfour_docrypt(krb5_key key, const krb5_data *state, /* In-place IOV crypto */ static krb5_error_code k5_arcfour_docrypt_iov(krb5_key key, - const krb5_data *state, - krb5_crypto_iov *data, - size_t num_data) + const krb5_data *state, + krb5_crypto_iov *data, + size_t num_data) { size_t i; int ret = 0, tmp_len = 0; @@ -141,8 +142,8 @@ k5_arcfour_docrypt_iov(krb5_key key, if (ENCRYPT_IOV(iov)) { tmp_buf=(unsigned char *)iov->data.data; ret = EVP_EncryptUpdate(&ciph_ctx, - tmp_buf, &tmp_len, - (unsigned char *)iov->data.data, iov->data.length); + tmp_buf, &tmp_len, + (unsigned char *)iov->data.data, iov->data.length); if (!ret) break; iov->data.length = tmp_len; } @@ -163,14 +164,14 @@ k5_arcfour_docrypt_iov(krb5_key key, static krb5_error_code k5_arcfour_free_state ( krb5_data *state) { - return 0; /* not implemented */ + return 0; /* not implemented */ } static krb5_error_code k5_arcfour_init_state (const krb5_keyblock *key, krb5_keyusage keyusage, krb5_data *new_state) { - return 0; /* not implemented */ + return 0; /* not implemented */ } diff --git a/src/lib/crypto/openssl/hash_provider/hash_crc32.c b/src/lib/crypto/openssl/hash_provider/hash_crc32.c index 771a7d6f32..e748c98cfe 100644 --- a/src/lib/crypto/openssl/hash_provider/hash_crc32.c +++ b/src/lib/crypto/openssl/hash_provider/hash_crc32.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 1998 by the FundsXpress, INC. * @@ -30,18 +31,18 @@ static krb5_error_code k5_crc32_hash(unsigned int icount, const krb5_data *input, - krb5_data *output) + krb5_data *output) { unsigned long c, cn; unsigned int i; if (output->length != CRC32_CKSUM_LENGTH) - return(KRB5_CRYPTO_INTERNAL); + return(KRB5_CRYPTO_INTERNAL); c = 0; for (i=0; i<icount; i++) { - mit_crc32(input[i].data, input[i].length, &cn); - c ^= cn; + mit_crc32(input[i].data, input[i].length, &cn); + c ^= cn; } store_32_le(c, output->data); diff --git a/src/lib/crypto/openssl/hash_provider/hash_md4.c b/src/lib/crypto/openssl/hash_provider/hash_md4.c index 916da0fa5f..3a7d0d4802 100644 --- a/src/lib/crypto/openssl/hash_provider/hash_md4.c +++ b/src/lib/crypto/openssl/hash_provider/hash_md4.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 1998 by the FundsXpress, INC. * @@ -30,17 +31,17 @@ static krb5_error_code k5_md4_hash(unsigned int icount, const krb5_data *input, - krb5_data *output) + krb5_data *output) { krb5_MD4_CTX ctx; unsigned int i; if (output->length != RSA_MD4_CKSUM_LENGTH) - return(KRB5_CRYPTO_INTERNAL); + return(KRB5_CRYPTO_INTERNAL); krb5int_MD4Init(&ctx); for (i=0; i<icount; i++) - krb5int_MD4Update(&ctx, (unsigned char *) input[i].data, input[i].length); + krb5int_MD4Update(&ctx, (unsigned char *) input[i].data, input[i].length); krb5int_MD4Final(&ctx); memcpy(output->data, ctx.digest, RSA_MD4_CKSUM_LENGTH); diff --git a/src/lib/crypto/openssl/hash_provider/hash_md5.c b/src/lib/crypto/openssl/hash_provider/hash_md5.c index e1e29f06e1..610e414cee 100644 --- a/src/lib/crypto/openssl/hash_provider/hash_md5.c +++ b/src/lib/crypto/openssl/hash_provider/hash_md5.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 1998 by the FundsXpress, INC. * @@ -30,17 +31,17 @@ static krb5_error_code k5_md5_hash(unsigned int icount, const krb5_data *input, - krb5_data *output) + krb5_data *output) { krb5_MD5_CTX ctx; unsigned int i; if (output->length != RSA_MD5_CKSUM_LENGTH) - return(KRB5_CRYPTO_INTERNAL); + return(KRB5_CRYPTO_INTERNAL); krb5int_MD5Init(&ctx); for (i=0; i<icount; i++) - krb5int_MD5Update(&ctx, (unsigned char *) input[i].data, input[i].length); + krb5int_MD5Update(&ctx, (unsigned char *) input[i].data, input[i].length); krb5int_MD5Final(&ctx); memcpy(output->data, ctx.digest, RSA_MD5_CKSUM_LENGTH); diff --git a/src/lib/crypto/openssl/hash_provider/hash_provider.h b/src/lib/crypto/openssl/hash_provider/hash_provider.h index 1023d1a458..eebe84588c 100644 --- a/src/lib/crypto/openssl/hash_provider/hash_provider.h +++ b/src/lib/crypto/openssl/hash_provider/hash_provider.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 1998 by the FundsXpress, INC. * diff --git a/src/lib/crypto/openssl/hash_provider/hash_sha1.c b/src/lib/crypto/openssl/hash_provider/hash_sha1.c index 18ee830f60..a914e349f3 100644 --- a/src/lib/crypto/openssl/hash_provider/hash_sha1.c +++ b/src/lib/crypto/openssl/hash_provider/hash_sha1.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/hash/yhash.h * * Copyright (C) 1998 by the FundsXpress, INC. @@ -31,17 +32,17 @@ static krb5_error_code k5_sha1_hash(unsigned int icount, const krb5_data *input, - krb5_data *output) + krb5_data *output) { SHS_INFO ctx; unsigned int i; if (output->length != SHS_DIGESTSIZE) - return(KRB5_CRYPTO_INTERNAL); + return(KRB5_CRYPTO_INTERNAL); shsInit(&ctx); for (i=0; i<icount; i++) - shsUpdate(&ctx, (unsigned char *) input[i].data, input[i].length); + shsUpdate(&ctx, (unsigned char *) input[i].data, input[i].length); shsFinal(&ctx); if (ctx.digestLen > 0 && ctx.digestLen <= output->length){ diff --git a/src/lib/crypto/openssl/hmac.c b/src/lib/crypto/openssl/hmac.c index b1768e0e95..425223d034 100644 --- a/src/lib/crypto/openssl/hmac.c +++ b/src/lib/crypto/openssl/hmac.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/hmac.c * * Copyright (C) 2009 by the Massachusetts Institute of Technology. @@ -82,8 +83,8 @@ map_digest(const struct krb5_hash_provider *hash) krb5_error_code krb5int_hmac_keyblock(const struct krb5_hash_provider *hash, - const krb5_keyblock *key, unsigned int icount, - const krb5_data *input, krb5_data *output) + const krb5_keyblock *key, unsigned int icount, + const krb5_data *input, krb5_data *output) { unsigned int i = 0, md_len = 0; unsigned char md[EVP_MAX_MD_SIZE]; @@ -162,16 +163,16 @@ krb5int_hmac_iov_keyblock(const struct krb5_hash_provider *hash, krb5_error_code krb5int_hmac(const struct krb5_hash_provider *hash, krb5_key key, - unsigned int icount, const krb5_data *input, krb5_data *output) + unsigned int icount, const krb5_data *input, krb5_data *output) { return krb5int_hmac_keyblock(hash, &key->keyblock, icount, input, output); } krb5_error_code krb5int_hmac_iov(const struct krb5_hash_provider *hash, krb5_key key, - const krb5_crypto_iov *data, size_t num_data, - krb5_data *output) + const krb5_crypto_iov *data, size_t num_data, + krb5_data *output) { return krb5int_hmac_iov_keyblock(hash, &key->keyblock, data, num_data, - output); + output); } diff --git a/src/lib/crypto/openssl/md4/md4.c b/src/lib/crypto/openssl/md4/md4.c index cd7684d668..8d2cd48a2e 100644 --- a/src/lib/crypto/openssl/md4/md4.c +++ b/src/lib/crypto/openssl/md4/md4.c @@ -1,5 +1,6 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* - * lib/crypto/openssl/md4/md4.c + * lib/crypto/openssl/md4/md4.c * * Copyright (C) 2009 by the Massachusetts Institute of Technology. * All rights reserved. diff --git a/src/lib/crypto/openssl/md4/rsa-md4.h b/src/lib/crypto/openssl/md4/rsa-md4.h index 93737e68b7..3d32f08577 100644 --- a/src/lib/crypto/openssl/md4/rsa-md4.h +++ b/src/lib/crypto/openssl/md4/rsa-md4.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/md4/rsa-md4.h * @@ -45,37 +46,37 @@ #define RSA_MD4_DES_CONFOUND_LENGTH 8 /* - ********************************************************************** - ** md4.h -- Header file for implementation of MD4 ** - ** RSA Data Security, Inc. MD4 Message Digest Algorithm ** - ** Created: 2/17/90 RLR ** - ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** - ********************************************************************** - */ +********************************************************************** +** md4.h -- Header file for implementation of MD4 ** +** RSA Data Security, Inc. MD4 Message Digest Algorithm ** +** Created: 2/17/90 RLR ** +** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** +********************************************************************** +*/ /* - ********************************************************************** - ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** - ** ** - ** License to copy and use this software is granted provided that ** - ** it is identified as the "RSA Data Security, Inc. MD4 Message ** - ** Digest Algorithm" in all material mentioning or referencing this ** - ** software or this function. ** - ** ** - ** License is also granted to make and use derivative works ** - ** provided that such works are identified as "derived from the RSA ** - ** Data Security, Inc. MD4 Message Digest Algorithm" in all ** - ** material mentioning or referencing the derived work. ** - ** ** - ** RSA Data Security, Inc. makes no representations concerning ** - ** either the merchantability of this software or the suitability ** - ** of this software for any particular purpose. It is provided "as ** - ** is" without express or implied warranty of any kind. ** - ** ** - ** These notices must be retained in any copies of any part of this ** - ** documentation and/or software. ** - ********************************************************************** - */ +********************************************************************** +** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** +** ** +** License to copy and use this software is granted provided that ** +** it is identified as the "RSA Data Security, Inc. MD4 Message ** +** Digest Algorithm" in all material mentioning or referencing this ** +** software or this function. ** +** ** +** License is also granted to make and use derivative works ** +** provided that such works are identified as "derived from the RSA ** +** Data Security, Inc. MD4 Message Digest Algorithm" in all ** +** material mentioning or referencing the derived work. ** +** ** +** RSA Data Security, Inc. makes no representations concerning ** +** either the merchantability of this software or the suitability ** +** of this software for any particular purpose. It is provided "as ** +** is" without express or implied warranty of any kind. ** +** ** +** These notices must be retained in any copies of any part of this ** +** documentation and/or software. ** +********************************************************************** +*/ /* Data structure for MD4 (Message Digest) computation */ typedef struct { @@ -92,8 +93,8 @@ extern void krb5int_MD4Update(krb5_MD4_CTX *, const unsigned char *, unsigned in extern void krb5int_MD4Final(krb5_MD4_CTX *); /* - ********************************************************************** - ** End of md4.h ** - ******************************* (cut) ******************************** - */ +********************************************************************** +** End of md4.h ** +******************************* (cut) ******************************** +*/ #endif /* __KRB5_RSA_MD4_H__ */ diff --git a/src/lib/crypto/openssl/md5/md5.c b/src/lib/crypto/openssl/md5/md5.c index 84c6d49192..41a8498f36 100644 --- a/src/lib/crypto/openssl/md5/md5.c +++ b/src/lib/crypto/openssl/md5/md5.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/md5/md5.c * * Copyright (C) 2009 by the Massachusetts Institute of Technology. @@ -30,7 +31,7 @@ /* The routine krb5int_MD5Init initializes the message-digest context mdContext. All fields are set to zero. - */ +*/ void krb5int_MD5Init (krb5_MD5_CTX *mdContext) { @@ -41,7 +42,7 @@ krb5int_MD5Init (krb5_MD5_CTX *mdContext) /* The routine krb5int_MD5Update updates the message-digest context to account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. - */ +*/ void krb5int_MD5Update (krb5_MD5_CTX *mdContext, const unsigned char *inBuf, unsigned int inLen) { @@ -50,7 +51,7 @@ krb5int_MD5Update (krb5_MD5_CTX *mdContext, const unsigned char *inBuf, unsigned /* The routine krb5int_MD5Final terminates the message-digest computation and ends with the desired message digest in mdContext->digest[0...15]. - */ +*/ void krb5int_MD5Final (krb5_MD5_CTX *mdContext) { diff --git a/src/lib/crypto/openssl/md5/rsa-md5.h b/src/lib/crypto/openssl/md5/rsa-md5.h index c9a5f9074c..a8380f4498 100644 --- a/src/lib/crypto/openssl/md5/rsa-md5.h +++ b/src/lib/crypto/openssl/md5/rsa-md5.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/md5/rsa-md5.h * * Copyright (C) 2009 by the Massachusetts Institute of Technology. @@ -24,43 +25,43 @@ */ /* - *********************************************************************** - ** md5.h -- header file for implementation of MD5 ** - ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** - ** Created: 2/17/90 RLR ** - ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** - ** Revised (for MD5): RLR 4/27/91 ** - ** -- G modified to have y&~z instead of y&z ** - ** -- FF, GG, HH modified to add in last register done ** - ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** - ** -- distinct additive constant for each step ** - ** -- round 4 added, working mod 7 ** - *********************************************************************** - */ +*********************************************************************** +** md5.h -- header file for implementation of MD5 ** +** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** +** Created: 2/17/90 RLR ** +** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** +** Revised (for MD5): RLR 4/27/91 ** +** -- G modified to have y&~z instead of y&z ** +** -- FF, GG, HH modified to add in last register done ** +** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** +** -- distinct additive constant for each step ** +** -- round 4 added, working mod 7 ** +*********************************************************************** +*/ /* - *********************************************************************** - ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** - ** ** - ** License to copy and use this software is granted provided that ** - ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** - ** Digest Algorithm" in all material mentioning or referencing this ** - ** software or this function. ** - ** ** - ** License is also granted to make and use derivative works ** - ** provided that such works are identified as "derived from the RSA ** - ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** - ** material mentioning or referencing the derived work. ** - ** ** - ** RSA Data Security, Inc. makes no representations concerning ** - ** either the merchantability of this software or the suitability ** - ** of this software for any particular purpose. It is provided "as ** - ** is" without express or implied warranty of any kind. ** - ** ** - ** These notices must be retained in any copies of any part of this ** - ** documentation and/or software. ** - *********************************************************************** - */ +*********************************************************************** +** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** +** ** +** License to copy and use this software is granted provided that ** +** it is identified as the "RSA Data Security, Inc. MD5 Message- ** +** Digest Algorithm" in all material mentioning or referencing this ** +** software or this function. ** +** ** +** License is also granted to make and use derivative works ** +** provided that such works are identified as "derived from the RSA ** +** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** +** material mentioning or referencing the derived work. ** +** ** +** RSA Data Security, Inc. makes no representations concerning ** +** either the merchantability of this software or the suitability ** +** of this software for any particular purpose. It is provided "as ** +** is" without express or implied warranty of any kind. ** +** ** +** These notices must be retained in any copies of any part of this ** +** documentation and/or software. ** +*********************************************************************** +*/ #ifndef KRB5_RSA_MD5__ diff --git a/src/lib/crypto/openssl/pbkdf2.c b/src/lib/crypto/openssl/pbkdf2.c index 2681739a5c..e64e562e76 100644 --- a/src/lib/crypto/openssl/pbkdf2.c +++ b/src/lib/crypto/openssl/pbkdf2.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/crypto/openssl/pbkdf2.c * @@ -39,13 +40,13 @@ krb5_error_code krb5int_pbkdf2_hmac_sha1 (const krb5_data *out, unsigned long count, - const krb5_data *pass, const krb5_data *salt) + const krb5_data *pass, const krb5_data *salt) { /* * This is an implementation of PKCS#5 v2.0 * Does not return an error */ - PKCS5_PBKDF2_HMAC_SHA1(pass->data, pass->length, + PKCS5_PBKDF2_HMAC_SHA1(pass->data, pass->length, (unsigned char *)salt->data, salt->length, count, out->length, (unsigned char *)out->data); return 0; diff --git a/src/lib/crypto/openssl/sha1/shs.c b/src/lib/crypto/openssl/sha1/shs.c index 98eeef39a6..42d260d3d3 100644 --- a/src/lib/crypto/openssl/sha1/shs.c +++ b/src/lib/crypto/openssl/sha1/shs.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/sha1/shs.c * * Copyright (C) 2009 by the Massachusetts Institute of Technology. diff --git a/src/lib/crypto/openssl/sha1/shs.h b/src/lib/crypto/openssl/sha1/shs.h index 88ab172875..60cf2ad2c7 100644 --- a/src/lib/crypto/openssl/sha1/shs.h +++ b/src/lib/crypto/openssl/sha1/shs.h @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ #ifndef _SHS_DEFINED #include "k5-int.h" @@ -8,8 +9,8 @@ /* Some useful types */ -typedef krb5_octet SHS_BYTE; -typedef krb5_ui_4 SHS_LONG; +typedef krb5_octet SHS_BYTE; +typedef krb5_ui_4 SHS_LONG; /* Define the following to use the updated SHS implementation */ #define NEW_SHS /**/ @@ -35,13 +36,13 @@ void shsFinal(SHS_INFO *shsInfo); /* Keyed Message digest functions (hmac_sha.c) */ krb5_error_code hmac_sha(krb5_octet *text, - int text_len, - krb5_octet *key, - int key_len, - krb5_octet *digest); + int text_len, + krb5_octet *key, + int key_len, + krb5_octet *digest); -#define NIST_SHA_CKSUM_LENGTH SHS_DIGESTSIZE -#define HMAC_SHA_CKSUM_LENGTH SHS_DIGESTSIZE +#define NIST_SHA_CKSUM_LENGTH SHS_DIGESTSIZE +#define HMAC_SHA_CKSUM_LENGTH SHS_DIGESTSIZE #endif /* _SHS_DEFINED */ diff --git a/src/lib/crypto/openssl/yhash.h b/src/lib/crypto/openssl/yhash.h index 95fee18c97..151818f3a4 100644 --- a/src/lib/crypto/openssl/yhash.h +++ b/src/lib/crypto/openssl/yhash.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; c-file-style: "bsd" -*- */ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/crypto/openssl/hash/yhash.h */ @@ -16,13 +16,13 @@ #define HASH_Init(x) shsInit(x) #define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz) -#define HASH_Final(x, tdigest) do { \ - int loopvar; \ - unsigned char *out2 = (void *)(tdigest); \ - HASH_CTX *ctx = (x); \ - shsFinal(ctx); \ - memcpy(out2, ctx->digestBuf, ctx->digestLen); \ - } while(0) +#define HASH_Final(x, tdigest) do { \ + int loopvar; \ + unsigned char *out2 = (void *)(tdigest); \ + HASH_CTX *ctx = (x); \ + shsFinal(ctx); \ + memcpy(out2, ctx->digestBuf, ctx->digestLen); \ + } while(0) #define HASH_DIGEST_SIZE SHS_DIGESTSIZE |
