aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ppp_mppe.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c
index bcb0885011c8..b35d79449500 100644
--- a/drivers/net/ppp_mppe.c
+++ b/drivers/net/ppp_mppe.c
@@ -68,7 +68,7 @@ MODULE_VERSION("1.0.2");
68static unsigned int 68static unsigned int
69setup_sg(struct scatterlist *sg, const void *address, unsigned int length) 69setup_sg(struct scatterlist *sg, const void *address, unsigned int length)
70{ 70{
71 sg_init_one(sg, address, length); 71 sg_set_buf(sg, address, length);
72 return length; 72 return length;
73} 73}
74 74
@@ -140,6 +140,8 @@ static void get_new_key_from_sha(struct ppp_mppe_state * state)
140 struct scatterlist sg[4]; 140 struct scatterlist sg[4];
141 unsigned int nbytes; 141 unsigned int nbytes;
142 142
143 sg_init_table(sg, 4);
144
143 nbytes = setup_sg(&sg[0], state->master_key, state->keylen); 145 nbytes = setup_sg(&sg[0], state->master_key, state->keylen);
144 nbytes += setup_sg(&sg[1], sha_pad->sha_pad1, 146 nbytes += setup_sg(&sg[1], sha_pad->sha_pad1,
145 sizeof(sha_pad->sha_pad1)); 147 sizeof(sha_pad->sha_pad1));
@@ -166,6 +168,8 @@ static void mppe_rekey(struct ppp_mppe_state * state, int initial_key)
166 if (!initial_key) { 168 if (!initial_key) {
167 crypto_blkcipher_setkey(state->arc4, state->sha1_digest, 169 crypto_blkcipher_setkey(state->arc4, state->sha1_digest,
168 state->keylen); 170 state->keylen);
171 sg_init_table(sg_in, 1);
172 sg_init_table(sg_out, 1);
169 setup_sg(sg_in, state->sha1_digest, state->keylen); 173 setup_sg(sg_in, state->sha1_digest, state->keylen);
170 setup_sg(sg_out, state->session_key, state->keylen); 174 setup_sg(sg_out, state->session_key, state->keylen);
171 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 175 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in,
@@ -421,6 +425,8 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf,
421 isize -= 2; 425 isize -= 2;
422 426
423 /* Encrypt packet */ 427 /* Encrypt packet */
428 sg_init_table(sg_in, 1);
429 sg_init_table(sg_out, 1);
424 setup_sg(sg_in, ibuf, isize); 430 setup_sg(sg_in, ibuf, isize);
425 setup_sg(sg_out, obuf, osize); 431 setup_sg(sg_out, obuf, osize);
426 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) { 432 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) {
@@ -608,6 +614,8 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
608 * Decrypt the first byte in order to check if it is 614 * Decrypt the first byte in order to check if it is
609 * a compressed or uncompressed protocol field. 615 * a compressed or uncompressed protocol field.
610 */ 616 */
617 sg_init_table(sg_in, 1);
618 sg_init_table(sg_out, 1);
611 setup_sg(sg_in, ibuf, 1); 619 setup_sg(sg_in, ibuf, 1);
612 setup_sg(sg_out, obuf, 1); 620 setup_sg(sg_out, obuf, 1);
613 if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) { 621 if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) {