evp.h 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597
  1. /*
  2. * Copyright 1995-2018 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. # ifndef OPENSSL_NO_ENGINE
  807. int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e);
  808. # endif
  809. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
  810. void *EVP_PKEY_get0(const EVP_PKEY *pkey);
  811. const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);
  812. # ifndef OPENSSL_NO_RSA
  813. struct rsa_st;
  814. int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key);
  815. struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
  816. struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
  817. # endif
  818. # ifndef OPENSSL_NO_DSA
  819. struct dsa_st;
  820. int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key);
  821. struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
  822. struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
  823. # endif
  824. # ifndef OPENSSL_NO_DH
  825. struct dh_st;
  826. int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key);
  827. struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey);
  828. struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
  829. # endif
  830. # ifndef OPENSSL_NO_EC
  831. struct ec_key_st;
  832. int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
  833. struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
  834. struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
  835. # endif
  836. EVP_PKEY *EVP_PKEY_new(void);
  837. int EVP_PKEY_up_ref(EVP_PKEY *pkey);
  838. void EVP_PKEY_free(EVP_PKEY *pkey);
  839. EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
  840. long length);
  841. int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
  842. EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
  843. long length);
  844. EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
  845. long length);
  846. int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
  847. int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
  848. int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
  849. int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode);
  850. int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
  851. int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
  852. int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
  853. int indent, ASN1_PCTX *pctx);
  854. int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
  855. int indent, ASN1_PCTX *pctx);
  856. int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
  857. int indent, ASN1_PCTX *pctx);
  858. int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
  859. int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey,
  860. const unsigned char *pt, size_t ptlen);
  861. size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt);
  862. int EVP_CIPHER_type(const EVP_CIPHER *ctx);
  863. /* calls methods */
  864. int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
  865. int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
  866. /* These are used by EVP_CIPHER methods */
  867. int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
  868. int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
  869. /* PKCS5 password based encryption */
  870. int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
  871. ASN1_TYPE *param, const EVP_CIPHER *cipher,
  872. const EVP_MD *md, int en_de);
  873. int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
  874. const unsigned char *salt, int saltlen, int iter,
  875. int keylen, unsigned char *out);
  876. int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
  877. const unsigned char *salt, int saltlen, int iter,
  878. const EVP_MD *digest, int keylen, unsigned char *out);
  879. int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
  880. ASN1_TYPE *param, const EVP_CIPHER *cipher,
  881. const EVP_MD *md, int en_de);
  882. #ifndef OPENSSL_NO_SCRYPT
  883. int EVP_PBE_scrypt(const char *pass, size_t passlen,
  884. const unsigned char *salt, size_t saltlen,
  885. uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
  886. unsigned char *key, size_t keylen);
  887. int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
  888. int passlen, ASN1_TYPE *param,
  889. const EVP_CIPHER *c, const EVP_MD *md, int en_de);
  890. #endif
  891. void PKCS5_PBE_add(void);
  892. int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
  893. ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
  894. /* PBE type */
  895. /* Can appear as the outermost AlgorithmIdentifier */
  896. # define EVP_PBE_TYPE_OUTER 0x0
  897. /* Is an PRF type OID */
  898. # define EVP_PBE_TYPE_PRF 0x1
  899. /* Is a PKCS#5 v2.0 KDF */
  900. # define EVP_PBE_TYPE_KDF 0x2
  901. int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
  902. int md_nid, EVP_PBE_KEYGEN *keygen);
  903. int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
  904. EVP_PBE_KEYGEN *keygen);
  905. int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
  906. EVP_PBE_KEYGEN **pkeygen);
  907. void EVP_PBE_cleanup(void);
  908. int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num);
  909. # define ASN1_PKEY_ALIAS 0x1
  910. # define ASN1_PKEY_DYNAMIC 0x2
  911. # define ASN1_PKEY_SIGPARAM_NULL 0x4
  912. # define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1
  913. # define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2
  914. # define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3
  915. # define ASN1_PKEY_CTRL_CMS_SIGN 0x5
  916. # define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7
  917. # define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8
  918. # define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9
  919. # define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa
  920. int EVP_PKEY_asn1_get_count(void);
  921. const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
  922. const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
  923. const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
  924. const char *str, int len);
  925. int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
  926. int EVP_PKEY_asn1_add_alias(int to, int from);
  927. int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,
  928. int *ppkey_flags, const char **pinfo,
  929. const char **ppem_str,
  930. const EVP_PKEY_ASN1_METHOD *ameth);
  931. const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey);
  932. EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
  933. const char *pem_str,
  934. const char *info);
  935. void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
  936. const EVP_PKEY_ASN1_METHOD *src);
  937. void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
  938. void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
  939. int (*pub_decode) (EVP_PKEY *pk,
  940. X509_PUBKEY *pub),
  941. int (*pub_encode) (X509_PUBKEY *pub,
  942. const EVP_PKEY *pk),
  943. int (*pub_cmp) (const EVP_PKEY *a,
  944. const EVP_PKEY *b),
  945. int (*pub_print) (BIO *out,
  946. const EVP_PKEY *pkey,
  947. int indent, ASN1_PCTX *pctx),
  948. int (*pkey_size) (const EVP_PKEY *pk),
  949. int (*pkey_bits) (const EVP_PKEY *pk));
  950. void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
  951. int (*priv_decode) (EVP_PKEY *pk,
  952. const PKCS8_PRIV_KEY_INFO
  953. *p8inf),
  954. int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,
  955. const EVP_PKEY *pk),
  956. int (*priv_print) (BIO *out,
  957. const EVP_PKEY *pkey,
  958. int indent,
  959. ASN1_PCTX *pctx));
  960. void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
  961. int (*param_decode) (EVP_PKEY *pkey,
  962. const unsigned char **pder,
  963. int derlen),
  964. int (*param_encode) (const EVP_PKEY *pkey,
  965. unsigned char **pder),
  966. int (*param_missing) (const EVP_PKEY *pk),
  967. int (*param_copy) (EVP_PKEY *to,
  968. const EVP_PKEY *from),
  969. int (*param_cmp) (const EVP_PKEY *a,
  970. const EVP_PKEY *b),
  971. int (*param_print) (BIO *out,
  972. const EVP_PKEY *pkey,
  973. int indent,
  974. ASN1_PCTX *pctx));
  975. void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
  976. void (*pkey_free) (EVP_PKEY *pkey));
  977. void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
  978. int (*pkey_ctrl) (EVP_PKEY *pkey, int op,
  979. long arg1, void *arg2));
  980. void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,
  981. int (*item_verify) (EVP_MD_CTX *ctx,
  982. const ASN1_ITEM *it,
  983. void *asn,
  984. X509_ALGOR *a,
  985. ASN1_BIT_STRING *sig,
  986. EVP_PKEY *pkey),
  987. int (*item_sign) (EVP_MD_CTX *ctx,
  988. const ASN1_ITEM *it,
  989. void *asn,
  990. X509_ALGOR *alg1,
  991. X509_ALGOR *alg2,
  992. ASN1_BIT_STRING *sig));
  993. void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
  994. int (*pkey_security_bits) (const EVP_PKEY
  995. *pk));
  996. # define EVP_PKEY_OP_UNDEFINED 0
  997. # define EVP_PKEY_OP_PARAMGEN (1<<1)
  998. # define EVP_PKEY_OP_KEYGEN (1<<2)
  999. # define EVP_PKEY_OP_SIGN (1<<3)
  1000. # define EVP_PKEY_OP_VERIFY (1<<4)
  1001. # define EVP_PKEY_OP_VERIFYRECOVER (1<<5)
  1002. # define EVP_PKEY_OP_SIGNCTX (1<<6)
  1003. # define EVP_PKEY_OP_VERIFYCTX (1<<7)
  1004. # define EVP_PKEY_OP_ENCRYPT (1<<8)
  1005. # define EVP_PKEY_OP_DECRYPT (1<<9)
  1006. # define EVP_PKEY_OP_DERIVE (1<<10)
  1007. # define EVP_PKEY_OP_TYPE_SIG \
  1008. (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
  1009. | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
  1010. # define EVP_PKEY_OP_TYPE_CRYPT \
  1011. (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
  1012. # define EVP_PKEY_OP_TYPE_NOGEN \
  1013. (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE)
  1014. # define EVP_PKEY_OP_TYPE_GEN \
  1015. (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
  1016. # define EVP_PKEY_CTX_set_signature_md(ctx, md) \
  1017. EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \
  1018. EVP_PKEY_CTRL_MD, 0, (void *)md)
  1019. # define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \
  1020. EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \
  1021. EVP_PKEY_CTRL_GET_MD, 0, (void *)pmd)
  1022. # define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \
  1023. EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \
  1024. EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)key)
  1025. # define EVP_PKEY_CTRL_MD 1
  1026. # define EVP_PKEY_CTRL_PEER_KEY 2
  1027. # define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3
  1028. # define EVP_PKEY_CTRL_PKCS7_DECRYPT 4
  1029. # define EVP_PKEY_CTRL_PKCS7_SIGN 5
  1030. # define EVP_PKEY_CTRL_SET_MAC_KEY 6
  1031. # define EVP_PKEY_CTRL_DIGESTINIT 7
  1032. /* Used by GOST key encryption in TLS */
  1033. # define EVP_PKEY_CTRL_SET_IV 8
  1034. # define EVP_PKEY_CTRL_CMS_ENCRYPT 9
  1035. # define EVP_PKEY_CTRL_CMS_DECRYPT 10
  1036. # define EVP_PKEY_CTRL_CMS_SIGN 11
  1037. # define EVP_PKEY_CTRL_CIPHER 12
  1038. # define EVP_PKEY_CTRL_GET_MD 13
  1039. # define EVP_PKEY_ALG_CTRL 0x1000
  1040. # define EVP_PKEY_FLAG_AUTOARGLEN 2
  1041. /*
  1042. * Method handles all operations: don't assume any digest related defaults.
  1043. */
  1044. # define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4
  1045. const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
  1046. EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
  1047. void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
  1048. const EVP_PKEY_METHOD *meth);
  1049. void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
  1050. void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
  1051. int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
  1052. EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
  1053. EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
  1054. EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
  1055. void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
  1056. int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
  1057. int cmd, int p1, void *p2);
  1058. int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
  1059. const char *value);
  1060. int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str);
  1061. int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex);
  1062. int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
  1063. void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);
  1064. EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
  1065. const unsigned char *key, int keylen);
  1066. void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
  1067. void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);
  1068. EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
  1069. EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
  1070. void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
  1071. void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
  1072. int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
  1073. int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
  1074. unsigned char *sig, size_t *siglen,
  1075. const unsigned char *tbs, size_t tbslen);
  1076. int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
  1077. int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
  1078. const unsigned char *sig, size_t siglen,
  1079. const unsigned char *tbs, size_t tbslen);
  1080. int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
  1081. int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
  1082. unsigned char *rout, size_t *routlen,
  1083. const unsigned char *sig, size_t siglen);
  1084. int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
  1085. int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
  1086. unsigned char *out, size_t *outlen,
  1087. const unsigned char *in, size_t inlen);
  1088. int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
  1089. int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
  1090. unsigned char *out, size_t *outlen,
  1091. const unsigned char *in, size_t inlen);
  1092. int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
  1093. int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
  1094. int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
  1095. typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
  1096. int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
  1097. int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
  1098. int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
  1099. int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
  1100. void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
  1101. EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
  1102. int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
  1103. void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
  1104. int (*init) (EVP_PKEY_CTX *ctx));
  1105. void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
  1106. int (*copy) (EVP_PKEY_CTX *dst,
  1107. EVP_PKEY_CTX *src));
  1108. void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
  1109. void (*cleanup) (EVP_PKEY_CTX *ctx));
  1110. void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
  1111. int (*paramgen_init) (EVP_PKEY_CTX *ctx),
  1112. int (*paramgen) (EVP_PKEY_CTX *ctx,
  1113. EVP_PKEY *pkey));
  1114. void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
  1115. int (*keygen_init) (EVP_PKEY_CTX *ctx),
  1116. int (*keygen) (EVP_PKEY_CTX *ctx,
  1117. EVP_PKEY *pkey));
  1118. void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
  1119. int (*sign_init) (EVP_PKEY_CTX *ctx),
  1120. int (*sign) (EVP_PKEY_CTX *ctx,
  1121. unsigned char *sig, size_t *siglen,
  1122. const unsigned char *tbs,
  1123. size_t tbslen));
  1124. void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
  1125. int (*verify_init) (EVP_PKEY_CTX *ctx),
  1126. int (*verify) (EVP_PKEY_CTX *ctx,
  1127. const unsigned char *sig,
  1128. size_t siglen,
  1129. const unsigned char *tbs,
  1130. size_t tbslen));
  1131. void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
  1132. int (*verify_recover_init) (EVP_PKEY_CTX
  1133. *ctx),
  1134. int (*verify_recover) (EVP_PKEY_CTX
  1135. *ctx,
  1136. unsigned char
  1137. *sig,
  1138. size_t *siglen,
  1139. const unsigned
  1140. char *tbs,
  1141. size_t tbslen));
  1142. void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
  1143. int (*signctx_init) (EVP_PKEY_CTX *ctx,
  1144. EVP_MD_CTX *mctx),
  1145. int (*signctx) (EVP_PKEY_CTX *ctx,
  1146. unsigned char *sig,
  1147. size_t *siglen,
  1148. EVP_MD_CTX *mctx));
  1149. void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
  1150. int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
  1151. EVP_MD_CTX *mctx),
  1152. int (*verifyctx) (EVP_PKEY_CTX *ctx,
  1153. const unsigned char *sig,
  1154. int siglen,
  1155. EVP_MD_CTX *mctx));
  1156. void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
  1157. int (*encrypt_init) (EVP_PKEY_CTX *ctx),
  1158. int (*encryptfn) (EVP_PKEY_CTX *ctx,
  1159. unsigned char *out,
  1160. size_t *outlen,
  1161. const unsigned char *in,
  1162. size_t inlen));
  1163. void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
  1164. int (*decrypt_init) (EVP_PKEY_CTX *ctx),
  1165. int (*decrypt) (EVP_PKEY_CTX *ctx,
  1166. unsigned char *out,
  1167. size_t *outlen,
  1168. const unsigned char *in,
  1169. size_t inlen));
  1170. void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
  1171. int (*derive_init) (EVP_PKEY_CTX *ctx),
  1172. int (*derive) (EVP_PKEY_CTX *ctx,
  1173. unsigned char *key,
  1174. size_t *keylen));
  1175. void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
  1176. int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
  1177. void *p2),
  1178. int (*ctrl_str) (EVP_PKEY_CTX *ctx,
  1179. const char *type,
  1180. const char *value));
  1181. void EVP_PKEY_meth_get_init(EVP_PKEY_METHOD *pmeth,
  1182. int (**pinit) (EVP_PKEY_CTX *ctx));
  1183. void EVP_PKEY_meth_get_copy(EVP_PKEY_METHOD *pmeth,
  1184. int (**pcopy) (EVP_PKEY_CTX *dst,
  1185. EVP_PKEY_CTX *src));
  1186. void EVP_PKEY_meth_get_cleanup(EVP_PKEY_METHOD *pmeth,
  1187. void (**pcleanup) (EVP_PKEY_CTX *ctx));
  1188. void EVP_PKEY_meth_get_paramgen(EVP_PKEY_METHOD *pmeth,
  1189. int (**pparamgen_init) (EVP_PKEY_CTX *ctx),
  1190. int (**pparamgen) (EVP_PKEY_CTX *ctx,
  1191. EVP_PKEY *pkey));
  1192. void EVP_PKEY_meth_get_keygen(EVP_PKEY_METHOD *pmeth,
  1193. int (**pkeygen_init) (EVP_PKEY_CTX *ctx),
  1194. int (**pkeygen) (EVP_PKEY_CTX *ctx,
  1195. EVP_PKEY *pkey));
  1196. void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth,
  1197. int (**psign_init) (EVP_PKEY_CTX *ctx),
  1198. int (**psign) (EVP_PKEY_CTX *ctx,
  1199. unsigned char *sig, size_t *siglen,
  1200. const unsigned char *tbs,
  1201. size_t tbslen));
  1202. void EVP_PKEY_meth_get_verify(EVP_PKEY_METHOD *pmeth,
  1203. int (**pverify_init) (EVP_PKEY_CTX *ctx),
  1204. int (**pverify) (EVP_PKEY_CTX *ctx,
  1205. const unsigned char *sig,
  1206. size_t siglen,
  1207. const unsigned char *tbs,
  1208. size_t tbslen));
  1209. void EVP_PKEY_meth_get_verify_recover(EVP_PKEY_METHOD *pmeth,
  1210. int (**pverify_recover_init) (EVP_PKEY_CTX
  1211. *ctx),
  1212. int (**pverify_recover) (EVP_PKEY_CTX
  1213. *ctx,
  1214. unsigned char
  1215. *sig,
  1216. size_t *siglen,
  1217. const unsigned
  1218. char *tbs,
  1219. size_t tbslen));
  1220. void EVP_PKEY_meth_get_signctx(EVP_PKEY_METHOD *pmeth,
  1221. int (**psignctx_init) (EVP_PKEY_CTX *ctx,
  1222. EVP_MD_CTX *mctx),
  1223. int (**psignctx) (EVP_PKEY_CTX *ctx,
  1224. unsigned char *sig,
  1225. size_t *siglen,
  1226. EVP_MD_CTX *mctx));
  1227. void EVP_PKEY_meth_get_verifyctx(EVP_PKEY_METHOD *pmeth,
  1228. int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,
  1229. EVP_MD_CTX *mctx),
  1230. int (**pverifyctx) (EVP_PKEY_CTX *ctx,
  1231. const unsigned char *sig,
  1232. int siglen,
  1233. EVP_MD_CTX *mctx));
  1234. void EVP_PKEY_meth_get_encrypt(EVP_PKEY_METHOD *pmeth,
  1235. int (**pencrypt_init) (EVP_PKEY_CTX *ctx),
  1236. int (**pencryptfn) (EVP_PKEY_CTX *ctx,
  1237. unsigned char *out,
  1238. size_t *outlen,
  1239. const unsigned char *in,
  1240. size_t inlen));
  1241. void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth,
  1242. int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
  1243. int (**pdecrypt) (EVP_PKEY_CTX *ctx,
  1244. unsigned char *out,
  1245. size_t *outlen,
  1246. const unsigned char *in,
  1247. size_t inlen));
  1248. void EVP_PKEY_meth_get_derive(EVP_PKEY_METHOD *pmeth,
  1249. int (**pderive_init) (EVP_PKEY_CTX *ctx),
  1250. int (**pderive) (EVP_PKEY_CTX *ctx,
  1251. unsigned char *key,
  1252. size_t *keylen));
  1253. void EVP_PKEY_meth_get_ctrl(EVP_PKEY_METHOD *pmeth,
  1254. int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
  1255. void *p2),
  1256. int (**pctrl_str) (EVP_PKEY_CTX *ctx,
  1257. const char *type,
  1258. const char *value));
  1259. void EVP_add_alg_module(void);
  1260. /* BEGIN ERROR CODES */
  1261. /*
  1262. * The following lines are auto generated by the script mkerr.pl. Any changes
  1263. * made after this point may be overwritten when the script is next run.
  1264. */
  1265. int ERR_load_EVP_strings(void);
  1266. /* Error codes for the EVP functions. */
  1267. /* Function codes. */
  1268. # define EVP_F_AESNI_INIT_KEY 165
  1269. # define EVP_F_AES_INIT_KEY 133
  1270. # define EVP_F_AES_OCB_CIPHER 169
  1271. # define EVP_F_AES_T4_INIT_KEY 178
  1272. # define EVP_F_AES_WRAP_CIPHER 170
  1273. # define EVP_F_ALG_MODULE_INIT 177
  1274. # define EVP_F_CAMELLIA_INIT_KEY 159
  1275. # define EVP_F_CHACHA20_POLY1305_CTRL 182
  1276. # define EVP_F_CMLL_T4_INIT_KEY 179
  1277. # define EVP_F_DES_EDE3_WRAP_CIPHER 171
  1278. # define EVP_F_DO_SIGVER_INIT 161
  1279. # define EVP_F_EVP_CIPHERINIT_EX 123
  1280. # define EVP_F_EVP_CIPHER_CTX_COPY 163
  1281. # define EVP_F_EVP_CIPHER_CTX_CTRL 124
  1282. # define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
  1283. # define EVP_F_EVP_DECRYPTFINAL_EX 101
  1284. # define EVP_F_EVP_DECRYPTUPDATE 166
  1285. # define EVP_F_EVP_DIGESTINIT_EX 128
  1286. # define EVP_F_EVP_ENCRYPTFINAL_EX 127
  1287. # define EVP_F_EVP_ENCRYPTUPDATE 167
  1288. # define EVP_F_EVP_MD_CTX_COPY_EX 110
  1289. # define EVP_F_EVP_MD_SIZE 162
  1290. # define EVP_F_EVP_OPENINIT 102
  1291. # define EVP_F_EVP_PBE_ALG_ADD 115
  1292. # define EVP_F_EVP_PBE_ALG_ADD_TYPE 160
  1293. # define EVP_F_EVP_PBE_CIPHERINIT 116
  1294. # define EVP_F_EVP_PBE_SCRYPT 181
  1295. # define EVP_F_EVP_PKCS82PKEY 111
  1296. # define EVP_F_EVP_PKEY2PKCS8 113
  1297. # define EVP_F_EVP_PKEY_ASN1_ADD0 168
  1298. # define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
  1299. # define EVP_F_EVP_PKEY_CTX_CTRL 137
  1300. # define EVP_F_EVP_PKEY_CTX_CTRL_STR 150
  1301. # define EVP_F_EVP_PKEY_CTX_DUP 156
  1302. # define EVP_F_EVP_PKEY_DECRYPT 104
  1303. # define EVP_F_EVP_PKEY_DECRYPT_INIT 138
  1304. # define EVP_F_EVP_PKEY_DECRYPT_OLD 151
  1305. # define EVP_F_EVP_PKEY_DERIVE 153
  1306. # define EVP_F_EVP_PKEY_DERIVE_INIT 154
  1307. # define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155
  1308. # define EVP_F_EVP_PKEY_ENCRYPT 105
  1309. # define EVP_F_EVP_PKEY_ENCRYPT_INIT 139
  1310. # define EVP_F_EVP_PKEY_ENCRYPT_OLD 152
  1311. # define EVP_F_EVP_PKEY_GET0_DH 119
  1312. # define EVP_F_EVP_PKEY_GET0_DSA 120
  1313. # define EVP_F_EVP_PKEY_GET0_EC_KEY 131
  1314. # define EVP_F_EVP_PKEY_GET0_HMAC 183
  1315. # define EVP_F_EVP_PKEY_GET0_RSA 121
  1316. # define EVP_F_EVP_PKEY_KEYGEN 146
  1317. # define EVP_F_EVP_PKEY_KEYGEN_INIT 147
  1318. # define EVP_F_EVP_PKEY_NEW 106
  1319. # define EVP_F_EVP_PKEY_PARAMGEN 148
  1320. # define EVP_F_EVP_PKEY_PARAMGEN_INIT 149
  1321. # define EVP_F_EVP_PKEY_SET1_ENGINE 187
  1322. # define EVP_F_EVP_PKEY_SIGN 140
  1323. # define EVP_F_EVP_PKEY_SIGN_INIT 141
  1324. # define EVP_F_EVP_PKEY_VERIFY 142
  1325. # define EVP_F_EVP_PKEY_VERIFY_INIT 143
  1326. # define EVP_F_EVP_PKEY_VERIFY_RECOVER 144
  1327. # define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145
  1328. # define EVP_F_EVP_SIGNFINAL 107
  1329. # define EVP_F_EVP_VERIFYFINAL 108
  1330. # define EVP_F_INT_CTX_NEW 157
  1331. # define EVP_F_PKCS5_PBE_KEYIVGEN 117
  1332. # define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
  1333. # define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164
  1334. # define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180
  1335. # define EVP_F_PKEY_SET_TYPE 158
  1336. # define EVP_F_RC2_MAGIC_TO_METH 109
  1337. # define EVP_F_RC5_CTRL 125
  1338. /* Reason codes. */
  1339. # define EVP_R_AES_KEY_SETUP_FAILED 143
  1340. # define EVP_R_BAD_DECRYPT 100
  1341. # define EVP_R_BUFFER_TOO_SMALL 155
  1342. # define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157
  1343. # define EVP_R_CIPHER_PARAMETER_ERROR 122
  1344. # define EVP_R_COMMAND_NOT_SUPPORTED 147
  1345. # define EVP_R_COPY_ERROR 173
  1346. # define EVP_R_CTRL_NOT_IMPLEMENTED 132
  1347. # define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
  1348. # define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138
  1349. # define EVP_R_DECODE_ERROR 114
  1350. # define EVP_R_DIFFERENT_KEY_TYPES 101
  1351. # define EVP_R_DIFFERENT_PARAMETERS 153
  1352. # define EVP_R_ERROR_LOADING_SECTION 165
  1353. # define EVP_R_ERROR_SETTING_FIPS_MODE 166
  1354. # define EVP_R_EXPECTING_AN_HMAC_KEY 174
  1355. # define EVP_R_EXPECTING_AN_RSA_KEY 127
  1356. # define EVP_R_EXPECTING_A_DH_KEY 128
  1357. # define EVP_R_EXPECTING_A_DSA_KEY 129
  1358. # define EVP_R_EXPECTING_A_EC_KEY 142
  1359. # define EVP_R_FIPS_MODE_NOT_SUPPORTED 167
  1360. # define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171
  1361. # define EVP_R_INITIALIZATION_ERROR 134
  1362. # define EVP_R_INPUT_NOT_INITIALIZED 111
  1363. # define EVP_R_INVALID_DIGEST 152
  1364. # define EVP_R_INVALID_FIPS_MODE 168
  1365. # define EVP_R_INVALID_KEY 163
  1366. # define EVP_R_INVALID_KEY_LENGTH 130
  1367. # define EVP_R_INVALID_OPERATION 148
  1368. # define EVP_R_KEYGEN_FAILURE 120
  1369. # define EVP_R_MEMORY_LIMIT_EXCEEDED 172
  1370. # define EVP_R_MESSAGE_DIGEST_IS_NULL 159
  1371. # define EVP_R_METHOD_NOT_SUPPORTED 144
  1372. # define EVP_R_MISSING_PARAMETERS 103
  1373. # define EVP_R_NO_CIPHER_SET 131
  1374. # define EVP_R_NO_DEFAULT_DIGEST 158
  1375. # define EVP_R_NO_DIGEST_SET 139
  1376. # define EVP_R_NO_KEY_SET 154
  1377. # define EVP_R_NO_OPERATION_SET 149
  1378. # define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150
  1379. # define EVP_R_OPERATON_NOT_INITIALIZED 151
  1380. # define EVP_R_PARTIALLY_OVERLAPPING 162
  1381. # define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 175
  1382. # define EVP_R_PKEY_ASN1_METHOD_ALREADY_REGISTERED 164
  1383. # define EVP_R_PRIVATE_KEY_DECODE_ERROR 145
  1384. # define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146
  1385. # define EVP_R_PUBLIC_KEY_NOT_RSA 106
  1386. # define EVP_R_UNKNOWN_CIPHER 160
  1387. # define EVP_R_UNKNOWN_DIGEST 161
  1388. # define EVP_R_UNKNOWN_OPTION 169
  1389. # define EVP_R_UNKNOWN_PBE_ALGORITHM 121
  1390. # define EVP_R_UNSUPPORTED_ALGORITHM 156
  1391. # define EVP_R_UNSUPPORTED_CIPHER 107
  1392. # define EVP_R_UNSUPPORTED_KEYLENGTH 123
  1393. # define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124
  1394. # define EVP_R_UNSUPPORTED_KEY_SIZE 108
  1395. # define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135
  1396. # define EVP_R_UNSUPPORTED_PRF 125
  1397. # define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118
  1398. # define EVP_R_UNSUPPORTED_SALT_TYPE 126
  1399. # define EVP_R_WRAP_MODE_NOT_ALLOWED 170
  1400. # define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
  1401. # ifdef __cplusplus
  1402. }
  1403. # endif
  1404. #endif