10Sstevel@tonic-gate /* crypto/evp/evp.h */ 20Sstevel@tonic-gate /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 30Sstevel@tonic-gate * All rights reserved. 40Sstevel@tonic-gate * 50Sstevel@tonic-gate * This package is an SSL implementation written 60Sstevel@tonic-gate * by Eric Young (eay@cryptsoft.com). 70Sstevel@tonic-gate * The implementation was written so as to conform with Netscapes SSL. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * This library is free for commercial and non-commercial use as long as 100Sstevel@tonic-gate * the following conditions are aheared to. The following conditions 110Sstevel@tonic-gate * apply to all code found in this distribution, be it the RC4, RSA, 120Sstevel@tonic-gate * lhash, DES, etc., code; not just the SSL code. The SSL documentation 130Sstevel@tonic-gate * included with this distribution is covered by the same copyright terms 140Sstevel@tonic-gate * except that the holder is Tim Hudson (tjh@cryptsoft.com). 150Sstevel@tonic-gate * 160Sstevel@tonic-gate * Copyright remains Eric Young's, and as such any Copyright notices in 170Sstevel@tonic-gate * the code are not to be removed. 180Sstevel@tonic-gate * If this package is used in a product, Eric Young should be given attribution 190Sstevel@tonic-gate * as the author of the parts of the library used. 200Sstevel@tonic-gate * This can be in the form of a textual message at program startup or 210Sstevel@tonic-gate * in documentation (online or textual) provided with the package. 220Sstevel@tonic-gate * 230Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 240Sstevel@tonic-gate * modification, are permitted provided that the following conditions 250Sstevel@tonic-gate * are met: 260Sstevel@tonic-gate * 1. Redistributions of source code must retain the copyright 270Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 280Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 290Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 300Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 310Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this software 320Sstevel@tonic-gate * must display the following acknowledgement: 330Sstevel@tonic-gate * "This product includes cryptographic software written by 340Sstevel@tonic-gate * Eric Young (eay@cryptsoft.com)" 350Sstevel@tonic-gate * The word 'cryptographic' can be left out if the rouines from the library 360Sstevel@tonic-gate * being used are not cryptographic related :-). 370Sstevel@tonic-gate * 4. If you include any Windows specific code (or a derivative thereof) from 380Sstevel@tonic-gate * the apps directory (application code) you must include an acknowledgement: 390Sstevel@tonic-gate * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 400Sstevel@tonic-gate * 410Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 420Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 430Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 440Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 450Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 460Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 470Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 480Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 490Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 500Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 510Sstevel@tonic-gate * SUCH DAMAGE. 520Sstevel@tonic-gate * 530Sstevel@tonic-gate * The licence and distribution terms for any publically available version or 540Sstevel@tonic-gate * derivative of this code cannot be changed. i.e. this code cannot simply be 550Sstevel@tonic-gate * copied and put under another distribution licence 560Sstevel@tonic-gate * [including the GNU Public Licence.] 570Sstevel@tonic-gate */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate #ifndef HEADER_ENVELOPE_H 600Sstevel@tonic-gate #define HEADER_ENVELOPE_H 610Sstevel@tonic-gate 620Sstevel@tonic-gate #ifdef OPENSSL_ALGORITHM_DEFINES 630Sstevel@tonic-gate # include <openssl/opensslconf.h> 640Sstevel@tonic-gate #else 650Sstevel@tonic-gate # define OPENSSL_ALGORITHM_DEFINES 660Sstevel@tonic-gate # include <openssl/opensslconf.h> 670Sstevel@tonic-gate # undef OPENSSL_ALGORITHM_DEFINES 680Sstevel@tonic-gate #endif 690Sstevel@tonic-gate 700Sstevel@tonic-gate #include <openssl/ossl_typ.h> 710Sstevel@tonic-gate 720Sstevel@tonic-gate #include <openssl/symhacks.h> 730Sstevel@tonic-gate 740Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO 750Sstevel@tonic-gate #include <openssl/bio.h> 760Sstevel@tonic-gate #endif 770Sstevel@tonic-gate 780Sstevel@tonic-gate /* 790Sstevel@tonic-gate #define EVP_RC2_KEY_SIZE 16 800Sstevel@tonic-gate #define EVP_RC4_KEY_SIZE 16 810Sstevel@tonic-gate #define EVP_BLOWFISH_KEY_SIZE 16 820Sstevel@tonic-gate #define EVP_CAST5_KEY_SIZE 16 830Sstevel@tonic-gate #define EVP_RC5_32_12_16_KEY_SIZE 16 840Sstevel@tonic-gate */ 85*2139Sjp161948 #define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ 860Sstevel@tonic-gate #define EVP_MAX_KEY_LENGTH 32 870Sstevel@tonic-gate #define EVP_MAX_IV_LENGTH 16 880Sstevel@tonic-gate #define EVP_MAX_BLOCK_LENGTH 32 890Sstevel@tonic-gate 900Sstevel@tonic-gate #define PKCS5_SALT_LEN 8 910Sstevel@tonic-gate /* Default PKCS#5 iteration count */ 920Sstevel@tonic-gate #define PKCS5_DEFAULT_ITER 2048 930Sstevel@tonic-gate 940Sstevel@tonic-gate #include <openssl/objects.h> 950Sstevel@tonic-gate 960Sstevel@tonic-gate #define EVP_PK_RSA 0x0001 970Sstevel@tonic-gate #define EVP_PK_DSA 0x0002 980Sstevel@tonic-gate #define EVP_PK_DH 0x0004 99*2139Sjp161948 #define EVP_PK_EC 0x0008 1000Sstevel@tonic-gate #define EVP_PKT_SIGN 0x0010 1010Sstevel@tonic-gate #define EVP_PKT_ENC 0x0020 1020Sstevel@tonic-gate #define EVP_PKT_EXCH 0x0040 1030Sstevel@tonic-gate #define EVP_PKS_RSA 0x0100 1040Sstevel@tonic-gate #define EVP_PKS_DSA 0x0200 105*2139Sjp161948 #define EVP_PKS_EC 0x0400 1060Sstevel@tonic-gate #define EVP_PKT_EXP 0x1000 /* <= 512 bit key */ 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #define EVP_PKEY_NONE NID_undef 1090Sstevel@tonic-gate #define EVP_PKEY_RSA NID_rsaEncryption 1100Sstevel@tonic-gate #define EVP_PKEY_RSA2 NID_rsa 1110Sstevel@tonic-gate #define EVP_PKEY_DSA NID_dsa 1120Sstevel@tonic-gate #define EVP_PKEY_DSA1 NID_dsa_2 1130Sstevel@tonic-gate #define EVP_PKEY_DSA2 NID_dsaWithSHA 1140Sstevel@tonic-gate #define EVP_PKEY_DSA3 NID_dsaWithSHA1 1150Sstevel@tonic-gate #define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 1160Sstevel@tonic-gate #define EVP_PKEY_DH NID_dhKeyAgreement 117*2139Sjp161948 #define EVP_PKEY_EC NID_X9_62_id_ecPublicKey 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate #ifdef __cplusplus 1200Sstevel@tonic-gate extern "C" { 1210Sstevel@tonic-gate #endif 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate /* Type needs to be a bit field 1240Sstevel@tonic-gate * Sub-type needs to be for variations on the method, as in, can it do 1250Sstevel@tonic-gate * arbitrary encryption.... */ 1260Sstevel@tonic-gate struct evp_pkey_st 1270Sstevel@tonic-gate { 1280Sstevel@tonic-gate int type; 1290Sstevel@tonic-gate int save_type; 1300Sstevel@tonic-gate int references; 1310Sstevel@tonic-gate union { 1320Sstevel@tonic-gate char *ptr; 1330Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA 1340Sstevel@tonic-gate struct rsa_st *rsa; /* RSA */ 1350Sstevel@tonic-gate #endif 1360Sstevel@tonic-gate #ifndef OPENSSL_NO_DSA 1370Sstevel@tonic-gate struct dsa_st *dsa; /* DSA */ 1380Sstevel@tonic-gate #endif 1390Sstevel@tonic-gate #ifndef OPENSSL_NO_DH 1400Sstevel@tonic-gate struct dh_st *dh; /* DH */ 1410Sstevel@tonic-gate #endif 142*2139Sjp161948 #ifndef OPENSSL_NO_EC 143*2139Sjp161948 struct ec_key_st *ec; /* ECC */ 144*2139Sjp161948 #endif 1450Sstevel@tonic-gate } pkey; 1460Sstevel@tonic-gate int save_parameters; 1470Sstevel@tonic-gate STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ 1480Sstevel@tonic-gate } /* EVP_PKEY */; 1490Sstevel@tonic-gate 1500Sstevel@tonic-gate #define EVP_PKEY_MO_SIGN 0x0001 1510Sstevel@tonic-gate #define EVP_PKEY_MO_VERIFY 0x0002 1520Sstevel@tonic-gate #define EVP_PKEY_MO_ENCRYPT 0x0004 1530Sstevel@tonic-gate #define EVP_PKEY_MO_DECRYPT 0x0008 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate #if 0 1560Sstevel@tonic-gate /* This structure is required to tie the message digest and signing together. 1570Sstevel@tonic-gate * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or 1580Sstevel@tonic-gate * oid, md and pkey. 1590Sstevel@tonic-gate * This is required because for various smart-card perform the digest and 1600Sstevel@tonic-gate * signing/verification on-board. To handle this case, the specific 1610Sstevel@tonic-gate * EVP_MD and EVP_PKEY_METHODs need to be closely associated. 1620Sstevel@tonic-gate * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. 1630Sstevel@tonic-gate * This can either be software or a token to provide the required low level 1640Sstevel@tonic-gate * routines. 1650Sstevel@tonic-gate */ 1660Sstevel@tonic-gate typedef struct evp_pkey_md_st 1670Sstevel@tonic-gate { 1680Sstevel@tonic-gate int oid; 1690Sstevel@tonic-gate EVP_MD *md; 1700Sstevel@tonic-gate EVP_PKEY_METHOD *pkey; 1710Sstevel@tonic-gate } EVP_PKEY_MD; 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate #define EVP_rsa_md2() \ 1740Sstevel@tonic-gate EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ 1750Sstevel@tonic-gate EVP_rsa_pkcs1(),EVP_md2()) 1760Sstevel@tonic-gate #define EVP_rsa_md5() \ 1770Sstevel@tonic-gate EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ 1780Sstevel@tonic-gate EVP_rsa_pkcs1(),EVP_md5()) 1790Sstevel@tonic-gate #define EVP_rsa_sha0() \ 1800Sstevel@tonic-gate EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ 1810Sstevel@tonic-gate EVP_rsa_pkcs1(),EVP_sha()) 1820Sstevel@tonic-gate #define EVP_rsa_sha1() \ 1830Sstevel@tonic-gate EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ 1840Sstevel@tonic-gate EVP_rsa_pkcs1(),EVP_sha1()) 1850Sstevel@tonic-gate #define EVP_rsa_ripemd160() \ 1860Sstevel@tonic-gate EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ 1870Sstevel@tonic-gate EVP_rsa_pkcs1(),EVP_ripemd160()) 1880Sstevel@tonic-gate #define EVP_rsa_mdc2() \ 1890Sstevel@tonic-gate EVP_PKEY_MD_add(NID_mdc2WithRSA,\ 1900Sstevel@tonic-gate EVP_rsa_octet_string(),EVP_mdc2()) 1910Sstevel@tonic-gate #define EVP_dsa_sha() \ 1920Sstevel@tonic-gate EVP_PKEY_MD_add(NID_dsaWithSHA,\ 1930Sstevel@tonic-gate EVP_dsa(),EVP_sha()) 1940Sstevel@tonic-gate #define EVP_dsa_sha1() \ 1950Sstevel@tonic-gate EVP_PKEY_MD_add(NID_dsaWithSHA1,\ 1960Sstevel@tonic-gate EVP_dsa(),EVP_sha1()) 1970Sstevel@tonic-gate 1980Sstevel@tonic-gate typedef struct evp_pkey_method_st 1990Sstevel@tonic-gate { 2000Sstevel@tonic-gate char *name; 2010Sstevel@tonic-gate int flags; 2020Sstevel@tonic-gate int type; /* RSA, DSA, an SSLeay specific constant */ 2030Sstevel@tonic-gate int oid; /* For the pub-key type */ 2040Sstevel@tonic-gate int encrypt_oid; /* pub/priv key encryption */ 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate int (*sign)(); 2070Sstevel@tonic-gate int (*verify)(); 2080Sstevel@tonic-gate struct { 2090Sstevel@tonic-gate int (*set)(); /* get and/or set the underlying type */ 2100Sstevel@tonic-gate int (*get)(); 2110Sstevel@tonic-gate int (*encrypt)(); 2120Sstevel@tonic-gate int (*decrypt)(); 2130Sstevel@tonic-gate int (*i2d)(); 2140Sstevel@tonic-gate int (*d2i)(); 2150Sstevel@tonic-gate int (*dup)(); 2160Sstevel@tonic-gate } pub,priv; 2170Sstevel@tonic-gate int (*set_asn1_parameters)(); 2180Sstevel@tonic-gate int (*get_asn1_parameters)(); 2190Sstevel@tonic-gate } EVP_PKEY_METHOD; 2200Sstevel@tonic-gate #endif 2210Sstevel@tonic-gate 2220Sstevel@tonic-gate #ifndef EVP_MD 2230Sstevel@tonic-gate struct env_md_st 2240Sstevel@tonic-gate { 2250Sstevel@tonic-gate int type; 2260Sstevel@tonic-gate int pkey_type; 2270Sstevel@tonic-gate int md_size; 2280Sstevel@tonic-gate unsigned long flags; 2290Sstevel@tonic-gate int (*init)(EVP_MD_CTX *ctx); 230*2139Sjp161948 int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); 2310Sstevel@tonic-gate int (*final)(EVP_MD_CTX *ctx,unsigned char *md); 2320Sstevel@tonic-gate int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from); 2330Sstevel@tonic-gate int (*cleanup)(EVP_MD_CTX *ctx); 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate /* FIXME: prototype these some day */ 236*2139Sjp161948 int (*sign)(int type, const unsigned char *m, unsigned int m_length, 237*2139Sjp161948 unsigned char *sigret, unsigned int *siglen, void *key); 238*2139Sjp161948 int (*verify)(int type, const unsigned char *m, unsigned int m_length, 239*2139Sjp161948 const unsigned char *sigbuf, unsigned int siglen, 240*2139Sjp161948 void *key); 2410Sstevel@tonic-gate int required_pkey_type[5]; /*EVP_PKEY_xxx */ 2420Sstevel@tonic-gate int block_size; 2430Sstevel@tonic-gate int ctx_size; /* how big does the ctx->md_data need to be */ 2440Sstevel@tonic-gate } /* EVP_MD */; 2450Sstevel@tonic-gate 246*2139Sjp161948 typedef int evp_sign_method(int type,const unsigned char *m, 247*2139Sjp161948 unsigned int m_length,unsigned char *sigret, 248*2139Sjp161948 unsigned int *siglen, void *key); 249*2139Sjp161948 typedef int evp_verify_method(int type,const unsigned char *m, 250*2139Sjp161948 unsigned int m_length,const unsigned char *sigbuf, 251*2139Sjp161948 unsigned int siglen, void *key); 252*2139Sjp161948 2530Sstevel@tonic-gate #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single 2540Sstevel@tonic-gate * block */ 2550Sstevel@tonic-gate 2560Sstevel@tonic-gate #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate #ifndef OPENSSL_NO_DSA 259*2139Sjp161948 #define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \ 260*2139Sjp161948 (evp_verify_method *)DSA_verify, \ 2610Sstevel@tonic-gate {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \ 2620Sstevel@tonic-gate EVP_PKEY_DSA4,0} 2630Sstevel@tonic-gate #else 2640Sstevel@tonic-gate #define EVP_PKEY_DSA_method EVP_PKEY_NULL_method 2650Sstevel@tonic-gate #endif 2660Sstevel@tonic-gate 267*2139Sjp161948 #ifndef OPENSSL_NO_ECDSA 268*2139Sjp161948 #define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ 269*2139Sjp161948 (evp_verify_method *)ECDSA_verify, \ 270*2139Sjp161948 {EVP_PKEY_EC,0,0,0} 271*2139Sjp161948 #else 272*2139Sjp161948 #define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method 273*2139Sjp161948 #endif 274*2139Sjp161948 2750Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA 276*2139Sjp161948 #define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \ 277*2139Sjp161948 (evp_verify_method *)RSA_verify, \ 2780Sstevel@tonic-gate {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} 2790Sstevel@tonic-gate #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ 280*2139Sjp161948 (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \ 281*2139Sjp161948 (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \ 2820Sstevel@tonic-gate {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} 2830Sstevel@tonic-gate #else 2840Sstevel@tonic-gate #define EVP_PKEY_RSA_method EVP_PKEY_NULL_method 2850Sstevel@tonic-gate #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method 2860Sstevel@tonic-gate #endif 2870Sstevel@tonic-gate 2880Sstevel@tonic-gate #endif /* !EVP_MD */ 2890Sstevel@tonic-gate 2900Sstevel@tonic-gate struct env_md_ctx_st 2910Sstevel@tonic-gate { 2920Sstevel@tonic-gate const EVP_MD *digest; 2930Sstevel@tonic-gate ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ 2940Sstevel@tonic-gate unsigned long flags; 2950Sstevel@tonic-gate void *md_data; 2960Sstevel@tonic-gate } /* EVP_MD_CTX */; 2970Sstevel@tonic-gate 2980Sstevel@tonic-gate /* values for EVP_MD_CTX flags */ 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate #define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called 3010Sstevel@tonic-gate * once only */ 3020Sstevel@tonic-gate #define EVP_MD_CTX_FLAG_CLEANED 0x0002 /* context has already been 3030Sstevel@tonic-gate * cleaned */ 3040Sstevel@tonic-gate #define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data 3050Sstevel@tonic-gate * in EVP_MD_CTX_cleanup */ 3060Sstevel@tonic-gate 3070Sstevel@tonic-gate struct evp_cipher_st 3080Sstevel@tonic-gate { 3090Sstevel@tonic-gate int nid; 3100Sstevel@tonic-gate int block_size; 3110Sstevel@tonic-gate int key_len; /* Default value for variable length ciphers */ 3120Sstevel@tonic-gate int iv_len; 3130Sstevel@tonic-gate unsigned long flags; /* Various flags */ 3140Sstevel@tonic-gate int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, 3150Sstevel@tonic-gate const unsigned char *iv, int enc); /* init key */ 3160Sstevel@tonic-gate int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, 3170Sstevel@tonic-gate const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */ 3180Sstevel@tonic-gate int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ 3190Sstevel@tonic-gate int ctx_size; /* how big ctx->cipher_data needs to be */ 3200Sstevel@tonic-gate int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ 3210Sstevel@tonic-gate int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ 3220Sstevel@tonic-gate int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ 3230Sstevel@tonic-gate void *app_data; /* Application data */ 3240Sstevel@tonic-gate } /* EVP_CIPHER */; 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate /* Values for cipher flags */ 3270Sstevel@tonic-gate 3280Sstevel@tonic-gate /* Modes for ciphers */ 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate #define EVP_CIPH_STREAM_CIPHER 0x0 3310Sstevel@tonic-gate #define EVP_CIPH_ECB_MODE 0x1 3320Sstevel@tonic-gate #define EVP_CIPH_CBC_MODE 0x2 3330Sstevel@tonic-gate #define EVP_CIPH_CFB_MODE 0x3 3340Sstevel@tonic-gate #define EVP_CIPH_OFB_MODE 0x4 3350Sstevel@tonic-gate #define EVP_CIPH_MODE 0x7 3360Sstevel@tonic-gate /* Set if variable length cipher */ 3370Sstevel@tonic-gate #define EVP_CIPH_VARIABLE_LENGTH 0x8 3380Sstevel@tonic-gate /* Set if the iv handling should be done by the cipher itself */ 3390Sstevel@tonic-gate #define EVP_CIPH_CUSTOM_IV 0x10 3400Sstevel@tonic-gate /* Set if the cipher's init() function should be called if key is NULL */ 3410Sstevel@tonic-gate #define EVP_CIPH_ALWAYS_CALL_INIT 0x20 3420Sstevel@tonic-gate /* Call ctrl() to init cipher parameters */ 3430Sstevel@tonic-gate #define EVP_CIPH_CTRL_INIT 0x40 3440Sstevel@tonic-gate /* Don't use standard key length function */ 3450Sstevel@tonic-gate #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 3460Sstevel@tonic-gate /* Don't use standard block padding */ 3470Sstevel@tonic-gate #define EVP_CIPH_NO_PADDING 0x100 348*2139Sjp161948 /* cipher handles random key generation */ 349*2139Sjp161948 #define EVP_CIPH_RAND_KEY 0x200 3500Sstevel@tonic-gate 3510Sstevel@tonic-gate /* ctrl() values */ 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate #define EVP_CTRL_INIT 0x0 3540Sstevel@tonic-gate #define EVP_CTRL_SET_KEY_LENGTH 0x1 3550Sstevel@tonic-gate #define EVP_CTRL_GET_RC2_KEY_BITS 0x2 3560Sstevel@tonic-gate #define EVP_CTRL_SET_RC2_KEY_BITS 0x3 3570Sstevel@tonic-gate #define EVP_CTRL_GET_RC5_ROUNDS 0x4 3580Sstevel@tonic-gate #define EVP_CTRL_SET_RC5_ROUNDS 0x5 359*2139Sjp161948 #define EVP_CTRL_RAND_KEY 0x6 3600Sstevel@tonic-gate 3610Sstevel@tonic-gate typedef struct evp_cipher_info_st 3620Sstevel@tonic-gate { 3630Sstevel@tonic-gate const EVP_CIPHER *cipher; 3640Sstevel@tonic-gate unsigned char iv[EVP_MAX_IV_LENGTH]; 3650Sstevel@tonic-gate } EVP_CIPHER_INFO; 3660Sstevel@tonic-gate 3670Sstevel@tonic-gate struct evp_cipher_ctx_st 3680Sstevel@tonic-gate { 3690Sstevel@tonic-gate const EVP_CIPHER *cipher; 3700Sstevel@tonic-gate ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ 3710Sstevel@tonic-gate int encrypt; /* encrypt or decrypt */ 3720Sstevel@tonic-gate int buf_len; /* number we have left */ 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ 3750Sstevel@tonic-gate unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ 3760Sstevel@tonic-gate unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */ 3770Sstevel@tonic-gate int num; /* used by cfb/ofb mode */ 3780Sstevel@tonic-gate 3790Sstevel@tonic-gate void *app_data; /* application stuff */ 3800Sstevel@tonic-gate int key_len; /* May change for variable length cipher */ 3810Sstevel@tonic-gate unsigned long flags; /* Various flags */ 3820Sstevel@tonic-gate void *cipher_data; /* per EVP data */ 3830Sstevel@tonic-gate int final_used; 3840Sstevel@tonic-gate int block_mask; 3850Sstevel@tonic-gate unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ 3860Sstevel@tonic-gate } /* EVP_CIPHER_CTX */; 3870Sstevel@tonic-gate 3880Sstevel@tonic-gate typedef struct evp_Encode_Ctx_st 3890Sstevel@tonic-gate { 3900Sstevel@tonic-gate int num; /* number saved in a partial encode/decode */ 3910Sstevel@tonic-gate int length; /* The length is either the output line length 3920Sstevel@tonic-gate * (in input bytes) or the shortest input line 3930Sstevel@tonic-gate * length that is ok. Once decoding begins, 3940Sstevel@tonic-gate * the length is adjusted up each time a longer 3950Sstevel@tonic-gate * line is decoded */ 3960Sstevel@tonic-gate unsigned char enc_data[80]; /* data to encode */ 3970Sstevel@tonic-gate int line_num; /* number read on current line */ 3980Sstevel@tonic-gate int expect_nl; 3990Sstevel@tonic-gate } EVP_ENCODE_CTX; 4000Sstevel@tonic-gate 4010Sstevel@tonic-gate /* Password based encryption function */ 4020Sstevel@tonic-gate typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 4030Sstevel@tonic-gate ASN1_TYPE *param, const EVP_CIPHER *cipher, 4040Sstevel@tonic-gate const EVP_MD *md, int en_de); 4050Sstevel@tonic-gate 4060Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA 4070Sstevel@tonic-gate #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ 4080Sstevel@tonic-gate (char *)(rsa)) 4090Sstevel@tonic-gate #endif 4100Sstevel@tonic-gate 4110Sstevel@tonic-gate #ifndef OPENSSL_NO_DSA 4120Sstevel@tonic-gate #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ 4130Sstevel@tonic-gate (char *)(dsa)) 4140Sstevel@tonic-gate #endif 4150Sstevel@tonic-gate 4160Sstevel@tonic-gate #ifndef OPENSSL_NO_DH 4170Sstevel@tonic-gate #define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ 4180Sstevel@tonic-gate (char *)(dh)) 4190Sstevel@tonic-gate #endif 4200Sstevel@tonic-gate 421*2139Sjp161948 #ifndef OPENSSL_NO_EC 422*2139Sjp161948 #define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ 423*2139Sjp161948 (char *)(eckey)) 424*2139Sjp161948 #endif 425*2139Sjp161948 4260Sstevel@tonic-gate /* Add some extra combinations */ 4270Sstevel@tonic-gate #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) 4280Sstevel@tonic-gate #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) 4290Sstevel@tonic-gate #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) 4300Sstevel@tonic-gate #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) 4310Sstevel@tonic-gate 4320Sstevel@tonic-gate #define EVP_MD_type(e) ((e)->type) 4330Sstevel@tonic-gate #define EVP_MD_nid(e) EVP_MD_type(e) 4340Sstevel@tonic-gate #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) 4350Sstevel@tonic-gate #define EVP_MD_pkey_type(e) ((e)->pkey_type) 4360Sstevel@tonic-gate #define EVP_MD_size(e) ((e)->md_size) 4370Sstevel@tonic-gate #define EVP_MD_block_size(e) ((e)->block_size) 4380Sstevel@tonic-gate 4390Sstevel@tonic-gate #define EVP_MD_CTX_md(e) ((e)->digest) 4400Sstevel@tonic-gate #define EVP_MD_CTX_size(e) EVP_MD_size((e)->digest) 4410Sstevel@tonic-gate #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) 4420Sstevel@tonic-gate #define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) 4430Sstevel@tonic-gate 4440Sstevel@tonic-gate #define EVP_CIPHER_nid(e) ((e)->nid) 4450Sstevel@tonic-gate #define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) 4460Sstevel@tonic-gate #define EVP_CIPHER_block_size(e) ((e)->block_size) 4470Sstevel@tonic-gate #define EVP_CIPHER_key_length(e) ((e)->key_len) 4480Sstevel@tonic-gate #define EVP_CIPHER_iv_length(e) ((e)->iv_len) 4490Sstevel@tonic-gate #define EVP_CIPHER_flags(e) ((e)->flags) 4500Sstevel@tonic-gate #define EVP_CIPHER_mode(e) (((e)->flags) & EVP_CIPH_MODE) 4510Sstevel@tonic-gate 4520Sstevel@tonic-gate #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) 4530Sstevel@tonic-gate #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) 4540Sstevel@tonic-gate #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) 4550Sstevel@tonic-gate #define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) 4560Sstevel@tonic-gate #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) 4570Sstevel@tonic-gate #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) 4580Sstevel@tonic-gate #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) 4590Sstevel@tonic-gate #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) 4600Sstevel@tonic-gate #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) 4610Sstevel@tonic-gate #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) 4620Sstevel@tonic-gate 4630Sstevel@tonic-gate #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) 4640Sstevel@tonic-gate #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) 4650Sstevel@tonic-gate 4660Sstevel@tonic-gate #define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) 4670Sstevel@tonic-gate #define EVP_SignInit(a,b) EVP_DigestInit(a,b) 4680Sstevel@tonic-gate #define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 4690Sstevel@tonic-gate #define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) 4700Sstevel@tonic-gate #define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) 4710Sstevel@tonic-gate #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) 4720Sstevel@tonic-gate #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) 4730Sstevel@tonic-gate #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) 4740Sstevel@tonic-gate 4750Sstevel@tonic-gate #ifdef CONST_STRICT 4760Sstevel@tonic-gate void BIO_set_md(BIO *,const EVP_MD *md); 4770Sstevel@tonic-gate #else 4780Sstevel@tonic-gate # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) 4790Sstevel@tonic-gate #endif 4800Sstevel@tonic-gate #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) 4810Sstevel@tonic-gate #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) 4820Sstevel@tonic-gate #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) 4830Sstevel@tonic-gate #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) 4840Sstevel@tonic-gate 4850Sstevel@tonic-gate #define EVP_Cipher(c,o,i,l) (c)->cipher->do_cipher((c),(o),(i),(l)) 4860Sstevel@tonic-gate 4870Sstevel@tonic-gate #define EVP_add_cipher_alias(n,alias) \ 4880Sstevel@tonic-gate OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) 4890Sstevel@tonic-gate #define EVP_add_digest_alias(n,alias) \ 4900Sstevel@tonic-gate OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) 4910Sstevel@tonic-gate #define EVP_delete_cipher_alias(alias) \ 4920Sstevel@tonic-gate OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); 4930Sstevel@tonic-gate #define EVP_delete_digest_alias(alias) \ 4940Sstevel@tonic-gate OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); 4950Sstevel@tonic-gate 4960Sstevel@tonic-gate void EVP_MD_CTX_init(EVP_MD_CTX *ctx); 4970Sstevel@tonic-gate int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); 4980Sstevel@tonic-gate EVP_MD_CTX *EVP_MD_CTX_create(void); 4990Sstevel@tonic-gate void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); 5000Sstevel@tonic-gate int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); 5010Sstevel@tonic-gate #define EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) 5020Sstevel@tonic-gate #define EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs)) 5030Sstevel@tonic-gate #define EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs)) 5040Sstevel@tonic-gate int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); 5050Sstevel@tonic-gate int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, 506*2139Sjp161948 size_t cnt); 5070Sstevel@tonic-gate int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); 508*2139Sjp161948 int EVP_Digest(const void *data, size_t count, 5090Sstevel@tonic-gate unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); 5100Sstevel@tonic-gate 5110Sstevel@tonic-gate int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in); 5120Sstevel@tonic-gate int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); 5130Sstevel@tonic-gate int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); 5140Sstevel@tonic-gate 5150Sstevel@tonic-gate int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); 516*2139Sjp161948 void EVP_set_pw_prompt(const char *prompt); 5170Sstevel@tonic-gate char * EVP_get_pw_prompt(void); 5180Sstevel@tonic-gate 5190Sstevel@tonic-gate int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, 5200Sstevel@tonic-gate const unsigned char *salt, const unsigned char *data, 5210Sstevel@tonic-gate int datal, int count, unsigned char *key,unsigned char *iv); 5220Sstevel@tonic-gate 5230Sstevel@tonic-gate int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, 5240Sstevel@tonic-gate const unsigned char *key, const unsigned char *iv); 5250Sstevel@tonic-gate int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, 5260Sstevel@tonic-gate const unsigned char *key, const unsigned char *iv); 5270Sstevel@tonic-gate int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 5280Sstevel@tonic-gate int *outl, const unsigned char *in, int inl); 5290Sstevel@tonic-gate int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 5300Sstevel@tonic-gate int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 5310Sstevel@tonic-gate 5320Sstevel@tonic-gate int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, 5330Sstevel@tonic-gate const unsigned char *key, const unsigned char *iv); 5340Sstevel@tonic-gate int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, 5350Sstevel@tonic-gate const unsigned char *key, const unsigned char *iv); 5360Sstevel@tonic-gate int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 5370Sstevel@tonic-gate int *outl, const unsigned char *in, int inl); 5380Sstevel@tonic-gate int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); 5390Sstevel@tonic-gate int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); 5400Sstevel@tonic-gate 5410Sstevel@tonic-gate int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, 5420Sstevel@tonic-gate const unsigned char *key,const unsigned char *iv, 5430Sstevel@tonic-gate int enc); 5440Sstevel@tonic-gate int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, 5450Sstevel@tonic-gate const unsigned char *key,const unsigned char *iv, 5460Sstevel@tonic-gate int enc); 5470Sstevel@tonic-gate int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, 5480Sstevel@tonic-gate int *outl, const unsigned char *in, int inl); 5490Sstevel@tonic-gate int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); 5500Sstevel@tonic-gate int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); 5510Sstevel@tonic-gate 5520Sstevel@tonic-gate int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, 5530Sstevel@tonic-gate EVP_PKEY *pkey); 5540Sstevel@tonic-gate 555*2139Sjp161948 int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, 5560Sstevel@tonic-gate unsigned int siglen,EVP_PKEY *pkey); 5570Sstevel@tonic-gate 558*2139Sjp161948 int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, 559*2139Sjp161948 const unsigned char *ek, int ekl, const unsigned char *iv, 560*2139Sjp161948 EVP_PKEY *priv); 5610Sstevel@tonic-gate int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); 5620Sstevel@tonic-gate 563*2139Sjp161948 int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, 564*2139Sjp161948 unsigned char **ek, int *ekl, unsigned char *iv, 565*2139Sjp161948 EVP_PKEY **pubk, int npubk); 5660Sstevel@tonic-gate int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); 5670Sstevel@tonic-gate 5680Sstevel@tonic-gate void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); 569*2139Sjp161948 void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, 570*2139Sjp161948 const unsigned char *in,int inl); 5710Sstevel@tonic-gate void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); 5720Sstevel@tonic-gate int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); 5730Sstevel@tonic-gate 5740Sstevel@tonic-gate void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); 5750Sstevel@tonic-gate int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, 576*2139Sjp161948 const unsigned char *in, int inl); 5770Sstevel@tonic-gate int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned 5780Sstevel@tonic-gate char *out, int *outl); 5790Sstevel@tonic-gate int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); 5800Sstevel@tonic-gate 5810Sstevel@tonic-gate void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); 5820Sstevel@tonic-gate int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); 5830Sstevel@tonic-gate int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); 5840Sstevel@tonic-gate int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); 5850Sstevel@tonic-gate int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); 586*2139Sjp161948 int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); 5870Sstevel@tonic-gate 5880Sstevel@tonic-gate #ifndef OPENSSL_NO_BIO 5890Sstevel@tonic-gate BIO_METHOD *BIO_f_md(void); 5900Sstevel@tonic-gate BIO_METHOD *BIO_f_base64(void); 5910Sstevel@tonic-gate BIO_METHOD *BIO_f_cipher(void); 5920Sstevel@tonic-gate BIO_METHOD *BIO_f_reliable(void); 593*2139Sjp161948 void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k, 594*2139Sjp161948 const unsigned char *i, int enc); 5950Sstevel@tonic-gate #endif 5960Sstevel@tonic-gate 5970Sstevel@tonic-gate const EVP_MD *EVP_md_null(void); 5980Sstevel@tonic-gate #ifndef OPENSSL_NO_MD2 5990Sstevel@tonic-gate const EVP_MD *EVP_md2(void); 6000Sstevel@tonic-gate #endif 6010Sstevel@tonic-gate #ifndef OPENSSL_NO_MD4 6020Sstevel@tonic-gate const EVP_MD *EVP_md4(void); 6030Sstevel@tonic-gate #endif 6040Sstevel@tonic-gate #ifndef OPENSSL_NO_MD5 6050Sstevel@tonic-gate const EVP_MD *EVP_md5(void); 6060Sstevel@tonic-gate #endif 6070Sstevel@tonic-gate #ifndef OPENSSL_NO_SHA 6080Sstevel@tonic-gate const EVP_MD *EVP_sha(void); 6090Sstevel@tonic-gate const EVP_MD *EVP_sha1(void); 6100Sstevel@tonic-gate const EVP_MD *EVP_dss(void); 6110Sstevel@tonic-gate const EVP_MD *EVP_dss1(void); 612*2139Sjp161948 const EVP_MD *EVP_ecdsa(void); 613*2139Sjp161948 #endif 614*2139Sjp161948 #ifndef OPENSSL_NO_SHA256 615*2139Sjp161948 const EVP_MD *EVP_sha224(void); 616*2139Sjp161948 const EVP_MD *EVP_sha256(void); 617*2139Sjp161948 #endif 618*2139Sjp161948 #ifndef OPENSSL_NO_SHA512 619*2139Sjp161948 const EVP_MD *EVP_sha384(void); 620*2139Sjp161948 const EVP_MD *EVP_sha512(void); 6210Sstevel@tonic-gate #endif 6220Sstevel@tonic-gate #ifndef OPENSSL_NO_MDC2 6230Sstevel@tonic-gate const EVP_MD *EVP_mdc2(void); 6240Sstevel@tonic-gate #endif 6250Sstevel@tonic-gate #ifndef OPENSSL_NO_RIPEMD 6260Sstevel@tonic-gate const EVP_MD *EVP_ripemd160(void); 6270Sstevel@tonic-gate #endif 6280Sstevel@tonic-gate const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ 6290Sstevel@tonic-gate #ifndef OPENSSL_NO_DES 6300Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ecb(void); 6310Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede(void); 6320Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede3(void); 6330Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede_ecb(void); 6340Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede3_ecb(void); 635*2139Sjp161948 const EVP_CIPHER *EVP_des_cfb64(void); 636*2139Sjp161948 # define EVP_des_cfb EVP_des_cfb64 637*2139Sjp161948 const EVP_CIPHER *EVP_des_cfb1(void); 638*2139Sjp161948 const EVP_CIPHER *EVP_des_cfb8(void); 639*2139Sjp161948 const EVP_CIPHER *EVP_des_ede_cfb64(void); 640*2139Sjp161948 # define EVP_des_ede_cfb EVP_des_ede_cfb64 641*2139Sjp161948 #if 0 642*2139Sjp161948 const EVP_CIPHER *EVP_des_ede_cfb1(void); 643*2139Sjp161948 const EVP_CIPHER *EVP_des_ede_cfb8(void); 644*2139Sjp161948 #endif 645*2139Sjp161948 const EVP_CIPHER *EVP_des_ede3_cfb64(void); 646*2139Sjp161948 # define EVP_des_ede3_cfb EVP_des_ede3_cfb64 647*2139Sjp161948 const EVP_CIPHER *EVP_des_ede3_cfb1(void); 648*2139Sjp161948 const EVP_CIPHER *EVP_des_ede3_cfb8(void); 6490Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ofb(void); 6500Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede_ofb(void); 6510Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede3_ofb(void); 6520Sstevel@tonic-gate const EVP_CIPHER *EVP_des_cbc(void); 6530Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede_cbc(void); 6540Sstevel@tonic-gate const EVP_CIPHER *EVP_des_ede3_cbc(void); 6550Sstevel@tonic-gate const EVP_CIPHER *EVP_desx_cbc(void); 6560Sstevel@tonic-gate /* This should now be supported through the dev_crypto ENGINE. But also, why are 6570Sstevel@tonic-gate * rc4 and md5 declarations made here inside a "NO_DES" precompiler branch? */ 6580Sstevel@tonic-gate #if 0 6590Sstevel@tonic-gate # ifdef OPENSSL_OPENBSD_DEV_CRYPTO 6600Sstevel@tonic-gate const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void); 6610Sstevel@tonic-gate const EVP_CIPHER *EVP_dev_crypto_rc4(void); 6620Sstevel@tonic-gate const EVP_MD *EVP_dev_crypto_md5(void); 6630Sstevel@tonic-gate # endif 6640Sstevel@tonic-gate #endif 6650Sstevel@tonic-gate #endif 6660Sstevel@tonic-gate #ifndef OPENSSL_NO_RC4 6670Sstevel@tonic-gate const EVP_CIPHER *EVP_rc4(void); 6680Sstevel@tonic-gate const EVP_CIPHER *EVP_rc4_40(void); 6690Sstevel@tonic-gate #endif 6700Sstevel@tonic-gate #ifndef OPENSSL_NO_IDEA 6710Sstevel@tonic-gate const EVP_CIPHER *EVP_idea_ecb(void); 672*2139Sjp161948 const EVP_CIPHER *EVP_idea_cfb64(void); 673*2139Sjp161948 # define EVP_idea_cfb EVP_idea_cfb64 6740Sstevel@tonic-gate const EVP_CIPHER *EVP_idea_ofb(void); 6750Sstevel@tonic-gate const EVP_CIPHER *EVP_idea_cbc(void); 6760Sstevel@tonic-gate #endif 6770Sstevel@tonic-gate #ifndef OPENSSL_NO_RC2 6780Sstevel@tonic-gate const EVP_CIPHER *EVP_rc2_ecb(void); 6790Sstevel@tonic-gate const EVP_CIPHER *EVP_rc2_cbc(void); 6800Sstevel@tonic-gate const EVP_CIPHER *EVP_rc2_40_cbc(void); 6810Sstevel@tonic-gate const EVP_CIPHER *EVP_rc2_64_cbc(void); 682*2139Sjp161948 const EVP_CIPHER *EVP_rc2_cfb64(void); 683*2139Sjp161948 # define EVP_rc2_cfb EVP_rc2_cfb64 6840Sstevel@tonic-gate const EVP_CIPHER *EVP_rc2_ofb(void); 6850Sstevel@tonic-gate #endif 6860Sstevel@tonic-gate #ifndef OPENSSL_NO_BF 6870Sstevel@tonic-gate const EVP_CIPHER *EVP_bf_ecb(void); 6880Sstevel@tonic-gate const EVP_CIPHER *EVP_bf_cbc(void); 689*2139Sjp161948 const EVP_CIPHER *EVP_bf_cfb64(void); 690*2139Sjp161948 # define EVP_bf_cfb EVP_bf_cfb64 6910Sstevel@tonic-gate const EVP_CIPHER *EVP_bf_ofb(void); 6920Sstevel@tonic-gate #endif 6930Sstevel@tonic-gate #ifndef OPENSSL_NO_CAST 6940Sstevel@tonic-gate const EVP_CIPHER *EVP_cast5_ecb(void); 6950Sstevel@tonic-gate const EVP_CIPHER *EVP_cast5_cbc(void); 696*2139Sjp161948 const EVP_CIPHER *EVP_cast5_cfb64(void); 697*2139Sjp161948 # define EVP_cast5_cfb EVP_cast5_cfb64 6980Sstevel@tonic-gate const EVP_CIPHER *EVP_cast5_ofb(void); 6990Sstevel@tonic-gate #endif 7000Sstevel@tonic-gate #ifndef OPENSSL_NO_RC5 7010Sstevel@tonic-gate const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); 7020Sstevel@tonic-gate const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); 703*2139Sjp161948 const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); 704*2139Sjp161948 # define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 7050Sstevel@tonic-gate const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); 7060Sstevel@tonic-gate #endif 7070Sstevel@tonic-gate #ifndef OPENSSL_NO_AES 7080Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_128_ecb(void); 7090Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_128_cbc(void); 710*2139Sjp161948 const EVP_CIPHER *EVP_aes_128_cfb1(void); 711*2139Sjp161948 const EVP_CIPHER *EVP_aes_128_cfb8(void); 712*2139Sjp161948 const EVP_CIPHER *EVP_aes_128_cfb128(void); 713*2139Sjp161948 # define EVP_aes_128_cfb EVP_aes_128_cfb128 7140Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_128_ofb(void); 7150Sstevel@tonic-gate #if 0 7160Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_128_ctr(void); 7170Sstevel@tonic-gate #endif 7180Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_192_ecb(void); 7190Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_192_cbc(void); 720*2139Sjp161948 const EVP_CIPHER *EVP_aes_192_cfb1(void); 721*2139Sjp161948 const EVP_CIPHER *EVP_aes_192_cfb8(void); 722*2139Sjp161948 const EVP_CIPHER *EVP_aes_192_cfb128(void); 723*2139Sjp161948 # define EVP_aes_192_cfb EVP_aes_192_cfb128 7240Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_192_ofb(void); 7250Sstevel@tonic-gate #if 0 7260Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_192_ctr(void); 7270Sstevel@tonic-gate #endif 7280Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_256_ecb(void); 7290Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_256_cbc(void); 730*2139Sjp161948 const EVP_CIPHER *EVP_aes_256_cfb1(void); 731*2139Sjp161948 const EVP_CIPHER *EVP_aes_256_cfb8(void); 732*2139Sjp161948 const EVP_CIPHER *EVP_aes_256_cfb128(void); 733*2139Sjp161948 # define EVP_aes_256_cfb EVP_aes_256_cfb128 7340Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_256_ofb(void); 7350Sstevel@tonic-gate #if 0 7360Sstevel@tonic-gate const EVP_CIPHER *EVP_aes_256_ctr(void); 7370Sstevel@tonic-gate #endif 7380Sstevel@tonic-gate #endif 7390Sstevel@tonic-gate 7400Sstevel@tonic-gate void OPENSSL_add_all_algorithms_noconf(void); 7410Sstevel@tonic-gate void OPENSSL_add_all_algorithms_conf(void); 7420Sstevel@tonic-gate 7430Sstevel@tonic-gate #ifdef OPENSSL_LOAD_CONF 7440Sstevel@tonic-gate #define OpenSSL_add_all_algorithms() \ 7450Sstevel@tonic-gate OPENSSL_add_all_algorithms_conf() 7460Sstevel@tonic-gate #else 7470Sstevel@tonic-gate #define OpenSSL_add_all_algorithms() \ 7480Sstevel@tonic-gate OPENSSL_add_all_algorithms_noconf() 7490Sstevel@tonic-gate #endif 7500Sstevel@tonic-gate 7510Sstevel@tonic-gate void OpenSSL_add_all_ciphers(void); 7520Sstevel@tonic-gate void OpenSSL_add_all_digests(void); 7530Sstevel@tonic-gate #define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() 7540Sstevel@tonic-gate #define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() 7550Sstevel@tonic-gate #define SSLeay_add_all_digests() OpenSSL_add_all_digests() 7560Sstevel@tonic-gate 7570Sstevel@tonic-gate int EVP_add_cipher(const EVP_CIPHER *cipher); 7580Sstevel@tonic-gate int EVP_add_digest(const EVP_MD *digest); 7590Sstevel@tonic-gate 7600Sstevel@tonic-gate const EVP_CIPHER *EVP_get_cipherbyname(const char *name); 7610Sstevel@tonic-gate const EVP_MD *EVP_get_digestbyname(const char *name); 7620Sstevel@tonic-gate void EVP_cleanup(void); 7630Sstevel@tonic-gate 764*2139Sjp161948 int EVP_PKEY_decrypt(unsigned char *dec_key, 765*2139Sjp161948 const unsigned char *enc_key,int enc_key_len, 766*2139Sjp161948 EVP_PKEY *private_key); 7670Sstevel@tonic-gate int EVP_PKEY_encrypt(unsigned char *enc_key, 768*2139Sjp161948 const unsigned char *key,int key_len, 769*2139Sjp161948 EVP_PKEY *pub_key); 7700Sstevel@tonic-gate int EVP_PKEY_type(int type); 7710Sstevel@tonic-gate int EVP_PKEY_bits(EVP_PKEY *pkey); 7720Sstevel@tonic-gate int EVP_PKEY_size(EVP_PKEY *pkey); 7730Sstevel@tonic-gate int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key); 7740Sstevel@tonic-gate 7750Sstevel@tonic-gate #ifndef OPENSSL_NO_RSA 7760Sstevel@tonic-gate struct rsa_st; 7770Sstevel@tonic-gate int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key); 7780Sstevel@tonic-gate struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); 7790Sstevel@tonic-gate #endif 7800Sstevel@tonic-gate #ifndef OPENSSL_NO_DSA 7810Sstevel@tonic-gate struct dsa_st; 7820Sstevel@tonic-gate int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key); 7830Sstevel@tonic-gate struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); 7840Sstevel@tonic-gate #endif 7850Sstevel@tonic-gate #ifndef OPENSSL_NO_DH 7860Sstevel@tonic-gate struct dh_st; 7870Sstevel@tonic-gate int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key); 7880Sstevel@tonic-gate struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); 7890Sstevel@tonic-gate #endif 790*2139Sjp161948 #ifndef OPENSSL_NO_EC 791*2139Sjp161948 struct ec_key_st; 792*2139Sjp161948 int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key); 793*2139Sjp161948 struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); 794*2139Sjp161948 #endif 7950Sstevel@tonic-gate 7960Sstevel@tonic-gate EVP_PKEY * EVP_PKEY_new(void); 7970Sstevel@tonic-gate void EVP_PKEY_free(EVP_PKEY *pkey); 798*2139Sjp161948 799*2139Sjp161948 EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, 8000Sstevel@tonic-gate long length); 8010Sstevel@tonic-gate int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); 8020Sstevel@tonic-gate 803*2139Sjp161948 EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, 8040Sstevel@tonic-gate long length); 805*2139Sjp161948 EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, 8060Sstevel@tonic-gate long length); 8070Sstevel@tonic-gate int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); 8080Sstevel@tonic-gate 809*2139Sjp161948 int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); 810*2139Sjp161948 int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); 8110Sstevel@tonic-gate int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); 812*2139Sjp161948 int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); 813*2139Sjp161948 814*2139Sjp161948 int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); 8150Sstevel@tonic-gate 8160Sstevel@tonic-gate int EVP_CIPHER_type(const EVP_CIPHER *ctx); 8170Sstevel@tonic-gate 8180Sstevel@tonic-gate /* calls methods */ 8190Sstevel@tonic-gate int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 8200Sstevel@tonic-gate int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); 8210Sstevel@tonic-gate 8220Sstevel@tonic-gate /* These are used by EVP_CIPHER methods */ 8230Sstevel@tonic-gate int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); 8240Sstevel@tonic-gate int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); 8250Sstevel@tonic-gate 8260Sstevel@tonic-gate /* PKCS5 password based encryption */ 8270Sstevel@tonic-gate int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 8280Sstevel@tonic-gate ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, 8290Sstevel@tonic-gate int en_de); 8300Sstevel@tonic-gate int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, 831*2139Sjp161948 const unsigned char *salt, int saltlen, int iter, 8320Sstevel@tonic-gate int keylen, unsigned char *out); 8330Sstevel@tonic-gate int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, 8340Sstevel@tonic-gate ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, 8350Sstevel@tonic-gate int en_de); 8360Sstevel@tonic-gate 8370Sstevel@tonic-gate void PKCS5_PBE_add(void); 8380Sstevel@tonic-gate 8390Sstevel@tonic-gate int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, 8400Sstevel@tonic-gate ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); 8410Sstevel@tonic-gate int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, 8420Sstevel@tonic-gate EVP_PBE_KEYGEN *keygen); 8430Sstevel@tonic-gate void EVP_PBE_cleanup(void); 8440Sstevel@tonic-gate 8450Sstevel@tonic-gate /* BEGIN ERROR CODES */ 8460Sstevel@tonic-gate /* The following lines are auto generated by the script mkerr.pl. Any changes 8470Sstevel@tonic-gate * made after this point may be overwritten when the script is next run. 8480Sstevel@tonic-gate */ 8490Sstevel@tonic-gate void ERR_load_EVP_strings(void); 8500Sstevel@tonic-gate 8510Sstevel@tonic-gate /* Error codes for the EVP functions. */ 8520Sstevel@tonic-gate 8530Sstevel@tonic-gate /* Function codes. */ 854*2139Sjp161948 #define EVP_F_AES_INIT_KEY 133 8550Sstevel@tonic-gate #define EVP_F_D2I_PKEY 100 856*2139Sjp161948 #define EVP_F_DSAPKEY2PKCS8 134 857*2139Sjp161948 #define EVP_F_DSA_PKEY2PKCS8 135 858*2139Sjp161948 #define EVP_F_ECDSA_PKEY2PKCS8 129 859*2139Sjp161948 #define EVP_F_ECKEY_PKEY2PKCS8 132 860*2139Sjp161948 #define EVP_F_EVP_CIPHERINIT_EX 123 8610Sstevel@tonic-gate #define EVP_F_EVP_CIPHER_CTX_CTRL 124 8620Sstevel@tonic-gate #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 863*2139Sjp161948 #define EVP_F_EVP_DECRYPTFINAL_EX 101 864*2139Sjp161948 #define EVP_F_EVP_DIGESTINIT_EX 128 865*2139Sjp161948 #define EVP_F_EVP_ENCRYPTFINAL_EX 127 866*2139Sjp161948 #define EVP_F_EVP_MD_CTX_COPY_EX 110 8670Sstevel@tonic-gate #define EVP_F_EVP_OPENINIT 102 8680Sstevel@tonic-gate #define EVP_F_EVP_PBE_ALG_ADD 115 8690Sstevel@tonic-gate #define EVP_F_EVP_PBE_CIPHERINIT 116 8700Sstevel@tonic-gate #define EVP_F_EVP_PKCS82PKEY 111 871*2139Sjp161948 #define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 8720Sstevel@tonic-gate #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 8730Sstevel@tonic-gate #define EVP_F_EVP_PKEY_DECRYPT 104 8740Sstevel@tonic-gate #define EVP_F_EVP_PKEY_ENCRYPT 105 8750Sstevel@tonic-gate #define EVP_F_EVP_PKEY_GET1_DH 119 8760Sstevel@tonic-gate #define EVP_F_EVP_PKEY_GET1_DSA 120 877*2139Sjp161948 #define EVP_F_EVP_PKEY_GET1_ECDSA 130 878*2139Sjp161948 #define EVP_F_EVP_PKEY_GET1_EC_KEY 131 8790Sstevel@tonic-gate #define EVP_F_EVP_PKEY_GET1_RSA 121 8800Sstevel@tonic-gate #define EVP_F_EVP_PKEY_NEW 106 8810Sstevel@tonic-gate #define EVP_F_EVP_RIJNDAEL 126 8820Sstevel@tonic-gate #define EVP_F_EVP_SIGNFINAL 107 8830Sstevel@tonic-gate #define EVP_F_EVP_VERIFYFINAL 108 8840Sstevel@tonic-gate #define EVP_F_PKCS5_PBE_KEYIVGEN 117 8850Sstevel@tonic-gate #define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 886*2139Sjp161948 #define EVP_F_PKCS8_SET_BROKEN 112 8870Sstevel@tonic-gate #define EVP_F_RC2_MAGIC_TO_METH 109 8880Sstevel@tonic-gate #define EVP_F_RC5_CTRL 125 8890Sstevel@tonic-gate 8900Sstevel@tonic-gate /* Reason codes. */ 891*2139Sjp161948 #define EVP_R_AES_KEY_SETUP_FAILED 143 892*2139Sjp161948 #define EVP_R_ASN1_LIB 140 8930Sstevel@tonic-gate #define EVP_R_BAD_BLOCK_LENGTH 136 8940Sstevel@tonic-gate #define EVP_R_BAD_DECRYPT 100 8950Sstevel@tonic-gate #define EVP_R_BAD_KEY_LENGTH 137 8960Sstevel@tonic-gate #define EVP_R_BN_DECODE_ERROR 112 8970Sstevel@tonic-gate #define EVP_R_BN_PUBKEY_ERROR 113 8980Sstevel@tonic-gate #define EVP_R_CIPHER_PARAMETER_ERROR 122 8990Sstevel@tonic-gate #define EVP_R_CTRL_NOT_IMPLEMENTED 132 9000Sstevel@tonic-gate #define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 9010Sstevel@tonic-gate #define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 9020Sstevel@tonic-gate #define EVP_R_DECODE_ERROR 114 9030Sstevel@tonic-gate #define EVP_R_DIFFERENT_KEY_TYPES 101 9040Sstevel@tonic-gate #define EVP_R_ENCODE_ERROR 115 9050Sstevel@tonic-gate #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 9060Sstevel@tonic-gate #define EVP_R_EXPECTING_AN_RSA_KEY 127 9070Sstevel@tonic-gate #define EVP_R_EXPECTING_A_DH_KEY 128 9080Sstevel@tonic-gate #define EVP_R_EXPECTING_A_DSA_KEY 129 909*2139Sjp161948 #define EVP_R_EXPECTING_A_ECDSA_KEY 141 910*2139Sjp161948 #define EVP_R_EXPECTING_A_EC_KEY 142 9110Sstevel@tonic-gate #define EVP_R_INITIALIZATION_ERROR 134 9120Sstevel@tonic-gate #define EVP_R_INPUT_NOT_INITIALIZED 111 9130Sstevel@tonic-gate #define EVP_R_INVALID_KEY_LENGTH 130 9140Sstevel@tonic-gate #define EVP_R_IV_TOO_LARGE 102 9150Sstevel@tonic-gate #define EVP_R_KEYGEN_FAILURE 120 9160Sstevel@tonic-gate #define EVP_R_MISSING_PARAMETERS 103 9170Sstevel@tonic-gate #define EVP_R_NO_CIPHER_SET 131 9180Sstevel@tonic-gate #define EVP_R_NO_DIGEST_SET 139 9190Sstevel@tonic-gate #define EVP_R_NO_DSA_PARAMETERS 116 9200Sstevel@tonic-gate #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 9210Sstevel@tonic-gate #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 9220Sstevel@tonic-gate #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 9230Sstevel@tonic-gate #define EVP_R_PUBLIC_KEY_NOT_RSA 106 9240Sstevel@tonic-gate #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 9250Sstevel@tonic-gate #define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 9260Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_CIPHER 107 9270Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_KEYLENGTH 123 9280Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 9290Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_KEY_SIZE 108 9300Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_PRF 125 9310Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 9320Sstevel@tonic-gate #define EVP_R_UNSUPPORTED_SALT_TYPE 126 9330Sstevel@tonic-gate #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 9340Sstevel@tonic-gate #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 9350Sstevel@tonic-gate 9360Sstevel@tonic-gate #ifdef __cplusplus 9370Sstevel@tonic-gate } 9380Sstevel@tonic-gate #endif 9390Sstevel@tonic-gate #endif 940