From 57f42a4ce140f97ddc36bba5482c2c0c4f368d6e Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 20 Feb 2018 18:13:31 +0000 Subject: [PATCH] Provide BIO_meth_get_{create,ctrl,destroy,gets,puts,read}() ok jsing --- lib/libcrypto/Symbols.list | 6 +++++ lib/libcrypto/bio/bio.h | 8 ++++++- lib/libcrypto/bio/bio_meth.c | 44 +++++++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 39ef6bf4305..04eb29fc1e8 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -290,6 +290,12 @@ BIO_gets BIO_indent BIO_int_ctrl BIO_meth_free +BIO_meth_get_create +BIO_meth_get_ctrl +BIO_meth_get_destroy +BIO_meth_get_gets +BIO_meth_get_puts +BIO_meth_get_read BIO_meth_new BIO_meth_set_create BIO_meth_set_ctrl diff --git a/lib/libcrypto/bio/bio.h b/lib/libcrypto/bio/bio.h index e06faa03eea..2d46535096b 100644 --- a/lib/libcrypto/bio/bio.h +++ b/lib/libcrypto/bio/bio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bio.h,v 1.36 2018/02/20 18:10:27 tb Exp $ */ +/* $OpenBSD: bio.h,v 1.37 2018/02/20 18:13:31 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -338,11 +338,17 @@ BIO_METHOD *BIO_meth_new(int type, const char *name); void BIO_meth_free(BIO_METHOD *biom); int BIO_meth_set_write(BIO_METHOD *biom, int (*write)(BIO *, const char *, int)); +int (*BIO_meth_get_read(BIO_METHOD *biom))(BIO *, char *, int); int BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)); +int (*BIO_meth_get_puts(BIO_METHOD *biom))(BIO *, const char *); int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)); +int (*BIO_meth_get_gets(BIO_METHOD *biom))(BIO *, char *, int); int BIO_meth_set_gets(BIO_METHOD *biom, int (*gets)(BIO *, char *, int)); +long (*BIO_meth_get_ctrl(BIO_METHOD *biom))(BIO *, int, long, void *); int BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl)(BIO *, int, long, void *)); +int (*BIO_meth_get_create(BIO_METHOD *biom))(BIO *); int BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)); +int (*BIO_meth_get_destroy(BIO_METHOD *biom))(BIO *); int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)); /* connect BIO stuff */ diff --git a/lib/libcrypto/bio/bio_meth.c b/lib/libcrypto/bio/bio_meth.c index 65437a8e603..1fc0df534b0 100644 --- a/lib/libcrypto/bio/bio_meth.c +++ b/lib/libcrypto/bio/bio_meth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_meth.c,v 1.2 2018/02/18 12:59:06 tb Exp $ */ +/* $OpenBSD: bio_meth.c,v 1.3 2018/02/20 18:13:31 tb Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -39,6 +39,12 @@ BIO_meth_free(BIO_METHOD *biom) free(biom); } +int +(*BIO_meth_get_write(BIO_METHOD *biom))(BIO *, const char *, int) +{ + return biom->bwrite; +} + int BIO_meth_set_write(BIO_METHOD *biom, int (*write)(BIO *, const char *, int)) { @@ -46,6 +52,12 @@ BIO_meth_set_write(BIO_METHOD *biom, int (*write)(BIO *, const char *, int)) return 1; } +int +(*BIO_meth_get_read(BIO_METHOD *biom))(BIO *, char *, int) +{ + return biom->bread; +} + int BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)) { @@ -53,6 +65,12 @@ BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int)) return 1; } +int +(*BIO_meth_get_puts(BIO_METHOD *biom))(BIO *, const char *) +{ + return biom->bputs; +} + int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)) { @@ -60,6 +78,12 @@ BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *)) return 1; } +int +(*BIO_meth_get_gets(BIO_METHOD *biom))(BIO *, char *, int) +{ + return biom->bgets; +} + int BIO_meth_set_gets(BIO_METHOD *biom, int (*gets)(BIO *, char *, int)) { @@ -67,6 +91,12 @@ BIO_meth_set_gets(BIO_METHOD *biom, int (*gets)(BIO *, char *, int)) return 1; } +long +(*BIO_meth_get_ctrl(BIO_METHOD *biom))(BIO *, int, long, void *) +{ + return biom->ctrl; +} + int BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl)(BIO *, int, long, void *)) { @@ -74,6 +104,12 @@ BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl)(BIO *, int, long, void *)) return 1; } +int +(*BIO_meth_get_create(BIO_METHOD *biom))(BIO *) +{ + return biom->create; +} + int BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)) { @@ -81,6 +117,12 @@ BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *)) return 1; } +int +(*BIO_meth_get_destroy(BIO_METHOD *biom))(BIO *) +{ + return biom->destroy; +} + int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)) { -- 2.20.1