summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/evp.h')
-rw-r--r--src/lib/libcrypto/evp/evp.h135
1 files changed, 2 insertions, 133 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 012b06befc..acf0650f9a 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.97 2022/01/14 07:49:49 tb Exp $ */ 1/* $OpenBSD: evp.h,v 1.98 2022/01/14 08:04:14 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,72 +119,12 @@
119extern "C" { 119extern "C" {
120#endif 120#endif
121 121
122/* Move to evp_locl.h */
123/* Type needs to be a bit field
124 * Sub-type needs to be for variations on the method, as in, can it do
125 * arbitrary encryption.... */
126struct evp_pkey_st {
127 int type;
128 int save_type;
129 int references;
130 const EVP_PKEY_ASN1_METHOD *ameth;
131 ENGINE *engine;
132 union {
133 char *ptr;
134#ifndef OPENSSL_NO_RSA
135 struct rsa_st *rsa; /* RSA */
136#endif
137#ifndef OPENSSL_NO_DSA
138 struct dsa_st *dsa; /* DSA */
139#endif
140#ifndef OPENSSL_NO_DH
141 struct dh_st *dh; /* DH */
142#endif
143#ifndef OPENSSL_NO_EC
144 struct ec_key_st *ec; /* ECC */
145#endif
146#ifndef OPENSSL_NO_GOST
147 struct gost_key_st *gost; /* GOST */
148#endif
149 } pkey;
150 int save_parameters;
151 STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
152} /* EVP_PKEY */;
153
154#define EVP_PKEY_MO_SIGN 0x0001 122#define EVP_PKEY_MO_SIGN 0x0001
155#define EVP_PKEY_MO_VERIFY 0x0002 123#define EVP_PKEY_MO_VERIFY 0x0002
156#define EVP_PKEY_MO_ENCRYPT 0x0004 124#define EVP_PKEY_MO_ENCRYPT 0x0004
157#define EVP_PKEY_MO_DECRYPT 0x0008 125#define EVP_PKEY_MO_DECRYPT 0x0008
158 126
159typedef int evp_sign_method(int type, const unsigned char *m,
160 unsigned int m_length, unsigned char *sigret, unsigned int *siglen,
161 void *key);
162typedef int evp_verify_method(int type, const unsigned char *m,
163 unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen,
164 void *key);
165
166#ifndef EVP_MD 127#ifndef EVP_MD
167/* Move to evp_locl.h */
168struct env_md_st {
169 int type;
170 int pkey_type;
171 int md_size;
172 unsigned long flags;
173 int (*init)(EVP_MD_CTX *ctx);
174 int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count);
175 int (*final)(EVP_MD_CTX *ctx, unsigned char *md);
176 int (*copy)(EVP_MD_CTX *to, const EVP_MD_CTX *from);
177 int (*cleanup)(EVP_MD_CTX *ctx);
178
179 evp_sign_method *sign;
180 evp_verify_method *verify;
181 int required_pkey_type[5]; /*EVP_PKEY_xxx */
182 int block_size;
183 int ctx_size; /* how big does the ctx->md_data need to be */
184 /* control function */
185 int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
186} /* EVP_MD */;
187
188#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single 128#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single
189 * block */ 129 * block */
190 130
@@ -260,18 +200,6 @@ struct env_md_st {
260 200
261#endif /* !EVP_MD */ 201#endif /* !EVP_MD */
262 202
263/* Move to evp_locl.h. */
264struct env_md_ctx_st {
265 const EVP_MD *digest;
266 ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
267 unsigned long flags;
268 void *md_data;
269 /* Public key context for sign/verify */
270 EVP_PKEY_CTX *pctx;
271 /* Update function: usually copied from EVP_MD */
272 int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count);
273} /* EVP_MD_CTX */;
274
275/* values for EVP_MD_CTX flags */ 203/* values for EVP_MD_CTX flags */
276 204
277#define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called 205#define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called
@@ -298,25 +226,6 @@ struct env_md_ctx_st {
298 226
299#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ 227#define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */
300 228
301/* Move to evp_locl.h */
302struct evp_cipher_st {
303 int nid;
304 int block_size;
305 int key_len; /* Default value for variable length ciphers */
306 int iv_len;
307 unsigned long flags; /* Various flags */
308 int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
309 const unsigned char *iv, int enc); /* init key */
310 int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
311 const unsigned char *in, size_t inl);/* encrypt/decrypt data */
312 int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */
313 int ctx_size; /* how big ctx->cipher_data needs to be */
314 int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
315 int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
316 int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
317 void *app_data; /* Application data */
318} /* EVP_CIPHER */;
319
320/* Values for cipher flags */ 229/* Values for cipher flags */
321 230
322/* Modes for ciphers */ 231/* Modes for ciphers */
@@ -417,41 +326,6 @@ typedef struct evp_cipher_info_st {
417 unsigned char iv[EVP_MAX_IV_LENGTH]; 326 unsigned char iv[EVP_MAX_IV_LENGTH];
418} EVP_CIPHER_INFO; 327} EVP_CIPHER_INFO;
419 328
420/* Move to evp_locl.h */
421struct evp_cipher_ctx_st {
422 const EVP_CIPHER *cipher;
423 ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
424 int encrypt; /* encrypt or decrypt */
425 int buf_len; /* number we have left */
426
427 unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
428 unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
429 unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
430 int num; /* used by cfb/ofb/ctr mode */
431
432 void *app_data; /* application stuff */
433 int key_len; /* May change for variable length cipher */
434 unsigned long flags; /* Various flags */
435 void *cipher_data; /* per EVP data */
436 int final_used;
437 int block_mask;
438 unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
439} /* EVP_CIPHER_CTX */;
440
441/* Move to evp_locl.h */
442struct evp_Encode_Ctx_st {
443
444 int num; /* number saved in a partial encode/decode */
445 int length; /* The length is either the output line length
446 * (in input bytes) or the shortest input line
447 * length that is ok. Once decoding begins,
448 * the length is adjusted up each time a longer
449 * line is decoded */
450 unsigned char enc_data[80]; /* data to encode */
451 int line_num; /* number read on current line */
452 int expect_nl;
453} /* EVP_ENCODE_CTX */;
454
455/* Password based encryption function */ 329/* Password based encryption function */
456typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 330typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
457 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); 331 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de);
@@ -1317,7 +1191,6 @@ void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth,
1317 * message has a unique, per-message nonce and, optionally, additional data 1191 * message has a unique, per-message nonce and, optionally, additional data
1318 * which is authenticated but not included in the output. */ 1192 * which is authenticated but not included in the output. */
1319 1193
1320struct evp_aead_st;
1321typedef struct evp_aead_st EVP_AEAD; 1194typedef struct evp_aead_st EVP_AEAD;
1322 1195
1323#ifndef OPENSSL_NO_AES 1196#ifndef OPENSSL_NO_AES
@@ -1351,11 +1224,7 @@ size_t EVP_AEAD_max_tag_len(const EVP_AEAD *aead);
1351 1224
1352/* An EVP_AEAD_CTX represents an AEAD algorithm configured with a specific key 1225/* An EVP_AEAD_CTX represents an AEAD algorithm configured with a specific key
1353 * and message-independent IV. */ 1226 * and message-independent IV. */
1354typedef struct evp_aead_ctx_st { 1227typedef struct evp_aead_ctx_st EVP_AEAD_CTX;
1355 const EVP_AEAD *aead;
1356 /* aead_state is an opaque pointer to the AEAD specific state. */
1357 void *aead_state;
1358} EVP_AEAD_CTX;
1359 1228
1360/* EVP_AEAD_MAX_TAG_LENGTH is the maximum tag length used by any AEAD 1229/* EVP_AEAD_MAX_TAG_LENGTH is the maximum tag length used by any AEAD
1361 * defined in this header. */ 1230 * defined in this header. */