From bb8e7336e4248b21517ed18a75b4d0343a3a0d53 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 21 Dec 2010 11:42:50 +0100 Subject: Updates all over the place (mostly devices) --- srec.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'srec.c') diff --git a/srec.c b/srec.c index 7c3aaf4..9179317 100644 --- a/srec.c +++ b/srec.c @@ -55,10 +55,11 @@ err_out: } static int srec_load_S3(char *buf, size_t data_count, - off_t offset, uint8_t *mem_base, size_t mem_size) + uint32_t load_addr, struct memory *mem) { size_t i; - uint32_t *base = (uint32_t *) mem_base; + size_t mem_size = mem->size; + uint32_t *base = mem->base; for (i = 0; i < data_count; i += 4) { uint32_t tmp; @@ -70,19 +71,19 @@ static int srec_load_S3(char *buf, size_t data_count, /* SREC is Big Endian, NiosII is Little Endian */ tmp = bswap_32(tmp); - if (offset + i >= mem_size) { + if (load_addr + i >= mem_size) { err("Image file too large for allocated memory of %zu bytes\n", mem_size); return -1; } /* Store in memory */ - base[offset / 4 + i] = tmp; + base[(load_addr + i) / 4] = tmp; } return 0; } -static int srec_handle_line(char *buf, size_t len, uint8_t *mem_base, size_t mem_size) +static int srec_handle_line(char *buf, size_t len, struct memory *mem) { unsigned int data_count = 0; unsigned int start_addr; @@ -114,7 +115,10 @@ static int srec_handle_line(char *buf, size_t len, uint8_t *mem_base, size_t mem return -1; } - if (srec_load_S3(buf + 12, data_count - 4, start_addr, mem_base, mem_size) != 0) + if (mem->image_base == IMAGE_BASE_UNINITIALIZED) + mem->image_base = start_addr; + + if (srec_load_S3(buf + 12, data_count - 4, start_addr, mem) != 0) return -1; break; case '4': @@ -143,7 +147,7 @@ static int srec_handle_line(char *buf, size_t len, uint8_t *mem_base, size_t mem return 0; } -int srec_load(FILE *fp, const char *name __unused, uint8_t *mem_base, size_t mem_size) +int srec_load(FILE *fp, const char *name __unused, struct memory *mem) { ssize_t len; int ret = 0; @@ -158,7 +162,7 @@ int srec_load(FILE *fp, const char *name __unused, uint8_t *mem_base, size_t mem ret = 0; break; } else { - ret = srec_handle_line(data_buf, len, mem_base, mem_size); + ret = srec_handle_line(data_buf, len, mem); if (ret < 0) break; } -- cgit v1.2.3-54-g00ecf ter
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-27 17:24:41 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-28 11:23:21 +0800
commit19fa77522e45e384be0f0f93b10c928763460ae3 (patch)
tree55c94d34e0e61b480801a0eb7c41d9764c6b9245 /crypto
parenta3f2185a29df084611641e964aa93d1a6ee2212c (diff)
crypto: algif_aead - Switch to new AEAD interface
This patch makes use of the new AEAD interface which uses a single SG list instead of separate lists for the AD and plain text. Note that the user-space interface now requires both input and output to be of the same length, and both must include space for the AD as well as the authentication tag. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')