Whamcloud - gitweb
branch: HEAD
authorericm <ericm>
Tue, 28 Aug 2007 16:46:40 +0000 (16:46 +0000)
committerericm <ericm>
Tue, 28 Aug 2007 16:46:40 +0000 (16:46 +0000)
another missing part related to the gss_bulk.c

lustre/include/lustre_sec.h
lustre/ptlrpc/gss/gss_bulk.c
lustre/ptlrpc/sec_bulk.c

index be0904e..c677a78 100644 (file)
@@ -405,6 +405,7 @@ struct ptlrpc_bulk_sec_desc {
 
 const char * sptlrpc_bulk_csum_alg2name(__u32 csum_alg);
 const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg);
 
 const char * sptlrpc_bulk_csum_alg2name(__u32 csum_alg);
 const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg);
+__u32 sptlrpc_bulk_priv_alg2flags(__u32 priv_alg);
 
 /*
  * lprocfs
 
 /*
  * lprocfs
index c477ffa..77aa401 100644 (file)
@@ -72,16 +72,18 @@ int do_bulk_privacy(struct gss_ctx *gctx,
         /* compute the secret iv */
         lgss_plain_encrypt(gctx, sizeof(local_iv), bsd->bsd_iv, local_iv);
 
         /* compute the secret iv */
         lgss_plain_encrypt(gctx, sizeof(local_iv), bsd->bsd_iv, local_iv);
 
-        tfm = crypto_alloc_tfm(priv_types[alg].name, priv_types[alg].flags);
+        tfm = crypto_alloc_tfm(sptlrpc_bulk_priv_alg2name(alg),
+                               sptlrpc_bulk_priv_alg2flags(alg));
         if (tfm == NULL) {
         if (tfm == NULL) {
-                CERROR("Failed to allocate TFM %s\n", priv_types[alg].name);
+                CERROR("Failed to allocate TFM %s\n",
+                       sptlrpc_bulk_priv_alg2name(alg));
                 return -ENOMEM;
         }
 
         rc = crypto_cipher_setkey(tfm, local_iv, sizeof(local_iv));
         if (rc) {
                 CERROR("Failed to set key for TFM %s: %d\n",
                 return -ENOMEM;
         }
 
         rc = crypto_cipher_setkey(tfm, local_iv, sizeof(local_iv));
         if (rc) {
                 CERROR("Failed to set key for TFM %s: %d\n",
-                       priv_types[alg].name, rc);
+                       sptlrpc_bulk_priv_alg2name(alg), rc);
                 crypto_free_tfm(tfm);
                 return rc;
         }
                 crypto_free_tfm(tfm);
                 return rc;
         }
@@ -91,10 +93,10 @@ int do_bulk_privacy(struct gss_ctx *gctx,
                 sg.offset = desc->bd_iov[i].kiov_offset;
                 sg.length = desc->bd_iov[i].kiov_len;
 
                 sg.offset = desc->bd_iov[i].kiov_offset;
                 sg.length = desc->bd_iov[i].kiov_len;
 
-                if (desc->bd_enc_iov) {
-                        sg2.page = desc->bd_enc_iov[i].kiov_page;
-                        sg2.offset = desc->bd_enc_iov[i].kiov_offset;
-                        sg2.length = desc->bd_enc_iov[i].kiov_len;
+                if (desc->bd_enc_pages) {
+                        sg2.page = desc->bd_enc_pages[i];
+                        sg2.offset = desc->bd_iov[i].kiov_offset;
+                        sg2.length = desc->bd_iov[i].kiov_len;
 
                         sgd = &sg2;
                 } else
 
                         sgd = &sg2;
                 } else
@@ -107,6 +109,9 @@ int do_bulk_privacy(struct gss_ctx *gctx,
 
                 LASSERT(rc == 0);
 
 
                 LASSERT(rc == 0);
 
+                if (desc->bd_enc_pages)
+                        desc->bd_iov[i].kiov_page = desc->bd_enc_pages[i];
+
                 /* although the procedure might be lengthy, the crypto functions
                  * internally called cond_resched() from time to time.
                  */
                 /* although the procedure might be lengthy, the crypto functions
                  * internally called cond_resched() from time to time.
                  */
index b8de051..c13650a 100644 (file)
@@ -1010,3 +1010,11 @@ const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg)
         return "unknown_priv";
 }
 EXPORT_SYMBOL(sptlrpc_bulk_priv_alg2name);
         return "unknown_priv";
 }
 EXPORT_SYMBOL(sptlrpc_bulk_priv_alg2name);
+
+__u32 sptlrpc_bulk_priv_alg2flags(__u32 priv_alg)
+{
+        if (priv_alg < BULK_PRIV_ALG_MAX)
+                return priv_types[priv_alg].flags;
+        return 0;
+}
+EXPORT_SYMBOL(sptlrpc_bulk_priv_alg2flags);