svn rev #24681: trunk/src/lib/crypto/krb/
ghudson@MIT.EDU
ghudson at MIT.EDU
Sat Mar 5 08:51:00 EST 2011
http://src.mit.edu/fisheye/changelog/krb5/?cs=24681
Commit By: ghudson
Log Message:
Remove the init_state and free_state enctype functions and go back to
always delegating state to the enc provider. (We needed enctype-
specific state initialization for CCM enctypes when we had them.)
Changed Files:
U trunk/src/lib/crypto/krb/crypto_int.h
U trunk/src/lib/crypto/krb/etypes.c
U trunk/src/lib/crypto/krb/state.c
Modified: trunk/src/lib/crypto/krb/crypto_int.h
===================================================================
--- trunk/src/lib/crypto/krb/crypto_int.h 2011-03-05 13:36:53 UTC (rev 24680)
+++ trunk/src/lib/crypto/krb/crypto_int.h 2011-03-05 13:51:00 UTC (rev 24681)
@@ -95,14 +95,6 @@
krb5_key key,
const krb5_data *in, krb5_data *out);
-typedef krb5_error_code (*init_state_func)(const struct krb5_keytypes *ktp,
- const krb5_keyblock *key,
- krb5_keyusage keyusage,
- krb5_data *out_state);
-
-typedef void (*free_state_func)(const struct krb5_keytypes *ktp,
- krb5_data *state);
-
struct krb5_keytypes {
krb5_enctype etype;
char *name;
@@ -117,8 +109,6 @@
str2key_func str2key;
rand2key_func rand2key;
prf_func prf;
- init_state_func init_state;
- free_state_func free_state;
krb5_cksumtype required_ctype;
krb5_flags flags;
};
@@ -291,14 +281,6 @@
krb5_key key, const krb5_data *in,
krb5_data *out);
-/* State initialization/cleanup handlers */
-krb5_error_code krb5int_init_state_enc(const struct krb5_keytypes *ktp,
- const krb5_keyblock *key,
- krb5_keyusage keyusage,
- krb5_data *out_state);
-void krb5int_free_state_enc(const struct krb5_keytypes *ktp,
- krb5_data *state);
-
/*** Prototypes for cksumtype handler functions ***/
krb5_error_code krb5int_unkeyed_checksum(const struct krb5_cksumtypes *ctp,
Modified: trunk/src/lib/crypto/krb/etypes.c
===================================================================
--- trunk/src/lib/crypto/krb/etypes.c 2011-03-05 13:36:53 UTC (rev 24680)
+++ trunk/src/lib/crypto/krb/etypes.c 2011-03-05 13:51:00 UTC (rev 24681)
@@ -41,7 +41,6 @@
krb5int_old_crypto_length, krb5int_old_encrypt, krb5int_old_decrypt,
krb5int_des_string_to_key, k5_rand2key_des,
krb5int_des_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_RSA_MD5_DES,
ETYPE_WEAK },
{ ENCTYPE_DES_CBC_MD4,
@@ -51,7 +50,6 @@
krb5int_old_crypto_length, krb5int_old_encrypt, krb5int_old_decrypt,
krb5int_des_string_to_key, k5_rand2key_des,
krb5int_des_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_RSA_MD4_DES,
ETYPE_WEAK },
{ ENCTYPE_DES_CBC_MD5,
@@ -61,7 +59,6 @@
krb5int_old_crypto_length, krb5int_old_encrypt, krb5int_old_decrypt,
krb5int_des_string_to_key, k5_rand2key_des,
krb5int_des_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_RSA_MD5_DES,
ETYPE_WEAK },
{ ENCTYPE_DES_CBC_RAW,
@@ -71,7 +68,6 @@
krb5int_raw_crypto_length, krb5int_raw_encrypt, krb5int_raw_decrypt,
krb5int_des_string_to_key, k5_rand2key_des,
krb5int_des_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
0,
ETYPE_WEAK },
{ ENCTYPE_DES3_CBC_RAW,
@@ -81,7 +77,6 @@
krb5int_raw_crypto_length, krb5int_raw_encrypt, krb5int_raw_decrypt,
krb5int_dk_string_to_key, k5_rand2key_des3,
NULL, /*PRF*/
- krb5int_init_state_enc, krb5int_free_state_enc,
0,
ETYPE_WEAK },
@@ -93,7 +88,6 @@
krb5int_dk_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt,
krb5int_dk_string_to_key, k5_rand2key_des3,
krb5int_dk_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_HMAC_SHA1_DES3,
0 /*flags*/ },
@@ -104,7 +98,6 @@
krb5int_dk_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt,
krb5int_dk_string_to_key, k5_rand2key_des,
NULL, /*PRF*/
- krb5int_init_state_enc, krb5int_free_state_enc,
0,
ETYPE_WEAK },
{ ENCTYPE_ARCFOUR_HMAC,
@@ -116,7 +109,6 @@
krb5int_arcfour_crypto_length, krb5int_arcfour_encrypt,
krb5int_arcfour_decrypt, krb5int_arcfour_string_to_key,
k5_rand2key_direct, krb5int_arcfour_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_HMAC_MD5_ARCFOUR,
0 /*flags*/ },
{ ENCTYPE_ARCFOUR_HMAC_EXP,
@@ -128,7 +120,6 @@
krb5int_arcfour_crypto_length, krb5int_arcfour_encrypt,
krb5int_arcfour_decrypt, krb5int_arcfour_string_to_key,
k5_rand2key_direct, krb5int_arcfour_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_HMAC_MD5_ARCFOUR,
ETYPE_WEAK
},
@@ -141,7 +132,6 @@
krb5int_aes_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt,
krb5int_aes_string_to_key, k5_rand2key_direct,
krb5int_dk_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_HMAC_SHA1_96_AES128,
0 /*flags*/ },
{ ENCTYPE_AES256_CTS_HMAC_SHA1_96,
@@ -152,7 +142,6 @@
krb5int_aes_crypto_length, krb5int_dk_encrypt, krb5int_dk_decrypt,
krb5int_aes_string_to_key, k5_rand2key_direct,
krb5int_dk_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_HMAC_SHA1_96_AES256,
0 /*flags*/ },
#ifdef CAMELLIA
@@ -165,7 +154,6 @@
krb5int_dk_cmac_encrypt, krb5int_dk_cmac_decrypt,
krb5int_camellia_string_to_key, k5_rand2key_direct,
krb5int_dk_cmac_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_CMAC_CAMELLIA128,
0 /*flags*/ },
{ ENCTYPE_CAMELLIA256_CTS_CMAC,
@@ -177,7 +165,6 @@
krb5int_dk_cmac_encrypt, krb5int_dk_cmac_decrypt,
krb5int_camellia_string_to_key, k5_rand2key_direct,
krb5int_dk_cmac_prf,
- krb5int_init_state_enc, krb5int_free_state_enc,
CKSUMTYPE_CMAC_CAMELLIA256,
0 /*flags */ },
#endif /* CAMELLIA */
Modified: trunk/src/lib/crypto/krb/state.c
===================================================================
--- trunk/src/lib/crypto/krb/state.c 2011-03-05 13:36:53 UTC (rev 24680)
+++ trunk/src/lib/crypto/krb/state.c 2011-03-05 13:51:00 UTC (rev 24681)
@@ -35,22 +35,6 @@
*/
#include "crypto_int.h"
-/* Most enctypes delegate cipher state handling to the enc provider by using
- * this function as their init_state methods. */
-krb5_error_code
-krb5int_init_state_enc(const struct krb5_keytypes *ktp,
- const krb5_keyblock *key, krb5_keyusage keyusage,
- krb5_data *out_state)
-{
- return ktp->enc->init_state(key, keyusage, out_state);
-}
-
-void
-krb5int_free_state_enc(const struct krb5_keytypes *ktp, krb5_data *state)
-{
- (void)ktp->enc->free_state(state);
-}
-
krb5_error_code KRB5_CALLCONV
krb5_c_init_state (krb5_context context, const krb5_keyblock *key,
krb5_keyusage keyusage, krb5_data *new_state)
@@ -60,7 +44,7 @@
ktp = find_enctype(key->enctype);
if (ktp == NULL)
return KRB5_BAD_ENCTYPE;
- return ktp->init_state(ktp, key, keyusage, new_state);
+ return ktp->enc->init_state(key, keyusage, new_state);
}
krb5_error_code KRB5_CALLCONV
@@ -72,6 +56,6 @@
ktp = find_enctype(key->enctype);
if (ktp == NULL)
return KRB5_BAD_ENCTYPE;
- ktp->free_state(ktp, state);
+ ktp->enc->free_state(state);
return 0;
}
More information about the cvs-krb5
mailing list