From: tobhe Date: Thu, 25 Feb 2021 20:13:24 +0000 (+0000) Subject: Constify cipher API. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a9a2a639c18589cbcef1f81b8516dfc5b4b073d9;p=openbsd Constify cipher API. ok markus@ --- diff --git a/sbin/iked/crypto.c b/sbin/iked/crypto.c index 3115baa607b..8e7f90ee893 100644 --- a/sbin/iked/crypto.c +++ b/sbin/iked/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.33 2021/02/04 19:59:15 tobhe Exp $ */ +/* $OpenBSD: crypto.c,v 1.34 2021/02/25 20:13:24 tobhe Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -486,7 +486,7 @@ cipher_new(uint8_t type, uint16_t id, uint16_t id_length) } struct ibuf * -cipher_setkey(struct iked_cipher *encr, void *key, size_t keylen) +cipher_setkey(struct iked_cipher *encr, const void *key, size_t keylen) { ibuf_release(encr->encr_key); if ((encr->encr_key = ibuf_new(key, keylen)) == NULL) { @@ -497,7 +497,7 @@ cipher_setkey(struct iked_cipher *encr, void *key, size_t keylen) } struct ibuf * -cipher_setiv(struct iked_cipher *encr, void *iv, size_t len) +cipher_setiv(struct iked_cipher *encr, const void *iv, size_t len) { ibuf_release(encr->encr_iv); encr->encr_iv = NULL; @@ -605,7 +605,7 @@ cipher_init_decrypt(struct iked_cipher *encr) } void -cipher_aad(struct iked_cipher *encr, void *in, size_t inlen, +cipher_aad(struct iked_cipher *encr, const void *in, size_t inlen, size_t *outlen) { int olen = 0; @@ -619,7 +619,7 @@ cipher_aad(struct iked_cipher *encr, void *in, size_t inlen, } int -cipher_update(struct iked_cipher *encr, void *in, size_t inlen, +cipher_update(struct iked_cipher *encr, const void *in, size_t inlen, void *out, size_t *outlen) { int olen; diff --git a/sbin/iked/iked.h b/sbin/iked/iked.h index cda2e156fd9..0a2e659df3f 100644 --- a/sbin/iked/iked.h +++ b/sbin/iked/iked.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iked.h,v 1.186 2021/02/22 21:58:12 tobhe Exp $ */ +/* $OpenBSD: iked.h,v 1.187 2021/02/25 20:13:24 tobhe Exp $ */ /* * Copyright (c) 2019 Tobias Heider @@ -908,17 +908,17 @@ size_t hash_length(struct iked_hash *); struct iked_cipher * cipher_new(uint8_t, uint16_t, uint16_t); struct ibuf * - cipher_setkey(struct iked_cipher *, void *, size_t); + cipher_setkey(struct iked_cipher *, const void *, size_t); struct ibuf * - cipher_setiv(struct iked_cipher *, void *, size_t); + cipher_setiv(struct iked_cipher *, const void *, size_t); int cipher_settag(struct iked_cipher *, uint8_t *, size_t); int cipher_gettag(struct iked_cipher *, uint8_t *, size_t); void cipher_free(struct iked_cipher *); int cipher_init(struct iked_cipher *, int); int cipher_init_encrypt(struct iked_cipher *); int cipher_init_decrypt(struct iked_cipher *); -void cipher_aad(struct iked_cipher *, void *, size_t, size_t *); -int cipher_update(struct iked_cipher *, void *, size_t, void *, size_t *); +void cipher_aad(struct iked_cipher *, const void *, size_t, size_t *); +int cipher_update(struct iked_cipher *, const void *, size_t, void *, size_t *); int cipher_final(struct iked_cipher *); size_t cipher_length(struct iked_cipher *); size_t cipher_keylength(struct iked_cipher *);