summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bio_lib.c
diff options
context:
space:
mode:
authorjsing <>2018-02-20 17:15:27 +0000
committerjsing <>2018-02-20 17:15:27 +0000
commit4f1ee631944961365c3b2ee139bc108c1ceff2ed (patch)
treeaaa79b91c7a94144ce88e4371f39e925adcc904d /src/lib/libcrypto/bio/bio_lib.c
parent2f0d52b8a3e3ce63552d3125a01f70077b6e6b1a (diff)
downloadopenbsd-4f1ee631944961365c3b2ee139bc108c1ceff2ed.tar.gz
openbsd-4f1ee631944961365c3b2ee139bc108c1ceff2ed.tar.bz2
openbsd-4f1ee631944961365c3b2ee139bc108c1ceff2ed.zip
Provide BIO_get_new_index().
Based on BoringSSL.
Diffstat (limited to 'src/lib/libcrypto/bio/bio_lib.c')
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c16
1 files changed, 15 insertions, 1 deletions
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{