diff options
| author | jsing <> | 2018-02-20 17:15:27 +0000 |
|---|---|---|
| committer | jsing <> | 2018-02-20 17:15:27 +0000 |
| commit | a4030b5396f86a13c74483f512c1fe91c03d73b5 (patch) | |
| tree | aaa79b91c7a94144ce88e4371f39e925adcc904d /src/lib/libcrypto/bio/bio_lib.c | |
| parent | 293a70c9811459080f491f606e3ce48530401462 (diff) | |
| download | openbsd-a4030b5396f86a13c74483f512c1fe91c03d73b5.tar.gz openbsd-a4030b5396f86a13c74483f512c1fe91c03d73b5.tar.bz2 openbsd-a4030b5396f86a13c74483f512c1fe91c03d73b5.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.c | 16 |
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 | ||
| 67 | int | ||
| 68 | BIO_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 | |||
| 67 | BIO * | 81 | BIO * |
| 68 | BIO_new(BIO_METHOD *method) | 82 | BIO_new(BIO_METHOD *method) |
| 69 | { | 83 | { |
