From ede3f3cde163300f5cd33e307719b9b753c91176 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 14 Jan 2022 08:21:12 +0000 Subject: [PATCH] Make structs in comp.h opaque This moves COMP_CTX and COMP_METHOD to comp_local.h and provides missing typedefs in ossl_typ.h. ok inoguchi jsing --- lib/libcrypto/comp/comp.h | 29 +---------------------------- lib/libcrypto/comp/comp_local.h | 28 +++++++++++++++++++++++++++- lib/libcrypto/ossl_typ.h | 5 ++++- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/lib/libcrypto/comp/comp.h b/lib/libcrypto/comp/comp.h index fe7397f8ea4..7c99ead3584 100644 --- a/lib/libcrypto/comp/comp.h +++ b/lib/libcrypto/comp/comp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: comp.h,v 1.8 2014/11/03 16:58:28 tedu Exp $ */ +/* $OpenBSD: comp.h,v 1.9 2022/01/14 08:21:12 tb Exp $ */ #ifndef HEADER_COMP_H #define HEADER_COMP_H @@ -9,33 +9,6 @@ extern "C" { #endif -typedef struct comp_ctx_st COMP_CTX; - -typedef struct comp_method_st { - int type; /* NID for compression library */ - const char *name; /* A text string to identify the library */ - int (*init)(COMP_CTX *ctx); - void (*finish)(COMP_CTX *ctx); - int (*compress)(COMP_CTX *ctx, unsigned char *out, unsigned int olen, - unsigned char *in, unsigned int ilen); - int (*expand)(COMP_CTX *ctx, unsigned char *out, unsigned int olen, - unsigned char *in, unsigned int ilen); - /* The following two do NOTHING, but are kept for backward compatibility */ - long (*ctrl)(void); - long (*callback_ctrl)(void); -} COMP_METHOD; - -struct comp_ctx_st { - COMP_METHOD *meth; - unsigned long compress_in; - unsigned long compress_out; - unsigned long expand_in; - unsigned long expand_out; - - CRYPTO_EX_DATA ex_data; -}; - - COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); void COMP_CTX_free(COMP_CTX *ctx); int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, diff --git a/lib/libcrypto/comp/comp_local.h b/lib/libcrypto/comp/comp_local.h index e1dfff1251f..fc1888711be 100644 --- a/lib/libcrypto/comp/comp_local.h +++ b/lib/libcrypto/comp/comp_local.h @@ -1,10 +1,36 @@ -/* $OpenBSD: comp_local.h,v 1.1 2022/01/09 23:50:10 tb Exp $ */ +/* $OpenBSD: comp_local.h,v 1.2 2022/01/14 08:21:12 tb Exp $ */ #ifndef HEADER_COMP_LOCAL_H #define HEADER_COMP_LOCAL_H __BEGIN_HIDDEN_DECLS +struct CMP_CTX; + +struct comp_method_st { + int type; /* NID for compression library */ + const char *name; /* A text string to identify the library */ + int (*init)(COMP_CTX *ctx); + void (*finish)(COMP_CTX *ctx); + int (*compress)(COMP_CTX *ctx, unsigned char *out, unsigned int olen, + unsigned char *in, unsigned int ilen); + int (*expand)(COMP_CTX *ctx, unsigned char *out, unsigned int olen, + unsigned char *in, unsigned int ilen); + /* The following two do NOTHING, but are kept for backward compatibility */ + long (*ctrl)(void); + long (*callback_ctrl)(void); +} /* COMP_METHOD */; + +struct comp_ctx_st { + COMP_METHOD *meth; + unsigned long compress_in; + unsigned long compress_out; + unsigned long expand_in; + unsigned long expand_out; + + CRYPTO_EX_DATA ex_data; +} /* COMP_CTX */; + __END_HIDDEN_DECLS #endif /* !HEADER_COMP_LOCAL_H */ diff --git a/lib/libcrypto/ossl_typ.h b/lib/libcrypto/ossl_typ.h index 21197f873a6..161bf86a3e3 100644 --- a/lib/libcrypto/ossl_typ.h +++ b/lib/libcrypto/ossl_typ.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ossl_typ.h,v 1.18 2022/01/14 08:18:55 tb Exp $ */ +/* $OpenBSD: ossl_typ.h,v 1.19 2022/01/14 08:21:12 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * @@ -95,6 +95,9 @@ typedef struct bn_gencb_st BN_GENCB; typedef struct bio_st BIO; typedef struct buf_mem_st BUF_MEM; +typedef struct comp_ctx_st COMP_CTX; +typedef struct comp_method_st COMP_METHOD; + typedef struct evp_cipher_st EVP_CIPHER; typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; typedef struct env_md_st EVP_MD; -- 2.20.1