X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Fptlrpc%2Fgss%2Fgss_crypto.c;fp=lustre%2Fptlrpc%2Fgss%2Fgss_crypto.c;h=a2ffd6028b42037098673fc3941b0ed96ce83079;hb=462037d5d302f408b840d2543de89b22f8eb7b73;hp=06f3542e3a31089ff860b1c2844b12e6e1e434a5;hpb=99bc4ba277637656f6329a67158af6cee7070b48;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/gss/gss_crypto.c b/lustre/ptlrpc/gss/gss_crypto.c index 06f3542..a2ffd60 100644 --- a/lustre/ptlrpc/gss/gss_crypto.c +++ b/lustre/ptlrpc/gss/gss_crypto.c @@ -424,11 +424,8 @@ int gss_add_padding(rawobj_t *msg, int msg_buflen, int blocksize) return 0; } -int gss_crypt_rawobjs(struct crypto_blkcipher *tfm, - int use_internal_iv, - int inobj_cnt, - rawobj_t *inobjs, - rawobj_t *outobj, +int gss_crypt_rawobjs(struct crypto_blkcipher *tfm, __u8 *iv, + int inobj_cnt, rawobj_t *inobjs, rawobj_t *outobj, int enc) { struct blkcipher_desc desc; @@ -436,14 +433,14 @@ int gss_crypt_rawobjs(struct crypto_blkcipher *tfm, struct scatterlist dst; struct sg_table sg_dst; struct sg_table sg_src; - __u8 local_iv[16] = {0}, *buf; + __u8 *buf; __u32 datalen = 0; int i, rc; ENTRY; buf = outobj->data; desc.tfm = tfm; - desc.info = local_iv; + desc.info = iv; desc.flags = 0; for (i = 0; i < inobj_cnt; i++) { @@ -461,14 +458,7 @@ int gss_crypt_rawobjs(struct crypto_blkcipher *tfm, RETURN(rc); } - if (use_internal_iv) { - if (enc) - rc = crypto_blkcipher_encrypt(&desc, &dst, &src, - src.length); - else - rc = crypto_blkcipher_decrypt(&desc, &dst, &src, - src.length); - } else { + if (iv) { if (enc) rc = crypto_blkcipher_encrypt_iv(&desc, &dst, &src, @@ -477,6 +467,13 @@ int gss_crypt_rawobjs(struct crypto_blkcipher *tfm, rc = crypto_blkcipher_decrypt_iv(&desc, &dst, &src, src.length); + } else { + if (enc) + rc = crypto_blkcipher_encrypt(&desc, &dst, &src, + src.length); + else + rc = crypto_blkcipher_decrypt(&desc, &dst, &src, + src.length); } gss_teardown_sgtable(&sg_src);