[Openvpn-devel] make struct key * argument of init_key_ctx const
Commit Message
This can be const, and should thus be const. (Also, resolves a compiler
warning.)
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
---
src/openvpn/crypto.c | 2 +-
src/openvpn/crypto.h | 2 +-
src/openvpn/crypto_backend.h | 2 +-
src/openvpn/crypto_mbedtls.c | 2 +-
src/openvpn/crypto_openssl.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
Comments
Hi,
On Mon, Oct 23, 2017 at 11:40:13AM +0200, Steffan Karger wrote:
> This can be const, and should thus be const. (Also, resolves a compiler
> warning.)
>
> Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
> ---
> src/openvpn/crypto.c | 2 +-
> src/openvpn/crypto.h | 2 +-
> src/openvpn/crypto_backend.h | 2 +-
> src/openvpn/crypto_mbedtls.c | 2 +-
> src/openvpn/crypto_openssl.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
I think the patch is good, but it *so* does not apply for me...
Applying: make struct key * argument of init_key_ctx const
error: patch failed: src/openvpn/crypto.c:826
error: src/openvpn/crypto.c: patch does not apply
error: patch failed: src/openvpn/crypto.h:321
error: src/openvpn/crypto.h: patch does not apply
error: patch failed: src/openvpn/crypto_backend.h:334
error: src/openvpn/crypto_backend.h: patch does not apply
error: patch failed: src/openvpn/crypto_mbedtls.c:563
error: src/openvpn/crypto_mbedtls.c: patch does not apply
error: patch failed: src/openvpn/crypto_openssl.c:677
error: src/openvpn/crypto_openssl.c: patch does not apply
Patch failed at 0001 make struct key * argument of init_key_ctx const
what tree is this based on...?
gert
Hi,
On Fri, Nov 03, 2017 at 07:24:33PM +0100, Gert Doering wrote:
> On Mon, Oct 23, 2017 at 11:40:13AM +0200, Steffan Karger wrote:
> > This can be const, and should thus be const. (Also, resolves a compiler
> > warning.)
[..]
> I think the patch is good, but it *so* does not apply for me...
>
> Applying: make struct key * argument of init_key_ctx const
> error: patch failed: src/openvpn/crypto.c:826
> error: src/openvpn/crypto.c: patch does not apply
> error: patch failed: src/openvpn/crypto.h:321
> error: src/openvpn/crypto.h: patch does not apply
Looked at the first two occurences, and the confusion is explained - this
change is already in "master" but not in 2.4
master/crypto.h
void init_key_ctx(struct key_ctx *ctx, const struct key *key,
const struct key_type *kt, int enc,
const char *prefix);
2.4/crypto.h
void init_key_ctx(struct key_ctx *ctx, struct key *key,
const struct key_type *kt, int enc,
const char *prefix);
I'm too lazy to trace which patch changed master, and did not get
cherrypicked to 2.4 - but this is reasonable to apply to 2.4 (-only),
so I will :-) - ACK.
gert
ACK, 2.4-only (already in master)
Your patch has been applied to the release/2.4 branch.
commit 94793462a977ad09c14530ff20eedc98bb35d36c
Author: Steffan Karger
Date: Mon Oct 23 11:40:13 2017 +0200
make struct key * argument of init_key_ctx const
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1508751613-23728-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15660.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
@@ -826,7 +826,7 @@ init_key_type(struct key_type *kt, const char *ciphername,
/* given a key and key_type, build a key_ctx */
void
-init_key_ctx(struct key_ctx *ctx, struct key *key,
+init_key_ctx(struct key_ctx *ctx, const struct key *key,
const struct key_type *kt, int enc,
const char *prefix)
{
@@ -321,7 +321,7 @@ void init_key_type(struct key_type *kt, const char *ciphername,
* Key context functions
*/
-void init_key_ctx(struct key_ctx *ctx, struct key *key,
+void init_key_ctx(struct key_ctx *ctx, const struct key *key,
const struct key_type *kt, int enc,
const char *prefix);
@@ -334,7 +334,7 @@ void cipher_ctx_free(cipher_ctx_t *ctx);
* @param enc Whether to encrypt or decrypt (either
* \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT).
*/
-void cipher_ctx_init(cipher_ctx_t *ctx, uint8_t *key, int key_len,
+void cipher_ctx_init(cipher_ctx_t *ctx, const uint8_t *key, int key_len,
const cipher_kt_t *kt, int enc);
/**
@@ -563,7 +563,7 @@ cipher_ctx_free(mbedtls_cipher_context_t *ctx)
}
void
-cipher_ctx_init(mbedtls_cipher_context_t *ctx, uint8_t *key, int key_len,
+cipher_ctx_init(mbedtls_cipher_context_t *ctx, const uint8_t *key, int key_len,
const mbedtls_cipher_info_t *kt, const mbedtls_operation_t operation)
{
ASSERT(NULL != kt && NULL != ctx);
@@ -677,7 +677,7 @@ cipher_ctx_free(EVP_CIPHER_CTX *ctx)
}
void
-cipher_ctx_init(EVP_CIPHER_CTX *ctx, uint8_t *key, int key_len,
+cipher_ctx_init(EVP_CIPHER_CTX *ctx, const uint8_t *key, int key_len,
const EVP_CIPHER *kt, int enc)
{
ASSERT(NULL != kt && NULL != ctx);