summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/Symbols.list1
-rw-r--r--src/lib/libcrypto/bio/bio.h9
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c16
3 files changed, 24 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index 23030bdb15..2252220278 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -280,6 +280,7 @@ BIO_get_data
280BIO_get_ex_data 280BIO_get_ex_data
281BIO_get_ex_new_index 281BIO_get_ex_new_index
282BIO_get_host_ip 282BIO_get_host_ip
283BIO_get_new_index
283BIO_get_port 284BIO_get_port
284BIO_get_retry_BIO 285BIO_get_retry_BIO
285BIO_get_retry_reason 286BIO_get_retry_reason
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h
index 8efeba2005..1d34f082ee 100644
--- a/src/lib/libcrypto/bio/bio.h
+++ b/src/lib/libcrypto/bio/bio.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio.h,v 1.33 2018/02/18 12:59:06 tb Exp $ */ 1/* $OpenBSD: bio.h,v 1.34 2018/02/20 17:15:27 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -103,6 +103,12 @@ extern "C" {
103#define BIO_TYPE_FILTER 0x0200 103#define BIO_TYPE_FILTER 0x0200
104#define BIO_TYPE_SOURCE_SINK 0x0400 104#define BIO_TYPE_SOURCE_SINK 0x0400
105 105
106/*
107 * BIO_TYPE_START is the first user-allocated BIO type. No pre-defined type,
108 * flag bits aside, may exceed this value.
109 */
110#define BIO_TYPE_START 128
111
106/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free. 112/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
107 * BIO_set_fp(in,stdin,BIO_NOCLOSE); */ 113 * BIO_set_fp(in,stdin,BIO_NOCLOSE); */
108#define BIO_NOCLOSE 0x00 114#define BIO_NOCLOSE 0x00
@@ -580,6 +586,7 @@ int
580BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, 586BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
581asn1_ps_func **psuffix_free); 587asn1_ps_func **psuffix_free);
582 588
589int BIO_get_new_index(void);
583BIO_METHOD *BIO_s_file(void ); 590BIO_METHOD *BIO_s_file(void );
584BIO *BIO_new_file(const char *filename, const char *mode); 591BIO *BIO_new_file(const char *filename, const char *mode);
585BIO *BIO_new_fp(FILE *stream, int close_flag); 592BIO *BIO_new_fp(FILE *stream, int close_flag);
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c
index 4e5405d6af..b2acd01342 100644
--- a/src/lib/libcrypto/bio/bio_lib.c
+++ b/src/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_lib.c,v 1.24 2018/02/18 12:58:25 tb Exp $ */ 1/* $OpenBSD: bio_lib.c,v 1.25 2018/02/20 17:15:27 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -64,6 +64,20 @@
64#include <openssl/err.h> 64#include <openssl/err.h>
65#include <openssl/stack.h> 65#include <openssl/stack.h>
66 66
67int
68BIO_get_new_index(void)
69{
70 static int bio_type_index = BIO_TYPE_START;
71 int index;
72
73 /* The index will collide with the BIO flag bits if it exceeds 255. */
74 index = CRYPTO_add(&bio_type_index, 1, CRYPTO_LOCK_BIO);
75 if (index > 255)
76 return -1;
77
78 return index;
79}
80
67BIO * 81BIO *
68BIO_new(BIO_METHOD *method) 82BIO_new(BIO_METHOD *method)
69{ 83{