Commit 91565996 authored by Trond Myklebust's avatar Trond Myklebust

RPCSEC_GSS: Make it safe to share crypto tfms among

multiple threads.
parent b26ef9fe
...@@ -71,14 +71,13 @@ krb5_encrypt( ...@@ -71,14 +71,13 @@ krb5_encrypt(
if (iv) if (iv)
memcpy(local_iv, iv, crypto_tfm_alg_ivsize(tfm)); memcpy(local_iv, iv, crypto_tfm_alg_ivsize(tfm));
crypto_cipher_set_iv(tfm, local_iv, crypto_tfm_alg_ivsize(tfm));
memcpy(out, in, length); memcpy(out, in, length);
sg[0].page = virt_to_page(out); sg[0].page = virt_to_page(out);
sg[0].offset = offset_in_page(out); sg[0].offset = offset_in_page(out);
sg[0].length = length; sg[0].length = length;
ret = crypto_cipher_encrypt(tfm, sg, sg, length); ret = crypto_cipher_encrypt_iv(tfm, sg, sg, length, local_iv);
out: out:
dprintk("gss_k5encrypt returns %d\n",ret); dprintk("gss_k5encrypt returns %d\n",ret);
...@@ -110,14 +109,13 @@ krb5_decrypt( ...@@ -110,14 +109,13 @@ krb5_decrypt(
} }
if (iv) if (iv)
memcpy(local_iv,iv, crypto_tfm_alg_ivsize(tfm)); memcpy(local_iv,iv, crypto_tfm_alg_ivsize(tfm));
crypto_cipher_set_iv(tfm, local_iv, crypto_tfm_alg_blocksize(tfm));
memcpy(out, in, length); memcpy(out, in, length);
sg[0].page = virt_to_page(out); sg[0].page = virt_to_page(out);
sg[0].offset = offset_in_page(out); sg[0].offset = offset_in_page(out);
sg[0].length = length; sg[0].length = length;
ret = crypto_cipher_decrypt(tfm, sg, sg, length); ret = crypto_cipher_decrypt_iv(tfm, sg, sg, length, local_iv);
out: out:
dprintk("gss_k5decrypt returns %d\n",ret); dprintk("gss_k5decrypt returns %d\n",ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment