SUNRPC: Remove the ->import_ctx method

All supported encryption types now use the same context import
function.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Chuck Lever 2023-06-29 13:51:26 -04:00
parent 6c922ea711
commit cfb6b328c4
2 changed files with 1 additions and 12 deletions

View File

@ -33,7 +33,6 @@ struct gss_krb5_enctype {
const u32 Ke_length; /* encryption subkey length, in octets */ const u32 Ke_length; /* encryption subkey length, in octets */
const u32 Ki_length; /* integrity subkey length, in octets */ const u32 Ki_length; /* integrity subkey length, in octets */
int (*import_ctx)(struct krb5_ctx *ctx, gfp_t gfp_mask);
int (*derive_key)(const struct gss_krb5_enctype *gk5e, int (*derive_key)(const struct gss_krb5_enctype *gk5e,
const struct xdr_netobj *in, const struct xdr_netobj *in,
struct xdr_netobj *out, struct xdr_netobj *out,

View File

@ -29,7 +29,6 @@
#endif #endif
static struct gss_api_mech gss_kerberos_mech; static struct gss_api_mech gss_kerberos_mech;
static int gss_krb5_import_ctx_v2(struct krb5_ctx *ctx, gfp_t gfp_mask);
static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
#if defined(CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1) #if defined(CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1)
@ -43,7 +42,6 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
.encrypt_name = "cts(cbc(aes))", .encrypt_name = "cts(cbc(aes))",
.aux_cipher = "cbc(aes)", .aux_cipher = "cbc(aes)",
.cksum_name = "hmac(sha1)", .cksum_name = "hmac(sha1)",
.import_ctx = gss_krb5_import_ctx_v2,
.derive_key = krb5_derive_key_v2, .derive_key = krb5_derive_key_v2,
.encrypt = gss_krb5_aes_encrypt, .encrypt = gss_krb5_aes_encrypt,
.decrypt = gss_krb5_aes_decrypt, .decrypt = gss_krb5_aes_decrypt,
@ -73,7 +71,6 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
.encrypt_name = "cts(cbc(aes))", .encrypt_name = "cts(cbc(aes))",
.aux_cipher = "cbc(aes)", .aux_cipher = "cbc(aes)",
.cksum_name = "hmac(sha1)", .cksum_name = "hmac(sha1)",
.import_ctx = gss_krb5_import_ctx_v2,
.derive_key = krb5_derive_key_v2, .derive_key = krb5_derive_key_v2,
.encrypt = gss_krb5_aes_encrypt, .encrypt = gss_krb5_aes_encrypt,
.decrypt = gss_krb5_aes_decrypt, .decrypt = gss_krb5_aes_decrypt,
@ -113,7 +110,6 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
.Ke_length = BITS2OCTETS(128), .Ke_length = BITS2OCTETS(128),
.Ki_length = BITS2OCTETS(128), .Ki_length = BITS2OCTETS(128),
.import_ctx = gss_krb5_import_ctx_v2,
.derive_key = krb5_kdf_feedback_cmac, .derive_key = krb5_kdf_feedback_cmac,
.encrypt = gss_krb5_aes_encrypt, .encrypt = gss_krb5_aes_encrypt,
.decrypt = gss_krb5_aes_decrypt, .decrypt = gss_krb5_aes_decrypt,
@ -140,7 +136,6 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
.Ke_length = BITS2OCTETS(256), .Ke_length = BITS2OCTETS(256),
.Ki_length = BITS2OCTETS(256), .Ki_length = BITS2OCTETS(256),
.import_ctx = gss_krb5_import_ctx_v2,
.derive_key = krb5_kdf_feedback_cmac, .derive_key = krb5_kdf_feedback_cmac,
.encrypt = gss_krb5_aes_encrypt, .encrypt = gss_krb5_aes_encrypt,
.decrypt = gss_krb5_aes_decrypt, .decrypt = gss_krb5_aes_decrypt,
@ -170,7 +165,6 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
.Ke_length = BITS2OCTETS(128), .Ke_length = BITS2OCTETS(128),
.Ki_length = BITS2OCTETS(128), .Ki_length = BITS2OCTETS(128),
.import_ctx = gss_krb5_import_ctx_v2,
.derive_key = krb5_kdf_hmac_sha2, .derive_key = krb5_kdf_hmac_sha2,
.encrypt = krb5_etm_encrypt, .encrypt = krb5_etm_encrypt,
.decrypt = krb5_etm_decrypt, .decrypt = krb5_etm_decrypt,
@ -197,7 +191,6 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
.Ke_length = BITS2OCTETS(256), .Ke_length = BITS2OCTETS(256),
.Ki_length = BITS2OCTETS(192), .Ki_length = BITS2OCTETS(192),
.import_ctx = gss_krb5_import_ctx_v2,
.derive_key = krb5_kdf_hmac_sha2, .derive_key = krb5_kdf_hmac_sha2,
.encrypt = krb5_etm_encrypt, .encrypt = krb5_etm_encrypt,
.decrypt = krb5_etm_decrypt, .decrypt = krb5_etm_decrypt,
@ -431,9 +424,6 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx,
p = simple_get_bytes(p, end, &ctx->enctype, sizeof(ctx->enctype)); p = simple_get_bytes(p, end, &ctx->enctype, sizeof(ctx->enctype));
if (IS_ERR(p)) if (IS_ERR(p))
goto out_err; goto out_err;
/* Map ENCTYPE_DES3_CBC_SHA1 to ENCTYPE_DES3_CBC_RAW */
if (ctx->enctype == ENCTYPE_DES3_CBC_SHA1)
ctx->enctype = ENCTYPE_DES3_CBC_RAW;
ctx->gk5e = gss_krb5_lookup_enctype(ctx->enctype); ctx->gk5e = gss_krb5_lookup_enctype(ctx->enctype);
if (ctx->gk5e == NULL) { if (ctx->gk5e == NULL) {
dprintk("gss_kerberos_mech: unsupported krb5 enctype %u\n", dprintk("gss_kerberos_mech: unsupported krb5 enctype %u\n",
@ -460,7 +450,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx,
} }
ctx->mech_used.len = gss_kerberos_mech.gm_oid.len; ctx->mech_used.len = gss_kerberos_mech.gm_oid.len;
return ctx->gk5e->import_ctx(ctx, gfp_mask); return gss_krb5_import_ctx_v2(ctx, gfp_mask);
out_err: out_err:
return PTR_ERR(p); return PTR_ERR(p);