diff options
author | tb <> | 2022-01-14 08:18:55 +0000 |
---|---|---|
committer | tb <> | 2022-01-14 08:18:55 +0000 |
commit | 5c9a6a0190a65419ec242e2449f81335e105a053 (patch) | |
tree | 824111983377b0701a219029d61dd0016cb529e9 /src | |
parent | 72623a3ef957eb2abae8f23270f10fce78f84123 (diff) | |
download | openbsd-5c9a6a0190a65419ec242e2449f81335e105a053.tar.gz openbsd-5c9a6a0190a65419ec242e2449f81335e105a053.tar.bz2 openbsd-5c9a6a0190a65419ec242e2449f81335e105a053.zip |
Make structs in bio.h opaque
Move BIO, BIO_METHOD and BIO_F_BUFFER_CTX to bio_local.h and provide
BIO typedef in ossl_typ.h.
ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 61 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_local.h | 59 | ||||
-rw-r--r-- | src/lib/libcrypto/ossl_typ.h | 3 |
3 files changed, 62 insertions, 61 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index 47e7baf205..8feb98d457 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio.h,v 1.52 2022/01/14 07:59:32 tb Exp $ */ | 1 | /* $OpenBSD: bio.h,v 1.53 2022/01/14 08:18:55 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 | * |
@@ -205,8 +205,6 @@ extern "C" { | |||
205 | */ | 205 | */ |
206 | #define BIO_FLAGS_MEM_RDONLY 0x200 | 206 | #define BIO_FLAGS_MEM_RDONLY 0x200 |
207 | 207 | ||
208 | typedef struct bio_st BIO; | ||
209 | |||
210 | void BIO_set_flags(BIO *b, int flags); | 208 | void BIO_set_flags(BIO *b, int flags); |
211 | int BIO_test_flags(const BIO *b, int flags); | 209 | int BIO_test_flags(const BIO *b, int flags); |
212 | void BIO_clear_flags(BIO *b, int flags); | 210 | void BIO_clear_flags(BIO *b, int flags); |
@@ -272,65 +270,10 @@ int BIO_method_type(const BIO *b); | |||
272 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); | 270 | typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); |
273 | typedef int BIO_info_cb(BIO *, int, int); | 271 | typedef int BIO_info_cb(BIO *, int, int); |
274 | 272 | ||
275 | typedef struct bio_method_st { | 273 | typedef struct bio_method_st BIO_METHOD; |
276 | int type; | ||
277 | const char *name; | ||
278 | int (*bwrite)(BIO *, const char *, int); | ||
279 | int (*bread)(BIO *, char *, int); | ||
280 | int (*bputs)(BIO *, const char *); | ||
281 | int (*bgets)(BIO *, char *, int); | ||
282 | long (*ctrl)(BIO *, int, long, void *); | ||
283 | int (*create)(BIO *); | ||
284 | int (*destroy)(BIO *); | ||
285 | long (*callback_ctrl)(BIO *, int, bio_info_cb *); | ||
286 | } BIO_METHOD; | ||
287 | |||
288 | struct bio_st { | ||
289 | const BIO_METHOD *method; | ||
290 | /* bio, mode, argp, argi, argl, ret */ | ||
291 | long (*callback)(struct bio_st *, int, const char *, int, long, long); | ||
292 | char *cb_arg; /* first argument for the callback */ | ||
293 | |||
294 | int init; | ||
295 | int shutdown; | ||
296 | int flags; /* extra storage */ | ||
297 | int retry_reason; | ||
298 | int num; | ||
299 | void *ptr; | ||
300 | struct bio_st *next_bio; /* used by filter BIOs */ | ||
301 | struct bio_st *prev_bio; /* used by filter BIOs */ | ||
302 | int references; | ||
303 | unsigned long num_read; | ||
304 | unsigned long num_write; | ||
305 | |||
306 | CRYPTO_EX_DATA ex_data; | ||
307 | }; | ||
308 | 274 | ||
309 | DECLARE_STACK_OF(BIO) | 275 | DECLARE_STACK_OF(BIO) |
310 | 276 | ||
311 | typedef struct bio_f_buffer_ctx_struct { | ||
312 | /* Buffers are setup like this: | ||
313 | * | ||
314 | * <---------------------- size -----------------------> | ||
315 | * +---------------------------------------------------+ | ||
316 | * | consumed | remaining | free space | | ||
317 | * +---------------------------------------------------+ | ||
318 | * <-- off --><------- len -------> | ||
319 | */ | ||
320 | |||
321 | /* BIO *bio; */ /* this is now in the BIO struct */ | ||
322 | int ibuf_size; /* how big is the input buffer */ | ||
323 | int obuf_size; /* how big is the output buffer */ | ||
324 | |||
325 | char *ibuf; /* the char array */ | ||
326 | int ibuf_len; /* how many bytes are in it */ | ||
327 | int ibuf_off; /* write/read offset */ | ||
328 | |||
329 | char *obuf; /* the char array */ | ||
330 | int obuf_len; /* how many bytes are in it */ | ||
331 | int obuf_off; /* write/read offset */ | ||
332 | } BIO_F_BUFFER_CTX; | ||
333 | |||
334 | /* Prefix and suffix callback in ASN1 BIO */ | 277 | /* Prefix and suffix callback in ASN1 BIO */ |
335 | typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); | 278 | typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); |
336 | 279 | ||
diff --git a/src/lib/libcrypto/bio/bio_local.h b/src/lib/libcrypto/bio/bio_local.h index 9c2e8f4808..62a9793d00 100644 --- a/src/lib/libcrypto/bio/bio_local.h +++ b/src/lib/libcrypto/bio/bio_local.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_local.h,v 1.1 2022/01/07 09:02:17 tb Exp $ */ | 1 | /* $OpenBSD: bio_local.h,v 1.2 2022/01/14 08:18:55 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 | * |
@@ -61,6 +61,63 @@ | |||
61 | 61 | ||
62 | __BEGIN_HIDDEN_DECLS | 62 | __BEGIN_HIDDEN_DECLS |
63 | 63 | ||
64 | struct bio_method_st { | ||
65 | int type; | ||
66 | const char *name; | ||
67 | int (*bwrite)(BIO *, const char *, int); | ||
68 | int (*bread)(BIO *, char *, int); | ||
69 | int (*bputs)(BIO *, const char *); | ||
70 | int (*bgets)(BIO *, char *, int); | ||
71 | long (*ctrl)(BIO *, int, long, void *); | ||
72 | int (*create)(BIO *); | ||
73 | int (*destroy)(BIO *); | ||
74 | long (*callback_ctrl)(BIO *, int, bio_info_cb *); | ||
75 | } /* BIO_METHOD */; | ||
76 | |||
77 | struct bio_st { | ||
78 | const BIO_METHOD *method; | ||
79 | /* bio, mode, argp, argi, argl, ret */ | ||
80 | long (*callback)(struct bio_st *, int, const char *, int, long, long); | ||
81 | char *cb_arg; /* first argument for the callback */ | ||
82 | |||
83 | int init; | ||
84 | int shutdown; | ||
85 | int flags; /* extra storage */ | ||
86 | int retry_reason; | ||
87 | int num; | ||
88 | void *ptr; | ||
89 | struct bio_st *next_bio; /* used by filter BIOs */ | ||
90 | struct bio_st *prev_bio; /* used by filter BIOs */ | ||
91 | int references; | ||
92 | unsigned long num_read; | ||
93 | unsigned long num_write; | ||
94 | |||
95 | CRYPTO_EX_DATA ex_data; | ||
96 | } /* BIO */; | ||
97 | |||
98 | typedef struct bio_f_buffer_ctx_struct { | ||
99 | /* Buffers are setup like this: | ||
100 | * | ||
101 | * <---------------------- size -----------------------> | ||
102 | * +---------------------------------------------------+ | ||
103 | * | consumed | remaining | free space | | ||
104 | * +---------------------------------------------------+ | ||
105 | * <-- off --><------- len -------> | ||
106 | */ | ||
107 | |||
108 | /* BIO *bio; */ /* this is now in the BIO struct */ | ||
109 | int ibuf_size; /* how big is the input buffer */ | ||
110 | int obuf_size; /* how big is the output buffer */ | ||
111 | |||
112 | char *ibuf; /* the char array */ | ||
113 | int ibuf_len; /* how many bytes are in it */ | ||
114 | int ibuf_off; /* write/read offset */ | ||
115 | |||
116 | char *obuf; /* the char array */ | ||
117 | int obuf_len; /* how many bytes are in it */ | ||
118 | int obuf_off; /* write/read offset */ | ||
119 | } BIO_F_BUFFER_CTX; | ||
120 | |||
64 | __END_HIDDEN_DECLS | 121 | __END_HIDDEN_DECLS |
65 | 122 | ||
66 | #endif /* !HEADER_BIO_LOCAL_H */ | 123 | #endif /* !HEADER_BIO_LOCAL_H */ |
diff --git a/src/lib/libcrypto/ossl_typ.h b/src/lib/libcrypto/ossl_typ.h index c4dd11eab2..21197f873a 100644 --- a/src/lib/libcrypto/ossl_typ.h +++ b/src/lib/libcrypto/ossl_typ.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ossl_typ.h,v 1.17 2022/01/14 08:09:18 tb Exp $ */ | 1 | /* $OpenBSD: ossl_typ.h,v 1.18 2022/01/14 08:18:55 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -92,6 +92,7 @@ typedef struct bn_mont_ctx_st BN_MONT_CTX; | |||
92 | typedef struct bn_recp_ctx_st BN_RECP_CTX; | 92 | typedef struct bn_recp_ctx_st BN_RECP_CTX; |
93 | typedef struct bn_gencb_st BN_GENCB; | 93 | typedef struct bn_gencb_st BN_GENCB; |
94 | 94 | ||
95 | typedef struct bio_st BIO; | ||
95 | typedef struct buf_mem_st BUF_MEM; | 96 | typedef struct buf_mem_st BUF_MEM; |
96 | 97 | ||
97 | typedef struct evp_cipher_st EVP_CIPHER; | 98 | typedef struct evp_cipher_st EVP_CIPHER; |