Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux] / net / sunrpc / auth_gss / gss_krb5_seal.c
index b4adeb0..48fe4a5 100644 (file)
@@ -123,30 +123,6 @@ setup_token_v2(struct krb5_ctx *ctx, struct xdr_netobj *token)
        return krb5_hdr;
 }
 
-u32
-gss_seq_send_fetch_and_inc(struct krb5_ctx *ctx)
-{
-       u32 old, seq_send = READ_ONCE(ctx->seq_send);
-
-       do {
-               old = seq_send;
-               seq_send = cmpxchg(&ctx->seq_send, old, old + 1);
-       } while (old != seq_send);
-       return seq_send;
-}
-
-u64
-gss_seq_send64_fetch_and_inc(struct krb5_ctx *ctx)
-{
-       u64 old, seq_send = READ_ONCE(ctx->seq_send);
-
-       do {
-               old = seq_send;
-               seq_send = cmpxchg64(&ctx->seq_send64, old, old + 1);
-       } while (old != seq_send);
-       return seq_send;
-}
-
 static u32
 gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,
                struct xdr_netobj *token)
@@ -177,7 +153,7 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,
 
        memcpy(ptr + GSS_KRB5_TOK_HDR_LEN, md5cksum.data, md5cksum.len);
 
-       seq_send = gss_seq_send_fetch_and_inc(ctx);
+       seq_send = atomic_fetch_inc(&ctx->seq_send);
 
        if (krb5_make_seq_num(ctx, ctx->seq, ctx->initiate ? 0 : 0xff,
                              seq_send, ptr + GSS_KRB5_TOK_HDR_LEN, ptr + 8))
@@ -205,7 +181,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,
 
        /* Set up the sequence number. Now 64-bits in clear
         * text and w/o direction indicator */
-       seq_send_be64 = cpu_to_be64(gss_seq_send64_fetch_and_inc(ctx));
+       seq_send_be64 = cpu_to_be64(atomic64_fetch_inc(&ctx->seq_send64));
        memcpy(krb5_hdr + 8, (char *) &seq_send_be64, 8);
 
        if (ctx->initiate) {