From f678e530ea1fc98606aa39d45e8462ab5457a357 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 12 Dec 2021 21:35:46 +0000 Subject: [PATCH] Annotate the structs that will be moved to hmac_local.h and evp_locl.h in an upcoming bump. This omits EVP_AEAD_CTX which will be dealt with separately. EVP_CIPHER_INFO internals are still publicly visible in OpenSSL, so it won't be moved. Move typedefs for HMAC_CTX and EVP_ENCODE_CTX to ossl_typ.h. These typedefs will be visible by files including only hmac.h or evp.h since hmac.h includes evp.h and evp.h includes ossl_typ.h. ok inoguchi --- lib/libcrypto/evp/evp.h | 13 ++++++++++--- lib/libcrypto/hmac/hmac.h | 9 +++++---- lib/libcrypto/ossl_typ.h | 6 +++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/libcrypto/evp/evp.h b/lib/libcrypto/evp/evp.h index 9898738e644..89ebac415da 100644 --- a/lib/libcrypto/evp/evp.h +++ b/lib/libcrypto/evp/evp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: evp.h,v 1.87 2021/11/30 18:27:04 tb Exp $ */ +/* $OpenBSD: evp.h,v 1.88 2021/12/12 21:35:46 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -119,6 +119,7 @@ extern "C" { #endif +/* Move to evp_locl.h */ /* Type needs to be a bit field * Sub-type needs to be for variations on the method, as in, can it do * arbitrary encryption.... */ @@ -163,6 +164,7 @@ typedef int evp_verify_method(int type, const unsigned char *m, void *key); #ifndef EVP_MD +/* Move to evp_locl.h */ struct env_md_st { int type; int pkey_type; @@ -258,6 +260,7 @@ struct env_md_st { #endif /* !EVP_MD */ +/* Move to evp_locl.h. */ struct env_md_ctx_st { const EVP_MD *digest; ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ @@ -295,6 +298,7 @@ struct env_md_ctx_st { #define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ +/* Move to evp_locl.h */ struct evp_cipher_st { int nid; int block_size; @@ -413,6 +417,7 @@ typedef struct evp_cipher_info_st { unsigned char iv[EVP_MAX_IV_LENGTH]; } EVP_CIPHER_INFO; +/* Move to evp_locl.h */ struct evp_cipher_ctx_st { const EVP_CIPHER *cipher; ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ @@ -433,7 +438,9 @@ struct evp_cipher_ctx_st { unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ } /* EVP_CIPHER_CTX */; -typedef struct evp_Encode_Ctx_st { +/* Move to evp_locl.h */ +struct evp_Encode_Ctx_st { + int num; /* number saved in a partial encode/decode */ int length; /* The length is either the output line length * (in input bytes) or the shortest input line @@ -443,7 +450,7 @@ typedef struct evp_Encode_Ctx_st { unsigned char enc_data[80]; /* data to encode */ int line_num; /* number read on current line */ int expect_nl; -} EVP_ENCODE_CTX; +} /* EVP_ENCODE_CTX */; /* Password based encryption function */ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, diff --git a/lib/libcrypto/hmac/hmac.h b/lib/libcrypto/hmac/hmac.h index e787c62ac89..2f91f55f9b2 100644 --- a/lib/libcrypto/hmac/hmac.h +++ b/lib/libcrypto/hmac/hmac.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hmac.h,v 1.13 2018/02/17 14:53:59 jsing Exp $ */ +/* $OpenBSD: hmac.h,v 1.14 2021/12/12 21:35:47 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -72,16 +72,17 @@ extern "C" { #endif -typedef struct hmac_ctx_st { +/* Move to hmac_local.h */ +struct hmac_ctx_st { const EVP_MD *md; EVP_MD_CTX md_ctx; EVP_MD_CTX i_ctx; EVP_MD_CTX o_ctx; unsigned int key_length; unsigned char key[HMAC_MAX_MD_CBLOCK]; -} HMAC_CTX; +} /* HMAC_CTX */; -#define HMAC_size(e) (EVP_MD_size((e)->md)) +#define HMAC_size(e) (EVP_MD_size(HMAC_CTX_get_md((e)))) HMAC_CTX *HMAC_CTX_new(void); void HMAC_CTX_free(HMAC_CTX *ctx); diff --git a/lib/libcrypto/ossl_typ.h b/lib/libcrypto/ossl_typ.h index 64630841984..9a1101d3876 100644 --- a/lib/libcrypto/ossl_typ.h +++ b/lib/libcrypto/ossl_typ.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ossl_typ.h,v 1.15 2021/11/24 01:12:43 beck Exp $ */ +/* $OpenBSD: ossl_typ.h,v 1.16 2021/12/12 21:35:46 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * @@ -103,6 +103,10 @@ typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; typedef struct evp_pkey_method_st EVP_PKEY_METHOD; typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; +typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; + +typedef struct hmac_ctx_st HMAC_CTX; + typedef struct dh_st DH; typedef struct dh_method DH_METHOD; -- 2.20.1