Application security training for developers, by developers.
LOGIN
SIGN UP
static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value) static int atmel_aes_sg_length(struct ablkcipher_request *req, struct scatterlist *sg) { unsigned int total = req->nbytes; int sg_nb; unsigned int len; struct scatterlist *sg_list; sg_nb = 0; sg_list = sg; total = req->nbytes; while (total) { len = min(sg_list->length, total); sg_nb++; total -= len; sg_list = sg_next(sg_list); if (!sg_list) total = 0; } return sg_nb; } static int atmel_aes_sg_copy(struct scatterlist **sg, size_t *offset, void *buf, size_t buflen, size_t total, int out) { unsigned int count, off = 0; while (buflen && total) { count = min((*sg)->length - *offset, total); count = min(count, buflen); if (!count) return off; scatterwalk_map_and_copy(buf + off, *sg, *offset, count, out); off += count; buflen -= count; *offset += count; total -= count; if (*offset == (*sg)->length) { *sg = sg_next(*sg); if (*sg) *offset = 0; else total = 0; } } return off; } static inline u32 atmel_aes_read(struct atmel_aes_dev *dd, u32 offset) { return readl_relaxed(dd->io_base + offset); } static inline void atmel_aes_write(struct atmel_aes_dev *dd, u32 offset, u32 value)
Log in to Codebashing
×
Remember me
Forgot your password?
Forgot your password?
×