remove (krb5_enctype) cast for ETYPE_xxx

Now that ETYPE_xxx names are macros to the KRB5_ENCTYPE_xxx
symbols there is no longer a need to cast to (krb5_enctype).

Change-Id: Ib561f6e45346abac7a53eb1db0bfef60ee3bcb74
This commit is contained in:
Jeffrey Altman
2022-01-15 21:48:11 -05:00
committed by Jeffrey Altman
parent 90e51a3d18
commit 1685c34b0d
9 changed files with 17 additions and 17 deletions

View File

@@ -95,9 +95,9 @@ _kdc_is_weak_exception(krb5_principal principal, krb5_enctype etype)
{ {
if (principal->name.name_string.len > 0 && if (principal->name.name_string.len > 0 &&
strcmp(principal->name.name_string.val[0], "afs") == 0 && strcmp(principal->name.name_string.val[0], "afs") == 0 &&
(etype == (krb5_enctype)ETYPE_DES_CBC_CRC (etype == ETYPE_DES_CBC_CRC
|| etype == (krb5_enctype)ETYPE_DES_CBC_MD4 || etype == ETYPE_DES_CBC_MD4
|| etype == (krb5_enctype)ETYPE_DES_CBC_MD5)) || etype == ETYPE_DES_CBC_MD5))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
@@ -165,7 +165,7 @@ _kdc_find_etype(astgs_request_t r, uint32_t flags,
krb5_principal request_princ; krb5_principal request_princ;
krb5_error_code ret; krb5_error_code ret;
krb5_salt def_salt; krb5_salt def_salt;
krb5_enctype enctype = (krb5_enctype)ETYPE_NULL; krb5_enctype enctype = ETYPE_NULL;
const krb5_enctype *p; const krb5_enctype *p;
Key *key = NULL; Key *key = NULL;
size_t i, k, m; size_t i, k, m;
@@ -224,14 +224,14 @@ _kdc_find_etype(astgs_request_t r, uint32_t flags,
/* drive the search with local supported enctypes list */ /* drive the search with local supported enctypes list */
p = krb5_kerberos_enctypes(r->context); p = krb5_kerberos_enctypes(r->context);
for (i = 0; for (i = 0;
p[i] != (krb5_enctype)ETYPE_NULL && enctype == (krb5_enctype)ETYPE_NULL; p[i] != ETYPE_NULL && enctype == ETYPE_NULL;
i++) { i++) {
if (krb5_enctype_valid(r->context, p[i]) != 0 && if (krb5_enctype_valid(r->context, p[i]) != 0 &&
!_kdc_is_weak_exception(princ->principal, p[i])) !_kdc_is_weak_exception(princ->principal, p[i]))
continue; continue;
/* check that the client supports it too */ /* check that the client supports it too */
for (k = 0; k < len && enctype == (krb5_enctype)ETYPE_NULL; k++) { for (k = 0; k < len && enctype == ETYPE_NULL; k++) {
if (p[i] != etypes[k]) if (p[i] != etypes[k])
continue; continue;
@@ -316,7 +316,7 @@ _kdc_find_etype(astgs_request_t r, uint32_t flags,
} }
} }
if (enctype == (krb5_enctype)ETYPE_NULL) { if (enctype == ETYPE_NULL) {
/* /*
* if the service principal is one for which there is a known 1DES * if the service principal is one for which there is a known 1DES
* exception and no other enctype matches both the client request and * exception and no other enctype matches both the client request and

View File

@@ -271,7 +271,7 @@ _kdc_get_preferred_key(krb5_context context,
if (config->use_strongest_server_key) { if (config->use_strongest_server_key) {
const krb5_enctype *p = krb5_kerberos_enctypes(context); const krb5_enctype *p = krb5_kerberos_enctypes(context);
for (i = 0; p[i] != (krb5_enctype)ETYPE_NULL; i++) { for (i = 0; p[i] != ETYPE_NULL; i++) {
if (krb5_enctype_valid(context, p[i]) != 0 && if (krb5_enctype_valid(context, p[i]) != 0 &&
!_kdc_is_weak_exception(h->principal, p[i])) !_kdc_is_weak_exception(h->principal, p[i]))
continue; continue;

View File

@@ -128,9 +128,9 @@ main(int argc, char **argv)
if(ret) if(ret)
krb5_err(context, 1, ret, "krb5_string_to_enctype"); krb5_err(context, 1, ret, "krb5_string_to_enctype");
if((etype != (krb5_enctype)ETYPE_DES_CBC_CRC && if((etype != ETYPE_DES_CBC_CRC &&
etype != (krb5_enctype)ETYPE_DES_CBC_MD4 && etype != ETYPE_DES_CBC_MD4 &&
etype != (krb5_enctype)ETYPE_DES_CBC_MD5) && etype != ETYPE_DES_CBC_MD5) &&
(afs || version4)) { (afs || version4)) {
if(!version5) { if(!version5) {
etype = ETYPE_DES_CBC_CRC; etype = ETYPE_DES_CBC_CRC;

View File

@@ -2575,7 +2575,7 @@ krb5_crypto_init(krb5_context context,
ALLOC(*crypto, 1); ALLOC(*crypto, 1);
if (*crypto == NULL) if (*crypto == NULL)
return krb5_enomem(context); return krb5_enomem(context);
if(etype == (krb5_enctype)ETYPE_NULL) if(etype == ETYPE_NULL)
etype = key->keytype; etype = key->keytype;
(*crypto)->et = _krb5_find_enctype(etype); (*crypto)->et = _krb5_find_enctype(etype);
if((*crypto)->et == NULL || ((*crypto)->et->flags & F_DISABLED)) { if((*crypto)->et == NULL || ((*crypto)->et->flags & F_DISABLED)) {

View File

@@ -58,7 +58,7 @@ krb5_generate_subkey_extended(krb5_context context,
if (*subkey == NULL) if (*subkey == NULL)
return krb5_enomem(context); return krb5_enomem(context);
if (etype == (krb5_enctype)ETYPE_NULL) if (etype == ETYPE_NULL)
etype = key->keytype; /* use session key etype */ etype = key->keytype; /* use session key etype */
/* XXX should we use the session key as input to the RF? */ /* XXX should we use the session key as input to the RF? */

View File

@@ -115,7 +115,7 @@ add_padata(krb5_context context,
if (!enctypes) { if (!enctypes) {
enctypes = context->etypes; enctypes = context->etypes;
netypes = 0; netypes = 0;
for (ep = enctypes; *ep != (krb5_enctype)ETYPE_NULL; ep++) for (ep = enctypes; *ep != ETYPE_NULL; ep++)
netypes++; netypes++;
} }
pa2 = realloc (md->val, (md->len + netypes) * sizeof(*md->val)); pa2 = realloc (md->val, (md->len + netypes) * sizeof(*md->val));

View File

@@ -1087,7 +1087,7 @@ add_enc_ts_padata(krb5_context context,
if (!enctypes) { if (!enctypes) {
enctypes = context->etypes; enctypes = context->etypes;
netypes = 0; netypes = 0;
for (ep = enctypes; *ep != (krb5_enctype)ETYPE_NULL; ep++) for (ep = enctypes; *ep != ETYPE_NULL; ep++)
netypes++; netypes++;
} }

View File

@@ -96,7 +96,7 @@ krb5_rd_cred(krb5_context context,
goto out; goto out;
} }
if (cred.enc_part.etype == (krb5_enctype)ETYPE_NULL) { if (cred.enc_part.etype == ETYPE_NULL) {
/* DK: MIT GSS-API Compatibility */ /* DK: MIT GSS-API Compatibility */
enc_krb_cred_part_data.length = cred.enc_part.cipher.length; enc_krb_cred_part_data.length = cred.enc_part.cipher.length;
enc_krb_cred_part_data.data = cred.enc_part.cipher.data; enc_krb_cred_part_data.data = cred.enc_part.cipher.data;

View File

@@ -474,7 +474,7 @@ krb5_verify_ap_req2(krb5_context context,
if (ap_req_options) { if (ap_req_options) {
*ap_req_options = 0; *ap_req_options = 0;
if (ac->keytype != (krb5_enctype)ETYPE_NULL) if (ac->keytype != ETYPE_NULL)
*ap_req_options |= AP_OPTS_USE_SUBKEY; *ap_req_options |= AP_OPTS_USE_SUBKEY;
if (ap_req->ap_options.use_session_key) if (ap_req->ap_options.use_session_key)
*ap_req_options |= AP_OPTS_USE_SESSION_KEY; *ap_req_options |= AP_OPTS_USE_SESSION_KEY;