|
23 | 23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
24 | 24 | */
|
25 | 25 |
|
26 |
| -#include <crypto/skcipher.h> |
| 26 | +#include <linux/crypto.h> |
27 | 27 | #include <linux/module.h>
|
28 | 28 | #include <linux/slab.h>
|
29 | 29 | #include <linux/fs.h>
|
@@ -69,46 +69,22 @@ str_to_key(unsigned char *str, unsigned char *key)
|
69 | 69 | static int
|
70 | 70 | smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
|
71 | 71 | {
|
72 |
| - int rc; |
73 | 72 | unsigned char key2[8];
|
74 |
| - struct crypto_skcipher *tfm_des; |
75 |
| - struct scatterlist sgin, sgout; |
76 |
| - struct skcipher_request *req; |
| 73 | + struct crypto_cipher *tfm_des; |
77 | 74 |
|
78 | 75 | str_to_key(key, key2);
|
79 | 76 |
|
80 |
| - tfm_des = crypto_alloc_skcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC); |
| 77 | + tfm_des = crypto_alloc_cipher("des", 0, 0); |
81 | 78 | if (IS_ERR(tfm_des)) {
|
82 |
| - rc = PTR_ERR(tfm_des); |
83 |
| - cifs_dbg(VFS, "could not allocate des crypto API\n"); |
84 |
| - goto smbhash_err; |
85 |
| - } |
86 |
| - |
87 |
| - req = skcipher_request_alloc(tfm_des, GFP_KERNEL); |
88 |
| - if (!req) { |
89 |
| - rc = -ENOMEM; |
90 | 79 | cifs_dbg(VFS, "could not allocate des crypto API\n");
|
91 |
| - goto smbhash_free_skcipher; |
| 80 | + return PTR_ERR(tfm_des); |
92 | 81 | }
|
93 | 82 |
|
94 |
| - crypto_skcipher_setkey(tfm_des, key2, 8); |
95 |
| - |
96 |
| - sg_init_one(&sgin, in, 8); |
97 |
| - sg_init_one(&sgout, out, 8); |
| 83 | + crypto_cipher_setkey(tfm_des, key2, 8); |
| 84 | + crypto_cipher_encrypt_one(tfm_des, out, in); |
| 85 | + crypto_free_cipher(tfm_des); |
98 | 86 |
|
99 |
| - skcipher_request_set_callback(req, 0, NULL, NULL); |
100 |
| - skcipher_request_set_crypt(req, &sgin, &sgout, 8, NULL); |
101 |
| - |
102 |
| - rc = crypto_skcipher_encrypt(req); |
103 |
| - if (rc) |
104 |
| - cifs_dbg(VFS, "could not encrypt crypt key rc: %d\n", rc); |
105 |
| - |
106 |
| - skcipher_request_free(req); |
107 |
| - |
108 |
| -smbhash_free_skcipher: |
109 |
| - crypto_free_skcipher(tfm_des); |
110 |
| -smbhash_err: |
111 |
| - return rc; |
| 87 | + return 0; |
112 | 88 | }
|
113 | 89 |
|
114 | 90 | static int
|
|
0 commit comments