summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2018-05-12 18:51:59 +0000
committertb <tb@openbsd.org>2018-05-12 18:51:59 +0000
commit91427bf79cac71179f05deb775bfae45dc182e93 (patch)
tree1d1fbbd6558c80d9dcb98810807a36a42d7affe7
parentAdd const qualifiers to the return values of BIO_s_mem() and (diff)
downloadwireguard-openbsd-91427bf79cac71179f05deb775bfae45dc182e93.tar.xz
wireguard-openbsd-91427bf79cac71179f05deb775bfae45dc182e93.zip
const qualifiers for BIO_new_mem_buf(), BIO_new_connect() and
BIO_new_accept(). The one for BIO_new_mem_buf() is a bit ugly since it needs to cast away the newly added const qualifier, as in OpenSSL commit 8ab31975bac. ok jsing
-rw-r--r--lib/libcrypto/bio/bio.h8
-rw-r--r--lib/libcrypto/bio/bss_acpt.c4
-rw-r--r--lib/libcrypto/bio/bss_conn.c4
-rw-r--r--lib/libcrypto/bio/bss_mem.c6
4 files changed, 11 insertions, 11 deletions
diff --git a/lib/libcrypto/bio/bio.h b/lib/libcrypto/bio/bio.h
index 678155c34e6..105d3ff3af0 100644
--- a/lib/libcrypto/bio/bio.h
+++ b/lib/libcrypto/bio/bio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bio.h,v 1.42 2018/05/12 17:47:53 tb Exp $ */
+/* $OpenBSD: bio.h,v 1.43 2018/05/12 18:51:59 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -642,7 +642,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
long argl, long ret);
const BIO_METHOD *BIO_s_mem(void);
-BIO *BIO_new_mem_buf(void *buf, int len);
+BIO *BIO_new_mem_buf(const void *buf, int len);
const BIO_METHOD *BIO_s_socket(void);
const BIO_METHOD *BIO_s_connect(void);
const BIO_METHOD *BIO_s_accept(void);
@@ -698,8 +698,8 @@ int BIO_set_tcp_ndelay(int sock, int turn_on);
BIO *BIO_new_socket(int sock, int close_flag);
BIO *BIO_new_dgram(int fd, int close_flag);
BIO *BIO_new_fd(int fd, int close_flag);
-BIO *BIO_new_connect(char *host_port);
-BIO *BIO_new_accept(char *host_port);
+BIO *BIO_new_connect(const char *host_port);
+BIO *BIO_new_accept(const char *host_port);
int
BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
diff --git a/lib/libcrypto/bio/bss_acpt.c b/lib/libcrypto/bio/bss_acpt.c
index b270199da1d..c95ddde7bb5 100644
--- a/lib/libcrypto/bio/bss_acpt.c
+++ b/lib/libcrypto/bio/bss_acpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bss_acpt.c,v 1.28 2018/05/01 13:29:09 tb Exp $ */
+/* $OpenBSD: bss_acpt.c,v 1.29 2018/05/12 18:51:59 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -436,7 +436,7 @@ acpt_puts(BIO *bp, const char *str)
}
BIO *
-BIO_new_accept(char *str)
+BIO_new_accept(const char *str)
{
BIO *ret;
diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c
index 575d163371a..46a37b06087 100644
--- a/lib/libcrypto/bio/bss_conn.c
+++ b/lib/libcrypto/bio/bss_conn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bss_conn.c,v 1.34 2018/05/01 13:29:09 tb Exp $ */
+/* $OpenBSD: bss_conn.c,v 1.35 2018/05/12 18:51:59 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -583,7 +583,7 @@ conn_puts(BIO *bp, const char *str)
}
BIO *
-BIO_new_connect(char *str)
+BIO_new_connect(const char *str)
{
BIO *ret;
diff --git a/lib/libcrypto/bio/bss_mem.c b/lib/libcrypto/bio/bss_mem.c
index a699dc51c30..e76e1ad2e72 100644
--- a/lib/libcrypto/bio/bss_mem.c
+++ b/lib/libcrypto/bio/bss_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bss_mem.c,v 1.16 2018/05/12 17:47:53 tb Exp $ */
+/* $OpenBSD: bss_mem.c,v 1.17 2018/05/12 18:51:59 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -94,7 +94,7 @@ BIO_s_mem(void)
}
BIO *
-BIO_new_mem_buf(void *buf, int len)
+BIO_new_mem_buf(const void *buf, int len)
{
BIO *ret;
BUF_MEM *b;
@@ -108,7 +108,7 @@ BIO_new_mem_buf(void *buf, int len)
if (!(ret = BIO_new(BIO_s_mem())))
return NULL;
b = (BUF_MEM *)ret->ptr;
- b->data = buf;
+ b->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */
b->length = sz;
b->max = sz;
ret->flags |= BIO_FLAGS_MEM_RDONLY;