VirtualBox

source: vbox/trunk/src/libs/openssl-3.3.2/include/internal/bio.h@ 108403

最後變更 在這個檔案從108403是 108206,由 vboxsync 提交於 5 週 前

openssl-3.3.2: Exported all files to OSE and removed .scm-settings ​bugref:10757

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.4 KB
 
1/*
2 * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef OSSL_INTERNAL_BIO_H
11# define OSSL_INTERNAL_BIO_H
12# ifndef RT_WITHOUT_PRAGMA_ONCE /* VBOX */
13# pragma once
14# endif /* VBOX */
15
16# include <openssl/core.h>
17# include <openssl/bio.h>
18
19struct bio_method_st {
20 int type;
21 char *name;
22 int (*bwrite) (BIO *, const char *, size_t, size_t *);
23 int (*bwrite_old) (BIO *, const char *, int);
24 int (*bread) (BIO *, char *, size_t, size_t *);
25 int (*bread_old) (BIO *, char *, int);
26 int (*bputs) (BIO *, const char *);
27 int (*bgets) (BIO *, char *, int);
28 long (*ctrl) (BIO *, int, long, void *);
29 int (*create) (BIO *);
30 int (*destroy) (BIO *);
31 long (*callback_ctrl) (BIO *, int, BIO_info_cb *);
32 int (*bsendmmsg) (BIO *, BIO_MSG *, size_t, size_t, uint64_t, size_t *);
33 int (*brecvmmsg) (BIO *, BIO_MSG *, size_t, size_t, uint64_t, size_t *);
34};
35
36void bio_free_ex_data(BIO *bio);
37void bio_cleanup(void);
38
39
40/* Old style to new style BIO_METHOD conversion functions */
41int bwrite_conv(BIO *bio, const char *data, size_t datal, size_t *written);
42int bread_conv(BIO *bio, char *data, size_t datal, size_t *read);
43
44/* Changes to these internal BIOs must also update include/openssl/bio.h */
45# define BIO_CTRL_SET_KTLS 72
46# define BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG 74
47# define BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG 75
48# define BIO_CTRL_SET_KTLS_TX_ZEROCOPY_SENDFILE 90
49
50/*
51 * This is used with socket BIOs:
52 * BIO_FLAGS_KTLS_TX means we are using ktls with this BIO for sending.
53 * BIO_FLAGS_KTLS_TX_CTRL_MSG means we are about to send a ctrl message next.
54 * BIO_FLAGS_KTLS_RX means we are using ktls with this BIO for receiving.
55 * BIO_FLAGS_KTLS_TX_ZEROCOPY_SENDFILE means we are using the zerocopy mode with
56 * this BIO for sending using sendfile.
57 */
58# define BIO_FLAGS_KTLS_TX_CTRL_MSG 0x1000
59# define BIO_FLAGS_KTLS_RX 0x2000
60# define BIO_FLAGS_KTLS_TX 0x4000
61# define BIO_FLAGS_KTLS_TX_ZEROCOPY_SENDFILE 0x8000
62
63/* KTLS related controls and flags */
64# define BIO_set_ktls_flag(b, is_tx) \
65 BIO_set_flags(b, (is_tx) ? BIO_FLAGS_KTLS_TX : BIO_FLAGS_KTLS_RX)
66# define BIO_should_ktls_flag(b, is_tx) \
67 BIO_test_flags(b, (is_tx) ? BIO_FLAGS_KTLS_TX : BIO_FLAGS_KTLS_RX)
68# define BIO_set_ktls_ctrl_msg_flag(b) \
69 BIO_set_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
70# define BIO_should_ktls_ctrl_msg_flag(b) \
71 BIO_test_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
72# define BIO_clear_ktls_ctrl_msg_flag(b) \
73 BIO_clear_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
74# define BIO_set_ktls_zerocopy_sendfile_flag(b) \
75 BIO_set_flags(b, BIO_FLAGS_KTLS_TX_ZEROCOPY_SENDFILE)
76
77# define BIO_set_ktls(b, keyblob, is_tx) \
78 BIO_ctrl(b, BIO_CTRL_SET_KTLS, is_tx, keyblob)
79# define BIO_set_ktls_ctrl_msg(b, record_type) \
80 BIO_ctrl(b, BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG, record_type, NULL)
81# define BIO_clear_ktls_ctrl_msg(b) \
82 BIO_ctrl(b, BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG, 0, NULL)
83# define BIO_set_ktls_tx_zerocopy_sendfile(b) \
84 BIO_ctrl(b, BIO_CTRL_SET_KTLS_TX_ZEROCOPY_SENDFILE, 0, NULL)
85
86/* Functions to allow the core to offer the CORE_BIO type to providers */
87OSSL_CORE_BIO *ossl_core_bio_new_from_bio(BIO *bio);
88OSSL_CORE_BIO *ossl_core_bio_new_file(const char *filename, const char *mode);
89OSSL_CORE_BIO *ossl_core_bio_new_mem_buf(const void *buf, int len);
90int ossl_core_bio_read_ex(OSSL_CORE_BIO *cb, void *data, size_t dlen,
91 size_t *readbytes);
92int ossl_core_bio_write_ex(OSSL_CORE_BIO *cb, const void *data, size_t dlen,
93 size_t *written);
94int ossl_core_bio_gets(OSSL_CORE_BIO *cb, char *buf, int size);
95int ossl_core_bio_puts(OSSL_CORE_BIO *cb, const char *buf);
96long ossl_core_bio_ctrl(OSSL_CORE_BIO *cb, int cmd, long larg, void *parg);
97int ossl_core_bio_up_ref(OSSL_CORE_BIO *cb);
98int ossl_core_bio_free(OSSL_CORE_BIO *cb);
99int ossl_core_bio_vprintf(OSSL_CORE_BIO *cb, const char *format, va_list args);
100
101int ossl_bio_init_core(OSSL_LIB_CTX *libctx, const OSSL_DISPATCH *fns);
102
103#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette