diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/padlock-sha.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-crypt.c | 2 | ||||
-rw-r--r-- | drivers/net/ppp_mppe.c | 10 | ||||
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 5 |
4 files changed, 14 insertions, 7 deletions
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 4e8de162fc12..c666b4e0933e 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -55,7 +55,7 @@ static void padlock_sha_bypass(struct crypto_tfm *tfm) | |||
55 | if (ctx(tfm)->data && ctx(tfm)->used) { | 55 | if (ctx(tfm)->data && ctx(tfm)->used) { |
56 | struct scatterlist sg; | 56 | struct scatterlist sg; |
57 | 57 | ||
58 | sg_set_buf(&sg, ctx(tfm)->data, ctx(tfm)->used); | 58 | sg_init_one(&sg, ctx(tfm)->data, ctx(tfm)->used); |
59 | crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length); | 59 | crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length); |
60 | } | 60 | } |
61 | 61 | ||
@@ -79,7 +79,7 @@ static void padlock_sha_update(struct crypto_tfm *tfm, | |||
79 | 79 | ||
80 | if (unlikely(ctx(tfm)->bypass)) { | 80 | if (unlikely(ctx(tfm)->bypass)) { |
81 | struct scatterlist sg; | 81 | struct scatterlist sg; |
82 | sg_set_buf(&sg, (uint8_t *)data, length); | 82 | sg_init_one(&sg, (uint8_t *)data, length); |
83 | crypto_hash_update(&ctx(tfm)->fallback, &sg, length); | 83 | crypto_hash_update(&ctx(tfm)->fallback, &sg, length); |
84 | return; | 84 | return; |
85 | } | 85 | } |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 1c159ac68c98..28c6ae095c56 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -168,7 +168,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
168 | return -ENOMEM; | 168 | return -ENOMEM; |
169 | } | 169 | } |
170 | 170 | ||
171 | sg_set_buf(&sg, cc->key, cc->key_size); | 171 | sg_init_one(&sg, cc->key, cc->key_size); |
172 | desc.tfm = hash_tfm; | 172 | desc.tfm = hash_tfm; |
173 | desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 173 | desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
174 | err = crypto_hash_digest(&desc, &sg, cc->key_size, salt); | 174 | err = crypto_hash_digest(&desc, &sg, cc->key_size, salt); |
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"); | |||
68 | static unsigned int | 68 | static unsigned int |
69 | setup_sg(struct scatterlist *sg, const void *address, unsigned int length) | 69 | setup_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) { |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 097a136398cb..4bcf916c21a7 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -674,9 +674,8 @@ partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg, | |||
674 | { | 674 | { |
675 | struct scatterlist temp; | 675 | struct scatterlist temp; |
676 | 676 | ||
677 | memcpy(&temp, sg, sizeof(struct scatterlist)); | 677 | sg_init_table(&temp, 1); |
678 | temp.offset = offset; | 678 | sg_set_page(&temp, sg_page(sg), length, offset); |
679 | temp.length = length; | ||
680 | crypto_hash_update(desc, &temp, length); | 679 | crypto_hash_update(desc, &temp, length); |
681 | } | 680 | } |
682 | 681 | ||