Sprinkle const into cgd crypto API.

This commit is contained in:
riastradh 2015-04-25 12:55:04 +00:00
parent 3a53aa923a
commit 1742e3a843
2 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cgd_crypto.c,v 1.12 2013/06/24 04:21:20 riastradh Exp $ */
/* $NetBSD: cgd_crypto.c,v 1.13 2015/04/25 12:55:04 riastradh Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c,v 1.12 2013/06/24 04:21:20 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: cgd_crypto.c,v 1.13 2015/04/25 12:55:04 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -126,8 +126,8 @@ static void
cgd_cipher_uio_cbc(void *privdata, cipher_func cipher,
struct uio *dstuio, struct uio *srcuio)
{
struct iovec *dst;
struct iovec *src;
const struct iovec *dst;
const struct iovec *src;
int dstnum;
int dstoff = 0;
int srcnum;
@ -140,7 +140,7 @@ cgd_cipher_uio_cbc(void *privdata, cipher_func cipher,
for (;;) {
int l = MIN(dst->iov_len - dstoff, src->iov_len - srcoff);
u_int8_t *d = (u_int8_t *)dst->iov_base + dstoff;
u_int8_t *s = (u_int8_t *)src->iov_base + srcoff;
const u_int8_t *s = (const u_int8_t *)src->iov_base + srcoff;
cipher(privdata, d, s, l);
@ -238,7 +238,7 @@ aes_cbc_dec_int(void *privdata, void *dst, const void *src, size_t len)
static void
cgd_cipher_aes_cbc(void *privdata, struct uio *dstuio,
struct uio *srcuio, void *iv, int dir)
struct uio *srcuio, const void *iv, int dir)
{
struct aes_privdata *apd = privdata;
struct aes_encdata encd;
@ -334,7 +334,7 @@ c3des_cbc_dec_int(void *privdata, void *dst, const void *src, size_t len)
static void
cgd_cipher_3des_cbc(void *privdata, struct uio *dstuio,
struct uio *srcuio, void *iv, int dir)
struct uio *srcuio, const void *iv, int dir)
{
struct c3des_privdata *cp = privdata;
struct c3des_encdata ce;
@ -417,7 +417,7 @@ bf_cbc_dec_int(void *privdata, void *dst, const void *src, size_t len)
static void
cgd_cipher_bf_cbc(void *privdata, struct uio *dstuio,
struct uio *srcuio, void *iv, int dir)
struct uio *srcuio, const void *iv, int dir)
{
struct bf_privdata *bp = privdata;
struct bf_encdata be;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cgd_crypto.h,v 1.7 2012/12/05 02:23:20 christos Exp $ */
/* $NetBSD: cgd_crypto.h,v 1.8 2015/04/25 12:55:04 riastradh Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -38,7 +38,8 @@
typedef void *(cfunc_init)(size_t, const void *, size_t *);
typedef void (cfunc_destroy)(void *);
typedef void (cfunc_cipher)(void *, struct uio *, struct uio *, void *, int);
typedef void (cfunc_cipher)(void *, struct uio *, struct uio *, const void *,
int);
struct cryptfuncs {
const char *cf_name; /* cipher name */