summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/crypto/evp/evp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/crypto/evp/evp.h')
-rw-r--r--src/lib/libssl/src/crypto/evp/evp.h99
1 files changed, 13 insertions, 86 deletions
diff --git a/src/lib/libssl/src/crypto/evp/evp.h b/src/lib/libssl/src/crypto/evp/evp.h
index 0d1b20a7d3..da93e945f5 100644
--- a/src/lib/libssl/src/crypto/evp/evp.h
+++ b/src/lib/libssl/src/crypto/evp/evp.h
@@ -83,7 +83,7 @@
83#define EVP_RC5_32_12_16_KEY_SIZE 16 83#define EVP_RC5_32_12_16_KEY_SIZE 16
84*/ 84*/
85#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ 85#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */
86#define EVP_MAX_KEY_LENGTH 64 86#define EVP_MAX_KEY_LENGTH 32
87#define EVP_MAX_IV_LENGTH 16 87#define EVP_MAX_IV_LENGTH 16
88#define EVP_MAX_BLOCK_LENGTH 32 88#define EVP_MAX_BLOCK_LENGTH 32
89 89
@@ -116,7 +116,6 @@
116#define EVP_PKEY_DH NID_dhKeyAgreement 116#define EVP_PKEY_DH NID_dhKeyAgreement
117#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey 117#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
118#define EVP_PKEY_HMAC NID_hmac 118#define EVP_PKEY_HMAC NID_hmac
119#define EVP_PKEY_CMAC NID_cmac
120 119
121#ifdef __cplusplus 120#ifdef __cplusplus
122extern "C" { 121extern "C" {
@@ -217,8 +216,6 @@ typedef int evp_verify_method(int type,const unsigned char *m,
217 216
218#define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 217#define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018
219 218
220#define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */
221
222/* Digest ctrls */ 219/* Digest ctrls */
223 220
224#define EVP_MD_CTRL_DIGALGID 0x1 221#define EVP_MD_CTRL_DIGALGID 0x1
@@ -328,10 +325,6 @@ struct evp_cipher_st
328#define EVP_CIPH_CBC_MODE 0x2 325#define EVP_CIPH_CBC_MODE 0x2
329#define EVP_CIPH_CFB_MODE 0x3 326#define EVP_CIPH_CFB_MODE 0x3
330#define EVP_CIPH_OFB_MODE 0x4 327#define EVP_CIPH_OFB_MODE 0x4
331#define EVP_CIPH_CTR_MODE 0x5
332#define EVP_CIPH_GCM_MODE 0x6
333#define EVP_CIPH_CCM_MODE 0x7
334#define EVP_CIPH_XTS_MODE 0x10001
335#define EVP_CIPH_MODE 0xF0007 328#define EVP_CIPH_MODE 0xF0007
336/* Set if variable length cipher */ 329/* Set if variable length cipher */
337#define EVP_CIPH_VARIABLE_LENGTH 0x8 330#define EVP_CIPH_VARIABLE_LENGTH 0x8
@@ -353,15 +346,6 @@ struct evp_cipher_st
353#define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 346#define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000
354/* Buffer length in bits not bytes: CFB1 mode only */ 347/* Buffer length in bits not bytes: CFB1 mode only */
355#define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 348#define EVP_CIPH_FLAG_LENGTH_BITS 0x2000
356/* Note if suitable for use in FIPS mode */
357#define EVP_CIPH_FLAG_FIPS 0x4000
358/* Allow non FIPS cipher in FIPS mode */
359#define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000
360/* Cipher handles any and all padding logic as well
361 * as finalisation.
362 */
363#define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000
364#define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
365 349
366/* ctrl() values */ 350/* ctrl() values */
367 351
@@ -374,34 +358,7 @@ struct evp_cipher_st
374#define EVP_CTRL_RAND_KEY 0x6 358#define EVP_CTRL_RAND_KEY 0x6
375#define EVP_CTRL_PBE_PRF_NID 0x7 359#define EVP_CTRL_PBE_PRF_NID 0x7
376#define EVP_CTRL_COPY 0x8 360#define EVP_CTRL_COPY 0x8
377#define EVP_CTRL_GCM_SET_IVLEN 0x9 361#define EVP_CTRL_SET_ACSS_MODE 0x9
378#define EVP_CTRL_GCM_GET_TAG 0x10
379#define EVP_CTRL_GCM_SET_TAG 0x11
380#define EVP_CTRL_GCM_SET_IV_FIXED 0x12
381#define EVP_CTRL_GCM_IV_GEN 0x13
382#define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN
383#define EVP_CTRL_CCM_GET_TAG EVP_CTRL_GCM_GET_TAG
384#define EVP_CTRL_CCM_SET_TAG EVP_CTRL_GCM_SET_TAG
385#define EVP_CTRL_CCM_SET_L 0x14
386#define EVP_CTRL_CCM_SET_MSGLEN 0x15
387/* AEAD cipher deduces payload length and returns number of bytes
388 * required to store MAC and eventual padding. Subsequent call to
389 * EVP_Cipher even appends/verifies MAC.
390 */
391#define EVP_CTRL_AEAD_TLS1_AAD 0x16
392/* Used by composite AEAD ciphers, no-op in GCM, CCM... */
393#define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
394/* Set the GCM invocation field, decrypt only */
395#define EVP_CTRL_GCM_SET_IV_INV 0x18
396
397/* GCM TLS constants */
398/* Length of fixed part of IV derived from PRF */
399#define EVP_GCM_TLS_FIXED_IV_LEN 4
400/* Length of explicit part of IV part of TLS records */
401#define EVP_GCM_TLS_EXPLICIT_IV_LEN 8
402/* Length of tag for TLS */
403#define EVP_GCM_TLS_TAG_LEN 16
404
405 362
406typedef struct evp_cipher_info_st 363typedef struct evp_cipher_info_st
407 { 364 {
@@ -419,7 +376,7 @@ struct evp_cipher_ctx_st
419 unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ 376 unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
420 unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ 377 unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
421 unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */ 378 unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
422 int num; /* used by cfb/ofb/ctr mode */ 379 int num; /* used by cfb/ofb mode */
423 380
424 void *app_data; /* application stuff */ 381 void *app_data; /* application stuff */
425 int key_len; /* May change for variable length cipher */ 382 int key_len; /* May change for variable length cipher */
@@ -739,9 +696,6 @@ const EVP_MD *EVP_dev_crypto_md5(void);
739#ifndef OPENSSL_NO_RC4 696#ifndef OPENSSL_NO_RC4
740const EVP_CIPHER *EVP_rc4(void); 697const EVP_CIPHER *EVP_rc4(void);
741const EVP_CIPHER *EVP_rc4_40(void); 698const EVP_CIPHER *EVP_rc4_40(void);
742#ifndef OPENSSL_NO_MD5
743const EVP_CIPHER *EVP_rc4_hmac_md5(void);
744#endif
745#endif 699#endif
746#ifndef OPENSSL_NO_IDEA 700#ifndef OPENSSL_NO_IDEA
747const EVP_CIPHER *EVP_idea_ecb(void); 701const EVP_CIPHER *EVP_idea_ecb(void);
@@ -788,10 +742,9 @@ const EVP_CIPHER *EVP_aes_128_cfb8(void);
788const EVP_CIPHER *EVP_aes_128_cfb128(void); 742const EVP_CIPHER *EVP_aes_128_cfb128(void);
789# define EVP_aes_128_cfb EVP_aes_128_cfb128 743# define EVP_aes_128_cfb EVP_aes_128_cfb128
790const EVP_CIPHER *EVP_aes_128_ofb(void); 744const EVP_CIPHER *EVP_aes_128_ofb(void);
745#if 0
791const EVP_CIPHER *EVP_aes_128_ctr(void); 746const EVP_CIPHER *EVP_aes_128_ctr(void);
792const EVP_CIPHER *EVP_aes_128_gcm(void); 747#endif
793const EVP_CIPHER *EVP_aes_128_ccm(void);
794const EVP_CIPHER *EVP_aes_128_xts(void);
795const EVP_CIPHER *EVP_aes_192_ecb(void); 748const EVP_CIPHER *EVP_aes_192_ecb(void);
796const EVP_CIPHER *EVP_aes_192_cbc(void); 749const EVP_CIPHER *EVP_aes_192_cbc(void);
797const EVP_CIPHER *EVP_aes_192_cfb1(void); 750const EVP_CIPHER *EVP_aes_192_cfb1(void);
@@ -799,9 +752,9 @@ const EVP_CIPHER *EVP_aes_192_cfb8(void);
799const EVP_CIPHER *EVP_aes_192_cfb128(void); 752const EVP_CIPHER *EVP_aes_192_cfb128(void);
800# define EVP_aes_192_cfb EVP_aes_192_cfb128 753# define EVP_aes_192_cfb EVP_aes_192_cfb128
801const EVP_CIPHER *EVP_aes_192_ofb(void); 754const EVP_CIPHER *EVP_aes_192_ofb(void);
755#if 0
802const EVP_CIPHER *EVP_aes_192_ctr(void); 756const EVP_CIPHER *EVP_aes_192_ctr(void);
803const EVP_CIPHER *EVP_aes_192_gcm(void); 757#endif
804const EVP_CIPHER *EVP_aes_192_ccm(void);
805const EVP_CIPHER *EVP_aes_256_ecb(void); 758const EVP_CIPHER *EVP_aes_256_ecb(void);
806const EVP_CIPHER *EVP_aes_256_cbc(void); 759const EVP_CIPHER *EVP_aes_256_cbc(void);
807const EVP_CIPHER *EVP_aes_256_cfb1(void); 760const EVP_CIPHER *EVP_aes_256_cfb1(void);
@@ -809,15 +762,13 @@ const EVP_CIPHER *EVP_aes_256_cfb8(void);
809const EVP_CIPHER *EVP_aes_256_cfb128(void); 762const EVP_CIPHER *EVP_aes_256_cfb128(void);
810# define EVP_aes_256_cfb EVP_aes_256_cfb128 763# define EVP_aes_256_cfb EVP_aes_256_cfb128
811const EVP_CIPHER *EVP_aes_256_ofb(void); 764const EVP_CIPHER *EVP_aes_256_ofb(void);
765#if 0
812const EVP_CIPHER *EVP_aes_256_ctr(void); 766const EVP_CIPHER *EVP_aes_256_ctr(void);
813const EVP_CIPHER *EVP_aes_256_gcm(void);
814const EVP_CIPHER *EVP_aes_256_ccm(void);
815const EVP_CIPHER *EVP_aes_256_xts(void);
816#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
817const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
818const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
819#endif 767#endif
820#endif 768#endif
769#ifndef OPENSSL_NO_ACSS
770const EVP_CIPHER *EVP_acss(void);
771#endif
821#ifndef OPENSSL_NO_CAMELLIA 772#ifndef OPENSSL_NO_CAMELLIA
822const EVP_CIPHER *EVP_camellia_128_ecb(void); 773const EVP_CIPHER *EVP_camellia_128_ecb(void);
823const EVP_CIPHER *EVP_camellia_128_cbc(void); 774const EVP_CIPHER *EVP_camellia_128_cbc(void);
@@ -1100,22 +1051,13 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
1100#define EVP_PKEY_CTRL_CMS_DECRYPT 10 1051#define EVP_PKEY_CTRL_CMS_DECRYPT 10
1101#define EVP_PKEY_CTRL_CMS_SIGN 11 1052#define EVP_PKEY_CTRL_CMS_SIGN 11
1102 1053
1103#define EVP_PKEY_CTRL_CIPHER 12
1104
1105#define EVP_PKEY_ALG_CTRL 0x1000 1054#define EVP_PKEY_ALG_CTRL 0x1000
1106 1055
1107 1056
1108#define EVP_PKEY_FLAG_AUTOARGLEN 2 1057#define EVP_PKEY_FLAG_AUTOARGLEN 2
1109/* Method handles all operations: don't assume any digest related
1110 * defaults.
1111 */
1112#define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4
1113 1058
1114const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); 1059const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
1115EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); 1060EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags);
1116void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
1117 const EVP_PKEY_METHOD *meth);
1118void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
1119void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); 1061void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
1120int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); 1062int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
1121 1063
@@ -1133,7 +1075,7 @@ int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
1133void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); 1075void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);
1134 1076
1135EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, 1077EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
1136 const unsigned char *key, int keylen); 1078 unsigned char *key, int keylen);
1137 1079
1138void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); 1080void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
1139void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); 1081void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);
@@ -1252,13 +1194,9 @@ void ERR_load_EVP_strings(void);
1252/* Error codes for the EVP functions. */ 1194/* Error codes for the EVP functions. */
1253 1195
1254/* Function codes. */ 1196/* Function codes. */
1255#define EVP_F_AESNI_INIT_KEY 165 1197#define EVP_F_AESNI_INIT_KEY 165
1256#define EVP_F_AESNI_XTS_CIPHER 176
1257#define EVP_F_AES_INIT_KEY 133 1198#define EVP_F_AES_INIT_KEY 133
1258#define EVP_F_AES_XTS 172
1259#define EVP_F_AES_XTS_CIPHER 175
1260#define EVP_F_CAMELLIA_INIT_KEY 159 1199#define EVP_F_CAMELLIA_INIT_KEY 159
1261#define EVP_F_CMAC_INIT 173
1262#define EVP_F_D2I_PKEY 100 1200#define EVP_F_D2I_PKEY 100
1263#define EVP_F_DO_SIGVER_INIT 161 1201#define EVP_F_DO_SIGVER_INIT 161
1264#define EVP_F_DSAPKEY2PKCS8 134 1202#define EVP_F_DSAPKEY2PKCS8 134
@@ -1313,24 +1251,15 @@ void ERR_load_EVP_strings(void);
1313#define EVP_F_EVP_RIJNDAEL 126 1251#define EVP_F_EVP_RIJNDAEL 126
1314#define EVP_F_EVP_SIGNFINAL 107 1252#define EVP_F_EVP_SIGNFINAL 107
1315#define EVP_F_EVP_VERIFYFINAL 108 1253#define EVP_F_EVP_VERIFYFINAL 108
1316#define EVP_F_FIPS_CIPHERINIT 166
1317#define EVP_F_FIPS_CIPHER_CTX_COPY 170
1318#define EVP_F_FIPS_CIPHER_CTX_CTRL 167
1319#define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH 171
1320#define EVP_F_FIPS_DIGESTINIT 168
1321#define EVP_F_FIPS_MD_CTX_COPY 169
1322#define EVP_F_HMAC_INIT_EX 174
1323#define EVP_F_INT_CTX_NEW 157 1254#define EVP_F_INT_CTX_NEW 157
1324#define EVP_F_PKCS5_PBE_KEYIVGEN 117 1255#define EVP_F_PKCS5_PBE_KEYIVGEN 117
1325#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 1256#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
1326#define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164
1327#define EVP_F_PKCS8_SET_BROKEN 112 1257#define EVP_F_PKCS8_SET_BROKEN 112
1328#define EVP_F_PKEY_SET_TYPE 158 1258#define EVP_F_PKEY_SET_TYPE 158
1329#define EVP_F_RC2_MAGIC_TO_METH 109 1259#define EVP_F_RC2_MAGIC_TO_METH 109
1330#define EVP_F_RC5_CTRL 125 1260#define EVP_F_RC5_CTRL 125
1331 1261
1332/* Reason codes. */ 1262/* Reason codes. */
1333#define EVP_R_AES_IV_SETUP_FAILED 162
1334#define EVP_R_AES_KEY_SETUP_FAILED 143 1263#define EVP_R_AES_KEY_SETUP_FAILED 143
1335#define EVP_R_ASN1_LIB 140 1264#define EVP_R_ASN1_LIB 140
1336#define EVP_R_BAD_BLOCK_LENGTH 136 1265#define EVP_R_BAD_BLOCK_LENGTH 136
@@ -1348,7 +1277,6 @@ void ERR_load_EVP_strings(void);
1348#define EVP_R_DECODE_ERROR 114 1277#define EVP_R_DECODE_ERROR 114
1349#define EVP_R_DIFFERENT_KEY_TYPES 101 1278#define EVP_R_DIFFERENT_KEY_TYPES 101
1350#define EVP_R_DIFFERENT_PARAMETERS 153 1279#define EVP_R_DIFFERENT_PARAMETERS 153
1351#define EVP_R_DISABLED_FOR_FIPS 163
1352#define EVP_R_ENCODE_ERROR 115 1280#define EVP_R_ENCODE_ERROR 115
1353#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 1281#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119
1354#define EVP_R_EXPECTING_AN_RSA_KEY 127 1282#define EVP_R_EXPECTING_AN_RSA_KEY 127
@@ -1380,7 +1308,6 @@ void ERR_load_EVP_strings(void);
1380#define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 1308#define EVP_R_PRIVATE_KEY_DECODE_ERROR 145
1381#define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 1309#define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146
1382#define EVP_R_PUBLIC_KEY_NOT_RSA 106 1310#define EVP_R_PUBLIC_KEY_NOT_RSA 106
1383#define EVP_R_TOO_LARGE 164
1384#define EVP_R_UNKNOWN_CIPHER 160 1311#define EVP_R_UNKNOWN_CIPHER 160
1385#define EVP_R_UNKNOWN_DIGEST 161 1312#define EVP_R_UNKNOWN_DIGEST 161
1386#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 1313#define EVP_R_UNKNOWN_PBE_ALGORITHM 121