simplify
This commit is contained in:

committed by
Love Hörnquist Åstrand

parent
7e1468ca52
commit
7635eee8c4
@@ -36,38 +36,36 @@
|
|||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
_krb5_fast_cf2(krb5_context context,
|
_krb5_fast_cf2(krb5_context context,
|
||||||
krb5_keyblock *sessionkey,
|
krb5_keyblock *key1,
|
||||||
const char *sessionpepper,
|
const char *pepper1,
|
||||||
krb5_keyblock *subkey,
|
krb5_keyblock *key2,
|
||||||
const char *subkeypepper,
|
const char *pepper2,
|
||||||
krb5_keyblock *armorkey,
|
krb5_keyblock *armorkey,
|
||||||
krb5_crypto *armor_crypto)
|
krb5_crypto *armor_crypto)
|
||||||
{
|
{
|
||||||
krb5_crypto crypto_subkey, crypto_session;
|
krb5_crypto crypto1, crypto2;
|
||||||
krb5_data pepper1, pepper2;
|
krb5_data pa1, pa2;
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
|
|
||||||
ret = krb5_crypto_init(context, subkey, 0, &crypto_subkey);
|
ret = krb5_crypto_init(context, key1, 0, &crypto1);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = krb5_crypto_init(context, sessionkey, 0, &crypto_session);
|
ret = krb5_crypto_init(context, key2, 0, &crypto2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
krb5_crypto_destroy(context, crypto_subkey);
|
krb5_crypto_destroy(context, crypto1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
pepper1.data = rk_UNCONST(sessionpepper);
|
pa1.data = rk_UNCONST(pepper1);
|
||||||
pepper1.length = strlen(sessionpepper);
|
pa1.length = strlen(pepper1);
|
||||||
pepper2.data = rk_UNCONST(subkeypepper);
|
pa2.data = rk_UNCONST(pepper2);
|
||||||
pepper2.length = strlen(subkeypepper);
|
pa2.length = strlen(pepper2);
|
||||||
|
|
||||||
ret = krb5_crypto_fx_cf2(context, crypto_subkey, crypto_session,
|
ret = krb5_crypto_fx_cf2(context, crypto1, crypto2, &pa1, &pa2,
|
||||||
&pepper1, &pepper2,
|
key1->keytype, armorkey);
|
||||||
subkey->keytype,
|
krb5_crypto_destroy(context, crypto1);
|
||||||
armorkey);
|
krb5_crypto_destroy(context, crypto2);
|
||||||
krb5_crypto_destroy(context, crypto_subkey);
|
|
||||||
krb5_crypto_destroy(context, crypto_session);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -82,16 +80,16 @@ _krb5_fast_cf2(krb5_context context,
|
|||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
_krb5_fast_armor_key(krb5_context context,
|
_krb5_fast_armor_key(krb5_context context,
|
||||||
krb5_keyblock *sessionkey,
|
|
||||||
krb5_keyblock *subkey,
|
krb5_keyblock *subkey,
|
||||||
|
krb5_keyblock *sessionkey,
|
||||||
krb5_keyblock *armorkey,
|
krb5_keyblock *armorkey,
|
||||||
krb5_crypto *armor_crypto)
|
krb5_crypto *armor_crypto)
|
||||||
{
|
{
|
||||||
return _krb5_fast_cf2(context,
|
return _krb5_fast_cf2(context,
|
||||||
sessionkey,
|
|
||||||
"ticketarmor",
|
|
||||||
subkey,
|
subkey,
|
||||||
"subkeyarmor",
|
"subkeyarmor",
|
||||||
|
sessionkey,
|
||||||
|
"ticketarmor",
|
||||||
armorkey,
|
armorkey,
|
||||||
armor_crypto);
|
armor_crypto);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user