summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2021-12-12 21:35:47 +0000
committertb <>2021-12-12 21:35:47 +0000
commit2079bd78020b8fe474a6b532e0144a4a39456ffb (patch)
tree44e57823eb232bea1ffbc4c1b1417f4ee3865a66
parentc1ae4c3a2dcb48029aaea219cb195e9dfe1d093d (diff)
downloadopenbsd-2079bd78020b8fe474a6b532e0144a4a39456ffb.tar.gz
openbsd-2079bd78020b8fe474a6b532e0144a4a39456ffb.tar.bz2
openbsd-2079bd78020b8fe474a6b532e0144a4a39456ffb.zip
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
-rw-r--r--src/lib/libcrypto/evp/evp.h13
-rw-r--r--src/lib/libcrypto/hmac/hmac.h9
-rw-r--r--src/lib/libcrypto/ossl_typ.h6
3 files changed, 20 insertions, 8 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 9898738e64..89ebac415d 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp.h,v 1.87 2021/11/30 18:27:04 tb Exp $ */ 1/* $OpenBSD: evp.h,v 1.88 2021/12/12 21:35:46 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 *
@@ -119,6 +119,7 @@
119extern "C" { 119extern "C" {
120#endif 120#endif
121 121
122/* Move to evp_locl.h */
122/* Type needs to be a bit field 123/* Type needs to be a bit field
123 * Sub-type needs to be for variations on the method, as in, can it do 124 * Sub-type needs to be for variations on the method, as in, can it do
124 * arbitrary encryption.... */ 125 * arbitrary encryption.... */
@@ -163,6 +164,7 @@ typedef int evp_verify_method(int type, const unsigned char *m,
163 void *key); 164 void *key);
164 165
165#ifndef EVP_MD 166#ifndef EVP_MD
167/* Move to evp_locl.h */
166struct env_md_st { 168struct env_md_st {
167 int type; 169 int type;
168 int pkey_type; 170 int pkey_type;
@@ -258,6 +260,7 @@ struct env_md_st {
258 260
259#endif /* !EVP_MD */ 261#endif /* !EVP_MD */
260 262
263/* Move to evp_locl.h. */
261struct env_md_ctx_st { 264struct env_md_ctx_st {
262 const EVP_MD *digest; 265 const EVP_MD *digest;
263 ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ 266 ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
@@ -295,6 +298,7 @@ struct env_md_ctx_st {
295 298
296#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ 299#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */
297 300
301/* Move to evp_locl.h */
298struct evp_cipher_st { 302struct evp_cipher_st {
299 int nid; 303 int nid;
300 int block_size; 304 int block_size;
@@ -413,6 +417,7 @@ typedef struct evp_cipher_info_st {
413 unsigned char iv[EVP_MAX_IV_LENGTH]; 417 unsigned char iv[EVP_MAX_IV_LENGTH];
414} EVP_CIPHER_INFO; 418} EVP_CIPHER_INFO;
415 419
420/* Move to evp_locl.h */
416struct evp_cipher_ctx_st { 421struct evp_cipher_ctx_st {
417 const EVP_CIPHER *cipher; 422 const EVP_CIPHER *cipher;
418 ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ 423 ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
@@ -433,7 +438,9 @@ struct evp_cipher_ctx_st {
433 unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ 438 unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
434} /* EVP_CIPHER_CTX */; 439} /* EVP_CIPHER_CTX */;
435 440
436typedef struct evp_Encode_Ctx_st { 441/* Move to evp_locl.h */
442struct evp_Encode_Ctx_st {
443
437 int num; /* number saved in a partial encode/decode */ 444 int num; /* number saved in a partial encode/decode */
438 int length; /* The length is either the output line length 445 int length; /* The length is either the output line length
439 * (in input bytes) or the shortest input line 446 * (in input bytes) or the shortest input line
@@ -443,7 +450,7 @@ typedef struct evp_Encode_Ctx_st {
443 unsigned char enc_data[80]; /* data to encode */ 450 unsigned char enc_data[80]; /* data to encode */
444 int line_num; /* number read on current line */ 451 int line_num; /* number read on current line */
445 int expect_nl; 452 int expect_nl;
446} EVP_ENCODE_CTX; 453} /* EVP_ENCODE_CTX */;
447 454
448/* Password based encryption function */ 455/* Password based encryption function */
449typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 456typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h
index e787c62ac8..2f91f55f9b 100644
--- a/src/lib/libcrypto/hmac/hmac.h
+++ b/src/lib/libcrypto/hmac/hmac.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: hmac.h,v 1.13 2018/02/17 14:53:59 jsing Exp $ */ 1/* $OpenBSD: hmac.h,v 1.14 2021/12/12 21:35:47 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 *
@@ -72,16 +72,17 @@
72extern "C" { 72extern "C" {
73#endif 73#endif
74 74
75typedef struct hmac_ctx_st { 75/* Move to hmac_local.h */
76struct hmac_ctx_st {
76 const EVP_MD *md; 77 const EVP_MD *md;
77 EVP_MD_CTX md_ctx; 78 EVP_MD_CTX md_ctx;
78 EVP_MD_CTX i_ctx; 79 EVP_MD_CTX i_ctx;
79 EVP_MD_CTX o_ctx; 80 EVP_MD_CTX o_ctx;
80 unsigned int key_length; 81 unsigned int key_length;
81 unsigned char key[HMAC_MAX_MD_CBLOCK]; 82 unsigned char key[HMAC_MAX_MD_CBLOCK];
82} HMAC_CTX; 83} /* HMAC_CTX */;
83 84
84#define HMAC_size(e) (EVP_MD_size((e)->md)) 85#define HMAC_size(e) (EVP_MD_size(HMAC_CTX_get_md((e))))
85 86
86HMAC_CTX *HMAC_CTX_new(void); 87HMAC_CTX *HMAC_CTX_new(void);
87void HMAC_CTX_free(HMAC_CTX *ctx); 88void HMAC_CTX_free(HMAC_CTX *ctx);
diff --git a/src/lib/libcrypto/ossl_typ.h b/src/lib/libcrypto/ossl_typ.h
index 6463084198..9a1101d387 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.15 2021/11/24 01:12:43 beck Exp $ */ 1/* $OpenBSD: ossl_typ.h,v 1.16 2021/12/12 21:35:46 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 *
@@ -103,6 +103,10 @@ typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
103typedef struct evp_pkey_method_st EVP_PKEY_METHOD; 103typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
104typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; 104typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
105 105
106typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX;
107
108typedef struct hmac_ctx_st HMAC_CTX;
109
106typedef struct dh_st DH; 110typedef struct dh_st DH;
107typedef struct dh_method DH_METHOD; 111typedef struct dh_method DH_METHOD;
108 112