evp.h 73 KB

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