SUNRPC: Rename .encrypt_v2 and .decrypt_v2 methods
authorChuck Lever <chuck.lever@oracle.com>
Sun, 15 Jan 2023 17:22:04 +0000 (12:22 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 20 Feb 2023 14:20:42 +0000 (09:20 -0500)
Clean up: there is now only one encrypt and only one decrypt method,
thus there is no longer a need for the v2-suffixed method names.

Tested-by: Scott Mayhew <smayhew@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/gss_krb5.h
net/sunrpc/auth_gss/gss_krb5_internal.h
net/sunrpc/auth_gss/gss_krb5_mech.c
net/sunrpc/auth_gss/gss_krb5_wrap.c

index a0646df12beb228a7198c147b5beb76c1445968b..85fce36c242dc6ae298e163b9dde64f4c051f47c 100644 (file)
@@ -73,12 +73,10 @@ struct gss_krb5_enctype {
        u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,
                       struct xdr_netobj *in,
                       struct xdr_netobj *out); /* complete key generation */
-       u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
-                          struct xdr_buf *buf,
-                          struct page **pages); /* v2 encryption function */
-       u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset, u32 len,
-                          struct xdr_buf *buf, u32 *headskip,
-                          u32 *tailskip);      /* v2 decryption function */
+       u32 (*encrypt)(struct krb5_ctx *kctx, u32 offset,
+                       struct xdr_buf *buf, struct page **pages);
+       u32 (*decrypt)(struct krb5_ctx *kctx, u32 offset, u32 len,
+                      struct xdr_buf *buf, u32 *headskip, u32 *tailskip);
        u32 (*get_mic)(struct krb5_ctx *kctx, struct xdr_buf *text,
                       struct xdr_netobj *token);
        u32 (*verify_mic)(struct krb5_ctx *kctx, struct xdr_buf *message_buffer,
@@ -276,14 +274,4 @@ gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
                      struct xdr_netobj *randombits,
                      struct xdr_netobj *key);
 
-u32
-gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
-                    struct xdr_buf *buf,
-                    struct page **pages);
-
-u32
-gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, u32 len,
-                    struct xdr_buf *buf, u32 *plainoffset,
-                    u32 *plainlen);
-
 #endif /* _LINUX_SUNRPC_GSS_KRB5_H */
index a4b752af69519d69415d5321f50177a73f768919..837bcfa3742f69ded94538ca2c004bc6ce4bb926 100644 (file)
@@ -50,4 +50,10 @@ u32 krb5_encrypt(struct crypto_sync_skcipher *key, void *iv, void *in,
 u32 krb5_decrypt(struct crypto_sync_skcipher *key, void *iv, void *in,
                 void *out, int length);
 
+u32 gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
+                        struct xdr_buf *buf, struct page **pages);
+
+u32 gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, u32 len,
+                        struct xdr_buf *buf, u32 *plainoffset, u32 *plainlen);
+
 #endif /* _NET_SUNRPC_AUTH_GSS_KRB5_INTERNAL_H */
index 47c065aa4a14aa06384230642ffae70c58ef4c1b..9f393175a276a630752d8043436a7700c2a57e2a 100644 (file)
@@ -98,8 +98,8 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
          .cksum_name = "hmac(sha1)",
          .import_ctx = gss_krb5_import_ctx_v2,
          .mk_key = gss_krb5_aes_make_key,
-         .encrypt_v2 = gss_krb5_aes_encrypt,
-         .decrypt_v2 = gss_krb5_aes_decrypt,
+         .encrypt = gss_krb5_aes_encrypt,
+         .decrypt = gss_krb5_aes_decrypt,
 
          .get_mic = gss_krb5_get_mic_v2,
          .verify_mic = gss_krb5_verify_mic_v2,
@@ -125,8 +125,8 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = {
          .cksum_name = "hmac(sha1)",
          .import_ctx = gss_krb5_import_ctx_v2,
          .mk_key = gss_krb5_aes_make_key,
-         .encrypt_v2 = gss_krb5_aes_encrypt,
-         .decrypt_v2 = gss_krb5_aes_decrypt,
+         .encrypt = gss_krb5_aes_encrypt,
+         .decrypt = gss_krb5_aes_decrypt,
 
          .get_mic = gss_krb5_get_mic_v2,
          .verify_mic = gss_krb5_verify_mic_v2,
index 7dabf379406be49c664d1680d3259935b4f83170..6d6b082380b23e9b7e1407829aa68c4cae315b71 100644 (file)
@@ -390,9 +390,6 @@ gss_krb5_wrap_v2(struct krb5_ctx *kctx, int offset,
 
        dprintk("RPC:       %s\n", __func__);
 
-       if (kctx->gk5e->encrypt_v2 == NULL)
-               return GSS_S_FAILURE;
-
        /* make room for gss token header */
        if (xdr_extend_head(buf, offset, GSS_KRB5_TOK_HDR_LEN))
                return GSS_S_FAILURE;
@@ -420,7 +417,7 @@ gss_krb5_wrap_v2(struct krb5_ctx *kctx, int offset,
        be64ptr = (__be64 *)be16ptr;
        *be64ptr = cpu_to_be64(atomic64_fetch_inc(&kctx->seq_send64));
 
-       err = (*kctx->gk5e->encrypt_v2)(kctx, offset, buf, pages);
+       err = (*kctx->gk5e->encrypt)(kctx, offset, buf, pages);
        if (err)
                return err;
 
@@ -445,9 +442,6 @@ gss_krb5_unwrap_v2(struct krb5_ctx *kctx, int offset, int len,
 
        dprintk("RPC:       %s\n", __func__);
 
-       if (kctx->gk5e->decrypt_v2 == NULL)
-               return GSS_S_FAILURE;
-
        ptr = buf->head[0].iov_base + offset;
 
        if (be16_to_cpu(*((__be16 *)ptr)) != KG2_TOK_WRAP)
@@ -477,8 +471,8 @@ gss_krb5_unwrap_v2(struct krb5_ctx *kctx, int offset, int len,
        if (rrc != 0)
                rotate_left(offset + 16, buf, rrc);
 
-       err = (*kctx->gk5e->decrypt_v2)(kctx, offset, len, buf,
-                                       &headskip, &tailskip);
+       err = (*kctx->gk5e->decrypt)(kctx, offset, len, buf,
+                                    &headskip, &tailskip);
        if (err)
                return GSS_S_FAILURE;