]> git.saurik.com Git - apple/security.git/blob - SecurityTests/cspxutils/utilLib/ssleayUtils.h
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / cspxutils / utilLib / ssleayUtils.h
1 /*
2 * ssleayUtils.h - common routines for CDSA/openssl compatibility testing
3 */
4
5 /*
6 * Clients of this module do not need to know about or see anything from the
7 * libcrypt headers.
8 */
9 #ifndef _SSLEAY_UTILS_H_
10 #define _SSLEAY_UTILS_H_
11 #include <Security/cssmtype.h>
12
13 typedef void *EAY_KEY;
14
15 /*
16 * Create a symmetric key.
17 */
18 CSSM_RETURN eayGenSymKey(
19 CSSM_ALGORITHMS alg,
20 CSSM_BOOL forEncr,
21 const CSSM_DATA *keyData,
22 EAY_KEY *key); // RETURNED
23
24 /*
25 * Free a key created in eayGenSymKey
26 */
27 CSSM_RETURN eayFreeKey(
28 EAY_KEY key);
29
30 /*
31 * encrypt/decrypt
32 */
33 CSSM_RETURN eayEncryptDecrypt(
34 EAY_KEY key,
35 CSSM_BOOL forEncrypt,
36 CSSM_ALGORITHMS encrAlg,
37 CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC ONLY!
38 const CSSM_DATA *iv, //ĂŠoptional per mode
39 const CSSM_DATA *inData,
40 CSSM_DATA_PTR outData); // mallocd and RETURNED
41
42 /*** EVP-based encrypt/decrypt ***/
43
44 int evpEncryptDecrypt(
45 CSSM_ALGORITHMS alg, // AES 128 only for now
46 CSSM_BOOL forEncr,
47 const CSSM_DATA *keyData, // may be larger than the key size we use
48 unsigned keyLengthInBits,
49 CSSM_ENCRYPT_MODE mode, // CSSM_ALGMODE_CBC_IV8, ECB, always padding
50 const CSSM_DATA *iv, // optional per mode
51 const CSSM_DATA *inData,
52 CSSM_DATA_PTR outData); // CSSM_MALLOCd and RETURNED
53
54 #endif /* _EAY_UTILS_H_ */