Another short and simple diff. The addition of const to
BIO_new_mem_buf() is a bit ugly, following OpenSSL commit 8ab31975bac,
casting away const and relying on the BIO_FLAGS_MEM_RDONLY flag.
Index: lib/libcrypto/bio/bio.h
===================================================================
RCS file: /cvs/src/lib/libcrypto/bio/bio.h,v
retrieving revision 1.42
diff -u -p -r1.42 bio.h
--- lib/libcrypto/bio/bio.h 12 May 2018 17:47:53 -0000 1.42
+++ lib/libcrypto/bio/bio.h 12 May 2018 18:00:56 -0000
@@ -642,7 +642,7 @@ long BIO_debug_callback(BIO *bio, int cm
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 tur
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,
Index: lib/libcrypto/bio/bss_acpt.c
===================================================================
RCS file: /cvs/src/lib/libcrypto/bio/bss_acpt.c,v
retrieving revision 1.28
diff -u -p -r1.28 bss_acpt.c
--- lib/libcrypto/bio/bss_acpt.c 1 May 2018 13:29:09 -0000 1.28
+++ lib/libcrypto/bio/bss_acpt.c 12 May 2018 18:00:56 -0000
@@ -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;
Index: lib/libcrypto/bio/bss_conn.c
===================================================================
RCS file: /cvs/src/lib/libcrypto/bio/bss_conn.c,v
retrieving revision 1.34
diff -u -p -r1.34 bss_conn.c
--- lib/libcrypto/bio/bss_conn.c 1 May 2018 13:29:09 -0000 1.34
+++ lib/libcrypto/bio/bss_conn.c 12 May 2018 18:00:56 -0000
@@ -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;
Index: lib/libcrypto/bio/bss_mem.c
===================================================================
RCS file: /cvs/src/lib/libcrypto/bio/bss_mem.c,v
retrieving revision 1.16
diff -u -p -r1.16 bss_mem.c
--- lib/libcrypto/bio/bss_mem.c 12 May 2018 17:47:53 -0000 1.16
+++ lib/libcrypto/bio/bss_mem.c 12 May 2018 18:00:56 -0000
@@ -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;