1 /* 2 * COPYRIGHT (c) International Business Machines Corp. 2001-2017 3 * 4 * This program is provided under the terms of the Common Public License, 5 * version 1.0 (CPL-1.0). Any use, reproduction or distribution for this 6 * software constitutes recipient's acceptance of CPL-1.0 terms which can be 7 * found in the file LICENSE file or at 8 * https://opensource.org/licenses/cpl1.0.php 9 */ 10 11 #ifndef __SW_CRYPT_H__ 12 #define __SW_CRYPT_H__ 13 14 #define sw_des3_cbc_encrypt(clear, len, cipher, len2, iv, key) \ 15 sw_des3_cbc(clear, len, cipher, len2, iv, key, 1) 16 17 #define sw_des3_cbc_decrypt(clear, len, cipher, len2, iv, key) \ 18 sw_des3_cbc(clear, len, cipher, len2, iv, key, 0) 19 20 CK_RV sw_des3_cbc(CK_BYTE *in_data, 21 CK_ULONG in_data_len, 22 CK_BYTE *out_data, 23 CK_ULONG *out_data_len, 24 CK_BYTE *init_v, CK_BYTE *key_value, CK_BYTE encrypt); 25 26 #define sw_aes_cbc_encrypt(clear, len, cipher, len2, iv, key, keylen) \ 27 sw_aes_cbc(clear, len, cipher, len2, iv, key, keylen, 1) 28 29 #define sw_aes_cbc_decrypt(clear, len, cipher, len2, iv, key, keylen) \ 30 sw_aes_cbc(clear, len, cipher, len2, iv, key, keylen, 0) 31 32 CK_RV sw_aes_cbc(CK_BYTE *in_data, 33 CK_ULONG in_data_len, 34 CK_BYTE *out_data, 35 CK_ULONG *out_data_len, 36 CK_BYTE *init_v, CK_BYTE *key_value, CK_ULONG keylen, 37 CK_BYTE encrypt); 38 39 #endif 40