From 5fd87cb94c147542b93b3014a2b2c6d7ea96b57f Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 20 Feb 2018 18:17:17 +0000 Subject: [PATCH] Provide BIO_meth_{g,s}et_callback_ctrl() with & ok jsing --- lib/libcrypto/Symbols.list | 2 ++ lib/libcrypto/bio/bio.h | 6 +++++- lib/libcrypto/bio/bio_meth.c | 18 +++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 04eb29fc1e8..61a7867182e 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -290,6 +290,7 @@ BIO_gets BIO_indent BIO_int_ctrl BIO_meth_free +BIO_meth_get_callback_ctrl BIO_meth_get_create BIO_meth_get_ctrl BIO_meth_get_destroy @@ -297,6 +298,7 @@ BIO_meth_get_gets BIO_meth_get_puts BIO_meth_get_read BIO_meth_new +BIO_meth_set_callback_ctrl BIO_meth_set_create BIO_meth_set_ctrl BIO_meth_set_destroy diff --git a/lib/libcrypto/bio/bio.h b/lib/libcrypto/bio/bio.h index 2d46535096b..0a05d64929b 100644 --- a/lib/libcrypto/bio/bio.h +++ b/lib/libcrypto/bio/bio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bio.h,v 1.37 2018/02/20 18:13:31 tb Exp $ */ +/* $OpenBSD: bio.h,v 1.38 2018/02/20 18:17:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -270,6 +270,7 @@ const char * BIO_method_name(const BIO *b); int BIO_method_type(const BIO *b); typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); +typedef int BIO_info_cb(BIO *, int, int); typedef struct bio_method_st { int type; @@ -350,6 +351,9 @@ 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 *)); +long (*BIO_meth_get_callback_ctrl(BIO_METHOD *biom))(BIO *, int, BIO_info_cb *); +int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, + long (*callback_ctrl)(BIO *, int, BIO_info_cb *)); /* connect BIO stuff */ #define BIO_CONN_S_BEFORE 1 diff --git a/lib/libcrypto/bio/bio_meth.c b/lib/libcrypto/bio/bio_meth.c index 1fc0df534b0..2eb6794f020 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.3 2018/02/20 18:13:31 tb Exp $ */ +/* $OpenBSD: bio_meth.c,v 1.4 2018/02/20 18:17:17 tb Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -129,3 +129,19 @@ BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *)) biom->destroy = destroy; return 1; } + +long +(*BIO_meth_get_callback_ctrl(BIO_METHOD *biom))(BIO *, int, BIO_info_cb *) +{ + return + (long (*)(BIO *, int, BIO_info_cb*))biom->callback_ctrl; /* XXX */ +} + +int +BIO_meth_set_callback_ctrl(BIO_METHOD *biom, + long (*callback_ctrl)(BIO *, int, BIO_info_cb *)) +{ + biom->callback_ctrl = + (long (*)(BIO *, int, bio_info_cb *))callback_ctrl; /* XXX */ + return 1; +} -- 2.20.1