evp.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. /*
  2. * Copyright 2015-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. #include <openssl/evp.h>
  10. #include "internal/refcount.h"
  11. /*
  12. * Don't free up md_ctx->pctx in EVP_MD_CTX_reset, use the reserved flag
  13. * values in evp.h
  14. */
  15. #define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX 0x0400
  16. struct evp_pkey_ctx_st {
  17. /* Method associated with this operation */
  18. const EVP_PKEY_METHOD *pmeth;
  19. /* Engine that implements this method or NULL if builtin */
  20. ENGINE *engine;
  21. /* Key: may be NULL */
  22. EVP_PKEY *pkey;
  23. /* Peer key for key agreement, may be NULL */
  24. EVP_PKEY *peerkey;
  25. /* Actual operation */
  26. int operation;
  27. /* Algorithm specific data */
  28. void *data;
  29. /* Application specific data */
  30. void *app_data;
  31. /* Keygen callback */
  32. EVP_PKEY_gen_cb *pkey_gencb;
  33. /* implementation specific keygen data */
  34. int *keygen_info;
  35. int keygen_info_count;
  36. } /* EVP_PKEY_CTX */ ;
  37. #define EVP_PKEY_FLAG_DYNAMIC 1
  38. struct evp_pkey_method_st {
  39. int pkey_id;
  40. int flags;
  41. int (*init) (EVP_PKEY_CTX *ctx);
  42. int (*copy) (EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src);
  43. void (*cleanup) (EVP_PKEY_CTX *ctx);
  44. int (*paramgen_init) (EVP_PKEY_CTX *ctx);
  45. int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
  46. int (*keygen_init) (EVP_PKEY_CTX *ctx);
  47. int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
  48. int (*sign_init) (EVP_PKEY_CTX *ctx);
  49. int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
  50. const unsigned char *tbs, size_t tbslen);
  51. int (*verify_init) (EVP_PKEY_CTX *ctx);
  52. int (*verify) (EVP_PKEY_CTX *ctx,
  53. const unsigned char *sig, size_t siglen,
  54. const unsigned char *tbs, size_t tbslen);
  55. int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
  56. int (*verify_recover) (EVP_PKEY_CTX *ctx,
  57. unsigned char *rout, size_t *routlen,
  58. const unsigned char *sig, size_t siglen);
  59. int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
  60. int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
  61. EVP_MD_CTX *mctx);
  62. int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
  63. int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
  64. EVP_MD_CTX *mctx);
  65. int (*encrypt_init) (EVP_PKEY_CTX *ctx);
  66. int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
  67. const unsigned char *in, size_t inlen);
  68. int (*decrypt_init) (EVP_PKEY_CTX *ctx);
  69. int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
  70. const unsigned char *in, size_t inlen);
  71. int (*derive_init) (EVP_PKEY_CTX *ctx);
  72. int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
  73. int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
  74. int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
  75. int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
  76. const unsigned char *tbs, size_t tbslen);
  77. int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
  78. size_t siglen, const unsigned char *tbs,
  79. size_t tbslen);
  80. int (*check) (EVP_PKEY *pkey);
  81. int (*public_check) (EVP_PKEY *pkey);
  82. int (*param_check) (EVP_PKEY *pkey);
  83. int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
  84. } /* EVP_PKEY_METHOD */ ;
  85. DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD)
  86. void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
  87. extern const EVP_PKEY_METHOD cmac_pkey_meth;
  88. extern const EVP_PKEY_METHOD dh_pkey_meth;
  89. extern const EVP_PKEY_METHOD dhx_pkey_meth;
  90. extern const EVP_PKEY_METHOD dsa_pkey_meth;
  91. extern const EVP_PKEY_METHOD ec_pkey_meth;
  92. extern const EVP_PKEY_METHOD sm2_pkey_meth;
  93. extern const EVP_PKEY_METHOD ecx25519_pkey_meth;
  94. extern const EVP_PKEY_METHOD ecx448_pkey_meth;
  95. extern const EVP_PKEY_METHOD ed25519_pkey_meth;
  96. extern const EVP_PKEY_METHOD ed448_pkey_meth;
  97. extern const EVP_PKEY_METHOD hmac_pkey_meth;
  98. extern const EVP_PKEY_METHOD rsa_pkey_meth;
  99. extern const EVP_PKEY_METHOD rsa_pss_pkey_meth;
  100. extern const EVP_PKEY_METHOD scrypt_pkey_meth;
  101. extern const EVP_PKEY_METHOD tls1_prf_pkey_meth;
  102. extern const EVP_PKEY_METHOD hkdf_pkey_meth;
  103. extern const EVP_PKEY_METHOD poly1305_pkey_meth;
  104. extern const EVP_PKEY_METHOD siphash_pkey_meth;
  105. struct evp_md_st {
  106. int type;
  107. int pkey_type;
  108. int md_size;
  109. unsigned long flags;
  110. int (*init) (EVP_MD_CTX *ctx);
  111. int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count);
  112. int (*final) (EVP_MD_CTX *ctx, unsigned char *md);
  113. int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from);
  114. int (*cleanup) (EVP_MD_CTX *ctx);
  115. int block_size;
  116. int ctx_size; /* how big does the ctx->md_data need to be */
  117. /* control function */
  118. int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
  119. } /* EVP_MD */ ;
  120. struct evp_cipher_st {
  121. int nid;
  122. int block_size;
  123. /* Default value for variable length ciphers */
  124. int key_len;
  125. int iv_len;
  126. /* Various flags */
  127. unsigned long flags;
  128. /* init key */
  129. int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key,
  130. const unsigned char *iv, int enc);
  131. /* encrypt/decrypt data */
  132. int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out,
  133. const unsigned char *in, size_t inl);
  134. /* cleanup ctx */
  135. int (*cleanup) (EVP_CIPHER_CTX *);
  136. /* how big ctx->cipher_data needs to be */
  137. int ctx_size;
  138. /* Populate a ASN1_TYPE with parameters */
  139. int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
  140. /* Get parameters from a ASN1_TYPE */
  141. int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *);
  142. /* Miscellaneous operations */
  143. int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr);
  144. /* Application data */
  145. void *app_data;
  146. } /* EVP_CIPHER */ ;
  147. /* Macros to code block cipher wrappers */
  148. /* Wrapper functions for each cipher mode */
  149. #define EVP_C_DATA(kstruct, ctx) \
  150. ((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx))
  151. #define BLOCK_CIPHER_ecb_loop() \
  152. size_t i, bl; \
  153. bl = EVP_CIPHER_CTX_cipher(ctx)->block_size; \
  154. if (inl < bl) return 1;\
  155. inl -= bl; \
  156. for (i=0; i <= inl; i+=bl)
  157. #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
  158. static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
  159. {\
  160. BLOCK_CIPHER_ecb_loop() \
  161. cprefix##_ecb_encrypt(in + i, out + i, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_encrypting(ctx)); \
  162. return 1;\
  163. }
  164. #define EVP_MAXCHUNK ((size_t)1<<(sizeof(long)*8-2))
  165. #define BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched) \
  166. static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
  167. {\
  168. while(inl>=EVP_MAXCHUNK) {\
  169. int num = EVP_CIPHER_CTX_num(ctx);\
  170. cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num); \
  171. EVP_CIPHER_CTX_set_num(ctx, num);\
  172. inl-=EVP_MAXCHUNK;\
  173. in +=EVP_MAXCHUNK;\
  174. out+=EVP_MAXCHUNK;\
  175. }\
  176. if (inl) {\
  177. int num = EVP_CIPHER_CTX_num(ctx);\
  178. cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num); \
  179. EVP_CIPHER_CTX_set_num(ctx, num);\
  180. }\
  181. return 1;\
  182. }
  183. #define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
  184. static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
  185. {\
  186. while(inl>=EVP_MAXCHUNK) \
  187. {\
  188. cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));\
  189. inl-=EVP_MAXCHUNK;\
  190. in +=EVP_MAXCHUNK;\
  191. out+=EVP_MAXCHUNK;\
  192. }\
  193. if (inl)\
  194. cprefix##_cbc_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx));\
  195. return 1;\
  196. }
  197. #define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
  198. static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
  199. {\
  200. size_t chunk = EVP_MAXCHUNK;\
  201. if (cbits == 1) chunk >>= 3;\
  202. if (inl < chunk) chunk = inl;\
  203. while (inl && inl >= chunk)\
  204. {\
  205. int num = EVP_CIPHER_CTX_num(ctx);\
  206. cprefix##_cfb##cbits##_encrypt(in, out, (long) \
  207. ((cbits == 1) \
  208. && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
  209. ? chunk*8 : chunk), \
  210. &EVP_C_DATA(kstruct, ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx),\
  211. &num, EVP_CIPHER_CTX_encrypting(ctx));\
  212. EVP_CIPHER_CTX_set_num(ctx, num);\
  213. inl -= chunk;\
  214. in += chunk;\
  215. out += chunk;\
  216. if (inl < chunk) chunk = inl;\
  217. }\
  218. return 1;\
  219. }
  220. #define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
  221. BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
  222. BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
  223. BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
  224. BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)
  225. #define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
  226. key_len, iv_len, flags, init_key, cleanup, \
  227. set_asn1, get_asn1, ctrl) \
  228. static const EVP_CIPHER cname##_##mode = { \
  229. nid##_##nmode, block_size, key_len, iv_len, \
  230. flags | EVP_CIPH_##MODE##_MODE, \
  231. init_key, \
  232. cname##_##mode##_cipher, \
  233. cleanup, \
  234. sizeof(kstruct), \
  235. set_asn1, get_asn1,\
  236. ctrl, \
  237. NULL \
  238. }; \
  239. const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
  240. #define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
  241. iv_len, flags, init_key, cleanup, set_asn1, \
  242. get_asn1, ctrl) \
  243. BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
  244. iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
  245. #define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \
  246. iv_len, cbits, flags, init_key, cleanup, \
  247. set_asn1, get_asn1, ctrl) \
  248. BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
  249. key_len, iv_len, flags, init_key, cleanup, set_asn1, \
  250. get_asn1, ctrl)
  251. #define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \
  252. iv_len, cbits, flags, init_key, cleanup, \
  253. set_asn1, get_asn1, ctrl) \
  254. BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \
  255. key_len, iv_len, flags, init_key, cleanup, set_asn1, \
  256. get_asn1, ctrl)
  257. #define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
  258. flags, init_key, cleanup, set_asn1, \
  259. get_asn1, ctrl) \
  260. BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
  261. 0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
  262. #define BLOCK_CIPHER_defs(cname, kstruct, \
  263. nid, block_size, key_len, iv_len, cbits, flags, \
  264. init_key, cleanup, set_asn1, get_asn1, ctrl) \
  265. BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
  266. init_key, cleanup, set_asn1, get_asn1, ctrl) \
  267. BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
  268. flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
  269. BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
  270. flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
  271. BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
  272. init_key, cleanup, set_asn1, get_asn1, ctrl)
  273. /*-
  274. #define BLOCK_CIPHER_defs(cname, kstruct, \
  275. nid, block_size, key_len, iv_len, flags,\
  276. init_key, cleanup, set_asn1, get_asn1, ctrl)\
  277. static const EVP_CIPHER cname##_cbc = {\
  278. nid##_cbc, block_size, key_len, iv_len, \
  279. flags | EVP_CIPH_CBC_MODE,\
  280. init_key,\
  281. cname##_cbc_cipher,\
  282. cleanup,\
  283. sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
  284. sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
  285. set_asn1, get_asn1,\
  286. ctrl, \
  287. NULL \
  288. };\
  289. const EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\
  290. static const EVP_CIPHER cname##_cfb = {\
  291. nid##_cfb64, 1, key_len, iv_len, \
  292. flags | EVP_CIPH_CFB_MODE,\
  293. init_key,\
  294. cname##_cfb_cipher,\
  295. cleanup,\
  296. sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
  297. sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
  298. set_asn1, get_asn1,\
  299. ctrl,\
  300. NULL \
  301. };\
  302. const EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\
  303. static const EVP_CIPHER cname##_ofb = {\
  304. nid##_ofb64, 1, key_len, iv_len, \
  305. flags | EVP_CIPH_OFB_MODE,\
  306. init_key,\
  307. cname##_ofb_cipher,\
  308. cleanup,\
  309. sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
  310. sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
  311. set_asn1, get_asn1,\
  312. ctrl,\
  313. NULL \
  314. };\
  315. const EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\
  316. static const EVP_CIPHER cname##_ecb = {\
  317. nid##_ecb, block_size, key_len, iv_len, \
  318. flags | EVP_CIPH_ECB_MODE,\
  319. init_key,\
  320. cname##_ecb_cipher,\
  321. cleanup,\
  322. sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
  323. sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
  324. set_asn1, get_asn1,\
  325. ctrl,\
  326. NULL \
  327. };\
  328. const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
  329. */
  330. #define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
  331. block_size, key_len, iv_len, cbits, \
  332. flags, init_key, \
  333. cleanup, set_asn1, get_asn1, ctrl) \
  334. BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
  335. BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
  336. cbits, flags, init_key, cleanup, set_asn1, \
  337. get_asn1, ctrl)
  338. #define IMPLEMENT_CFBR(cipher,cprefix,kstruct,ksched,keysize,cbits,iv_len,fl) \
  339. BLOCK_CIPHER_func_cfb(cipher##_##keysize,cprefix,cbits,kstruct,ksched) \
  340. BLOCK_CIPHER_def_cfb(cipher##_##keysize,kstruct, \
  341. NID_##cipher##_##keysize, keysize/8, iv_len, cbits, \
  342. (fl)|EVP_CIPH_FLAG_DEFAULT_ASN1, \
  343. cipher##_init_key, NULL, NULL, NULL, NULL)
  344. # ifndef OPENSSL_NO_EC
  345. #define X25519_KEYLEN 32
  346. #define X448_KEYLEN 56
  347. #define ED448_KEYLEN 57
  348. #define MAX_KEYLEN ED448_KEYLEN
  349. typedef struct {
  350. unsigned char pubkey[MAX_KEYLEN];
  351. unsigned char *privkey;
  352. } ECX_KEY;
  353. #endif
  354. /*
  355. * Type needs to be a bit field Sub-type needs to be for variations on the
  356. * method, as in, can it do arbitrary encryption....
  357. */
  358. struct evp_pkey_st {
  359. int type;
  360. int save_type;
  361. CRYPTO_REF_COUNT references;
  362. const EVP_PKEY_ASN1_METHOD *ameth;
  363. ENGINE *engine;
  364. ENGINE *pmeth_engine; /* If not NULL public key ENGINE to use */
  365. union {
  366. void *ptr;
  367. # ifndef OPENSSL_NO_RSA
  368. struct rsa_st *rsa; /* RSA */
  369. # endif
  370. # ifndef OPENSSL_NO_DSA
  371. struct dsa_st *dsa; /* DSA */
  372. # endif
  373. # ifndef OPENSSL_NO_DH
  374. struct dh_st *dh; /* DH */
  375. # endif
  376. # ifndef OPENSSL_NO_EC
  377. struct ec_key_st *ec; /* ECC */
  378. ECX_KEY *ecx; /* X25519, X448, Ed25519, Ed448 */
  379. # endif
  380. } pkey;
  381. int save_parameters;
  382. STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
  383. CRYPTO_RWLOCK *lock;
  384. } /* EVP_PKEY */ ;
  385. void openssl_add_all_ciphers_int(void);
  386. void openssl_add_all_digests_int(void);
  387. void evp_cleanup_int(void);
  388. void evp_app_cleanup_int(void);
  389. /* Pulling defines out of C source files */
  390. #define EVP_RC4_KEY_SIZE 16
  391. #ifndef TLS1_1_VERSION
  392. # define TLS1_1_VERSION 0x0302
  393. #endif
  394. void evp_encode_ctx_set_flags(EVP_ENCODE_CTX *ctx, unsigned int flags);
  395. /* EVP_ENCODE_CTX flags */
  396. /* Don't generate new lines when encoding */
  397. #define EVP_ENCODE_CTX_NO_NEWLINES 1
  398. /* Use the SRP base64 alphabet instead of the standard one */
  399. #define EVP_ENCODE_CTX_USE_SRP_ALPHABET 2