summaryrefslogtreecommitdiffstats
path: root/include/digest.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-03-12 08:06:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-13 08:32:28 +0100
commitac2407db7a25ba81852919c34de56db792e77fca (patch)
tree4a5d25321610c7a226bd948c87e7fbd1f5006dac /include/digest.h
parent102d59f91fdd327c68c1b7a8c43f3f4685422f52 (diff)
downloadbarebox-ac2407db7a25ba81852919c34de56db792e77fca.tar.gz
barebox-ac2407db7a25ba81852919c34de56db792e77fca.tar.xz
crypto: digest: Make string arguments const
Most string arguments for keys and filenames can be const. Change that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/digest.h')
-rw-r--r--include/digest.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/include/digest.h b/include/digest.h
index fd47a7e248..b890a7a10b 100644
--- a/include/digest.h
+++ b/include/digest.h
@@ -31,7 +31,7 @@ struct digest_algo {
int (*init)(struct digest *d);
int (*update)(struct digest *d, const void *data, unsigned long len);
int (*final)(struct digest *d, unsigned char *md);
- int (*set_key)(struct digest *d, unsigned char *key, unsigned int len);
+ int (*set_key)(struct digest *d, const unsigned char *key, unsigned int len);
unsigned int length;
unsigned int ctx_length;
@@ -50,18 +50,18 @@ struct digest {
int digest_algo_register(struct digest_algo *d);
void digest_algo_unregister(struct digest_algo *d);
-struct digest *digest_alloc(char* name);
+struct digest *digest_alloc(const char *name);
void digest_free(struct digest *d);
-int digest_file_window(struct digest *d, char *filename,
- unsigned char *key, size_t keylen,
+int digest_file_window(struct digest *d, const char *filename,
+ const unsigned char *key, size_t keylen,
unsigned char *hash,
ulong start, ulong size);
-int digest_file(struct digest *d, char *filename,
- unsigned char *key, size_t keylen,
+int digest_file(struct digest *d, const char *filename,
+ const unsigned char *key, size_t keylen,
unsigned char *hash);
-int digest_file_by_name(char *algo, char *filename,
- unsigned char *key, size_t keylen,
+int digest_file_by_name(const char *algo, const char *filename,
+ const unsigned char *key, size_t keylen,
unsigned char *hash);
static inline int digest_init(struct digest *d)
@@ -85,7 +85,8 @@ static inline int digest_length(struct digest *d)
return d->algo->length;
}
-static inline int digest_set_key(struct digest *d, unsigned char *key, unsigned int len)
+static inline int digest_set_key(struct digest *d, const unsigned char *key,
+ unsigned int len)
{
if (!d->algo->set_key)
return -ENOTSUPP;