Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
evp.h2173 linesDownload Raw Back to openssl
1/*2 * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.3 *4 * Licensed under the Apache License 2.0 (the "License").  You may not use5 * this file except in compliance with the License.  You can obtain a copy6 * in the file LICENSE in the source distribution or at7 * https://www.openssl.org/source/license.html8 */9 10#ifndef OPENSSL_EVP_H11# define OPENSSL_EVP_H12# pragma once13 14# include <openssl/macros.h>15# ifndef OPENSSL_NO_DEPRECATED_3_016#  define HEADER_ENVELOPE_H17# endif18 19# include <stdarg.h>20 21# ifndef OPENSSL_NO_STDIO22#  include <stdio.h>23# endif24 25# include <openssl/opensslconf.h>26# include <openssl/types.h>27# include <openssl/core.h>28# include <openssl/core_dispatch.h>29# include <openssl/symhacks.h>30# include <openssl/bio.h>31# include <openssl/evperr.h>32# include <openssl/params.h>33 34# define EVP_MAX_MD_SIZE                 64/* longest known is SHA512 */35# define EVP_MAX_KEY_LENGTH              6436# define EVP_MAX_IV_LENGTH               1637# define EVP_MAX_BLOCK_LENGTH            3238 39# define PKCS5_SALT_LEN                  840/* Default PKCS#5 iteration count */41# define PKCS5_DEFAULT_ITER              204842 43# include <openssl/objects.h>44 45# ifndef OPENSSL_NO_DEPRECATED_3_046#  define EVP_PK_RSA      0x000147#  define EVP_PK_DSA      0x000248#  define EVP_PK_DH       0x000449#  define EVP_PK_EC       0x000850#  define EVP_PKT_SIGN    0x001051#  define EVP_PKT_ENC     0x002052#  define EVP_PKT_EXCH    0x004053#  define EVP_PKS_RSA     0x010054#  define EVP_PKS_DSA     0x020055#  define EVP_PKS_EC      0x040056# endif57 58# define EVP_PKEY_NONE   NID_undef59# define EVP_PKEY_RSA    NID_rsaEncryption60# define EVP_PKEY_RSA2   NID_rsa61# define EVP_PKEY_RSA_PSS NID_rsassaPss62# define EVP_PKEY_DSA    NID_dsa63# define EVP_PKEY_DSA1   NID_dsa_264# define EVP_PKEY_DSA2   NID_dsaWithSHA65# define EVP_PKEY_DSA3   NID_dsaWithSHA166# define EVP_PKEY_DSA4   NID_dsaWithSHA1_267# define EVP_PKEY_DH     NID_dhKeyAgreement68# define EVP_PKEY_DHX    NID_dhpublicnumber69# define EVP_PKEY_EC     NID_X9_62_id_ecPublicKey70# define EVP_PKEY_SM2    NID_sm271# define EVP_PKEY_HMAC   NID_hmac72# define EVP_PKEY_CMAC   NID_cmac73# define EVP_PKEY_SCRYPT NID_id_scrypt74# define EVP_PKEY_TLS1_PRF NID_tls1_prf75# define EVP_PKEY_HKDF   NID_hkdf76# define EVP_PKEY_POLY1305 NID_poly130577# define EVP_PKEY_SIPHASH NID_siphash78# define EVP_PKEY_X25519 NID_X2551979# define EVP_PKEY_ED25519 NID_ED2551980# define EVP_PKEY_X448 NID_X44881# define EVP_PKEY_ED448 NID_ED44882/* Special indicator that the object is uniquely provider side */83# define EVP_PKEY_KEYMGMT -184 85/* Easy to use macros for EVP_PKEY related selections */86# define EVP_PKEY_KEY_PARAMETERS                                            \87    ( OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )88# define EVP_PKEY_PRIVATE_KEY                                               \89    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )90# define EVP_PKEY_PUBLIC_KEY                                                \91    ( EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )92# define EVP_PKEY_KEYPAIR                                                   \93    ( EVP_PKEY_PUBLIC_KEY | OSSL_KEYMGMT_SELECT_PRIVATE_KEY )94 95#ifdef  __cplusplus96extern "C" {97#endif98 99int EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq);100int EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx);101int EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable);102 103# define EVP_PKEY_MO_SIGN        0x0001104# define EVP_PKEY_MO_VERIFY      0x0002105# define EVP_PKEY_MO_ENCRYPT     0x0004106# define EVP_PKEY_MO_DECRYPT     0x0008107 108# ifndef EVP_MD109#  ifndef OPENSSL_NO_DEPRECATED_3_0110OSSL_DEPRECATEDIN_3_0 EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);111OSSL_DEPRECATEDIN_3_0 EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);112OSSL_DEPRECATEDIN_3_0 void EVP_MD_meth_free(EVP_MD *md);113OSSL_DEPRECATEDIN_3_0114int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);115OSSL_DEPRECATEDIN_3_0116int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);117OSSL_DEPRECATEDIN_3_0118int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);119OSSL_DEPRECATEDIN_3_0120int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);121OSSL_DEPRECATEDIN_3_0122int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));123OSSL_DEPRECATEDIN_3_0124int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,125                                                     const void *data,126                                                     size_t count));127OSSL_DEPRECATEDIN_3_0128int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,129                                                   unsigned char *md));130OSSL_DEPRECATEDIN_3_0131int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,132                                                 const EVP_MD_CTX *from));133OSSL_DEPRECATEDIN_3_0134int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));135OSSL_DEPRECATEDIN_3_0136int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,137                                                 int p1, void *p2));138OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);139OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_result_size(const EVP_MD *md);140OSSL_DEPRECATEDIN_3_0 int EVP_MD_meth_get_app_datasize(const EVP_MD *md);141OSSL_DEPRECATEDIN_3_0 unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);142OSSL_DEPRECATEDIN_3_0143int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);144OSSL_DEPRECATEDIN_3_0145int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,146                                                const void *data, size_t count);147OSSL_DEPRECATEDIN_3_0148int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,149                                               unsigned char *md);150OSSL_DEPRECATEDIN_3_0151int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,152                                              const EVP_MD_CTX *from);153OSSL_DEPRECATEDIN_3_0154int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);155OSSL_DEPRECATEDIN_3_0156int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,157                                              int p1, void *p2);158#  endif159/* digest can only handle a single block */160#  define EVP_MD_FLAG_ONESHOT     0x0001161 162/* digest is extensible-output function, XOF */163#  define EVP_MD_FLAG_XOF         0x0002164 165/* DigestAlgorithmIdentifier flags... */166 167#  define EVP_MD_FLAG_DIGALGID_MASK               0x0018168 169/* NULL or absent parameter accepted. Use NULL */170 171#  define EVP_MD_FLAG_DIGALGID_NULL               0x0000172 173/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */174 175#  define EVP_MD_FLAG_DIGALGID_ABSENT             0x0008176 177/* Custom handling via ctrl */178 179#  define EVP_MD_FLAG_DIGALGID_CUSTOM             0x0018180 181/* Note if suitable for use in FIPS mode */182#  define EVP_MD_FLAG_FIPS        0x0400183 184/* Digest ctrls */185 186#  define EVP_MD_CTRL_DIGALGID                    0x1187#  define EVP_MD_CTRL_MICALG                      0x2188#  define EVP_MD_CTRL_XOF_LEN                     0x3189#  define EVP_MD_CTRL_TLSTREE                     0x4190 191/* Minimum Algorithm specific ctrl value */192 193#  define EVP_MD_CTRL_ALG_CTRL                    0x1000194 195# endif                         /* !EVP_MD */196 197/* values for EVP_MD_CTX flags */198 199# define EVP_MD_CTX_FLAG_ONESHOT         0x0001/* digest update will be200                                                * called once only */201# define EVP_MD_CTX_FLAG_CLEANED         0x0002/* context has already been202                                                * cleaned */203# define EVP_MD_CTX_FLAG_REUSE           0x0004/* Don't free up ctx->md_data204                                                * in EVP_MD_CTX_reset */205/*206 * FIPS and pad options are ignored in 1.0.0, definitions are here so we207 * don't accidentally reuse the values for other purposes.208 */209 210/* This flag has no effect from openssl-3.0 onwards */211# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW  0x0008212 213/*214 * The following PAD options are also currently ignored in 1.0.0, digest215 * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*()216 * instead.217 */218# define EVP_MD_CTX_FLAG_PAD_MASK        0xF0/* RSA mode to use */219# define EVP_MD_CTX_FLAG_PAD_PKCS1       0x00/* PKCS#1 v1.5 mode */220# define EVP_MD_CTX_FLAG_PAD_X931        0x10/* X9.31 mode */221# define EVP_MD_CTX_FLAG_PAD_PSS         0x20/* PSS mode */222 223# define EVP_MD_CTX_FLAG_NO_INIT         0x0100/* Don't initialize md_data */224/*225 * Some functions such as EVP_DigestSign only finalise copies of internal226 * contexts so additional data can be included after the finalisation call.227 * This is inefficient if this functionality is not required: it is disabled228 * if the following flag is set.229 */230# define EVP_MD_CTX_FLAG_FINALISE        0x0200231/* NOTE: 0x0400 is reserved for internal usage */232# ifndef OPENSSL_NO_DEPRECATED_3_0233OSSL_DEPRECATEDIN_3_0234EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len);235OSSL_DEPRECATEDIN_3_0236EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher);237OSSL_DEPRECATEDIN_3_0238void EVP_CIPHER_meth_free(EVP_CIPHER *cipher);239OSSL_DEPRECATEDIN_3_0240int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len);241OSSL_DEPRECATEDIN_3_0242int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags);243OSSL_DEPRECATEDIN_3_0244int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size);245OSSL_DEPRECATEDIN_3_0246int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,247                             int (*init) (EVP_CIPHER_CTX *ctx,248                                          const unsigned char *key,249                                          const unsigned char *iv,250                                          int enc));251OSSL_DEPRECATEDIN_3_0252int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,253                                  int (*do_cipher) (EVP_CIPHER_CTX *ctx,254                                                    unsigned char *out,255                                                    const unsigned char *in,256                                                    size_t inl));257OSSL_DEPRECATEDIN_3_0258int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,259                                int (*cleanup) (EVP_CIPHER_CTX *));260OSSL_DEPRECATEDIN_3_0261int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher,262                                        int (*set_asn1_parameters) (EVP_CIPHER_CTX *,263                                                                    ASN1_TYPE *));264OSSL_DEPRECATEDIN_3_0265int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher,266                                        int (*get_asn1_parameters) (EVP_CIPHER_CTX *,267                                                                    ASN1_TYPE *));268OSSL_DEPRECATEDIN_3_0269int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,270                             int (*ctrl) (EVP_CIPHER_CTX *, int type,271                                          int arg, void *ptr));272OSSL_DEPRECATEDIN_3_0 int273(*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,274                                                      const unsigned char *key,275                                                      const unsigned char *iv,276                                                      int enc);277OSSL_DEPRECATEDIN_3_0 int278(*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,279                                                           unsigned char *out,280                                                           const unsigned char *in,281                                                           size_t inl);282OSSL_DEPRECATEDIN_3_0 int283(*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);284OSSL_DEPRECATEDIN_3_0 int285(*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,286                                                                 ASN1_TYPE *);287OSSL_DEPRECATEDIN_3_0 int288(*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,289                                                                 ASN1_TYPE *);290OSSL_DEPRECATEDIN_3_0 int291(*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, int type,292                                                      int arg, void *ptr);293# endif294 295/* Values for cipher flags */296 297/* Modes for ciphers */298 299# define         EVP_CIPH_STREAM_CIPHER          0x0300# define         EVP_CIPH_ECB_MODE               0x1301# define         EVP_CIPH_CBC_MODE               0x2302# define         EVP_CIPH_CFB_MODE               0x3303# define         EVP_CIPH_OFB_MODE               0x4304# define         EVP_CIPH_CTR_MODE               0x5305# define         EVP_CIPH_GCM_MODE               0x6306# define         EVP_CIPH_CCM_MODE               0x7307# define         EVP_CIPH_XTS_MODE               0x10001308# define         EVP_CIPH_WRAP_MODE              0x10002309# define         EVP_CIPH_OCB_MODE               0x10003310# define         EVP_CIPH_SIV_MODE               0x10004311# define         EVP_CIPH_MODE                   0xF0007312/* Set if variable length cipher */313# define         EVP_CIPH_VARIABLE_LENGTH        0x8314/* Set if the iv handling should be done by the cipher itself */315# define         EVP_CIPH_CUSTOM_IV              0x10316/* Set if the cipher's init() function should be called if key is NULL */317# define         EVP_CIPH_ALWAYS_CALL_INIT       0x20318/* Call ctrl() to init cipher parameters */319# define         EVP_CIPH_CTRL_INIT              0x40320/* Don't use standard key length function */321# define         EVP_CIPH_CUSTOM_KEY_LENGTH      0x80322/* Don't use standard block padding */323# define         EVP_CIPH_NO_PADDING             0x100324/* cipher handles random key generation */325# define         EVP_CIPH_RAND_KEY               0x200326/* cipher has its own additional copying logic */327# define         EVP_CIPH_CUSTOM_COPY            0x400328/* Don't use standard iv length function */329# define         EVP_CIPH_CUSTOM_IV_LENGTH       0x800330/* Legacy and no longer relevant: Allow use default ASN1 get/set iv */331# define         EVP_CIPH_FLAG_DEFAULT_ASN1      0332/* Free:                                         0x1000 */333/* Buffer length in bits not bytes: CFB1 mode only */334# define         EVP_CIPH_FLAG_LENGTH_BITS       0x2000335/* Deprecated FIPS flag: was 0x4000 */336# define         EVP_CIPH_FLAG_FIPS              0337/* Deprecated FIPS flag: was 0x8000 */338# define         EVP_CIPH_FLAG_NON_FIPS_ALLOW    0339 340/*341 * Cipher handles any and all padding logic as well as finalisation.342 */343# define         EVP_CIPH_FLAG_CTS               0x4000344# define         EVP_CIPH_FLAG_CUSTOM_CIPHER     0x100000345# define         EVP_CIPH_FLAG_AEAD_CIPHER       0x200000346# define         EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000347/* Cipher can handle pipeline operations */348# define         EVP_CIPH_FLAG_PIPELINE          0X800000349/* For provider implementations that handle  ASN1 get/set param themselves */350# define         EVP_CIPH_FLAG_CUSTOM_ASN1       0x1000000351/* For ciphers generating unprotected CMS attributes */352# define         EVP_CIPH_FLAG_CIPHER_WITH_MAC   0x2000000353/* For supplementary wrap cipher support */354# define         EVP_CIPH_FLAG_GET_WRAP_CIPHER   0x4000000355# define         EVP_CIPH_FLAG_INVERSE_CIPHER    0x8000000356 357/*358 * Cipher context flag to indicate we can handle wrap mode: if allowed in359 * older applications it could overflow buffers.360 */361 362# define         EVP_CIPHER_CTX_FLAG_WRAP_ALLOW  0x1363 364/* ctrl() values */365 366# define         EVP_CTRL_INIT                   0x0367# define         EVP_CTRL_SET_KEY_LENGTH         0x1368# define         EVP_CTRL_GET_RC2_KEY_BITS       0x2369# define         EVP_CTRL_SET_RC2_KEY_BITS       0x3370# define         EVP_CTRL_GET_RC5_ROUNDS         0x4371# define         EVP_CTRL_SET_RC5_ROUNDS         0x5372# define         EVP_CTRL_RAND_KEY               0x6373# define         EVP_CTRL_PBE_PRF_NID            0x7374# define         EVP_CTRL_COPY                   0x8375# define         EVP_CTRL_AEAD_SET_IVLEN         0x9376# define         EVP_CTRL_AEAD_GET_TAG           0x10377# define         EVP_CTRL_AEAD_SET_TAG           0x11378# define         EVP_CTRL_AEAD_SET_IV_FIXED      0x12379# define         EVP_CTRL_GCM_SET_IVLEN          EVP_CTRL_AEAD_SET_IVLEN380# define         EVP_CTRL_GCM_GET_TAG            EVP_CTRL_AEAD_GET_TAG381# define         EVP_CTRL_GCM_SET_TAG            EVP_CTRL_AEAD_SET_TAG382# define         EVP_CTRL_GCM_SET_IV_FIXED       EVP_CTRL_AEAD_SET_IV_FIXED383# define         EVP_CTRL_GCM_IV_GEN             0x13384# define         EVP_CTRL_CCM_SET_IVLEN          EVP_CTRL_AEAD_SET_IVLEN385# define         EVP_CTRL_CCM_GET_TAG            EVP_CTRL_AEAD_GET_TAG386# define         EVP_CTRL_CCM_SET_TAG            EVP_CTRL_AEAD_SET_TAG387# define         EVP_CTRL_CCM_SET_IV_FIXED       EVP_CTRL_AEAD_SET_IV_FIXED388# define         EVP_CTRL_CCM_SET_L              0x14389# define         EVP_CTRL_CCM_SET_MSGLEN         0x15390/*391 * AEAD cipher deduces payload length and returns number of bytes required to392 * store MAC and eventual padding. Subsequent call to EVP_Cipher even393 * appends/verifies MAC.394 */395# define         EVP_CTRL_AEAD_TLS1_AAD          0x16396/* Used by composite AEAD ciphers, no-op in GCM, CCM... */397# define         EVP_CTRL_AEAD_SET_MAC_KEY       0x17398/* Set the GCM invocation field, decrypt only */399# define         EVP_CTRL_GCM_SET_IV_INV         0x18400 401# define         EVP_CTRL_TLS1_1_MULTIBLOCK_AAD  0x19402# define         EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT      0x1a403# define         EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT      0x1b404# define         EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE  0x1c405 406# define         EVP_CTRL_SSL3_MASTER_SECRET             0x1d407 408/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */409# define         EVP_CTRL_SET_SBOX                       0x1e410/*411 * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a412 * pre-allocated buffer with specified size413 */414# define         EVP_CTRL_SBOX_USED                      0x1f415/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after,416 * 0 switches meshing off417 */418# define         EVP_CTRL_KEY_MESH                       0x20419/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */420# define         EVP_CTRL_BLOCK_PADDING_MODE             0x21421 422/* Set the output buffers to use for a pipelined operation */423# define         EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS       0x22424/* Set the input buffers to use for a pipelined operation */425# define         EVP_CTRL_SET_PIPELINE_INPUT_BUFS        0x23426/* Set the input buffer lengths to use for a pipelined operation */427# define         EVP_CTRL_SET_PIPELINE_INPUT_LENS        0x24428/* Get the IV length used by the cipher */429# define         EVP_CTRL_GET_IVLEN                      0x25430/* 0x26 is unused */431/* Tell the cipher it's doing a speed test (SIV disallows multiple ops) */432# define         EVP_CTRL_SET_SPEED                      0x27433/* Get the unprotectedAttrs from cipher ctx */434# define         EVP_CTRL_PROCESS_UNPROTECTED            0x28435/* Get the supplementary wrap cipher */436#define          EVP_CTRL_GET_WRAP_CIPHER                0x29437/* TLSTREE key diversification */438#define          EVP_CTRL_TLSTREE                        0x2A439 440/* Padding modes */441#define EVP_PADDING_PKCS7       1442#define EVP_PADDING_ISO7816_4   2443#define EVP_PADDING_ANSI923     3444#define EVP_PADDING_ISO10126    4445#define EVP_PADDING_ZERO        5446 447/* RFC 5246 defines additional data to be 13 bytes in length */448# define         EVP_AEAD_TLS1_AAD_LEN           13449 450typedef struct {451    unsigned char *out;452    const unsigned char *inp;453    size_t len;454    unsigned int interleave;455} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM;456 457/* GCM TLS constants */458/* Length of fixed part of IV derived from PRF */459# define EVP_GCM_TLS_FIXED_IV_LEN                        4460/* Length of explicit part of IV part of TLS records */461# define EVP_GCM_TLS_EXPLICIT_IV_LEN                     8462/* Length of tag for TLS */463# define EVP_GCM_TLS_TAG_LEN                             16464 465/* CCM TLS constants */466/* Length of fixed part of IV derived from PRF */467# define EVP_CCM_TLS_FIXED_IV_LEN                        4468/* Length of explicit part of IV part of TLS records */469# define EVP_CCM_TLS_EXPLICIT_IV_LEN                     8470/* Total length of CCM IV length for TLS */471# define EVP_CCM_TLS_IV_LEN                              12472/* Length of tag for TLS */473# define EVP_CCM_TLS_TAG_LEN                             16474/* Length of CCM8 tag for TLS */475# define EVP_CCM8_TLS_TAG_LEN                            8476 477/* Length of tag for TLS */478# define EVP_CHACHAPOLY_TLS_TAG_LEN                      16479 480typedef struct evp_cipher_info_st {481    const EVP_CIPHER *cipher;482    unsigned char iv[EVP_MAX_IV_LENGTH];483} EVP_CIPHER_INFO;484 485 486/* Password based encryption function */487typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass,488                              int passlen, ASN1_TYPE *param,489                              const EVP_CIPHER *cipher, const EVP_MD *md,490                              int en_de);491 492typedef int (EVP_PBE_KEYGEN_EX) (EVP_CIPHER_CTX *ctx, const char *pass,493                                 int passlen, ASN1_TYPE *param,494                                 const EVP_CIPHER *cipher, const EVP_MD *md,495                                 int en_de, OSSL_LIB_CTX *libctx, const char *propq);496 497# ifndef OPENSSL_NO_DEPRECATED_3_0498#  define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\499                                                         (rsa))500# endif501 502# ifndef OPENSSL_NO_DSA503#  define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\504                                        (dsa))505# endif506 507# if !defined(OPENSSL_NO_DH) && !defined(OPENSSL_NO_DEPRECATED_3_0)508#  define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,(dh))509# endif510 511# ifndef OPENSSL_NO_DEPRECATED_3_0512#  ifndef OPENSSL_NO_EC513#   define EVP_PKEY_assign_EC_KEY(pkey,eckey) \514        EVP_PKEY_assign((pkey), EVP_PKEY_EC, (eckey))515#  endif516# endif517# ifndef OPENSSL_NO_SIPHASH518#  define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),\519                                        EVP_PKEY_SIPHASH,(shkey))520# endif521 522# ifndef OPENSSL_NO_POLY1305523#  define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),\524                                        EVP_PKEY_POLY1305,(polykey))525# endif526 527/* Add some extra combinations */528# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))529# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))530# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))531# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))532 533int EVP_MD_get_type(const EVP_MD *md);534# define EVP_MD_type EVP_MD_get_type535# define EVP_MD_nid EVP_MD_get_type536const char *EVP_MD_get0_name(const EVP_MD *md);537# define EVP_MD_name EVP_MD_get0_name538const char *EVP_MD_get0_description(const EVP_MD *md);539int EVP_MD_is_a(const EVP_MD *md, const char *name);540int EVP_MD_names_do_all(const EVP_MD *md,541                        void (*fn)(const char *name, void *data),542                        void *data);543const OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md);544int EVP_MD_get_pkey_type(const EVP_MD *md);545# define EVP_MD_pkey_type EVP_MD_get_pkey_type546int EVP_MD_get_size(const EVP_MD *md);547# define EVP_MD_size EVP_MD_get_size548int EVP_MD_get_block_size(const EVP_MD *md);549# define EVP_MD_block_size EVP_MD_get_block_size550unsigned long EVP_MD_get_flags(const EVP_MD *md);551# define EVP_MD_flags EVP_MD_get_flags552 553const EVP_MD *EVP_MD_CTX_get0_md(const EVP_MD_CTX *ctx);554EVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx);555# ifndef OPENSSL_NO_DEPRECATED_3_0556OSSL_DEPRECATEDIN_3_0557const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);558OSSL_DEPRECATEDIN_3_0559int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,560                                             const void *data, size_t count);561OSSL_DEPRECATEDIN_3_0562void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,563                              int (*update) (EVP_MD_CTX *ctx,564                                             const void *data, size_t count));565# endif566# define EVP_MD_CTX_get0_name(e)       EVP_MD_get0_name(EVP_MD_CTX_get0_md(e))567# define EVP_MD_CTX_get_size(e)        EVP_MD_get_size(EVP_MD_CTX_get0_md(e))568# define EVP_MD_CTX_size               EVP_MD_CTX_get_size569# define EVP_MD_CTX_get_block_size(e)  EVP_MD_get_block_size(EVP_MD_CTX_get0_md(e))570# define EVP_MD_CTX_block_size EVP_MD_CTX_get_block_size571# define EVP_MD_CTX_get_type(e)            EVP_MD_get_type(EVP_MD_CTX_get0_md(e))572# define EVP_MD_CTX_type EVP_MD_CTX_get_type573EVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx);574# define EVP_MD_CTX_pkey_ctx EVP_MD_CTX_get_pkey_ctx575void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);576void *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx);577# define EVP_MD_CTX_md_data EVP_MD_CTX_get0_md_data578 579int EVP_CIPHER_get_nid(const EVP_CIPHER *cipher);580# define EVP_CIPHER_nid EVP_CIPHER_get_nid581const char *EVP_CIPHER_get0_name(const EVP_CIPHER *cipher);582# define EVP_CIPHER_name EVP_CIPHER_get0_name583const char *EVP_CIPHER_get0_description(const EVP_CIPHER *cipher);584int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name);585int EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,586                            void (*fn)(const char *name, void *data),587                            void *data);588const OSSL_PROVIDER *EVP_CIPHER_get0_provider(const EVP_CIPHER *cipher);589int EVP_CIPHER_get_block_size(const EVP_CIPHER *cipher);590# define EVP_CIPHER_block_size EVP_CIPHER_get_block_size591# ifndef OPENSSL_NO_DEPRECATED_3_0592OSSL_DEPRECATEDIN_3_0593int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher);594# endif595int EVP_CIPHER_get_key_length(const EVP_CIPHER *cipher);596# define EVP_CIPHER_key_length EVP_CIPHER_get_key_length597int EVP_CIPHER_get_iv_length(const EVP_CIPHER *cipher);598# define EVP_CIPHER_iv_length EVP_CIPHER_get_iv_length599unsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *cipher);600# define EVP_CIPHER_flags EVP_CIPHER_get_flags601int EVP_CIPHER_get_mode(const EVP_CIPHER *cipher);602# define EVP_CIPHER_mode EVP_CIPHER_get_mode603int EVP_CIPHER_get_type(const EVP_CIPHER *cipher);604# define EVP_CIPHER_type EVP_CIPHER_get_type605EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,606                             const char *properties);607int EVP_CIPHER_up_ref(EVP_CIPHER *cipher);608void EVP_CIPHER_free(EVP_CIPHER *cipher);609 610const EVP_CIPHER *EVP_CIPHER_CTX_get0_cipher(const EVP_CIPHER_CTX *ctx);611EVP_CIPHER *EVP_CIPHER_CTX_get1_cipher(EVP_CIPHER_CTX *ctx);612int EVP_CIPHER_CTX_is_encrypting(const EVP_CIPHER_CTX *ctx);613# define EVP_CIPHER_CTX_encrypting EVP_CIPHER_CTX_is_encrypting614int EVP_CIPHER_CTX_get_nid(const EVP_CIPHER_CTX *ctx);615# define EVP_CIPHER_CTX_nid EVP_CIPHER_CTX_get_nid616int EVP_CIPHER_CTX_get_block_size(const EVP_CIPHER_CTX *ctx);617# define EVP_CIPHER_CTX_block_size EVP_CIPHER_CTX_get_block_size618int EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx);619# define EVP_CIPHER_CTX_key_length EVP_CIPHER_CTX_get_key_length620int EVP_CIPHER_CTX_get_iv_length(const EVP_CIPHER_CTX *ctx);621# define EVP_CIPHER_CTX_iv_length EVP_CIPHER_CTX_get_iv_length622int EVP_CIPHER_CTX_get_tag_length(const EVP_CIPHER_CTX *ctx);623# define EVP_CIPHER_CTX_tag_length EVP_CIPHER_CTX_get_tag_length624# ifndef OPENSSL_NO_DEPRECATED_3_0625const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);626OSSL_DEPRECATEDIN_3_0 const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);627OSSL_DEPRECATEDIN_3_0 const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);628OSSL_DEPRECATEDIN_3_0 unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);629# endif630int EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);631int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);632# ifndef OPENSSL_NO_DEPRECATED_3_0633OSSL_DEPRECATEDIN_3_0634unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);635# endif636int EVP_CIPHER_CTX_get_num(const EVP_CIPHER_CTX *ctx);637# define EVP_CIPHER_CTX_num EVP_CIPHER_CTX_get_num638int EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num);639int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);640void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);641void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);642void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);643void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);644# define EVP_CIPHER_CTX_get0_name(c) EVP_CIPHER_get0_name(EVP_CIPHER_CTX_get0_cipher(c))645# define EVP_CIPHER_CTX_get_type(c)  EVP_CIPHER_get_type(EVP_CIPHER_CTX_get0_cipher(c))646# define EVP_CIPHER_CTX_type         EVP_CIPHER_CTX_get_type647# ifndef OPENSSL_NO_DEPRECATED_1_1_0648#  define EVP_CIPHER_CTX_flags(c)    EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(c))649# endif650# define EVP_CIPHER_CTX_get_mode(c)  EVP_CIPHER_get_mode(EVP_CIPHER_CTX_get0_cipher(c))651# define EVP_CIPHER_CTX_mode         EVP_CIPHER_CTX_get_mode652 653# define EVP_ENCODE_LENGTH(l)    ((((l)+2)/3*4)+((l)/48+1)*2+80)654# define EVP_DECODE_LENGTH(l)    (((l)+3)/4*3+80)655 656# define EVP_SignInit_ex(a,b,c)          EVP_DigestInit_ex(a,b,c)657# define EVP_SignInit(a,b)               EVP_DigestInit(a,b)658# define EVP_SignUpdate(a,b,c)           EVP_DigestUpdate(a,b,c)659# define EVP_VerifyInit_ex(a,b,c)        EVP_DigestInit_ex(a,b,c)660# define EVP_VerifyInit(a,b)             EVP_DigestInit(a,b)661# define EVP_VerifyUpdate(a,b,c)         EVP_DigestUpdate(a,b,c)662# define EVP_OpenUpdate(a,b,c,d,e)       EVP_DecryptUpdate(a,b,c,d,e)663# define EVP_SealUpdate(a,b,c,d,e)       EVP_EncryptUpdate(a,b,c,d,e)664 665# ifdef CONST_STRICT666void BIO_set_md(BIO *, const EVP_MD *md);667# else668#  define BIO_set_md(b,md)          BIO_ctrl(b,BIO_C_SET_MD,0,(void *)(md))669# endif670# define BIO_get_md(b,mdp)          BIO_ctrl(b,BIO_C_GET_MD,0,(mdp))671# define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(mdcp))672# define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(mdcp))673# define BIO_get_cipher_status(b)   BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)674# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(c_pp))675 676/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c,677                          unsigned char *out,678                          const unsigned char *in, unsigned int inl);679 680# define EVP_add_cipher_alias(n,alias) \681        OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))682# define EVP_add_digest_alias(n,alias) \683        OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))684# define EVP_delete_cipher_alias(alias) \685        OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);686# define EVP_delete_digest_alias(alias) \687        OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);688 689int EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]);690int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);691int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);692const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest);693const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);694const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);695const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);696const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);697int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);698EVP_MD_CTX *EVP_MD_CTX_new(void);699int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);700void EVP_MD_CTX_free(EVP_MD_CTX *ctx);701# define EVP_MD_CTX_create()     EVP_MD_CTX_new()702# define EVP_MD_CTX_init(ctx)    EVP_MD_CTX_reset((ctx))703# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx))704__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);705void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);706void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);707int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);708__owur int EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type,709                              const OSSL_PARAM params[]);710__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type,711                                 ENGINE *impl);712__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d,713                                size_t cnt);714__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md,715                                  unsigned int *s);716__owur int EVP_Digest(const void *data, size_t count,717                          unsigned char *md, unsigned int *size,718                          const EVP_MD *type, ENGINE *impl);719__owur int EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name,720                        const char *propq, const void *data, size_t datalen,721                        unsigned char *md, size_t *mdlen);722 723__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);724__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);725__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md,726                           unsigned int *s);727__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md,728                              size_t len);729 730__owur EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,731                            const char *properties);732 733int EVP_MD_up_ref(EVP_MD *md);734void EVP_MD_free(EVP_MD *md);735 736int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);737int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,738                           const char *prompt, int verify);739void EVP_set_pw_prompt(const char *prompt);740char *EVP_get_pw_prompt(void);741 742__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,743                          const unsigned char *salt,744                          const unsigned char *data, int datal, int count,745                          unsigned char *key, unsigned char *iv);746 747void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);748void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);749int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);750 751__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,752                           const unsigned char *key, const unsigned char *iv);753/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,754                                  const EVP_CIPHER *cipher, ENGINE *impl,755                                  const unsigned char *key,756                                  const unsigned char *iv);757__owur int EVP_EncryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,758                               const unsigned char *key,759                               const unsigned char *iv,760                               const OSSL_PARAM params[]);761/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,762                                 int *outl, const unsigned char *in, int inl);763/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,764                                   int *outl);765/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,766                                int *outl);767 768__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,769                           const unsigned char *key, const unsigned char *iv);770/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,771                                  const EVP_CIPHER *cipher, ENGINE *impl,772                                  const unsigned char *key,773                                  const unsigned char *iv);774__owur int EVP_DecryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,775                               const unsigned char *key,776                               const unsigned char *iv,777                               const OSSL_PARAM params[]);778/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,779                                 int *outl, const unsigned char *in, int inl);780__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,781                            int *outl);782/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,783                                   int *outl);784 785__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,786                          const unsigned char *key, const unsigned char *iv,787                          int enc);788/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,789                                 const EVP_CIPHER *cipher, ENGINE *impl,790                                 const unsigned char *key,791                                 const unsigned char *iv, int enc);792__owur int EVP_CipherInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,793                              const unsigned char *key, const unsigned char *iv,794                              int enc, const OSSL_PARAM params[]);795__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,796                            int *outl, const unsigned char *in, int inl);797__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,798                           int *outl);799__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,800                              int *outl);801 802__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,803                         EVP_PKEY *pkey);804__owur int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,805                            EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,806                            const char *propq);807 808__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret,809                          size_t *siglen, const unsigned char *tbs,810                          size_t tbslen);811 812__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,813                           unsigned int siglen, EVP_PKEY *pkey);814__owur int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,815                              unsigned int siglen, EVP_PKEY *pkey,816                              OSSL_LIB_CTX *libctx, const char *propq);817 818__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret,819                            size_t siglen, const unsigned char *tbs,820                            size_t tbslen);821 822int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,823                          const char *mdname, OSSL_LIB_CTX *libctx,824                          const char *props, EVP_PKEY *pkey,825                          const OSSL_PARAM params[]);826/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,827                                  const EVP_MD *type, ENGINE *e,828                                  EVP_PKEY *pkey);829int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize);830__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,831                               size_t *siglen);832 833int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,834                            const char *mdname, OSSL_LIB_CTX *libctx,835                            const char *props, EVP_PKEY *pkey,836                            const OSSL_PARAM params[]);837__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,838                                const EVP_MD *type, ENGINE *e,839                                EVP_PKEY *pkey);840int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize);841__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,842                                 size_t siglen);843 844__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,845                        const unsigned char *ek, int ekl,846                        const unsigned char *iv, EVP_PKEY *priv);847__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);848 849__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,850                        unsigned char **ek, int *ekl, unsigned char *iv,851                        EVP_PKEY **pubk, int npubk);852__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);853 854EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void);855void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx);856int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, const EVP_ENCODE_CTX *sctx);857int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx);858void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);859int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,860                     const unsigned char *in, int inl);861void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);862int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);863 864void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);865int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,866                     const unsigned char *in, int inl);867int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned868                    char *out, int *outl);869int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);870 871# ifndef OPENSSL_NO_DEPRECATED_1_1_0872#  define EVP_CIPHER_CTX_init(c)      EVP_CIPHER_CTX_reset(c)873#  define EVP_CIPHER_CTX_cleanup(c)   EVP_CIPHER_CTX_reset(c)874# endif875EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);876int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c);877void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c);878int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);879int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);880int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);881int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);882int EVP_CIPHER_get_params(EVP_CIPHER *cipher, OSSL_PARAM params[]);883int EVP_CIPHER_CTX_set_params(EVP_CIPHER_CTX *ctx, const OSSL_PARAM params[]);884int EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]);885const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher);886const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher);887const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher);888const OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *ctx);889const OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *ctx);890 891const BIO_METHOD *BIO_f_md(void);892const BIO_METHOD *BIO_f_base64(void);893const BIO_METHOD *BIO_f_cipher(void);894const BIO_METHOD *BIO_f_reliable(void);895__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,896                          const unsigned char *i, int enc);897 898const EVP_MD *EVP_md_null(void);899# ifndef OPENSSL_NO_MD2900const EVP_MD *EVP_md2(void);901# endif902# ifndef OPENSSL_NO_MD4903const EVP_MD *EVP_md4(void);904# endif905# ifndef OPENSSL_NO_MD5906const EVP_MD *EVP_md5(void);907const EVP_MD *EVP_md5_sha1(void);908# endif909# ifndef OPENSSL_NO_BLAKE2910const EVP_MD *EVP_blake2b512(void);911const EVP_MD *EVP_blake2s256(void);912# endif913const EVP_MD *EVP_sha1(void);914const EVP_MD *EVP_sha224(void);915const EVP_MD *EVP_sha256(void);916const EVP_MD *EVP_sha384(void);917const EVP_MD *EVP_sha512(void);918const EVP_MD *EVP_sha512_224(void);919const EVP_MD *EVP_sha512_256(void);920const EVP_MD *EVP_sha3_224(void);921const EVP_MD *EVP_sha3_256(void);922const EVP_MD *EVP_sha3_384(void);923const EVP_MD *EVP_sha3_512(void);924const EVP_MD *EVP_shake128(void);925const EVP_MD *EVP_shake256(void);926 927# ifndef OPENSSL_NO_MDC2928const EVP_MD *EVP_mdc2(void);929# endif930# ifndef OPENSSL_NO_RMD160931const EVP_MD *EVP_ripemd160(void);932# endif933# ifndef OPENSSL_NO_WHIRLPOOL934const EVP_MD *EVP_whirlpool(void);935# endif936# ifndef OPENSSL_NO_SM3937const EVP_MD *EVP_sm3(void);938# endif939const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */940# ifndef OPENSSL_NO_DES941const EVP_CIPHER *EVP_des_ecb(void);942const EVP_CIPHER *EVP_des_ede(void);943const EVP_CIPHER *EVP_des_ede3(void);944const EVP_CIPHER *EVP_des_ede_ecb(void);945const EVP_CIPHER *EVP_des_ede3_ecb(void);946const EVP_CIPHER *EVP_des_cfb64(void);947#  define EVP_des_cfb EVP_des_cfb64948const EVP_CIPHER *EVP_des_cfb1(void);949const EVP_CIPHER *EVP_des_cfb8(void);950const EVP_CIPHER *EVP_des_ede_cfb64(void);951#  define EVP_des_ede_cfb EVP_des_ede_cfb64952const EVP_CIPHER *EVP_des_ede3_cfb64(void);953#  define EVP_des_ede3_cfb EVP_des_ede3_cfb64954const EVP_CIPHER *EVP_des_ede3_cfb1(void);955const EVP_CIPHER *EVP_des_ede3_cfb8(void);956const EVP_CIPHER *EVP_des_ofb(void);957const EVP_CIPHER *EVP_des_ede_ofb(void);958const EVP_CIPHER *EVP_des_ede3_ofb(void);959const EVP_CIPHER *EVP_des_cbc(void);960const EVP_CIPHER *EVP_des_ede_cbc(void);961const EVP_CIPHER *EVP_des_ede3_cbc(void);962const EVP_CIPHER *EVP_desx_cbc(void);963const EVP_CIPHER *EVP_des_ede3_wrap(void);964/*965 * This should now be supported through the dev_crypto ENGINE. But also, why966 * are rc4 and md5 declarations made here inside a "NO_DES" precompiler967 * branch?968 */969# endif970# ifndef OPENSSL_NO_RC4971const EVP_CIPHER *EVP_rc4(void);972const EVP_CIPHER *EVP_rc4_40(void);973#  ifndef OPENSSL_NO_MD5974const EVP_CIPHER *EVP_rc4_hmac_md5(void);975#  endif976# endif977# ifndef OPENSSL_NO_IDEA978const EVP_CIPHER *EVP_idea_ecb(void);979const EVP_CIPHER *EVP_idea_cfb64(void);980#  define EVP_idea_cfb EVP_idea_cfb64981const EVP_CIPHER *EVP_idea_ofb(void);982const EVP_CIPHER *EVP_idea_cbc(void);983# endif984# ifndef OPENSSL_NO_RC2985const EVP_CIPHER *EVP_rc2_ecb(void);986const EVP_CIPHER *EVP_rc2_cbc(void);987const EVP_CIPHER *EVP_rc2_40_cbc(void);988const EVP_CIPHER *EVP_rc2_64_cbc(void);989const EVP_CIPHER *EVP_rc2_cfb64(void);990#  define EVP_rc2_cfb EVP_rc2_cfb64991const EVP_CIPHER *EVP_rc2_ofb(void);992# endif993# ifndef OPENSSL_NO_BF994const EVP_CIPHER *EVP_bf_ecb(void);995const EVP_CIPHER *EVP_bf_cbc(void);996const EVP_CIPHER *EVP_bf_cfb64(void);997#  define EVP_bf_cfb EVP_bf_cfb64998const EVP_CIPHER *EVP_bf_ofb(void);999# endif1000# ifndef OPENSSL_NO_CAST1001const EVP_CIPHER *EVP_cast5_ecb(void);1002const EVP_CIPHER *EVP_cast5_cbc(void);1003const EVP_CIPHER *EVP_cast5_cfb64(void);1004#  define EVP_cast5_cfb EVP_cast5_cfb641005const EVP_CIPHER *EVP_cast5_ofb(void);1006# endif1007# ifndef OPENSSL_NO_RC51008const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);1009const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);1010const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);1011#  define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb641012const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);1013# endif1014const EVP_CIPHER *EVP_aes_128_ecb(void);1015const EVP_CIPHER *EVP_aes_128_cbc(void);1016const EVP_CIPHER *EVP_aes_128_cfb1(void);1017const EVP_CIPHER *EVP_aes_128_cfb8(void);1018const EVP_CIPHER *EVP_aes_128_cfb128(void);1019# define EVP_aes_128_cfb EVP_aes_128_cfb1281020const EVP_CIPHER *EVP_aes_128_ofb(void);1021const EVP_CIPHER *EVP_aes_128_ctr(void);1022const EVP_CIPHER *EVP_aes_128_ccm(void);1023const EVP_CIPHER *EVP_aes_128_gcm(void);1024const EVP_CIPHER *EVP_aes_128_xts(void);1025const EVP_CIPHER *EVP_aes_128_wrap(void);1026const EVP_CIPHER *EVP_aes_128_wrap_pad(void);1027# ifndef OPENSSL_NO_OCB1028const EVP_CIPHER *EVP_aes_128_ocb(void);1029# endif1030const EVP_CIPHER *EVP_aes_192_ecb(void);1031const EVP_CIPHER *EVP_aes_192_cbc(void);1032const EVP_CIPHER *EVP_aes_192_cfb1(void);1033const EVP_CIPHER *EVP_aes_192_cfb8(void);1034const EVP_CIPHER *EVP_aes_192_cfb128(void);1035# define EVP_aes_192_cfb EVP_aes_192_cfb1281036const EVP_CIPHER *EVP_aes_192_ofb(void);1037const EVP_CIPHER *EVP_aes_192_ctr(void);1038const EVP_CIPHER *EVP_aes_192_ccm(void);1039const EVP_CIPHER *EVP_aes_192_gcm(void);1040const EVP_CIPHER *EVP_aes_192_wrap(void);1041const EVP_CIPHER *EVP_aes_192_wrap_pad(void);1042# ifndef OPENSSL_NO_OCB1043const EVP_CIPHER *EVP_aes_192_ocb(void);1044# endif1045const EVP_CIPHER *EVP_aes_256_ecb(void);1046const EVP_CIPHER *EVP_aes_256_cbc(void);1047const EVP_CIPHER *EVP_aes_256_cfb1(void);1048const EVP_CIPHER *EVP_aes_256_cfb8(void);1049const EVP_CIPHER *EVP_aes_256_cfb128(void);1050# define EVP_aes_256_cfb EVP_aes_256_cfb1281051const EVP_CIPHER *EVP_aes_256_ofb(void);1052const EVP_CIPHER *EVP_aes_256_ctr(void);1053const EVP_CIPHER *EVP_aes_256_ccm(void);1054const EVP_CIPHER *EVP_aes_256_gcm(void);1055const EVP_CIPHER *EVP_aes_256_xts(void);1056const EVP_CIPHER *EVP_aes_256_wrap(void);1057const EVP_CIPHER *EVP_aes_256_wrap_pad(void);1058# ifndef OPENSSL_NO_OCB1059const EVP_CIPHER *EVP_aes_256_ocb(void);1060# endif1061const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);1062const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);1063const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void);1064const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void);1065# ifndef OPENSSL_NO_ARIA1066const EVP_CIPHER *EVP_aria_128_ecb(void);1067const EVP_CIPHER *EVP_aria_128_cbc(void);1068const EVP_CIPHER *EVP_aria_128_cfb1(void);1069const EVP_CIPHER *EVP_aria_128_cfb8(void);1070const EVP_CIPHER *EVP_aria_128_cfb128(void);1071#  define EVP_aria_128_cfb EVP_aria_128_cfb1281072const EVP_CIPHER *EVP_aria_128_ctr(void);1073const EVP_CIPHER *EVP_aria_128_ofb(void);1074const EVP_CIPHER *EVP_aria_128_gcm(void);1075const EVP_CIPHER *EVP_aria_128_ccm(void);1076const EVP_CIPHER *EVP_aria_192_ecb(void);1077const EVP_CIPHER *EVP_aria_192_cbc(void);1078const EVP_CIPHER *EVP_aria_192_cfb1(void);1079const EVP_CIPHER *EVP_aria_192_cfb8(void);1080const EVP_CIPHER *EVP_aria_192_cfb128(void);1081#  define EVP_aria_192_cfb EVP_aria_192_cfb1281082const EVP_CIPHER *EVP_aria_192_ctr(void);1083const EVP_CIPHER *EVP_aria_192_ofb(void);1084const EVP_CIPHER *EVP_aria_192_gcm(void);1085const EVP_CIPHER *EVP_aria_192_ccm(void);1086const EVP_CIPHER *EVP_aria_256_ecb(void);1087const EVP_CIPHER *EVP_aria_256_cbc(void);1088const EVP_CIPHER *EVP_aria_256_cfb1(void);1089const EVP_CIPHER *EVP_aria_256_cfb8(void);1090const EVP_CIPHER *EVP_aria_256_cfb128(void);1091#  define EVP_aria_256_cfb EVP_aria_256_cfb1281092const EVP_CIPHER *EVP_aria_256_ctr(void);1093const EVP_CIPHER *EVP_aria_256_ofb(void);1094const EVP_CIPHER *EVP_aria_256_gcm(void);1095const EVP_CIPHER *EVP_aria_256_ccm(void);1096# endif1097# ifndef OPENSSL_NO_CAMELLIA1098const EVP_CIPHER *EVP_camellia_128_ecb(void);1099const EVP_CIPHER *EVP_camellia_128_cbc(void);1100const EVP_CIPHER *EVP_camellia_128_cfb1(void);1101const EVP_CIPHER *EVP_camellia_128_cfb8(void);1102const EVP_CIPHER *EVP_camellia_128_cfb128(void);1103#  define EVP_camellia_128_cfb EVP_camellia_128_cfb1281104const EVP_CIPHER *EVP_camellia_128_ofb(void);1105const EVP_CIPHER *EVP_camellia_128_ctr(void);1106const EVP_CIPHER *EVP_camellia_192_ecb(void);1107const EVP_CIPHER *EVP_camellia_192_cbc(void);1108const EVP_CIPHER *EVP_camellia_192_cfb1(void);1109const EVP_CIPHER *EVP_camellia_192_cfb8(void);1110const EVP_CIPHER *EVP_camellia_192_cfb128(void);1111#  define EVP_camellia_192_cfb EVP_camellia_192_cfb1281112const EVP_CIPHER *EVP_camellia_192_ofb(void);1113const EVP_CIPHER *EVP_camellia_192_ctr(void);1114const EVP_CIPHER *EVP_camellia_256_ecb(void);1115const EVP_CIPHER *EVP_camellia_256_cbc(void);1116const EVP_CIPHER *EVP_camellia_256_cfb1(void);1117const EVP_CIPHER *EVP_camellia_256_cfb8(void);1118const EVP_CIPHER *EVP_camellia_256_cfb128(void);1119#  define EVP_camellia_256_cfb EVP_camellia_256_cfb1281120const EVP_CIPHER *EVP_camellia_256_ofb(void);1121const EVP_CIPHER *EVP_camellia_256_ctr(void);1122# endif1123# ifndef OPENSSL_NO_CHACHA1124const EVP_CIPHER *EVP_chacha20(void);1125#  ifndef OPENSSL_NO_POLY13051126const EVP_CIPHER *EVP_chacha20_poly1305(void);1127#  endif1128# endif1129 1130# ifndef OPENSSL_NO_SEED1131const EVP_CIPHER *EVP_seed_ecb(void);1132const EVP_CIPHER *EVP_seed_cbc(void);1133const EVP_CIPHER *EVP_seed_cfb128(void);1134#  define EVP_seed_cfb EVP_seed_cfb1281135const EVP_CIPHER *EVP_seed_ofb(void);1136# endif1137 1138# ifndef OPENSSL_NO_SM41139const EVP_CIPHER *EVP_sm4_ecb(void);1140const EVP_CIPHER *EVP_sm4_cbc(void);1141const EVP_CIPHER *EVP_sm4_cfb128(void);1142#  define EVP_sm4_cfb EVP_sm4_cfb1281143const EVP_CIPHER *EVP_sm4_ofb(void);1144const EVP_CIPHER *EVP_sm4_ctr(void);1145# endif1146 1147# ifndef OPENSSL_NO_DEPRECATED_1_1_01148#  define OPENSSL_add_all_algorithms_conf() \1149    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \1150                        | OPENSSL_INIT_ADD_ALL_DIGESTS \1151                        | OPENSSL_INIT_LOAD_CONFIG, NULL)1152#  define OPENSSL_add_all_algorithms_noconf() \1153    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \1154                        | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)1155 1156#  ifdef OPENSSL_LOAD_CONF1157#   define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf()1158#  else1159#   define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf()1160#  endif1161 1162#  define OpenSSL_add_all_ciphers() \1163    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL)1164#  define OpenSSL_add_all_digests() \1165    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)1166 1167#  define EVP_cleanup() while(0) continue1168# endif1169 1170int EVP_add_cipher(const EVP_CIPHER *cipher);1171int EVP_add_digest(const EVP_MD *digest);1172 1173const EVP_CIPHER *EVP_get_cipherbyname(const char *name);1174const EVP_MD *EVP_get_digestbyname(const char *name);1175 1176void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph,1177                                   const char *from, const char *to, void *x),1178                       void *arg);1179void EVP_CIPHER_do_all_sorted(void (*fn)1180                               (const EVP_CIPHER *ciph, const char *from,1181                                const char *to, void *x), void *arg);1182void EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,1183                                void (*fn)(EVP_CIPHER *cipher, void *arg),1184                                void *arg);1185 1186void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph,1187                               const char *from, const char *to, void *x),1188                   void *arg);1189void EVP_MD_do_all_sorted(void (*fn)1190                           (const EVP_MD *ciph, const char *from,1191                            const char *to, void *x), void *arg);1192void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,1193                            void (*fn)(EVP_MD *md, void *arg),1194                            void *arg);1195 1196/* MAC stuff */1197 1198EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,1199                       const char *properties);1200int EVP_MAC_up_ref(EVP_MAC *mac);

Showing the first 1,200 of 2173 lines. Download the file for the rest.

codekingpro/portable-devtools · Team Ai