Skip to content
Snippets Groups Projects
Commit 6996bc66 authored by Eric Mei's avatar Eric Mei
Browse files

branch: HEAD

another missing part related to the gss_bulk.c
parent 6b3205a7
No related branches found
No related tags found
No related merge requests found
...@@ -405,6 +405,7 @@ struct ptlrpc_bulk_sec_desc { ...@@ -405,6 +405,7 @@ struct ptlrpc_bulk_sec_desc {
const char * sptlrpc_bulk_csum_alg2name(__u32 csum_alg); const char * sptlrpc_bulk_csum_alg2name(__u32 csum_alg);
const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg); const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg);
__u32 sptlrpc_bulk_priv_alg2flags(__u32 priv_alg);
/* /*
* lprocfs * lprocfs
......
...@@ -72,16 +72,18 @@ int do_bulk_privacy(struct gss_ctx *gctx, ...@@ -72,16 +72,18 @@ int do_bulk_privacy(struct gss_ctx *gctx,
/* compute the secret iv */ /* compute the secret iv */
lgss_plain_encrypt(gctx, sizeof(local_iv), bsd->bsd_iv, local_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; return -ENOMEM;
} }
rc = crypto_cipher_setkey(tfm, local_iv, sizeof(local_iv)); rc = crypto_cipher_setkey(tfm, local_iv, sizeof(local_iv));
if (rc) { if (rc) {
CERROR("Failed to set key for TFM %s: %d\n", 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); crypto_free_tfm(tfm);
return rc; return rc;
} }
...@@ -91,10 +93,10 @@ int do_bulk_privacy(struct gss_ctx *gctx, ...@@ -91,10 +93,10 @@ int do_bulk_privacy(struct gss_ctx *gctx,
sg.offset = desc->bd_iov[i].kiov_offset; sg.offset = desc->bd_iov[i].kiov_offset;
sg.length = desc->bd_iov[i].kiov_len; sg.length = desc->bd_iov[i].kiov_len;
if (desc->bd_enc_iov) { if (desc->bd_enc_pages) {
sg2.page = desc->bd_enc_iov[i].kiov_page; sg2.page = desc->bd_enc_pages[i];
sg2.offset = desc->bd_enc_iov[i].kiov_offset; sg2.offset = desc->bd_iov[i].kiov_offset;
sg2.length = desc->bd_enc_iov[i].kiov_len; sg2.length = desc->bd_iov[i].kiov_len;
sgd = &sg2; sgd = &sg2;
} else } else
...@@ -107,6 +109,9 @@ int do_bulk_privacy(struct gss_ctx *gctx, ...@@ -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 /* although the procedure might be lengthy, the crypto functions
* internally called cond_resched() from time to time. * internally called cond_resched() from time to time.
*/ */
......
...@@ -1010,3 +1010,11 @@ const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg) ...@@ -1010,3 +1010,11 @@ const char * sptlrpc_bulk_priv_alg2name(__u32 priv_alg)
return "unknown_priv"; return "unknown_priv";
} }
EXPORT_SYMBOL(sptlrpc_bulk_priv_alg2name); 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);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment