aboutsummaryrefslogtreecommitdiff
path: root/sys/opencrypto/xform_aes_icm.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2019-08-22 00:02:08 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2019-08-22 00:02:08 +0000
commit821fe3d3a4ab0a2867fa05ad106bb5bc6bb5058d (patch)
tree1eb842fb12e97bb27f262e8c6c16c9e63398bb67 /sys/opencrypto/xform_aes_icm.c
parente1a29d8c67bc1944819b9d7b7bf3110cb8dbead5 (diff)
downloadsrc-821fe3d3a4ab0a2867fa05ad106bb5bc6bb5058d.tar.gz
src-821fe3d3a4ab0a2867fa05ad106bb5bc6bb5058d.zip
Use 'const' for keys and IVs passed to software encryption algorithms.
Specifically, use 'const' for the key passed to the 'setkey' method and 'const' for the 'iv' passed to the 'reinit' method. Reviewed by: cem Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21347
Notes
Notes: svn path=/head/; revision=351364
Diffstat (limited to 'sys/opencrypto/xform_aes_icm.c')
-rw-r--r--sys/opencrypto/xform_aes_icm.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/opencrypto/xform_aes_icm.c b/sys/opencrypto/xform_aes_icm.c
index 052be5a779ae..ba3eca0a839e 100644
--- a/sys/opencrypto/xform_aes_icm.c
+++ b/sys/opencrypto/xform_aes_icm.c
@@ -52,12 +52,12 @@ __FBSDID("$FreeBSD$");
#include <opencrypto/xform_enc.h>
-static int aes_icm_setkey(u_int8_t **, u_int8_t *, int);
+static int aes_icm_setkey(u_int8_t **, const u_int8_t *, int);
static void aes_icm_crypt(caddr_t, u_int8_t *);
static void aes_icm_zerokey(u_int8_t **);
-static void aes_icm_reinit(caddr_t, u_int8_t *);
-static void aes_gcm_reinit(caddr_t, u_int8_t *);
-static void aes_ccm_reinit(caddr_t, u_int8_t *);
+static void aes_icm_reinit(caddr_t, const u_int8_t *);
+static void aes_gcm_reinit(caddr_t, const u_int8_t *);
+static void aes_ccm_reinit(caddr_t, const u_int8_t *);
/* Encryption instances */
struct enc_xform enc_xform_aes_icm = {
@@ -96,7 +96,7 @@ struct enc_xform enc_xform_ccm = {
* Encryption wrapper routines.
*/
static void
-aes_icm_reinit(caddr_t key, u_int8_t *iv)
+aes_icm_reinit(caddr_t key, const u_int8_t *iv)
{
struct aes_icm_ctx *ctx;
@@ -105,7 +105,7 @@ aes_icm_reinit(caddr_t key, u_int8_t *iv)
}
static void
-aes_gcm_reinit(caddr_t key, u_int8_t *iv)
+aes_gcm_reinit(caddr_t key, const u_int8_t *iv)
{
struct aes_icm_ctx *ctx;
@@ -118,7 +118,7 @@ aes_gcm_reinit(caddr_t key, u_int8_t *iv)
}
static void
-aes_ccm_reinit(caddr_t key, u_int8_t *iv)
+aes_ccm_reinit(caddr_t key, const u_int8_t *iv)
{
struct aes_icm_ctx *ctx;
@@ -153,7 +153,7 @@ aes_icm_crypt(caddr_t key, u_int8_t *data)
}
static int
-aes_icm_setkey(u_int8_t **sched, u_int8_t *key, int len)
+aes_icm_setkey(u_int8_t **sched, const u_int8_t *key, int len)
{
struct aes_icm_ctx *ctx;
@@ -166,7 +166,7 @@ aes_icm_setkey(u_int8_t **sched, u_int8_t *key, int len)
return ENOMEM;
ctx = (struct aes_icm_ctx *)*sched;
- ctx->ac_nr = rijndaelKeySetupEnc(ctx->ac_ek, (u_char *)key, len * 8);
+ ctx->ac_nr = rijndaelKeySetupEnc(ctx->ac_ek, key, len * 8);
return 0;
}