]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/evp/evp_locl.h
Add generic EVP method fetcher
[thirdparty/openssl.git] / crypto / evp / evp_locl.h
CommitLineData
0f113f3e 1/*
c13d2ab4 2 * Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
5da2f69f 3 *
4a8b0c55 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
aa6bb135
RS
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
5da2f69f
DSH
8 */
9
7638370c
RL
10/* EVP_MD_CTX related stuff */
11
12struct evp_md_ctx_st {
13 const EVP_MD *digest;
14 ENGINE *engine; /* functional reference if 'digest' is
15 * ENGINE-provided */
16 unsigned long flags;
17 void *md_data;
18 /* Public key context for sign/verify */
19 EVP_PKEY_CTX *pctx;
20 /* Update function: usually copied from EVP_MD */
21 int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
22} /* EVP_MD_CTX */ ;
23
8baf9968
RL
24struct evp_cipher_ctx_st {
25 const EVP_CIPHER *cipher;
26 ENGINE *engine; /* functional reference if 'cipher' is
27 * ENGINE-provided */
28 int encrypt; /* encrypt or decrypt */
29 int buf_len; /* number we have left */
30 unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
31 unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
32 unsigned char buf[EVP_MAX_BLOCK_LENGTH]; /* saved partial block */
33 int num; /* used by cfb/ofb/ctr mode */
34 /* FIXME: Should this even exist? It appears unused */
35 void *app_data; /* application stuff */
36 int key_len; /* May change for variable length cipher */
37 unsigned long flags; /* Various flags */
38 void *cipher_data; /* per EVP data */
39 int final_used;
40 int block_mask;
41 unsigned char final[EVP_MAX_BLOCK_LENGTH]; /* possible final block */
42} /* EVP_CIPHER_CTX */ ;
43
567db2c1
RL
44struct evp_mac_ctx_st {
45 const EVP_MAC *meth; /* Method structure */
46 void *data; /* Individual method data */
47} /* EVP_MAC_CTX */;
48
5a285add
DM
49struct evp_kdf_ctx_st {
50 const EVP_KDF_METHOD *kmeth;
51 EVP_KDF_IMPL *impl; /* Algorithm-specific data */
52} /* EVP_KDF_CTX */ ;
53
0f113f3e
MC
54int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
55 int passlen, ASN1_TYPE *param,
56 const EVP_CIPHER *c, const EVP_MD *md,
57 int en_de);
a0be4fd1
RL
58
59struct evp_Encode_Ctx_st {
60 /* number saved in a partial encode/decode */
61 int num;
62 /*
63 * The length is either the output line length (in input bytes) or the
64 * shortest input line length that is ok. Once decoding begins, the
65 * length is adjusted up each time a longer line is decoded
66 */
67 int length;
68 /* data to encode */
69 unsigned char enc_data[80];
70 /* number read on current line */
71 int line_num;
c0804614 72 unsigned int flags;
a0be4fd1 73};
4a1f3f27
DSH
74
75typedef struct evp_pbe_st EVP_PBE_CTL;
76DEFINE_STACK_OF(EVP_PBE_CTL)
7141ba31
MC
77
78int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);
c13d2ab4
RL
79
80#include <openssl/ossl_typ.h>
81#include <openssl/core.h>
82
83void *evp_generic_fetch(OPENSSL_CTX *ctx, int operation_id,
84 const char *algorithm, const char *properties,
85 void *(*new_method)(int nid, const OSSL_DISPATCH *fns,
86 OSSL_PROVIDER *prov),
87 int (*upref_method)(void *),
88 void (*free_method)(void *));