Whamcloud - gitweb
LU-5710 all: second batch of corrected typos and grammar errors
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_krb5_mech.c
index bd1114f..b43cb04 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  *
  * Author: Eric Mei <ericm@clusterfs.com>
  */
  */
 
 #define DEBUG_SUBSYSTEM S_SEC
-#ifdef __KERNEL__
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/crypto.h>
 #include <linux/mutex.h>
-#else
-#include <liblustre.h>
-#endif
 
 #include <obd.h>
 #include <obd_class.h>
@@ -345,7 +341,7 @@ __u32 import_context_rfc1964(struct krb5_ctx *kctx, char *p, char *end)
         if (p != end)
                 goto out_err;
 
-        CDEBUG(D_SEC, "succesfully imported rfc1964 context\n");
+       CDEBUG(D_SEC, "successfully imported rfc1964 context\n");
         return 0;
 out_err:
         return GSS_S_FAILURE;
@@ -407,7 +403,7 @@ __u32 import_context_rfc4121(struct krb5_ctx *kctx, char *p, char *end)
         if (get_keyblock(&p, end, &kctx->kc_keyc, keysize))
                 goto out_err;
 
-        CDEBUG(D_SEC, "succesfully imported v2 context\n");
+       CDEBUG(D_SEC, "successfully imported v2 context\n");
         return 0;
 out_err:
         return GSS_S_FAILURE;
@@ -498,7 +494,7 @@ __u32 gss_copy_reverse_context_kerberos(struct gss_ctx *gctx,
                 goto out_err;
 
         gctx_new->internal_ctx_id = knew;
-        CDEBUG(D_SEC, "succesfully copied reverse context\n");
+       CDEBUG(D_SEC, "successfully copied reverse context\n");
         return GSS_S_COMPLETE;
 
 out_err:
@@ -529,6 +525,7 @@ void gss_delete_sec_context_kerberos(void *internal_ctx)
 static
 void buf_to_sg(struct scatterlist *sg, void *ptr, int len)
 {
+       sg_init_table(sg, 1);
        sg_set_buf(sg, ptr, len);
 }
 
@@ -605,6 +602,7 @@ int krb5_digest_hmac(struct crypto_hash *tfm,
                 if (iovs[i].kiov_len == 0)
                         continue;
 
+               sg_init_table(sg, 1);
                sg_set_page(&sg[0], iovs[i].kiov_page, iovs[i].kiov_len,
                            iovs[i].kiov_offset);
                crypto_hash_update(&desc, sg, iovs[i].kiov_len);
@@ -647,6 +645,7 @@ int krb5_digest_norm(struct crypto_hash *tfm,
                 if (iovs[i].kiov_len == 0)
                         continue;
 
+               sg_init_table(sg, 1);
                sg_set_page(&sg[0], iovs[i].kiov_page, iovs[i].kiov_len,
                            iovs[i].kiov_offset);
                crypto_hash_update(&desc, sg, iovs[i].kiov_len);
@@ -973,12 +972,14 @@ int krb5_encrypt_bulk(struct crypto_blkcipher *tfm,
 
         /* encrypt clear pages */
         for (i = 0; i < desc->bd_iov_count; i++) {
+               sg_init_table(&src, 1);
                sg_set_page(&src, desc->bd_iov[i].kiov_page,
                            (desc->bd_iov[i].kiov_len + blocksize - 1) &
                            (~(blocksize - 1)),
                            desc->bd_iov[i].kiov_offset);
                if (adj_nob)
                        nob += src.length;
+               sg_init_table(&dst, 1);
                sg_set_page(&dst, desc->bd_enc_iov[i].kiov_page, src.length,
                            src.offset);
 
@@ -1097,6 +1098,7 @@ int krb5_decrypt_bulk(struct crypto_blkcipher *tfm,
                 if (desc->bd_enc_iov[i].kiov_len == 0)
                         continue;
 
+               sg_init_table(&src, 1);
                sg_set_page(&src, desc->bd_enc_iov[i].kiov_page,
                            desc->bd_enc_iov[i].kiov_len,
                            desc->bd_enc_iov[i].kiov_offset);
@@ -1782,7 +1784,7 @@ int __init init_kerberos_module(void)
        return status;
 }
 
-void __exit cleanup_kerberos_module(void)
+void cleanup_kerberos_module(void)
 {
         lgss_mech_unregister(&gss_kerberos_mech);
 }