diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 00:48:06 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 00:48:06 -0400 |
| commit | 9f75e1eff3edb2bb07349b94c28f4f2a6c66ca43 (patch) | |
| tree | 27a73405d3652dc6771fab28721b70e6d44ff47a /net | |
| parent | b1459461f1e0abd5c28317d6bff6f2ca612a719d (diff) | |
| parent | 1b40efd772f4419fbc1a8940506424246985c333 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv6/addrconf.c | 10 | ||||
| -rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_crypto.c | 23 |
2 files changed, 9 insertions, 24 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a970b4727ce8..41edc14851e8 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -75,7 +75,7 @@ | |||
| 75 | #ifdef CONFIG_IPV6_PRIVACY | 75 | #ifdef CONFIG_IPV6_PRIVACY |
| 76 | #include <linux/random.h> | 76 | #include <linux/random.h> |
| 77 | #include <linux/crypto.h> | 77 | #include <linux/crypto.h> |
| 78 | #include <asm/scatterlist.h> | 78 | #include <linux/scatterlist.h> |
| 79 | #endif | 79 | #endif |
| 80 | 80 | ||
| 81 | #include <asm/uaccess.h> | 81 | #include <asm/uaccess.h> |
| @@ -1217,12 +1217,8 @@ static int __ipv6_regen_rndid(struct inet6_dev *idev) | |||
| 1217 | struct net_device *dev; | 1217 | struct net_device *dev; |
| 1218 | struct scatterlist sg[2]; | 1218 | struct scatterlist sg[2]; |
| 1219 | 1219 | ||
| 1220 | sg[0].page = virt_to_page(idev->entropy); | 1220 | sg_set_buf(&sg[0], idev->entropy, 8); |
| 1221 | sg[0].offset = offset_in_page(idev->entropy); | 1221 | sg_set_buf(&sg[1], idev->work_eui64, 8); |
| 1222 | sg[0].length = 8; | ||
| 1223 | sg[1].page = virt_to_page(idev->work_eui64); | ||
| 1224 | sg[1].offset = offset_in_page(idev->work_eui64); | ||
| 1225 | sg[1].length = 8; | ||
| 1226 | 1222 | ||
| 1227 | dev = idev->dev; | 1223 | dev = idev->dev; |
| 1228 | 1224 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 3f3d5437f02d..97c981fa6b8e 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | #include <linux/types.h> | 37 | #include <linux/types.h> |
| 38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
| 39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
| 40 | #include <asm/scatterlist.h> | 40 | #include <linux/scatterlist.h> |
| 41 | #include <linux/crypto.h> | 41 | #include <linux/crypto.h> |
| 42 | #include <linux/highmem.h> | 42 | #include <linux/highmem.h> |
| 43 | #include <linux/pagemap.h> | 43 | #include <linux/pagemap.h> |
| @@ -75,9 +75,7 @@ krb5_encrypt( | |||
| 75 | memcpy(local_iv, iv, crypto_tfm_alg_ivsize(tfm)); | 75 | memcpy(local_iv, iv, crypto_tfm_alg_ivsize(tfm)); |
| 76 | 76 | ||
| 77 | memcpy(out, in, length); | 77 | memcpy(out, in, length); |
| 78 | sg[0].page = virt_to_page(out); | 78 | sg_set_buf(sg, out, length); |
| 79 | sg[0].offset = offset_in_page(out); | ||
| 80 | sg[0].length = length; | ||
| 81 | 79 | ||
| 82 | ret = crypto_cipher_encrypt_iv(tfm, sg, sg, length, local_iv); | 80 | ret = crypto_cipher_encrypt_iv(tfm, sg, sg, length, local_iv); |
| 83 | 81 | ||
| @@ -117,9 +115,7 @@ krb5_decrypt( | |||
| 117 | memcpy(local_iv,iv, crypto_tfm_alg_ivsize(tfm)); | 115 | memcpy(local_iv,iv, crypto_tfm_alg_ivsize(tfm)); |
| 118 | 116 | ||
| 119 | memcpy(out, in, length); | 117 | memcpy(out, in, length); |
| 120 | sg[0].page = virt_to_page(out); | 118 | sg_set_buf(sg, out, length); |
| 121 | sg[0].offset = offset_in_page(out); | ||
| 122 | sg[0].length = length; | ||
| 123 | 119 | ||
| 124 | ret = crypto_cipher_decrypt_iv(tfm, sg, sg, length, local_iv); | 120 | ret = crypto_cipher_decrypt_iv(tfm, sg, sg, length, local_iv); |
| 125 | 121 | ||
| @@ -132,13 +128,6 @@ out: | |||
| 132 | 128 | ||
| 133 | EXPORT_SYMBOL(krb5_decrypt); | 129 | EXPORT_SYMBOL(krb5_decrypt); |
| 134 | 130 | ||
| 135 | static void | ||
| 136 | buf_to_sg(struct scatterlist *sg, char *ptr, int len) { | ||
| 137 | sg->page = virt_to_page(ptr); | ||
| 138 | sg->offset = offset_in_page(ptr); | ||
| 139 | sg->length = len; | ||
| 140 | } | ||
| 141 | |||
| 142 | static int | 131 | static int |
| 143 | process_xdr_buf(struct xdr_buf *buf, int offset, int len, | 132 | process_xdr_buf(struct xdr_buf *buf, int offset, int len, |
| 144 | int (*actor)(struct scatterlist *, void *), void *data) | 133 | int (*actor)(struct scatterlist *, void *), void *data) |
| @@ -152,7 +141,7 @@ process_xdr_buf(struct xdr_buf *buf, int offset, int len, | |||
| 152 | thislen = buf->head[0].iov_len - offset; | 141 | thislen = buf->head[0].iov_len - offset; |
| 153 | if (thislen > len) | 142 | if (thislen > len) |
| 154 | thislen = len; | 143 | thislen = len; |
| 155 | buf_to_sg(sg, buf->head[0].iov_base + offset, thislen); | 144 | sg_set_buf(sg, buf->head[0].iov_base + offset, thislen); |
| 156 | ret = actor(sg, data); | 145 | ret = actor(sg, data); |
| 157 | if (ret) | 146 | if (ret) |
| 158 | goto out; | 147 | goto out; |
| @@ -195,7 +184,7 @@ process_xdr_buf(struct xdr_buf *buf, int offset, int len, | |||
| 195 | thislen = buf->tail[0].iov_len - offset; | 184 | thislen = buf->tail[0].iov_len - offset; |
| 196 | if (thislen > len) | 185 | if (thislen > len) |
| 197 | thislen = len; | 186 | thislen = len; |
| 198 | buf_to_sg(sg, buf->tail[0].iov_base + offset, thislen); | 187 | sg_set_buf(sg, buf->tail[0].iov_base + offset, thislen); |
| 199 | ret = actor(sg, data); | 188 | ret = actor(sg, data); |
| 200 | len -= thislen; | 189 | len -= thislen; |
| 201 | } | 190 | } |
| @@ -241,7 +230,7 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, | |||
| 241 | goto out; | 230 | goto out; |
| 242 | 231 | ||
| 243 | crypto_digest_init(tfm); | 232 | crypto_digest_init(tfm); |
| 244 | buf_to_sg(sg, header, hdrlen); | 233 | sg_set_buf(sg, header, hdrlen); |
| 245 | crypto_digest_update(tfm, sg, 1); | 234 | crypto_digest_update(tfm, sg, 1); |
| 246 | process_xdr_buf(body, body_offset, body->len - body_offset, | 235 | process_xdr_buf(body, body_offset, body->len - body_offset, |
| 247 | checksummer, tfm); | 236 | checksummer, tfm); |
