summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp
diff options
context:
space:
mode:
authortb <>2022-01-14 08:40:57 +0000
committertb <>2022-01-14 08:40:57 +0000
commit7de4d3a68913b50be213d1f95ad168ee17570641 (patch)
treef4107fef050d8e49767a68206c4485731507efa2 /src/lib/libcrypto/evp
parent11d03b6dcd305ef8269fb1b034e0f623f6d08d93 (diff)
downloadopenbsd-7de4d3a68913b50be213d1f95ad168ee17570641.tar.gz
openbsd-7de4d3a68913b50be213d1f95ad168ee17570641.tar.bz2
openbsd-7de4d3a68913b50be213d1f95ad168ee17570641.zip
Implement new-style OpenSSL BIO callbacks
This provides support for new-style BIO callbacks in BIO_{read,write,gets,puts}() and a helper function to work out whether it should call the new or the old style callback. It also adds a few typedefs and minor code cleanup as well as the BIO_{get,set}_callback_ex() from jsing, ok tb
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r--src/lib/libcrypto/evp/bio_b64.c6
-rw-r--r--src/lib/libcrypto/evp/bio_enc.c6
-rw-r--r--src/lib/libcrypto/evp/bio_md.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c
index c1ec25d9c4..b61a342a3e 100644
--- a/src/lib/libcrypto/evp/bio_b64.c
+++ b/src/lib/libcrypto/evp/bio_b64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_b64.c,v 1.24 2022/01/07 09:02:18 tb Exp $ */ 1/* $OpenBSD: bio_b64.c,v 1.25 2022/01/14 08:40:57 tb 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 *
@@ -73,7 +73,7 @@ static int b64_puts(BIO *h, const char *str);
73static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2); 73static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2);
74static int b64_new(BIO *h); 74static int b64_new(BIO *h);
75static int b64_free(BIO *data); 75static int b64_free(BIO *data);
76static long b64_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); 76static long b64_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
77#define B64_BLOCK_SIZE 1024 77#define B64_BLOCK_SIZE 1024
78#define B64_BLOCK_SIZE2 768 78#define B64_BLOCK_SIZE2 768
79#define B64_NONE 0 79#define B64_NONE 0
@@ -550,7 +550,7 @@ again:
550} 550}
551 551
552static long 552static long
553b64_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) 553b64_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
554{ 554{
555 long ret = 1; 555 long ret = 1;
556 556
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c
index 6ab07e13d9..2a0f76fcbe 100644
--- a/src/lib/libcrypto/evp/bio_enc.c
+++ b/src/lib/libcrypto/evp/bio_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_enc.c,v 1.25 2022/01/07 09:02:18 tb Exp $ */ 1/* $OpenBSD: bio_enc.c,v 1.26 2022/01/14 08:40:57 tb 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 *
@@ -73,7 +73,7 @@ static int enc_read(BIO *h, char *buf, int size);
73static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2); 73static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2);
74static int enc_new(BIO *h); 74static int enc_new(BIO *h);
75static int enc_free(BIO *data); 75static int enc_free(BIO *data);
76static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps); 76static long enc_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fps);
77#define ENC_BLOCK_SIZE (1024*4) 77#define ENC_BLOCK_SIZE (1024*4)
78#define BUF_OFFSET (EVP_MAX_BLOCK_LENGTH*2) 78#define BUF_OFFSET (EVP_MAX_BLOCK_LENGTH*2)
79 79
@@ -373,7 +373,7 @@ again:
373} 373}
374 374
375static long 375static long
376enc_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) 376enc_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
377{ 377{
378 long ret = 1; 378 long ret = 1;
379 379
diff --git a/src/lib/libcrypto/evp/bio_md.c b/src/lib/libcrypto/evp/bio_md.c
index a83088a963..4ae5f1f496 100644
--- a/src/lib/libcrypto/evp/bio_md.c
+++ b/src/lib/libcrypto/evp/bio_md.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_md.c,v 1.17 2022/01/07 09:02:18 tb Exp $ */ 1/* $OpenBSD: bio_md.c,v 1.18 2022/01/14 08:40:57 tb 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 *
@@ -75,7 +75,7 @@ static int md_gets(BIO *h, char *str, int size);
75static long md_ctrl(BIO *h, int cmd, long arg1, void *arg2); 75static long md_ctrl(BIO *h, int cmd, long arg1, void *arg2);
76static int md_new(BIO *h); 76static int md_new(BIO *h);
77static int md_free(BIO *data); 77static int md_free(BIO *data);
78static long md_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); 78static long md_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
79 79
80static const BIO_METHOD methods_md = { 80static const BIO_METHOD methods_md = {
81 .type = BIO_TYPE_MD, 81 .type = BIO_TYPE_MD,
@@ -241,7 +241,7 @@ md_ctrl(BIO *b, int cmd, long num, void *ptr)
241} 241}
242 242
243static long 243static long
244md_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) 244md_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
245{ 245{
246 long ret = 1; 246 long ret = 1;
247 247