1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the OpenSSL license (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci#ifndef HEADER_ENVELOPE_H 11e1051a39Sopenharmony_ci# define HEADER_ENVELOPE_H 12e1051a39Sopenharmony_ci 13e1051a39Sopenharmony_ci# include <openssl/opensslconf.h> 14e1051a39Sopenharmony_ci# include <openssl/ossl_typ.h> 15e1051a39Sopenharmony_ci# include <openssl/symhacks.h> 16e1051a39Sopenharmony_ci# include <openssl/bio.h> 17e1051a39Sopenharmony_ci# include <openssl/evperr.h> 18e1051a39Sopenharmony_ci 19e1051a39Sopenharmony_ci# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ 20e1051a39Sopenharmony_ci# define EVP_MAX_KEY_LENGTH 64 21e1051a39Sopenharmony_ci# define EVP_MAX_IV_LENGTH 16 22e1051a39Sopenharmony_ci# define EVP_MAX_BLOCK_LENGTH 32 23e1051a39Sopenharmony_ci 24e1051a39Sopenharmony_ci# define PKCS5_SALT_LEN 8 25e1051a39Sopenharmony_ci/* Default PKCS#5 iteration count */ 26e1051a39Sopenharmony_ci# define PKCS5_DEFAULT_ITER 2048 27e1051a39Sopenharmony_ci 28e1051a39Sopenharmony_ci# include <openssl/objects.h> 29e1051a39Sopenharmony_ci 30e1051a39Sopenharmony_ci# define EVP_PK_RSA 0x0001 31e1051a39Sopenharmony_ci# define EVP_PK_DSA 0x0002 32e1051a39Sopenharmony_ci# define EVP_PK_DH 0x0004 33e1051a39Sopenharmony_ci# define EVP_PK_EC 0x0008 34e1051a39Sopenharmony_ci# define EVP_PKT_SIGN 0x0010 35e1051a39Sopenharmony_ci# define EVP_PKT_ENC 0x0020 36e1051a39Sopenharmony_ci# define EVP_PKT_EXCH 0x0040 37e1051a39Sopenharmony_ci# define EVP_PKS_RSA 0x0100 38e1051a39Sopenharmony_ci# define EVP_PKS_DSA 0x0200 39e1051a39Sopenharmony_ci# define EVP_PKS_EC 0x0400 40e1051a39Sopenharmony_ci 41e1051a39Sopenharmony_ci# define EVP_PKEY_NONE NID_undef 42e1051a39Sopenharmony_ci# define EVP_PKEY_RSA NID_rsaEncryption 43e1051a39Sopenharmony_ci# define EVP_PKEY_RSA2 NID_rsa 44e1051a39Sopenharmony_ci# define EVP_PKEY_RSA_PSS NID_rsassaPss 45e1051a39Sopenharmony_ci# define EVP_PKEY_DSA NID_dsa 46e1051a39Sopenharmony_ci# define EVP_PKEY_DSA1 NID_dsa_2 47e1051a39Sopenharmony_ci# define EVP_PKEY_DSA2 NID_dsaWithSHA 48e1051a39Sopenharmony_ci# define EVP_PKEY_DSA3 NID_dsaWithSHA1 49e1051a39Sopenharmony_ci# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 50e1051a39Sopenharmony_ci# define EVP_PKEY_DH NID_dhKeyAgreement 51e1051a39Sopenharmony_ci# define EVP_PKEY_DHX NID_dhpublicnumber 52e1051a39Sopenharmony_ci# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey 53e1051a39Sopenharmony_ci# define EVP_PKEY_SM2 NID_sm2 54e1051a39Sopenharmony_ci# define EVP_PKEY_HMAC NID_hmac 55e1051a39Sopenharmony_ci# define EVP_PKEY_CMAC NID_cmac 56e1051a39Sopenharmony_ci# define EVP_PKEY_SCRYPT NID_id_scrypt 57e1051a39Sopenharmony_ci# define EVP_PKEY_TLS1_PRF NID_tls1_prf 58e1051a39Sopenharmony_ci# define EVP_PKEY_HKDF NID_hkdf 59e1051a39Sopenharmony_ci# define EVP_PKEY_POLY1305 NID_poly1305 60e1051a39Sopenharmony_ci# define EVP_PKEY_SIPHASH NID_siphash 61e1051a39Sopenharmony_ci# define EVP_PKEY_X25519 NID_X25519 62e1051a39Sopenharmony_ci# define EVP_PKEY_ED25519 NID_ED25519 63e1051a39Sopenharmony_ci# define EVP_PKEY_X448 NID_X448 64e1051a39Sopenharmony_ci# define EVP_PKEY_ED448 NID_ED448 65e1051a39Sopenharmony_ci 66e1051a39Sopenharmony_ci#ifdef __cplusplus 67e1051a39Sopenharmony_ciextern "C" { 68e1051a39Sopenharmony_ci#endif 69e1051a39Sopenharmony_ci 70e1051a39Sopenharmony_ci# define EVP_PKEY_MO_SIGN 0x0001 71e1051a39Sopenharmony_ci# define EVP_PKEY_MO_VERIFY 0x0002 72e1051a39Sopenharmony_ci# define EVP_PKEY_MO_ENCRYPT 0x0004 73e1051a39Sopenharmony_ci# define EVP_PKEY_MO_DECRYPT 0x0008 74e1051a39Sopenharmony_ci 75e1051a39Sopenharmony_ci# ifndef EVP_MD 76e1051a39Sopenharmony_ciEVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); 77e1051a39Sopenharmony_ciEVP_MD *EVP_MD_meth_dup(const EVP_MD *md); 78e1051a39Sopenharmony_civoid EVP_MD_meth_free(EVP_MD *md); 79e1051a39Sopenharmony_ci 80e1051a39Sopenharmony_ciint EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); 81e1051a39Sopenharmony_ciint EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); 82e1051a39Sopenharmony_ciint EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); 83e1051a39Sopenharmony_ciint EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); 84e1051a39Sopenharmony_ciint EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); 85e1051a39Sopenharmony_ciint EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, 86e1051a39Sopenharmony_ci const void *data, 87e1051a39Sopenharmony_ci size_t count)); 88e1051a39Sopenharmony_ciint EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, 89e1051a39Sopenharmony_ci unsigned char *md)); 90e1051a39Sopenharmony_ciint EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, 91e1051a39Sopenharmony_ci const EVP_MD_CTX *from)); 92e1051a39Sopenharmony_ciint EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); 93e1051a39Sopenharmony_ciint EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, 94e1051a39Sopenharmony_ci int p1, void *p2)); 95e1051a39Sopenharmony_ci 96e1051a39Sopenharmony_ciint EVP_MD_meth_get_input_blocksize(const EVP_MD *md); 97e1051a39Sopenharmony_ciint EVP_MD_meth_get_result_size(const EVP_MD *md); 98e1051a39Sopenharmony_ciint EVP_MD_meth_get_app_datasize(const EVP_MD *md); 99e1051a39Sopenharmony_ciunsigned long EVP_MD_meth_get_flags(const EVP_MD *md); 100e1051a39Sopenharmony_ciint (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); 101e1051a39Sopenharmony_ciint (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, 102e1051a39Sopenharmony_ci const void *data, 103e1051a39Sopenharmony_ci size_t count); 104e1051a39Sopenharmony_ciint (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, 105e1051a39Sopenharmony_ci unsigned char *md); 106e1051a39Sopenharmony_ciint (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, 107e1051a39Sopenharmony_ci const EVP_MD_CTX *from); 108e1051a39Sopenharmony_ciint (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); 109e1051a39Sopenharmony_ciint (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, 110e1051a39Sopenharmony_ci int p1, void *p2); 111e1051a39Sopenharmony_ci 112e1051a39Sopenharmony_ci/* digest can only handle a single block */ 113e1051a39Sopenharmony_ci# define EVP_MD_FLAG_ONESHOT 0x0001 114e1051a39Sopenharmony_ci 115e1051a39Sopenharmony_ci/* digest is extensible-output function, XOF */ 116e1051a39Sopenharmony_ci# define EVP_MD_FLAG_XOF 0x0002 117e1051a39Sopenharmony_ci 118e1051a39Sopenharmony_ci/* DigestAlgorithmIdentifier flags... */ 119e1051a39Sopenharmony_ci 120e1051a39Sopenharmony_ci# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 121e1051a39Sopenharmony_ci 122e1051a39Sopenharmony_ci/* NULL or absent parameter accepted. Use NULL */ 123e1051a39Sopenharmony_ci 124e1051a39Sopenharmony_ci# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 125e1051a39Sopenharmony_ci 126e1051a39Sopenharmony_ci/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ 127e1051a39Sopenharmony_ci 128e1051a39Sopenharmony_ci# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 129e1051a39Sopenharmony_ci 130e1051a39Sopenharmony_ci/* Custom handling via ctrl */ 131e1051a39Sopenharmony_ci 132e1051a39Sopenharmony_ci# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 133e1051a39Sopenharmony_ci 134e1051a39Sopenharmony_ci/* Note if suitable for use in FIPS mode */ 135e1051a39Sopenharmony_ci# define EVP_MD_FLAG_FIPS 0x0400 136e1051a39Sopenharmony_ci 137e1051a39Sopenharmony_ci/* Digest ctrls */ 138e1051a39Sopenharmony_ci 139e1051a39Sopenharmony_ci# define EVP_MD_CTRL_DIGALGID 0x1 140e1051a39Sopenharmony_ci# define EVP_MD_CTRL_MICALG 0x2 141e1051a39Sopenharmony_ci# define EVP_MD_CTRL_XOF_LEN 0x3 142e1051a39Sopenharmony_ci 143e1051a39Sopenharmony_ci/* Minimum Algorithm specific ctrl value */ 144e1051a39Sopenharmony_ci 145e1051a39Sopenharmony_ci# define EVP_MD_CTRL_ALG_CTRL 0x1000 146e1051a39Sopenharmony_ci 147e1051a39Sopenharmony_ci# endif /* !EVP_MD */ 148e1051a39Sopenharmony_ci 149e1051a39Sopenharmony_ci/* values for EVP_MD_CTX flags */ 150e1051a39Sopenharmony_ci 151e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be 152e1051a39Sopenharmony_ci * called once only */ 153e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been 154e1051a39Sopenharmony_ci * cleaned */ 155e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data 156e1051a39Sopenharmony_ci * in EVP_MD_CTX_reset */ 157e1051a39Sopenharmony_ci/* 158e1051a39Sopenharmony_ci * FIPS and pad options are ignored in 1.0.0, definitions are here so we 159e1051a39Sopenharmony_ci * don't accidentally reuse the values for other purposes. 160e1051a39Sopenharmony_ci */ 161e1051a39Sopenharmony_ci 162e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS 163e1051a39Sopenharmony_ci * digest in FIPS mode */ 164e1051a39Sopenharmony_ci 165e1051a39Sopenharmony_ci/* 166e1051a39Sopenharmony_ci * The following PAD options are also currently ignored in 1.0.0, digest 167e1051a39Sopenharmony_ci * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() 168e1051a39Sopenharmony_ci * instead. 169e1051a39Sopenharmony_ci */ 170e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ 171e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ 172e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ 173e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ 174e1051a39Sopenharmony_ci 175e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ 176e1051a39Sopenharmony_ci/* 177e1051a39Sopenharmony_ci * Some functions such as EVP_DigestSign only finalise copies of internal 178e1051a39Sopenharmony_ci * contexts so additional data can be included after the finalisation call. 179e1051a39Sopenharmony_ci * This is inefficient if this functionality is not required: it is disabled 180e1051a39Sopenharmony_ci * if the following flag is set. 181e1051a39Sopenharmony_ci */ 182e1051a39Sopenharmony_ci# define EVP_MD_CTX_FLAG_FINALISE 0x0200 183e1051a39Sopenharmony_ci/* NOTE: 0x0400 is reserved for internal usage */ 184e1051a39Sopenharmony_ci 185e1051a39Sopenharmony_ciEVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); 186e1051a39Sopenharmony_ciEVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); 187e1051a39Sopenharmony_civoid EVP_CIPHER_meth_free(EVP_CIPHER *cipher); 188e1051a39Sopenharmony_ci 189e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); 190e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); 191e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); 192e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, 193e1051a39Sopenharmony_ci int (*init) (EVP_CIPHER_CTX *ctx, 194e1051a39Sopenharmony_ci const unsigned char *key, 195e1051a39Sopenharmony_ci const unsigned char *iv, 196e1051a39Sopenharmony_ci int enc)); 197e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, 198e1051a39Sopenharmony_ci int (*do_cipher) (EVP_CIPHER_CTX *ctx, 199e1051a39Sopenharmony_ci unsigned char *out, 200e1051a39Sopenharmony_ci const unsigned char *in, 201e1051a39Sopenharmony_ci size_t inl)); 202e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, 203e1051a39Sopenharmony_ci int (*cleanup) (EVP_CIPHER_CTX *)); 204e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, 205e1051a39Sopenharmony_ci int (*set_asn1_parameters) (EVP_CIPHER_CTX *, 206e1051a39Sopenharmony_ci ASN1_TYPE *)); 207e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, 208e1051a39Sopenharmony_ci int (*get_asn1_parameters) (EVP_CIPHER_CTX *, 209e1051a39Sopenharmony_ci ASN1_TYPE *)); 210e1051a39Sopenharmony_ciint EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, 211e1051a39Sopenharmony_ci int (*ctrl) (EVP_CIPHER_CTX *, int type, 212e1051a39Sopenharmony_ci int arg, void *ptr)); 213e1051a39Sopenharmony_ci 214e1051a39Sopenharmony_ciint (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, 215e1051a39Sopenharmony_ci const unsigned char *key, 216e1051a39Sopenharmony_ci const unsigned char *iv, 217e1051a39Sopenharmony_ci int enc); 218e1051a39Sopenharmony_ciint (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, 219e1051a39Sopenharmony_ci unsigned char *out, 220e1051a39Sopenharmony_ci const unsigned char *in, 221e1051a39Sopenharmony_ci size_t inl); 222e1051a39Sopenharmony_ciint (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); 223e1051a39Sopenharmony_ciint (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, 224e1051a39Sopenharmony_ci ASN1_TYPE *); 225e1051a39Sopenharmony_ciint (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, 226e1051a39Sopenharmony_ci ASN1_TYPE *); 227e1051a39Sopenharmony_ciint (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, 228e1051a39Sopenharmony_ci int type, int arg, 229e1051a39Sopenharmony_ci void *ptr); 230e1051a39Sopenharmony_ci 231e1051a39Sopenharmony_ci/* Values for cipher flags */ 232e1051a39Sopenharmony_ci 233e1051a39Sopenharmony_ci/* Modes for ciphers */ 234e1051a39Sopenharmony_ci 235e1051a39Sopenharmony_ci# define EVP_CIPH_STREAM_CIPHER 0x0 236e1051a39Sopenharmony_ci# define EVP_CIPH_ECB_MODE 0x1 237e1051a39Sopenharmony_ci# define EVP_CIPH_CBC_MODE 0x2 238e1051a39Sopenharmony_ci# define EVP_CIPH_CFB_MODE 0x3 239e1051a39Sopenharmony_ci# define EVP_CIPH_OFB_MODE 0x4 240e1051a39Sopenharmony_ci# define EVP_CIPH_CTR_MODE 0x5 241e1051a39Sopenharmony_ci# define EVP_CIPH_GCM_MODE 0x6 242e1051a39Sopenharmony_ci# define EVP_CIPH_CCM_MODE 0x7 243e1051a39Sopenharmony_ci# define EVP_CIPH_XTS_MODE 0x10001 244e1051a39Sopenharmony_ci# define EVP_CIPH_WRAP_MODE 0x10002 245e1051a39Sopenharmony_ci# define EVP_CIPH_OCB_MODE 0x10003 246e1051a39Sopenharmony_ci# define EVP_CIPH_MODE 0xF0007 247e1051a39Sopenharmony_ci/* Set if variable length cipher */ 248e1051a39Sopenharmony_ci# define EVP_CIPH_VARIABLE_LENGTH 0x8 249e1051a39Sopenharmony_ci/* Set if the iv handling should be done by the cipher itself */ 250e1051a39Sopenharmony_ci# define EVP_CIPH_CUSTOM_IV 0x10 251e1051a39Sopenharmony_ci/* Set if the cipher's init() function should be called if key is NULL */ 252e1051a39Sopenharmony_ci# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 253e1051a39Sopenharmony_ci/* Call ctrl() to init cipher parameters */ 254e1051a39Sopenharmony_ci# define EVP_CIPH_CTRL_INIT 0x40 255e1051a39Sopenharmony_ci/* Don't use standard key length function */ 256e1051a39Sopenharmony_ci# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 257e1051a39Sopenharmony_ci/* Don't use standard block padding */ 258e1051a39Sopenharmony_ci# define EVP_CIPH_NO_PADDING 0x100 259e1051a39Sopenharmony_ci/* cipher handles random key generation */ 260e1051a39Sopenharmony_ci# define EVP_CIPH_RAND_KEY 0x200 261e1051a39Sopenharmony_ci/* cipher has its own additional copying logic */ 262e1051a39Sopenharmony_ci# define EVP_CIPH_CUSTOM_COPY 0x400 263e1051a39Sopenharmony_ci/* Don't use standard iv length function */ 264e1051a39Sopenharmony_ci# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 265e1051a39Sopenharmony_ci/* Allow use default ASN1 get/set iv */ 266e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 267e1051a39Sopenharmony_ci/* Buffer length in bits not bytes: CFB1 mode only */ 268e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 269e1051a39Sopenharmony_ci/* Note if suitable for use in FIPS mode */ 270e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_FIPS 0x4000 271e1051a39Sopenharmony_ci/* Allow non FIPS cipher in FIPS mode */ 272e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 273e1051a39Sopenharmony_ci/* 274e1051a39Sopenharmony_ci * Cipher handles any and all padding logic as well as finalisation. 275e1051a39Sopenharmony_ci */ 276e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 277e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 278e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 279e1051a39Sopenharmony_ci/* Cipher can handle pipeline operations */ 280e1051a39Sopenharmony_ci# define EVP_CIPH_FLAG_PIPELINE 0X800000 281e1051a39Sopenharmony_ci 282e1051a39Sopenharmony_ci/* 283e1051a39Sopenharmony_ci * Cipher context flag to indicate we can handle wrap mode: if allowed in 284e1051a39Sopenharmony_ci * older applications it could overflow buffers. 285e1051a39Sopenharmony_ci */ 286e1051a39Sopenharmony_ci 287e1051a39Sopenharmony_ci# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 288e1051a39Sopenharmony_ci 289e1051a39Sopenharmony_ci/* ctrl() values */ 290e1051a39Sopenharmony_ci 291e1051a39Sopenharmony_ci# define EVP_CTRL_INIT 0x0 292e1051a39Sopenharmony_ci# define EVP_CTRL_SET_KEY_LENGTH 0x1 293e1051a39Sopenharmony_ci# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 294e1051a39Sopenharmony_ci# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 295e1051a39Sopenharmony_ci# define EVP_CTRL_GET_RC5_ROUNDS 0x4 296e1051a39Sopenharmony_ci# define EVP_CTRL_SET_RC5_ROUNDS 0x5 297e1051a39Sopenharmony_ci# define EVP_CTRL_RAND_KEY 0x6 298e1051a39Sopenharmony_ci# define EVP_CTRL_PBE_PRF_NID 0x7 299e1051a39Sopenharmony_ci# define EVP_CTRL_COPY 0x8 300e1051a39Sopenharmony_ci# define EVP_CTRL_AEAD_SET_IVLEN 0x9 301e1051a39Sopenharmony_ci# define EVP_CTRL_AEAD_GET_TAG 0x10 302e1051a39Sopenharmony_ci# define EVP_CTRL_AEAD_SET_TAG 0x11 303e1051a39Sopenharmony_ci# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 304e1051a39Sopenharmony_ci# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN 305e1051a39Sopenharmony_ci# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG 306e1051a39Sopenharmony_ci# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG 307e1051a39Sopenharmony_ci# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED 308e1051a39Sopenharmony_ci# define EVP_CTRL_GCM_IV_GEN 0x13 309e1051a39Sopenharmony_ci# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN 310e1051a39Sopenharmony_ci# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG 311e1051a39Sopenharmony_ci# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG 312e1051a39Sopenharmony_ci# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED 313e1051a39Sopenharmony_ci# define EVP_CTRL_CCM_SET_L 0x14 314e1051a39Sopenharmony_ci# define EVP_CTRL_CCM_SET_MSGLEN 0x15 315e1051a39Sopenharmony_ci/* 316e1051a39Sopenharmony_ci * AEAD cipher deduces payload length and returns number of bytes required to 317e1051a39Sopenharmony_ci * store MAC and eventual padding. Subsequent call to EVP_Cipher even 318e1051a39Sopenharmony_ci * appends/verifies MAC. 319e1051a39Sopenharmony_ci */ 320e1051a39Sopenharmony_ci# define EVP_CTRL_AEAD_TLS1_AAD 0x16 321e1051a39Sopenharmony_ci/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ 322e1051a39Sopenharmony_ci# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 323e1051a39Sopenharmony_ci/* Set the GCM invocation field, decrypt only */ 324e1051a39Sopenharmony_ci# define EVP_CTRL_GCM_SET_IV_INV 0x18 325e1051a39Sopenharmony_ci 326e1051a39Sopenharmony_ci# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 327e1051a39Sopenharmony_ci# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a 328e1051a39Sopenharmony_ci# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b 329e1051a39Sopenharmony_ci# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c 330e1051a39Sopenharmony_ci 331e1051a39Sopenharmony_ci# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d 332e1051a39Sopenharmony_ci 333e1051a39Sopenharmony_ci/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ 334e1051a39Sopenharmony_ci# define EVP_CTRL_SET_SBOX 0x1e 335e1051a39Sopenharmony_ci/* 336e1051a39Sopenharmony_ci * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a 337e1051a39Sopenharmony_ci * pre-allocated buffer with specified size 338e1051a39Sopenharmony_ci */ 339e1051a39Sopenharmony_ci# define EVP_CTRL_SBOX_USED 0x1f 340e1051a39Sopenharmony_ci/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, 341e1051a39Sopenharmony_ci * 0 switches meshing off 342e1051a39Sopenharmony_ci */ 343e1051a39Sopenharmony_ci# define EVP_CTRL_KEY_MESH 0x20 344e1051a39Sopenharmony_ci/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ 345e1051a39Sopenharmony_ci# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 346e1051a39Sopenharmony_ci 347e1051a39Sopenharmony_ci/* Set the output buffers to use for a pipelined operation */ 348e1051a39Sopenharmony_ci# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 349e1051a39Sopenharmony_ci/* Set the input buffers to use for a pipelined operation */ 350e1051a39Sopenharmony_ci# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 351e1051a39Sopenharmony_ci/* Set the input buffer lengths to use for a pipelined operation */ 352e1051a39Sopenharmony_ci# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 353e1051a39Sopenharmony_ci 354e1051a39Sopenharmony_ci# define EVP_CTRL_GET_IVLEN 0x25 355e1051a39Sopenharmony_ci 356e1051a39Sopenharmony_ci/* Padding modes */ 357e1051a39Sopenharmony_ci#define EVP_PADDING_PKCS7 1 358e1051a39Sopenharmony_ci#define EVP_PADDING_ISO7816_4 2 359e1051a39Sopenharmony_ci#define EVP_PADDING_ANSI923 3 360e1051a39Sopenharmony_ci#define EVP_PADDING_ISO10126 4 361e1051a39Sopenharmony_ci#define EVP_PADDING_ZERO 5 362e1051a39Sopenharmony_ci 363e1051a39Sopenharmony_ci/* RFC 5246 defines additional data to be 13 bytes in length */ 364e1051a39Sopenharmony_ci# define EVP_AEAD_TLS1_AAD_LEN 13 365e1051a39Sopenharmony_ci 366e1051a39Sopenharmony_citypedef struct { 367e1051a39Sopenharmony_ci unsigned char *out; 368e1051a39Sopenharmony_ci const unsigned char *inp; 369e1051a39Sopenharmony_ci size_t len; 370e1051a39Sopenharmony_ci unsigned int interleave; 371e1051a39Sopenharmony_ci} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; 372e1051a39Sopenharmony_ci 373e1051a39Sopenharmony_ci/* GCM TLS constants */ 374e1051a39Sopenharmony_ci/* Length of fixed part of IV derived from PRF */ 375e1051a39Sopenharmony_ci# define EVP_GCM_TLS_FIXED_IV_LEN 4 376e1051a39Sopenharmony_ci/* Length of explicit part of IV part of TLS records */ 377e1051a39Sopenharmony_ci# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 378e1051a39Sopenharmony_ci/* Length of tag for TLS */ 379e1051a39Sopenharmony_ci# define EVP_GCM_TLS_TAG_LEN 16 380e1051a39Sopenharmony_ci 381e1051a39Sopenharmony_ci/* CCM TLS constants */ 382e1051a39Sopenharmony_ci/* Length of fixed part of IV derived from PRF */ 383e1051a39Sopenharmony_ci# define EVP_CCM_TLS_FIXED_IV_LEN 4 384e1051a39Sopenharmony_ci/* Length of explicit part of IV part of TLS records */ 385e1051a39Sopenharmony_ci# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 386e1051a39Sopenharmony_ci/* Total length of CCM IV length for TLS */ 387e1051a39Sopenharmony_ci# define EVP_CCM_TLS_IV_LEN 12 388e1051a39Sopenharmony_ci/* Length of tag for TLS */ 389e1051a39Sopenharmony_ci# define EVP_CCM_TLS_TAG_LEN 16 390e1051a39Sopenharmony_ci/* Length of CCM8 tag for TLS */ 391e1051a39Sopenharmony_ci# define EVP_CCM8_TLS_TAG_LEN 8 392e1051a39Sopenharmony_ci 393e1051a39Sopenharmony_ci/* Length of tag for TLS */ 394e1051a39Sopenharmony_ci# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 395e1051a39Sopenharmony_ci 396e1051a39Sopenharmony_citypedef struct evp_cipher_info_st { 397e1051a39Sopenharmony_ci const EVP_CIPHER *cipher; 398e1051a39Sopenharmony_ci unsigned char iv[EVP_MAX_IV_LENGTH]; 399e1051a39Sopenharmony_ci} EVP_CIPHER_INFO; 400e1051a39Sopenharmony_ci 401e1051a39Sopenharmony_ci 402e1051a39Sopenharmony_ci/* Password based encryption function */ 403e1051a39Sopenharmony_citypedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, 404e1051a39Sopenharmony_ci int passlen, ASN1_TYPE *param, 405e1051a39Sopenharmony_ci const EVP_CIPHER *cipher, const EVP_MD *md, 406e1051a39Sopenharmony_ci int en_de); 407e1051a39Sopenharmony_ci 408e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RSA 409e1051a39Sopenharmony_ci# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ 410e1051a39Sopenharmony_ci (char *)(rsa)) 411e1051a39Sopenharmony_ci# endif 412e1051a39Sopenharmony_ci 413e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_DSA 414e1051a39Sopenharmony_ci# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ 415e1051a39Sopenharmony_ci (char *)(dsa)) 416e1051a39Sopenharmony_ci# endif 417e1051a39Sopenharmony_ci 418e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_DH 419e1051a39Sopenharmony_ci# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ 420e1051a39Sopenharmony_ci (char *)(dh)) 421e1051a39Sopenharmony_ci# endif 422e1051a39Sopenharmony_ci 423e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_EC 424e1051a39Sopenharmony_ci# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ 425e1051a39Sopenharmony_ci (char *)(eckey)) 426e1051a39Sopenharmony_ci# endif 427e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SIPHASH 428e1051a39Sopenharmony_ci# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ 429e1051a39Sopenharmony_ci (char *)(shkey)) 430e1051a39Sopenharmony_ci# endif 431e1051a39Sopenharmony_ci 432e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_POLY1305 433e1051a39Sopenharmony_ci# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ 434e1051a39Sopenharmony_ci (char *)(polykey)) 435e1051a39Sopenharmony_ci# endif 436e1051a39Sopenharmony_ci 437e1051a39Sopenharmony_ci/* Add some extra combinations */ 438e1051a39Sopenharmony_ci# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) 439e1051a39Sopenharmony_ci# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) 440e1051a39Sopenharmony_ci# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) 441e1051a39Sopenharmony_ci# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) 442e1051a39Sopenharmony_ci 443e1051a39Sopenharmony_ciint EVP_MD_type(const EVP_MD *md); 444e1051a39Sopenharmony_ci# define EVP_MD_nid(e) EVP_MD_type(e) 445e1051a39Sopenharmony_ci# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) 446e1051a39Sopenharmony_ciint EVP_MD_pkey_type(const EVP_MD *md); 447e1051a39Sopenharmony_ciint EVP_MD_size(const EVP_MD *md); 448e1051a39Sopenharmony_ciint EVP_MD_block_size(const EVP_MD *md); 449e1051a39Sopenharmony_ciunsigned long EVP_MD_flags(const EVP_MD *md); 450e1051a39Sopenharmony_ci 451e1051a39Sopenharmony_ciconst EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); 452e1051a39Sopenharmony_ciint (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, 453e1051a39Sopenharmony_ci const void *data, size_t count); 454e1051a39Sopenharmony_civoid EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, 455e1051a39Sopenharmony_ci int (*update) (EVP_MD_CTX *ctx, 456e1051a39Sopenharmony_ci const void *data, size_t count)); 457e1051a39Sopenharmony_ci# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) 458e1051a39Sopenharmony_ci# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) 459e1051a39Sopenharmony_ci# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) 460e1051a39Sopenharmony_ciEVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); 461e1051a39Sopenharmony_civoid EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); 462e1051a39Sopenharmony_civoid *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); 463e1051a39Sopenharmony_ci 464e1051a39Sopenharmony_ciint EVP_CIPHER_nid(const EVP_CIPHER *cipher); 465e1051a39Sopenharmony_ci# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) 466e1051a39Sopenharmony_ciint EVP_CIPHER_block_size(const EVP_CIPHER *cipher); 467e1051a39Sopenharmony_ciint EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); 468e1051a39Sopenharmony_ciint EVP_CIPHER_key_length(const EVP_CIPHER *cipher); 469e1051a39Sopenharmony_ciint EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); 470e1051a39Sopenharmony_ciunsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); 471e1051a39Sopenharmony_ci# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) 472e1051a39Sopenharmony_ci 473e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); 474e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); 475e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); 476e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); 477e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); 478e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); 479e1051a39Sopenharmony_ciconst unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); 480e1051a39Sopenharmony_ciconst unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); 481e1051a39Sopenharmony_ciunsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); 482e1051a39Sopenharmony_ciunsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); 483e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); 484e1051a39Sopenharmony_civoid EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); 485e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); 486e1051a39Sopenharmony_civoid *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); 487e1051a39Sopenharmony_civoid EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); 488e1051a39Sopenharmony_civoid *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); 489e1051a39Sopenharmony_civoid *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); 490e1051a39Sopenharmony_ci# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) 491e1051a39Sopenharmony_ci# if OPENSSL_API_COMPAT < 0x10100000L 492e1051a39Sopenharmony_ci# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) 493e1051a39Sopenharmony_ci# endif 494e1051a39Sopenharmony_ci# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) 495e1051a39Sopenharmony_ci 496e1051a39Sopenharmony_ci# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) 497e1051a39Sopenharmony_ci# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) 498e1051a39Sopenharmony_ci 499e1051a39Sopenharmony_ci# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) 500e1051a39Sopenharmony_ci# define EVP_SignInit(a,b) EVP_DigestInit(a,b) 501e1051a39Sopenharmony_ci# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 502e1051a39Sopenharmony_ci# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) 503e1051a39Sopenharmony_ci# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) 504e1051a39Sopenharmony_ci# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 505e1051a39Sopenharmony_ci# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) 506e1051a39Sopenharmony_ci# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) 507e1051a39Sopenharmony_ci# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 508e1051a39Sopenharmony_ci# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 509e1051a39Sopenharmony_ci 510e1051a39Sopenharmony_ci# ifdef CONST_STRICT 511e1051a39Sopenharmony_civoid BIO_set_md(BIO *, const EVP_MD *md); 512e1051a39Sopenharmony_ci# else 513e1051a39Sopenharmony_ci# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) 514e1051a39Sopenharmony_ci# endif 515e1051a39Sopenharmony_ci# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) 516e1051a39Sopenharmony_ci# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ 517e1051a39Sopenharmony_ci (char *)(mdcp)) 518e1051a39Sopenharmony_ci# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ 519e1051a39Sopenharmony_ci (char *)(mdcp)) 520e1051a39Sopenharmony_ci# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) 521e1051a39Sopenharmony_ci# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ 522e1051a39Sopenharmony_ci (char *)(c_pp)) 523e1051a39Sopenharmony_ci 524e1051a39Sopenharmony_ci/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, 525e1051a39Sopenharmony_ci unsigned char *out, 526e1051a39Sopenharmony_ci const unsigned char *in, unsigned int inl); 527e1051a39Sopenharmony_ci 528e1051a39Sopenharmony_ci# define EVP_add_cipher_alias(n,alias) \ 529e1051a39Sopenharmony_ci OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) 530e1051a39Sopenharmony_ci# define EVP_add_digest_alias(n,alias) \ 531e1051a39Sopenharmony_ci OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) 532e1051a39Sopenharmony_ci# define EVP_delete_cipher_alias(alias) \ 533e1051a39Sopenharmony_ci OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); 534e1051a39Sopenharmony_ci# define EVP_delete_digest_alias(alias) \ 535e1051a39Sopenharmony_ci OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); 536e1051a39Sopenharmony_ci 537e1051a39Sopenharmony_ciint EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); 538e1051a39Sopenharmony_ciEVP_MD_CTX *EVP_MD_CTX_new(void); 539e1051a39Sopenharmony_ciint EVP_MD_CTX_reset(EVP_MD_CTX *ctx); 540e1051a39Sopenharmony_civoid EVP_MD_CTX_free(EVP_MD_CTX *ctx); 541e1051a39Sopenharmony_ci# define EVP_MD_CTX_create() EVP_MD_CTX_new() 542e1051a39Sopenharmony_ci# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) 543e1051a39Sopenharmony_ci# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) 544e1051a39Sopenharmony_ci__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); 545e1051a39Sopenharmony_civoid EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); 546e1051a39Sopenharmony_civoid EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); 547e1051a39Sopenharmony_ciint EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); 548e1051a39Sopenharmony_ci__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, 549e1051a39Sopenharmony_ci ENGINE *impl); 550e1051a39Sopenharmony_ci__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, 551e1051a39Sopenharmony_ci size_t cnt); 552e1051a39Sopenharmony_ci__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, 553e1051a39Sopenharmony_ci unsigned int *s); 554e1051a39Sopenharmony_ci__owur int EVP_Digest(const void *data, size_t count, 555e1051a39Sopenharmony_ci unsigned char *md, unsigned int *size, 556e1051a39Sopenharmony_ci const EVP_MD *type, ENGINE *impl); 557e1051a39Sopenharmony_ci 558e1051a39Sopenharmony_ci__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); 559e1051a39Sopenharmony_ci__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); 560e1051a39Sopenharmony_ci__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, 561e1051a39Sopenharmony_ci unsigned int *s); 562e1051a39Sopenharmony_ci__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, 563e1051a39Sopenharmony_ci size_t len); 564e1051a39Sopenharmony_ci 565e1051a39Sopenharmony_ciint EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); 566e1051a39Sopenharmony_ciint EVP_read_pw_string_min(char *buf, int minlen, int maxlen, 567e1051a39Sopenharmony_ci const char *prompt, int verify); 568e1051a39Sopenharmony_civoid EVP_set_pw_prompt(const char *prompt); 569e1051a39Sopenharmony_cichar *EVP_get_pw_prompt(void); 570e1051a39Sopenharmony_ci 571e1051a39Sopenharmony_ci__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, 572e1051a39Sopenharmony_ci const unsigned char *salt, 573e1051a39Sopenharmony_ci const unsigned char *data, int datal, int count, 574e1051a39Sopenharmony_ci unsigned char *key, unsigned char *iv); 575e1051a39Sopenharmony_ci 576e1051a39Sopenharmony_civoid EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); 577e1051a39Sopenharmony_civoid EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); 578e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); 579e1051a39Sopenharmony_ci 580e1051a39Sopenharmony_ci__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, 581e1051a39Sopenharmony_ci const unsigned char *key, const unsigned char *iv); 582e1051a39Sopenharmony_ci/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, 583e1051a39Sopenharmony_ci const EVP_CIPHER *cipher, ENGINE *impl, 584e1051a39Sopenharmony_ci const unsigned char *key, 585e1051a39Sopenharmony_ci const unsigned char *iv); 586e1051a39Sopenharmony_ci/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 587e1051a39Sopenharmony_ci int *outl, const unsigned char *in, int inl); 588e1051a39Sopenharmony_ci/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, 589e1051a39Sopenharmony_ci int *outl); 590e1051a39Sopenharmony_ci/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, 591e1051a39Sopenharmony_ci int *outl); 592e1051a39Sopenharmony_ci 593e1051a39Sopenharmony_ci__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, 594e1051a39Sopenharmony_ci const unsigned char *key, const unsigned char *iv); 595e1051a39Sopenharmony_ci/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, 596e1051a39Sopenharmony_ci const EVP_CIPHER *cipher, ENGINE *impl, 597e1051a39Sopenharmony_ci const unsigned char *key, 598e1051a39Sopenharmony_ci const unsigned char *iv); 599e1051a39Sopenharmony_ci/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 600e1051a39Sopenharmony_ci int *outl, const unsigned char *in, int inl); 601e1051a39Sopenharmony_ci__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, 602e1051a39Sopenharmony_ci int *outl); 603e1051a39Sopenharmony_ci/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, 604e1051a39Sopenharmony_ci int *outl); 605e1051a39Sopenharmony_ci 606e1051a39Sopenharmony_ci__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, 607e1051a39Sopenharmony_ci const unsigned char *key, const unsigned char *iv, 608e1051a39Sopenharmony_ci int enc); 609e1051a39Sopenharmony_ci/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, 610e1051a39Sopenharmony_ci const EVP_CIPHER *cipher, ENGINE *impl, 611e1051a39Sopenharmony_ci const unsigned char *key, 612e1051a39Sopenharmony_ci const unsigned char *iv, int enc); 613e1051a39Sopenharmony_ci__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 614e1051a39Sopenharmony_ci int *outl, const unsigned char *in, int inl); 615e1051a39Sopenharmony_ci__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, 616e1051a39Sopenharmony_ci int *outl); 617e1051a39Sopenharmony_ci__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, 618e1051a39Sopenharmony_ci int *outl); 619e1051a39Sopenharmony_ci 620e1051a39Sopenharmony_ci__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, 621e1051a39Sopenharmony_ci EVP_PKEY *pkey); 622e1051a39Sopenharmony_ci 623e1051a39Sopenharmony_ci__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, 624e1051a39Sopenharmony_ci size_t *siglen, const unsigned char *tbs, 625e1051a39Sopenharmony_ci size_t tbslen); 626e1051a39Sopenharmony_ci 627e1051a39Sopenharmony_ci__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, 628e1051a39Sopenharmony_ci unsigned int siglen, EVP_PKEY *pkey); 629e1051a39Sopenharmony_ci 630e1051a39Sopenharmony_ci__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, 631e1051a39Sopenharmony_ci size_t siglen, const unsigned char *tbs, 632e1051a39Sopenharmony_ci size_t tbslen); 633e1051a39Sopenharmony_ci 634e1051a39Sopenharmony_ci/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, 635e1051a39Sopenharmony_ci const EVP_MD *type, ENGINE *e, 636e1051a39Sopenharmony_ci EVP_PKEY *pkey); 637e1051a39Sopenharmony_ci__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, 638e1051a39Sopenharmony_ci size_t *siglen); 639e1051a39Sopenharmony_ci 640e1051a39Sopenharmony_ci__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, 641e1051a39Sopenharmony_ci const EVP_MD *type, ENGINE *e, 642e1051a39Sopenharmony_ci EVP_PKEY *pkey); 643e1051a39Sopenharmony_ci__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, 644e1051a39Sopenharmony_ci size_t siglen); 645e1051a39Sopenharmony_ci 646e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RSA 647e1051a39Sopenharmony_ci__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, 648e1051a39Sopenharmony_ci const unsigned char *ek, int ekl, 649e1051a39Sopenharmony_ci const unsigned char *iv, EVP_PKEY *priv); 650e1051a39Sopenharmony_ci__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 651e1051a39Sopenharmony_ci 652e1051a39Sopenharmony_ci__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, 653e1051a39Sopenharmony_ci unsigned char **ek, int *ekl, unsigned char *iv, 654e1051a39Sopenharmony_ci EVP_PKEY **pubk, int npubk); 655e1051a39Sopenharmony_ci__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 656e1051a39Sopenharmony_ci# endif 657e1051a39Sopenharmony_ci 658e1051a39Sopenharmony_ciEVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); 659e1051a39Sopenharmony_civoid EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); 660e1051a39Sopenharmony_ciint EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); 661e1051a39Sopenharmony_ciint EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); 662e1051a39Sopenharmony_civoid EVP_EncodeInit(EVP_ENCODE_CTX *ctx); 663e1051a39Sopenharmony_ciint EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 664e1051a39Sopenharmony_ci const unsigned char *in, int inl); 665e1051a39Sopenharmony_civoid EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); 666e1051a39Sopenharmony_ciint EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); 667e1051a39Sopenharmony_ci 668e1051a39Sopenharmony_civoid EVP_DecodeInit(EVP_ENCODE_CTX *ctx); 669e1051a39Sopenharmony_ciint EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 670e1051a39Sopenharmony_ci const unsigned char *in, int inl); 671e1051a39Sopenharmony_ciint EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned 672e1051a39Sopenharmony_ci char *out, int *outl); 673e1051a39Sopenharmony_ciint EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); 674e1051a39Sopenharmony_ci 675e1051a39Sopenharmony_ci# if OPENSSL_API_COMPAT < 0x10100000L 676e1051a39Sopenharmony_ci# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) 677e1051a39Sopenharmony_ci# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) 678e1051a39Sopenharmony_ci# endif 679e1051a39Sopenharmony_ciEVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); 680e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); 681e1051a39Sopenharmony_civoid EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); 682e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); 683e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); 684e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); 685e1051a39Sopenharmony_ciint EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); 686e1051a39Sopenharmony_ci 687e1051a39Sopenharmony_ciconst BIO_METHOD *BIO_f_md(void); 688e1051a39Sopenharmony_ciconst BIO_METHOD *BIO_f_base64(void); 689e1051a39Sopenharmony_ciconst BIO_METHOD *BIO_f_cipher(void); 690e1051a39Sopenharmony_ciconst BIO_METHOD *BIO_f_reliable(void); 691e1051a39Sopenharmony_ci__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, 692e1051a39Sopenharmony_ci const unsigned char *i, int enc); 693e1051a39Sopenharmony_ci 694e1051a39Sopenharmony_ciconst EVP_MD *EVP_md_null(void); 695e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_MD2 696e1051a39Sopenharmony_ciconst EVP_MD *EVP_md2(void); 697e1051a39Sopenharmony_ci# endif 698e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_MD4 699e1051a39Sopenharmony_ciconst EVP_MD *EVP_md4(void); 700e1051a39Sopenharmony_ci# endif 701e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_MD5 702e1051a39Sopenharmony_ciconst EVP_MD *EVP_md5(void); 703e1051a39Sopenharmony_ciconst EVP_MD *EVP_md5_sha1(void); 704e1051a39Sopenharmony_ci# endif 705e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_BLAKE2 706e1051a39Sopenharmony_ciconst EVP_MD *EVP_blake2b512(void); 707e1051a39Sopenharmony_ciconst EVP_MD *EVP_blake2s256(void); 708e1051a39Sopenharmony_ci# endif 709e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha1(void); 710e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha224(void); 711e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha256(void); 712e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha384(void); 713e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha512(void); 714e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha512_224(void); 715e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha512_256(void); 716e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha3_224(void); 717e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha3_256(void); 718e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha3_384(void); 719e1051a39Sopenharmony_ciconst EVP_MD *EVP_sha3_512(void); 720e1051a39Sopenharmony_ciconst EVP_MD *EVP_shake128(void); 721e1051a39Sopenharmony_ciconst EVP_MD *EVP_shake256(void); 722e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_MDC2 723e1051a39Sopenharmony_ciconst EVP_MD *EVP_mdc2(void); 724e1051a39Sopenharmony_ci# endif 725e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RMD160 726e1051a39Sopenharmony_ciconst EVP_MD *EVP_ripemd160(void); 727e1051a39Sopenharmony_ci# endif 728e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_WHIRLPOOL 729e1051a39Sopenharmony_ciconst EVP_MD *EVP_whirlpool(void); 730e1051a39Sopenharmony_ci# endif 731e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SM3 732e1051a39Sopenharmony_ciconst EVP_MD *EVP_sm3(void); 733e1051a39Sopenharmony_ci# endif 734e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ 735e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_DES 736e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ecb(void); 737e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede(void); 738e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3(void); 739e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede_ecb(void); 740e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_ecb(void); 741e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_cfb64(void); 742e1051a39Sopenharmony_ci# define EVP_des_cfb EVP_des_cfb64 743e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_cfb1(void); 744e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_cfb8(void); 745e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede_cfb64(void); 746e1051a39Sopenharmony_ci# define EVP_des_ede_cfb EVP_des_ede_cfb64 747e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_cfb64(void); 748e1051a39Sopenharmony_ci# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 749e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_cfb1(void); 750e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_cfb8(void); 751e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ofb(void); 752e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede_ofb(void); 753e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_ofb(void); 754e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_cbc(void); 755e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede_cbc(void); 756e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_cbc(void); 757e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_desx_cbc(void); 758e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_des_ede3_wrap(void); 759e1051a39Sopenharmony_ci/* 760e1051a39Sopenharmony_ci * This should now be supported through the dev_crypto ENGINE. But also, why 761e1051a39Sopenharmony_ci * are rc4 and md5 declarations made here inside a "NO_DES" precompiler 762e1051a39Sopenharmony_ci * branch? 763e1051a39Sopenharmony_ci */ 764e1051a39Sopenharmony_ci# endif 765e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RC4 766e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc4(void); 767e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc4_40(void); 768e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_MD5 769e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc4_hmac_md5(void); 770e1051a39Sopenharmony_ci# endif 771e1051a39Sopenharmony_ci# endif 772e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_IDEA 773e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_idea_ecb(void); 774e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_idea_cfb64(void); 775e1051a39Sopenharmony_ci# define EVP_idea_cfb EVP_idea_cfb64 776e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_idea_ofb(void); 777e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_idea_cbc(void); 778e1051a39Sopenharmony_ci# endif 779e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RC2 780e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc2_ecb(void); 781e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc2_cbc(void); 782e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc2_40_cbc(void); 783e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc2_64_cbc(void); 784e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc2_cfb64(void); 785e1051a39Sopenharmony_ci# define EVP_rc2_cfb EVP_rc2_cfb64 786e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc2_ofb(void); 787e1051a39Sopenharmony_ci# endif 788e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_BF 789e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_bf_ecb(void); 790e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_bf_cbc(void); 791e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_bf_cfb64(void); 792e1051a39Sopenharmony_ci# define EVP_bf_cfb EVP_bf_cfb64 793e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_bf_ofb(void); 794e1051a39Sopenharmony_ci# endif 795e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_CAST 796e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_cast5_ecb(void); 797e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_cast5_cbc(void); 798e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_cast5_cfb64(void); 799e1051a39Sopenharmony_ci# define EVP_cast5_cfb EVP_cast5_cfb64 800e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_cast5_ofb(void); 801e1051a39Sopenharmony_ci# endif 802e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RC5 803e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); 804e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); 805e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); 806e1051a39Sopenharmony_ci# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 807e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); 808e1051a39Sopenharmony_ci# endif 809e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_ecb(void); 810e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_cbc(void); 811e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_cfb1(void); 812e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_cfb8(void); 813e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_cfb128(void); 814e1051a39Sopenharmony_ci# define EVP_aes_128_cfb EVP_aes_128_cfb128 815e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_ofb(void); 816e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_ctr(void); 817e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_ccm(void); 818e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_gcm(void); 819e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_xts(void); 820e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_wrap(void); 821e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_wrap_pad(void); 822e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_OCB 823e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_ocb(void); 824e1051a39Sopenharmony_ci# endif 825e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_ecb(void); 826e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_cbc(void); 827e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_cfb1(void); 828e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_cfb8(void); 829e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_cfb128(void); 830e1051a39Sopenharmony_ci# define EVP_aes_192_cfb EVP_aes_192_cfb128 831e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_ofb(void); 832e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_ctr(void); 833e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_ccm(void); 834e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_gcm(void); 835e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_wrap(void); 836e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_wrap_pad(void); 837e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_OCB 838e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_192_ocb(void); 839e1051a39Sopenharmony_ci# endif 840e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_ecb(void); 841e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_cbc(void); 842e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_cfb1(void); 843e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_cfb8(void); 844e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_cfb128(void); 845e1051a39Sopenharmony_ci# define EVP_aes_256_cfb EVP_aes_256_cfb128 846e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_ofb(void); 847e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_ctr(void); 848e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_ccm(void); 849e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_gcm(void); 850e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_xts(void); 851e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_wrap(void); 852e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_wrap_pad(void); 853e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_OCB 854e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_ocb(void); 855e1051a39Sopenharmony_ci# endif 856e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); 857e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); 858e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); 859e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); 860e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_ARIA 861e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_ecb(void); 862e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_cbc(void); 863e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_cfb1(void); 864e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_cfb8(void); 865e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_cfb128(void); 866e1051a39Sopenharmony_ci# define EVP_aria_128_cfb EVP_aria_128_cfb128 867e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_ctr(void); 868e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_ofb(void); 869e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_gcm(void); 870e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_128_ccm(void); 871e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_ecb(void); 872e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_cbc(void); 873e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_cfb1(void); 874e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_cfb8(void); 875e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_cfb128(void); 876e1051a39Sopenharmony_ci# define EVP_aria_192_cfb EVP_aria_192_cfb128 877e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_ctr(void); 878e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_ofb(void); 879e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_gcm(void); 880e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_192_ccm(void); 881e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_ecb(void); 882e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_cbc(void); 883e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_cfb1(void); 884e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_cfb8(void); 885e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_cfb128(void); 886e1051a39Sopenharmony_ci# define EVP_aria_256_cfb EVP_aria_256_cfb128 887e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_ctr(void); 888e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_ofb(void); 889e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_gcm(void); 890e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_aria_256_ccm(void); 891e1051a39Sopenharmony_ci# endif 892e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_CAMELLIA 893e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_ecb(void); 894e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_cbc(void); 895e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_cfb1(void); 896e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_cfb8(void); 897e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_cfb128(void); 898e1051a39Sopenharmony_ci# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 899e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_ofb(void); 900e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_128_ctr(void); 901e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_ecb(void); 902e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_cbc(void); 903e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_cfb1(void); 904e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_cfb8(void); 905e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_cfb128(void); 906e1051a39Sopenharmony_ci# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 907e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_ofb(void); 908e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_192_ctr(void); 909e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_ecb(void); 910e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_cbc(void); 911e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_cfb1(void); 912e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_cfb8(void); 913e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_cfb128(void); 914e1051a39Sopenharmony_ci# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 915e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_ofb(void); 916e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_camellia_256_ctr(void); 917e1051a39Sopenharmony_ci# endif 918e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_CHACHA 919e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_chacha20(void); 920e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_POLY1305 921e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_chacha20_poly1305(void); 922e1051a39Sopenharmony_ci# endif 923e1051a39Sopenharmony_ci# endif 924e1051a39Sopenharmony_ci 925e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SEED 926e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_seed_ecb(void); 927e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_seed_cbc(void); 928e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_seed_cfb128(void); 929e1051a39Sopenharmony_ci# define EVP_seed_cfb EVP_seed_cfb128 930e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_seed_ofb(void); 931e1051a39Sopenharmony_ci# endif 932e1051a39Sopenharmony_ci 933e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SM4 934e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_sm4_ecb(void); 935e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_sm4_cbc(void); 936e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_sm4_cfb128(void); 937e1051a39Sopenharmony_ci# define EVP_sm4_cfb EVP_sm4_cfb128 938e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_sm4_ofb(void); 939e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_sm4_ctr(void); 940e1051a39Sopenharmony_ci# endif 941e1051a39Sopenharmony_ci 942e1051a39Sopenharmony_ci# if OPENSSL_API_COMPAT < 0x10100000L 943e1051a39Sopenharmony_ci# define OPENSSL_add_all_algorithms_conf() \ 944e1051a39Sopenharmony_ci OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ 945e1051a39Sopenharmony_ci | OPENSSL_INIT_ADD_ALL_DIGESTS \ 946e1051a39Sopenharmony_ci | OPENSSL_INIT_LOAD_CONFIG, NULL) 947e1051a39Sopenharmony_ci# define OPENSSL_add_all_algorithms_noconf() \ 948e1051a39Sopenharmony_ci OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ 949e1051a39Sopenharmony_ci | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) 950e1051a39Sopenharmony_ci 951e1051a39Sopenharmony_ci# ifdef OPENSSL_LOAD_CONF 952e1051a39Sopenharmony_ci# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() 953e1051a39Sopenharmony_ci# else 954e1051a39Sopenharmony_ci# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() 955e1051a39Sopenharmony_ci# endif 956e1051a39Sopenharmony_ci 957e1051a39Sopenharmony_ci# define OpenSSL_add_all_ciphers() \ 958e1051a39Sopenharmony_ci OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) 959e1051a39Sopenharmony_ci# define OpenSSL_add_all_digests() \ 960e1051a39Sopenharmony_ci OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) 961e1051a39Sopenharmony_ci 962e1051a39Sopenharmony_ci# define EVP_cleanup() while(0) continue 963e1051a39Sopenharmony_ci# endif 964e1051a39Sopenharmony_ci 965e1051a39Sopenharmony_ciint EVP_add_cipher(const EVP_CIPHER *cipher); 966e1051a39Sopenharmony_ciint EVP_add_digest(const EVP_MD *digest); 967e1051a39Sopenharmony_ci 968e1051a39Sopenharmony_ciconst EVP_CIPHER *EVP_get_cipherbyname(const char *name); 969e1051a39Sopenharmony_ciconst EVP_MD *EVP_get_digestbyname(const char *name); 970e1051a39Sopenharmony_ci 971e1051a39Sopenharmony_civoid EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, 972e1051a39Sopenharmony_ci const char *from, const char *to, void *x), 973e1051a39Sopenharmony_ci void *arg); 974e1051a39Sopenharmony_civoid EVP_CIPHER_do_all_sorted(void (*fn) 975e1051a39Sopenharmony_ci (const EVP_CIPHER *ciph, const char *from, 976e1051a39Sopenharmony_ci const char *to, void *x), void *arg); 977e1051a39Sopenharmony_ci 978e1051a39Sopenharmony_civoid EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, 979e1051a39Sopenharmony_ci const char *from, const char *to, void *x), 980e1051a39Sopenharmony_ci void *arg); 981e1051a39Sopenharmony_civoid EVP_MD_do_all_sorted(void (*fn) 982e1051a39Sopenharmony_ci (const EVP_MD *ciph, const char *from, 983e1051a39Sopenharmony_ci const char *to, void *x), void *arg); 984e1051a39Sopenharmony_ci 985e1051a39Sopenharmony_ciint EVP_PKEY_decrypt_old(unsigned char *dec_key, 986e1051a39Sopenharmony_ci const unsigned char *enc_key, int enc_key_len, 987e1051a39Sopenharmony_ci EVP_PKEY *private_key); 988e1051a39Sopenharmony_ciint EVP_PKEY_encrypt_old(unsigned char *enc_key, 989e1051a39Sopenharmony_ci const unsigned char *key, int key_len, 990e1051a39Sopenharmony_ci EVP_PKEY *pub_key); 991e1051a39Sopenharmony_ciint EVP_PKEY_type(int type); 992e1051a39Sopenharmony_ciint EVP_PKEY_id(const EVP_PKEY *pkey); 993e1051a39Sopenharmony_ciint EVP_PKEY_base_id(const EVP_PKEY *pkey); 994e1051a39Sopenharmony_ciint EVP_PKEY_bits(const EVP_PKEY *pkey); 995e1051a39Sopenharmony_ciint EVP_PKEY_security_bits(const EVP_PKEY *pkey); 996e1051a39Sopenharmony_ciint EVP_PKEY_size(const EVP_PKEY *pkey); 997e1051a39Sopenharmony_ciint EVP_PKEY_set_type(EVP_PKEY *pkey, int type); 998e1051a39Sopenharmony_ciint EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); 999e1051a39Sopenharmony_ciint EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); 1000e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_ENGINE 1001e1051a39Sopenharmony_ciint EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); 1002e1051a39Sopenharmony_ciENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); 1003e1051a39Sopenharmony_ci# endif 1004e1051a39Sopenharmony_ciint EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); 1005e1051a39Sopenharmony_civoid *EVP_PKEY_get0(const EVP_PKEY *pkey); 1006e1051a39Sopenharmony_ciconst unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); 1007e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_POLY1305 1008e1051a39Sopenharmony_ciconst unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); 1009e1051a39Sopenharmony_ci# endif 1010e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_SIPHASH 1011e1051a39Sopenharmony_ciconst unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); 1012e1051a39Sopenharmony_ci# endif 1013e1051a39Sopenharmony_ci 1014e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_RSA 1015e1051a39Sopenharmony_cistruct rsa_st; 1016e1051a39Sopenharmony_ciint EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); 1017e1051a39Sopenharmony_cistruct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); 1018e1051a39Sopenharmony_cistruct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); 1019e1051a39Sopenharmony_ci# endif 1020e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_DSA 1021e1051a39Sopenharmony_cistruct dsa_st; 1022e1051a39Sopenharmony_ciint EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); 1023e1051a39Sopenharmony_cistruct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); 1024e1051a39Sopenharmony_cistruct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); 1025e1051a39Sopenharmony_ci# endif 1026e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_DH 1027e1051a39Sopenharmony_cistruct dh_st; 1028e1051a39Sopenharmony_ciint EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); 1029e1051a39Sopenharmony_cistruct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); 1030e1051a39Sopenharmony_cistruct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); 1031e1051a39Sopenharmony_ci# endif 1032e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_EC 1033e1051a39Sopenharmony_cistruct ec_key_st; 1034e1051a39Sopenharmony_ciint EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); 1035e1051a39Sopenharmony_cistruct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); 1036e1051a39Sopenharmony_cistruct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); 1037e1051a39Sopenharmony_ci# endif 1038e1051a39Sopenharmony_ci 1039e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_new(void); 1040e1051a39Sopenharmony_ciint EVP_PKEY_up_ref(EVP_PKEY *pkey); 1041e1051a39Sopenharmony_civoid EVP_PKEY_free(EVP_PKEY *pkey); 1042e1051a39Sopenharmony_ci 1043e1051a39Sopenharmony_ciEVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, 1044e1051a39Sopenharmony_ci long length); 1045e1051a39Sopenharmony_ciint i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); 1046e1051a39Sopenharmony_ci 1047e1051a39Sopenharmony_ciEVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, 1048e1051a39Sopenharmony_ci long length); 1049e1051a39Sopenharmony_ciEVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, 1050e1051a39Sopenharmony_ci long length); 1051e1051a39Sopenharmony_ciint i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); 1052e1051a39Sopenharmony_ci 1053e1051a39Sopenharmony_ciint EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); 1054e1051a39Sopenharmony_ciint EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); 1055e1051a39Sopenharmony_ciint EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); 1056e1051a39Sopenharmony_ciint EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); 1057e1051a39Sopenharmony_ci 1058e1051a39Sopenharmony_ciint EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); 1059e1051a39Sopenharmony_ci 1060e1051a39Sopenharmony_ciint EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, 1061e1051a39Sopenharmony_ci int indent, ASN1_PCTX *pctx); 1062e1051a39Sopenharmony_ciint EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, 1063e1051a39Sopenharmony_ci int indent, ASN1_PCTX *pctx); 1064e1051a39Sopenharmony_ciint EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, 1065e1051a39Sopenharmony_ci int indent, ASN1_PCTX *pctx); 1066e1051a39Sopenharmony_ci 1067e1051a39Sopenharmony_ciint EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); 1068e1051a39Sopenharmony_ci 1069e1051a39Sopenharmony_ciint EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, 1070e1051a39Sopenharmony_ci const unsigned char *pt, size_t ptlen); 1071e1051a39Sopenharmony_cisize_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); 1072e1051a39Sopenharmony_ci 1073e1051a39Sopenharmony_ciint EVP_CIPHER_type(const EVP_CIPHER *ctx); 1074e1051a39Sopenharmony_ci 1075e1051a39Sopenharmony_ci/* calls methods */ 1076e1051a39Sopenharmony_ciint EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 1077e1051a39Sopenharmony_ciint EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 1078e1051a39Sopenharmony_ci 1079e1051a39Sopenharmony_ci/* These are used by EVP_CIPHER methods */ 1080e1051a39Sopenharmony_ciint EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 1081e1051a39Sopenharmony_ciint EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 1082e1051a39Sopenharmony_ci 1083e1051a39Sopenharmony_ci/* PKCS5 password based encryption */ 1084e1051a39Sopenharmony_ciint PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 1085e1051a39Sopenharmony_ci ASN1_TYPE *param, const EVP_CIPHER *cipher, 1086e1051a39Sopenharmony_ci const EVP_MD *md, int en_de); 1087e1051a39Sopenharmony_ciint PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, 1088e1051a39Sopenharmony_ci const unsigned char *salt, int saltlen, int iter, 1089e1051a39Sopenharmony_ci int keylen, unsigned char *out); 1090e1051a39Sopenharmony_ciint PKCS5_PBKDF2_HMAC(const char *pass, int passlen, 1091e1051a39Sopenharmony_ci const unsigned char *salt, int saltlen, int iter, 1092e1051a39Sopenharmony_ci const EVP_MD *digest, int keylen, unsigned char *out); 1093e1051a39Sopenharmony_ciint PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 1094e1051a39Sopenharmony_ci ASN1_TYPE *param, const EVP_CIPHER *cipher, 1095e1051a39Sopenharmony_ci const EVP_MD *md, int en_de); 1096e1051a39Sopenharmony_ci 1097e1051a39Sopenharmony_ci#ifndef OPENSSL_NO_SCRYPT 1098e1051a39Sopenharmony_ciint EVP_PBE_scrypt(const char *pass, size_t passlen, 1099e1051a39Sopenharmony_ci const unsigned char *salt, size_t saltlen, 1100e1051a39Sopenharmony_ci uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, 1101e1051a39Sopenharmony_ci unsigned char *key, size_t keylen); 1102e1051a39Sopenharmony_ci 1103e1051a39Sopenharmony_ciint PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, 1104e1051a39Sopenharmony_ci int passlen, ASN1_TYPE *param, 1105e1051a39Sopenharmony_ci const EVP_CIPHER *c, const EVP_MD *md, int en_de); 1106e1051a39Sopenharmony_ci#endif 1107e1051a39Sopenharmony_ci 1108e1051a39Sopenharmony_civoid PKCS5_PBE_add(void); 1109e1051a39Sopenharmony_ci 1110e1051a39Sopenharmony_ciint EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 1111e1051a39Sopenharmony_ci ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); 1112e1051a39Sopenharmony_ci 1113e1051a39Sopenharmony_ci/* PBE type */ 1114e1051a39Sopenharmony_ci 1115e1051a39Sopenharmony_ci/* Can appear as the outermost AlgorithmIdentifier */ 1116e1051a39Sopenharmony_ci# define EVP_PBE_TYPE_OUTER 0x0 1117e1051a39Sopenharmony_ci/* Is an PRF type OID */ 1118e1051a39Sopenharmony_ci# define EVP_PBE_TYPE_PRF 0x1 1119e1051a39Sopenharmony_ci/* Is a PKCS#5 v2.0 KDF */ 1120e1051a39Sopenharmony_ci# define EVP_PBE_TYPE_KDF 0x2 1121e1051a39Sopenharmony_ci 1122e1051a39Sopenharmony_ciint EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, 1123e1051a39Sopenharmony_ci int md_nid, EVP_PBE_KEYGEN *keygen); 1124e1051a39Sopenharmony_ciint EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, 1125e1051a39Sopenharmony_ci EVP_PBE_KEYGEN *keygen); 1126e1051a39Sopenharmony_ciint EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, 1127e1051a39Sopenharmony_ci EVP_PBE_KEYGEN **pkeygen); 1128e1051a39Sopenharmony_civoid EVP_PBE_cleanup(void); 1129e1051a39Sopenharmony_ciint EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); 1130e1051a39Sopenharmony_ci 1131e1051a39Sopenharmony_ci# define ASN1_PKEY_ALIAS 0x1 1132e1051a39Sopenharmony_ci# define ASN1_PKEY_DYNAMIC 0x2 1133e1051a39Sopenharmony_ci# define ASN1_PKEY_SIGPARAM_NULL 0x4 1134e1051a39Sopenharmony_ci 1135e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 1136e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 1137e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 1138e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 1139e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 1140e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 1141e1051a39Sopenharmony_ci 1142e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 1143e1051a39Sopenharmony_ci# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa 1144e1051a39Sopenharmony_ci 1145e1051a39Sopenharmony_ciint EVP_PKEY_asn1_get_count(void); 1146e1051a39Sopenharmony_ciconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); 1147e1051a39Sopenharmony_ciconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); 1148e1051a39Sopenharmony_ciconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, 1149e1051a39Sopenharmony_ci const char *str, int len); 1150e1051a39Sopenharmony_ciint EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); 1151e1051a39Sopenharmony_ciint EVP_PKEY_asn1_add_alias(int to, int from); 1152e1051a39Sopenharmony_ciint EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, 1153e1051a39Sopenharmony_ci int *ppkey_flags, const char **pinfo, 1154e1051a39Sopenharmony_ci const char **ppem_str, 1155e1051a39Sopenharmony_ci const EVP_PKEY_ASN1_METHOD *ameth); 1156e1051a39Sopenharmony_ci 1157e1051a39Sopenharmony_ciconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); 1158e1051a39Sopenharmony_ciEVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, 1159e1051a39Sopenharmony_ci const char *pem_str, 1160e1051a39Sopenharmony_ci const char *info); 1161e1051a39Sopenharmony_civoid EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, 1162e1051a39Sopenharmony_ci const EVP_PKEY_ASN1_METHOD *src); 1163e1051a39Sopenharmony_civoid EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); 1164e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, 1165e1051a39Sopenharmony_ci int (*pub_decode) (EVP_PKEY *pk, 1166e1051a39Sopenharmony_ci X509_PUBKEY *pub), 1167e1051a39Sopenharmony_ci int (*pub_encode) (X509_PUBKEY *pub, 1168e1051a39Sopenharmony_ci const EVP_PKEY *pk), 1169e1051a39Sopenharmony_ci int (*pub_cmp) (const EVP_PKEY *a, 1170e1051a39Sopenharmony_ci const EVP_PKEY *b), 1171e1051a39Sopenharmony_ci int (*pub_print) (BIO *out, 1172e1051a39Sopenharmony_ci const EVP_PKEY *pkey, 1173e1051a39Sopenharmony_ci int indent, ASN1_PCTX *pctx), 1174e1051a39Sopenharmony_ci int (*pkey_size) (const EVP_PKEY *pk), 1175e1051a39Sopenharmony_ci int (*pkey_bits) (const EVP_PKEY *pk)); 1176e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, 1177e1051a39Sopenharmony_ci int (*priv_decode) (EVP_PKEY *pk, 1178e1051a39Sopenharmony_ci const PKCS8_PRIV_KEY_INFO 1179e1051a39Sopenharmony_ci *p8inf), 1180e1051a39Sopenharmony_ci int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, 1181e1051a39Sopenharmony_ci const EVP_PKEY *pk), 1182e1051a39Sopenharmony_ci int (*priv_print) (BIO *out, 1183e1051a39Sopenharmony_ci const EVP_PKEY *pkey, 1184e1051a39Sopenharmony_ci int indent, 1185e1051a39Sopenharmony_ci ASN1_PCTX *pctx)); 1186e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, 1187e1051a39Sopenharmony_ci int (*param_decode) (EVP_PKEY *pkey, 1188e1051a39Sopenharmony_ci const unsigned char **pder, 1189e1051a39Sopenharmony_ci int derlen), 1190e1051a39Sopenharmony_ci int (*param_encode) (const EVP_PKEY *pkey, 1191e1051a39Sopenharmony_ci unsigned char **pder), 1192e1051a39Sopenharmony_ci int (*param_missing) (const EVP_PKEY *pk), 1193e1051a39Sopenharmony_ci int (*param_copy) (EVP_PKEY *to, 1194e1051a39Sopenharmony_ci const EVP_PKEY *from), 1195e1051a39Sopenharmony_ci int (*param_cmp) (const EVP_PKEY *a, 1196e1051a39Sopenharmony_ci const EVP_PKEY *b), 1197e1051a39Sopenharmony_ci int (*param_print) (BIO *out, 1198e1051a39Sopenharmony_ci const EVP_PKEY *pkey, 1199e1051a39Sopenharmony_ci int indent, 1200e1051a39Sopenharmony_ci ASN1_PCTX *pctx)); 1201e1051a39Sopenharmony_ci 1202e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, 1203e1051a39Sopenharmony_ci void (*pkey_free) (EVP_PKEY *pkey)); 1204e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, 1205e1051a39Sopenharmony_ci int (*pkey_ctrl) (EVP_PKEY *pkey, int op, 1206e1051a39Sopenharmony_ci long arg1, void *arg2)); 1207e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, 1208e1051a39Sopenharmony_ci int (*item_verify) (EVP_MD_CTX *ctx, 1209e1051a39Sopenharmony_ci const ASN1_ITEM *it, 1210e1051a39Sopenharmony_ci void *asn, 1211e1051a39Sopenharmony_ci X509_ALGOR *a, 1212e1051a39Sopenharmony_ci ASN1_BIT_STRING *sig, 1213e1051a39Sopenharmony_ci EVP_PKEY *pkey), 1214e1051a39Sopenharmony_ci int (*item_sign) (EVP_MD_CTX *ctx, 1215e1051a39Sopenharmony_ci const ASN1_ITEM *it, 1216e1051a39Sopenharmony_ci void *asn, 1217e1051a39Sopenharmony_ci X509_ALGOR *alg1, 1218e1051a39Sopenharmony_ci X509_ALGOR *alg2, 1219e1051a39Sopenharmony_ci ASN1_BIT_STRING *sig)); 1220e1051a39Sopenharmony_ci 1221e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, 1222e1051a39Sopenharmony_ci int (*siginf_set) (X509_SIG_INFO *siginf, 1223e1051a39Sopenharmony_ci const X509_ALGOR *alg, 1224e1051a39Sopenharmony_ci const ASN1_STRING *sig)); 1225e1051a39Sopenharmony_ci 1226e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, 1227e1051a39Sopenharmony_ci int (*pkey_check) (const EVP_PKEY *pk)); 1228e1051a39Sopenharmony_ci 1229e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, 1230e1051a39Sopenharmony_ci int (*pkey_pub_check) (const EVP_PKEY *pk)); 1231e1051a39Sopenharmony_ci 1232e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, 1233e1051a39Sopenharmony_ci int (*pkey_param_check) (const EVP_PKEY *pk)); 1234e1051a39Sopenharmony_ci 1235e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, 1236e1051a39Sopenharmony_ci int (*set_priv_key) (EVP_PKEY *pk, 1237e1051a39Sopenharmony_ci const unsigned char 1238e1051a39Sopenharmony_ci *priv, 1239e1051a39Sopenharmony_ci size_t len)); 1240e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, 1241e1051a39Sopenharmony_ci int (*set_pub_key) (EVP_PKEY *pk, 1242e1051a39Sopenharmony_ci const unsigned char *pub, 1243e1051a39Sopenharmony_ci size_t len)); 1244e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, 1245e1051a39Sopenharmony_ci int (*get_priv_key) (const EVP_PKEY *pk, 1246e1051a39Sopenharmony_ci unsigned char *priv, 1247e1051a39Sopenharmony_ci size_t *len)); 1248e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, 1249e1051a39Sopenharmony_ci int (*get_pub_key) (const EVP_PKEY *pk, 1250e1051a39Sopenharmony_ci unsigned char *pub, 1251e1051a39Sopenharmony_ci size_t *len)); 1252e1051a39Sopenharmony_ci 1253e1051a39Sopenharmony_civoid EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, 1254e1051a39Sopenharmony_ci int (*pkey_security_bits) (const EVP_PKEY 1255e1051a39Sopenharmony_ci *pk)); 1256e1051a39Sopenharmony_ci 1257e1051a39Sopenharmony_ci# define EVP_PKEY_OP_UNDEFINED 0 1258e1051a39Sopenharmony_ci# define EVP_PKEY_OP_PARAMGEN (1<<1) 1259e1051a39Sopenharmony_ci# define EVP_PKEY_OP_KEYGEN (1<<2) 1260e1051a39Sopenharmony_ci# define EVP_PKEY_OP_SIGN (1<<3) 1261e1051a39Sopenharmony_ci# define EVP_PKEY_OP_VERIFY (1<<4) 1262e1051a39Sopenharmony_ci# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) 1263e1051a39Sopenharmony_ci# define EVP_PKEY_OP_SIGNCTX (1<<6) 1264e1051a39Sopenharmony_ci# define EVP_PKEY_OP_VERIFYCTX (1<<7) 1265e1051a39Sopenharmony_ci# define EVP_PKEY_OP_ENCRYPT (1<<8) 1266e1051a39Sopenharmony_ci# define EVP_PKEY_OP_DECRYPT (1<<9) 1267e1051a39Sopenharmony_ci# define EVP_PKEY_OP_DERIVE (1<<10) 1268e1051a39Sopenharmony_ci 1269e1051a39Sopenharmony_ci# define EVP_PKEY_OP_TYPE_SIG \ 1270e1051a39Sopenharmony_ci (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ 1271e1051a39Sopenharmony_ci | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) 1272e1051a39Sopenharmony_ci 1273e1051a39Sopenharmony_ci# define EVP_PKEY_OP_TYPE_CRYPT \ 1274e1051a39Sopenharmony_ci (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) 1275e1051a39Sopenharmony_ci 1276e1051a39Sopenharmony_ci# define EVP_PKEY_OP_TYPE_NOGEN \ 1277e1051a39Sopenharmony_ci (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) 1278e1051a39Sopenharmony_ci 1279e1051a39Sopenharmony_ci# define EVP_PKEY_OP_TYPE_GEN \ 1280e1051a39Sopenharmony_ci (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) 1281e1051a39Sopenharmony_ci 1282e1051a39Sopenharmony_ci# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ 1283e1051a39Sopenharmony_ci EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ 1284e1051a39Sopenharmony_ci EVP_PKEY_CTRL_MD, 0, (void *)(md)) 1285e1051a39Sopenharmony_ci 1286e1051a39Sopenharmony_ci# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ 1287e1051a39Sopenharmony_ci EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ 1288e1051a39Sopenharmony_ci EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) 1289e1051a39Sopenharmony_ci 1290e1051a39Sopenharmony_ci# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ 1291e1051a39Sopenharmony_ci EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ 1292e1051a39Sopenharmony_ci EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) 1293e1051a39Sopenharmony_ci 1294e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_MD 1 1295e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_PEER_KEY 2 1296e1051a39Sopenharmony_ci 1297e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 1298e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 1299e1051a39Sopenharmony_ci 1300e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_PKCS7_SIGN 5 1301e1051a39Sopenharmony_ci 1302e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_SET_MAC_KEY 6 1303e1051a39Sopenharmony_ci 1304e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_DIGESTINIT 7 1305e1051a39Sopenharmony_ci 1306e1051a39Sopenharmony_ci/* Used by GOST key encryption in TLS */ 1307e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_SET_IV 8 1308e1051a39Sopenharmony_ci 1309e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 1310e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_CMS_DECRYPT 10 1311e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_CMS_SIGN 11 1312e1051a39Sopenharmony_ci 1313e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_CIPHER 12 1314e1051a39Sopenharmony_ci 1315e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_GET_MD 13 1316e1051a39Sopenharmony_ci 1317e1051a39Sopenharmony_ci# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 1318e1051a39Sopenharmony_ci 1319e1051a39Sopenharmony_ci# define EVP_PKEY_ALG_CTRL 0x1000 1320e1051a39Sopenharmony_ci 1321e1051a39Sopenharmony_ci# define EVP_PKEY_FLAG_AUTOARGLEN 2 1322e1051a39Sopenharmony_ci/* 1323e1051a39Sopenharmony_ci * Method handles all operations: don't assume any digest related defaults. 1324e1051a39Sopenharmony_ci */ 1325e1051a39Sopenharmony_ci# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 1326e1051a39Sopenharmony_ci 1327e1051a39Sopenharmony_ciconst EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); 1328e1051a39Sopenharmony_ciEVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); 1329e1051a39Sopenharmony_civoid EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, 1330e1051a39Sopenharmony_ci const EVP_PKEY_METHOD *meth); 1331e1051a39Sopenharmony_civoid EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); 1332e1051a39Sopenharmony_civoid EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); 1333e1051a39Sopenharmony_ciint EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); 1334e1051a39Sopenharmony_ciint EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); 1335e1051a39Sopenharmony_cisize_t EVP_PKEY_meth_get_count(void); 1336e1051a39Sopenharmony_ciconst EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); 1337e1051a39Sopenharmony_ci 1338e1051a39Sopenharmony_ciEVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); 1339e1051a39Sopenharmony_ciEVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); 1340e1051a39Sopenharmony_ciEVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); 1341e1051a39Sopenharmony_civoid EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); 1342e1051a39Sopenharmony_ci 1343e1051a39Sopenharmony_ciint EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, 1344e1051a39Sopenharmony_ci int cmd, int p1, void *p2); 1345e1051a39Sopenharmony_ciint EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, 1346e1051a39Sopenharmony_ci const char *value); 1347e1051a39Sopenharmony_ciint EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, 1348e1051a39Sopenharmony_ci int cmd, uint64_t value); 1349e1051a39Sopenharmony_ci 1350e1051a39Sopenharmony_ciint EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); 1351e1051a39Sopenharmony_ciint EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); 1352e1051a39Sopenharmony_ci 1353e1051a39Sopenharmony_ciint EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); 1354e1051a39Sopenharmony_ci 1355e1051a39Sopenharmony_ciint EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); 1356e1051a39Sopenharmony_civoid EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); 1357e1051a39Sopenharmony_ci 1358e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, 1359e1051a39Sopenharmony_ci const unsigned char *key, int keylen); 1360e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, 1361e1051a39Sopenharmony_ci const unsigned char *priv, 1362e1051a39Sopenharmony_ci size_t len); 1363e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, 1364e1051a39Sopenharmony_ci const unsigned char *pub, 1365e1051a39Sopenharmony_ci size_t len); 1366e1051a39Sopenharmony_ciint EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, 1367e1051a39Sopenharmony_ci size_t *len); 1368e1051a39Sopenharmony_ciint EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, 1369e1051a39Sopenharmony_ci size_t *len); 1370e1051a39Sopenharmony_ci 1371e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, 1372e1051a39Sopenharmony_ci size_t len, const EVP_CIPHER *cipher); 1373e1051a39Sopenharmony_ci 1374e1051a39Sopenharmony_civoid EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); 1375e1051a39Sopenharmony_civoid *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); 1376e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); 1377e1051a39Sopenharmony_ci 1378e1051a39Sopenharmony_ciEVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); 1379e1051a39Sopenharmony_ci 1380e1051a39Sopenharmony_civoid EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); 1381e1051a39Sopenharmony_civoid *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); 1382e1051a39Sopenharmony_ci 1383e1051a39Sopenharmony_ciint EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); 1384e1051a39Sopenharmony_ciint EVP_PKEY_sign(EVP_PKEY_CTX *ctx, 1385e1051a39Sopenharmony_ci unsigned char *sig, size_t *siglen, 1386e1051a39Sopenharmony_ci const unsigned char *tbs, size_t tbslen); 1387e1051a39Sopenharmony_ciint EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); 1388e1051a39Sopenharmony_ciint EVP_PKEY_verify(EVP_PKEY_CTX *ctx, 1389e1051a39Sopenharmony_ci const unsigned char *sig, size_t siglen, 1390e1051a39Sopenharmony_ci const unsigned char *tbs, size_t tbslen); 1391e1051a39Sopenharmony_ciint EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); 1392e1051a39Sopenharmony_ciint EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, 1393e1051a39Sopenharmony_ci unsigned char *rout, size_t *routlen, 1394e1051a39Sopenharmony_ci const unsigned char *sig, size_t siglen); 1395e1051a39Sopenharmony_ciint EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); 1396e1051a39Sopenharmony_ciint EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, 1397e1051a39Sopenharmony_ci unsigned char *out, size_t *outlen, 1398e1051a39Sopenharmony_ci const unsigned char *in, size_t inlen); 1399e1051a39Sopenharmony_ciint EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); 1400e1051a39Sopenharmony_ciint EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, 1401e1051a39Sopenharmony_ci unsigned char *out, size_t *outlen, 1402e1051a39Sopenharmony_ci const unsigned char *in, size_t inlen); 1403e1051a39Sopenharmony_ci 1404e1051a39Sopenharmony_ciint EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); 1405e1051a39Sopenharmony_ciint EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); 1406e1051a39Sopenharmony_ciint EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); 1407e1051a39Sopenharmony_ci 1408e1051a39Sopenharmony_citypedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); 1409e1051a39Sopenharmony_ci 1410e1051a39Sopenharmony_ciint EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); 1411e1051a39Sopenharmony_ciint EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); 1412e1051a39Sopenharmony_ciint EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); 1413e1051a39Sopenharmony_ciint EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); 1414e1051a39Sopenharmony_ciint EVP_PKEY_check(EVP_PKEY_CTX *ctx); 1415e1051a39Sopenharmony_ciint EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); 1416e1051a39Sopenharmony_ciint EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); 1417e1051a39Sopenharmony_ci 1418e1051a39Sopenharmony_civoid EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); 1419e1051a39Sopenharmony_ciEVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); 1420e1051a39Sopenharmony_ci 1421e1051a39Sopenharmony_ciint EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); 1422e1051a39Sopenharmony_ci 1423e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, 1424e1051a39Sopenharmony_ci int (*init) (EVP_PKEY_CTX *ctx)); 1425e1051a39Sopenharmony_ci 1426e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, 1427e1051a39Sopenharmony_ci int (*copy) (EVP_PKEY_CTX *dst, 1428e1051a39Sopenharmony_ci EVP_PKEY_CTX *src)); 1429e1051a39Sopenharmony_ci 1430e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, 1431e1051a39Sopenharmony_ci void (*cleanup) (EVP_PKEY_CTX *ctx)); 1432e1051a39Sopenharmony_ci 1433e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, 1434e1051a39Sopenharmony_ci int (*paramgen_init) (EVP_PKEY_CTX *ctx), 1435e1051a39Sopenharmony_ci int (*paramgen) (EVP_PKEY_CTX *ctx, 1436e1051a39Sopenharmony_ci EVP_PKEY *pkey)); 1437e1051a39Sopenharmony_ci 1438e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, 1439e1051a39Sopenharmony_ci int (*keygen_init) (EVP_PKEY_CTX *ctx), 1440e1051a39Sopenharmony_ci int (*keygen) (EVP_PKEY_CTX *ctx, 1441e1051a39Sopenharmony_ci EVP_PKEY *pkey)); 1442e1051a39Sopenharmony_ci 1443e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, 1444e1051a39Sopenharmony_ci int (*sign_init) (EVP_PKEY_CTX *ctx), 1445e1051a39Sopenharmony_ci int (*sign) (EVP_PKEY_CTX *ctx, 1446e1051a39Sopenharmony_ci unsigned char *sig, size_t *siglen, 1447e1051a39Sopenharmony_ci const unsigned char *tbs, 1448e1051a39Sopenharmony_ci size_t tbslen)); 1449e1051a39Sopenharmony_ci 1450e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, 1451e1051a39Sopenharmony_ci int (*verify_init) (EVP_PKEY_CTX *ctx), 1452e1051a39Sopenharmony_ci int (*verify) (EVP_PKEY_CTX *ctx, 1453e1051a39Sopenharmony_ci const unsigned char *sig, 1454e1051a39Sopenharmony_ci size_t siglen, 1455e1051a39Sopenharmony_ci const unsigned char *tbs, 1456e1051a39Sopenharmony_ci size_t tbslen)); 1457e1051a39Sopenharmony_ci 1458e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, 1459e1051a39Sopenharmony_ci int (*verify_recover_init) (EVP_PKEY_CTX 1460e1051a39Sopenharmony_ci *ctx), 1461e1051a39Sopenharmony_ci int (*verify_recover) (EVP_PKEY_CTX 1462e1051a39Sopenharmony_ci *ctx, 1463e1051a39Sopenharmony_ci unsigned char 1464e1051a39Sopenharmony_ci *sig, 1465e1051a39Sopenharmony_ci size_t *siglen, 1466e1051a39Sopenharmony_ci const unsigned 1467e1051a39Sopenharmony_ci char *tbs, 1468e1051a39Sopenharmony_ci size_t tbslen)); 1469e1051a39Sopenharmony_ci 1470e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, 1471e1051a39Sopenharmony_ci int (*signctx_init) (EVP_PKEY_CTX *ctx, 1472e1051a39Sopenharmony_ci EVP_MD_CTX *mctx), 1473e1051a39Sopenharmony_ci int (*signctx) (EVP_PKEY_CTX *ctx, 1474e1051a39Sopenharmony_ci unsigned char *sig, 1475e1051a39Sopenharmony_ci size_t *siglen, 1476e1051a39Sopenharmony_ci EVP_MD_CTX *mctx)); 1477e1051a39Sopenharmony_ci 1478e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, 1479e1051a39Sopenharmony_ci int (*verifyctx_init) (EVP_PKEY_CTX *ctx, 1480e1051a39Sopenharmony_ci EVP_MD_CTX *mctx), 1481e1051a39Sopenharmony_ci int (*verifyctx) (EVP_PKEY_CTX *ctx, 1482e1051a39Sopenharmony_ci const unsigned char *sig, 1483e1051a39Sopenharmony_ci int siglen, 1484e1051a39Sopenharmony_ci EVP_MD_CTX *mctx)); 1485e1051a39Sopenharmony_ci 1486e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, 1487e1051a39Sopenharmony_ci int (*encrypt_init) (EVP_PKEY_CTX *ctx), 1488e1051a39Sopenharmony_ci int (*encryptfn) (EVP_PKEY_CTX *ctx, 1489e1051a39Sopenharmony_ci unsigned char *out, 1490e1051a39Sopenharmony_ci size_t *outlen, 1491e1051a39Sopenharmony_ci const unsigned char *in, 1492e1051a39Sopenharmony_ci size_t inlen)); 1493e1051a39Sopenharmony_ci 1494e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, 1495e1051a39Sopenharmony_ci int (*decrypt_init) (EVP_PKEY_CTX *ctx), 1496e1051a39Sopenharmony_ci int (*decrypt) (EVP_PKEY_CTX *ctx, 1497e1051a39Sopenharmony_ci unsigned char *out, 1498e1051a39Sopenharmony_ci size_t *outlen, 1499e1051a39Sopenharmony_ci const unsigned char *in, 1500e1051a39Sopenharmony_ci size_t inlen)); 1501e1051a39Sopenharmony_ci 1502e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, 1503e1051a39Sopenharmony_ci int (*derive_init) (EVP_PKEY_CTX *ctx), 1504e1051a39Sopenharmony_ci int (*derive) (EVP_PKEY_CTX *ctx, 1505e1051a39Sopenharmony_ci unsigned char *key, 1506e1051a39Sopenharmony_ci size_t *keylen)); 1507e1051a39Sopenharmony_ci 1508e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, 1509e1051a39Sopenharmony_ci int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, 1510e1051a39Sopenharmony_ci void *p2), 1511e1051a39Sopenharmony_ci int (*ctrl_str) (EVP_PKEY_CTX *ctx, 1512e1051a39Sopenharmony_ci const char *type, 1513e1051a39Sopenharmony_ci const char *value)); 1514e1051a39Sopenharmony_ci 1515e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, 1516e1051a39Sopenharmony_ci int (*digestsign) (EVP_MD_CTX *ctx, 1517e1051a39Sopenharmony_ci unsigned char *sig, 1518e1051a39Sopenharmony_ci size_t *siglen, 1519e1051a39Sopenharmony_ci const unsigned char *tbs, 1520e1051a39Sopenharmony_ci size_t tbslen)); 1521e1051a39Sopenharmony_ci 1522e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, 1523e1051a39Sopenharmony_ci int (*digestverify) (EVP_MD_CTX *ctx, 1524e1051a39Sopenharmony_ci const unsigned char *sig, 1525e1051a39Sopenharmony_ci size_t siglen, 1526e1051a39Sopenharmony_ci const unsigned char *tbs, 1527e1051a39Sopenharmony_ci size_t tbslen)); 1528e1051a39Sopenharmony_ci 1529e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, 1530e1051a39Sopenharmony_ci int (*check) (EVP_PKEY *pkey)); 1531e1051a39Sopenharmony_ci 1532e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, 1533e1051a39Sopenharmony_ci int (*check) (EVP_PKEY *pkey)); 1534e1051a39Sopenharmony_ci 1535e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, 1536e1051a39Sopenharmony_ci int (*check) (EVP_PKEY *pkey)); 1537e1051a39Sopenharmony_ci 1538e1051a39Sopenharmony_civoid EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, 1539e1051a39Sopenharmony_ci int (*digest_custom) (EVP_PKEY_CTX *ctx, 1540e1051a39Sopenharmony_ci EVP_MD_CTX *mctx)); 1541e1051a39Sopenharmony_ci 1542e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, 1543e1051a39Sopenharmony_ci int (**pinit) (EVP_PKEY_CTX *ctx)); 1544e1051a39Sopenharmony_ci 1545e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, 1546e1051a39Sopenharmony_ci int (**pcopy) (EVP_PKEY_CTX *dst, 1547e1051a39Sopenharmony_ci EVP_PKEY_CTX *src)); 1548e1051a39Sopenharmony_ci 1549e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, 1550e1051a39Sopenharmony_ci void (**pcleanup) (EVP_PKEY_CTX *ctx)); 1551e1051a39Sopenharmony_ci 1552e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, 1553e1051a39Sopenharmony_ci int (**pparamgen_init) (EVP_PKEY_CTX *ctx), 1554e1051a39Sopenharmony_ci int (**pparamgen) (EVP_PKEY_CTX *ctx, 1555e1051a39Sopenharmony_ci EVP_PKEY *pkey)); 1556e1051a39Sopenharmony_ci 1557e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, 1558e1051a39Sopenharmony_ci int (**pkeygen_init) (EVP_PKEY_CTX *ctx), 1559e1051a39Sopenharmony_ci int (**pkeygen) (EVP_PKEY_CTX *ctx, 1560e1051a39Sopenharmony_ci EVP_PKEY *pkey)); 1561e1051a39Sopenharmony_ci 1562e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, 1563e1051a39Sopenharmony_ci int (**psign_init) (EVP_PKEY_CTX *ctx), 1564e1051a39Sopenharmony_ci int (**psign) (EVP_PKEY_CTX *ctx, 1565e1051a39Sopenharmony_ci unsigned char *sig, size_t *siglen, 1566e1051a39Sopenharmony_ci const unsigned char *tbs, 1567e1051a39Sopenharmony_ci size_t tbslen)); 1568e1051a39Sopenharmony_ci 1569e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, 1570e1051a39Sopenharmony_ci int (**pverify_init) (EVP_PKEY_CTX *ctx), 1571e1051a39Sopenharmony_ci int (**pverify) (EVP_PKEY_CTX *ctx, 1572e1051a39Sopenharmony_ci const unsigned char *sig, 1573e1051a39Sopenharmony_ci size_t siglen, 1574e1051a39Sopenharmony_ci const unsigned char *tbs, 1575e1051a39Sopenharmony_ci size_t tbslen)); 1576e1051a39Sopenharmony_ci 1577e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, 1578e1051a39Sopenharmony_ci int (**pverify_recover_init) (EVP_PKEY_CTX 1579e1051a39Sopenharmony_ci *ctx), 1580e1051a39Sopenharmony_ci int (**pverify_recover) (EVP_PKEY_CTX 1581e1051a39Sopenharmony_ci *ctx, 1582e1051a39Sopenharmony_ci unsigned char 1583e1051a39Sopenharmony_ci *sig, 1584e1051a39Sopenharmony_ci size_t *siglen, 1585e1051a39Sopenharmony_ci const unsigned 1586e1051a39Sopenharmony_ci char *tbs, 1587e1051a39Sopenharmony_ci size_t tbslen)); 1588e1051a39Sopenharmony_ci 1589e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, 1590e1051a39Sopenharmony_ci int (**psignctx_init) (EVP_PKEY_CTX *ctx, 1591e1051a39Sopenharmony_ci EVP_MD_CTX *mctx), 1592e1051a39Sopenharmony_ci int (**psignctx) (EVP_PKEY_CTX *ctx, 1593e1051a39Sopenharmony_ci unsigned char *sig, 1594e1051a39Sopenharmony_ci size_t *siglen, 1595e1051a39Sopenharmony_ci EVP_MD_CTX *mctx)); 1596e1051a39Sopenharmony_ci 1597e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, 1598e1051a39Sopenharmony_ci int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, 1599e1051a39Sopenharmony_ci EVP_MD_CTX *mctx), 1600e1051a39Sopenharmony_ci int (**pverifyctx) (EVP_PKEY_CTX *ctx, 1601e1051a39Sopenharmony_ci const unsigned char *sig, 1602e1051a39Sopenharmony_ci int siglen, 1603e1051a39Sopenharmony_ci EVP_MD_CTX *mctx)); 1604e1051a39Sopenharmony_ci 1605e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, 1606e1051a39Sopenharmony_ci int (**pencrypt_init) (EVP_PKEY_CTX *ctx), 1607e1051a39Sopenharmony_ci int (**pencryptfn) (EVP_PKEY_CTX *ctx, 1608e1051a39Sopenharmony_ci unsigned char *out, 1609e1051a39Sopenharmony_ci size_t *outlen, 1610e1051a39Sopenharmony_ci const unsigned char *in, 1611e1051a39Sopenharmony_ci size_t inlen)); 1612e1051a39Sopenharmony_ci 1613e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, 1614e1051a39Sopenharmony_ci int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), 1615e1051a39Sopenharmony_ci int (**pdecrypt) (EVP_PKEY_CTX *ctx, 1616e1051a39Sopenharmony_ci unsigned char *out, 1617e1051a39Sopenharmony_ci size_t *outlen, 1618e1051a39Sopenharmony_ci const unsigned char *in, 1619e1051a39Sopenharmony_ci size_t inlen)); 1620e1051a39Sopenharmony_ci 1621e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, 1622e1051a39Sopenharmony_ci int (**pderive_init) (EVP_PKEY_CTX *ctx), 1623e1051a39Sopenharmony_ci int (**pderive) (EVP_PKEY_CTX *ctx, 1624e1051a39Sopenharmony_ci unsigned char *key, 1625e1051a39Sopenharmony_ci size_t *keylen)); 1626e1051a39Sopenharmony_ci 1627e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, 1628e1051a39Sopenharmony_ci int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, 1629e1051a39Sopenharmony_ci void *p2), 1630e1051a39Sopenharmony_ci int (**pctrl_str) (EVP_PKEY_CTX *ctx, 1631e1051a39Sopenharmony_ci const char *type, 1632e1051a39Sopenharmony_ci const char *value)); 1633e1051a39Sopenharmony_ci 1634e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, 1635e1051a39Sopenharmony_ci int (**digestsign) (EVP_MD_CTX *ctx, 1636e1051a39Sopenharmony_ci unsigned char *sig, 1637e1051a39Sopenharmony_ci size_t *siglen, 1638e1051a39Sopenharmony_ci const unsigned char *tbs, 1639e1051a39Sopenharmony_ci size_t tbslen)); 1640e1051a39Sopenharmony_ci 1641e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, 1642e1051a39Sopenharmony_ci int (**digestverify) (EVP_MD_CTX *ctx, 1643e1051a39Sopenharmony_ci const unsigned char *sig, 1644e1051a39Sopenharmony_ci size_t siglen, 1645e1051a39Sopenharmony_ci const unsigned char *tbs, 1646e1051a39Sopenharmony_ci size_t tbslen)); 1647e1051a39Sopenharmony_ci 1648e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, 1649e1051a39Sopenharmony_ci int (**pcheck) (EVP_PKEY *pkey)); 1650e1051a39Sopenharmony_ci 1651e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, 1652e1051a39Sopenharmony_ci int (**pcheck) (EVP_PKEY *pkey)); 1653e1051a39Sopenharmony_ci 1654e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, 1655e1051a39Sopenharmony_ci int (**pcheck) (EVP_PKEY *pkey)); 1656e1051a39Sopenharmony_ci 1657e1051a39Sopenharmony_civoid EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, 1658e1051a39Sopenharmony_ci int (**pdigest_custom) (EVP_PKEY_CTX *ctx, 1659e1051a39Sopenharmony_ci EVP_MD_CTX *mctx)); 1660e1051a39Sopenharmony_civoid EVP_add_alg_module(void); 1661e1051a39Sopenharmony_ci 1662e1051a39Sopenharmony_ci 1663e1051a39Sopenharmony_ci# ifdef __cplusplus 1664e1051a39Sopenharmony_ci} 1665e1051a39Sopenharmony_ci# endif 1666e1051a39Sopenharmony_ci#endif 1667