Home | History | Annotate | Line # | Download | only in hcrypto
      1 /*	$NetBSD: evp-pkcs11.h,v 1.3 2023/06/19 21:41:43 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2015, Secure Endpoints Inc.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  *
     11  * - Redistributions of source code must retain the above copyright
     12  *   notice, this list of conditions and the following disclaimer.
     13  *
     14  * - Redistributions in binary form must reproduce the above copyright
     15  *   notice, this list of conditions and the following disclaimer in
     16  *   the documentation and/or other materials provided with the
     17  *   distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     24  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     25  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     26  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     28  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
     30  * OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 /* Id */
     34 
     35 #ifndef HEIM_EVP_PKCS11_H
     36 #define HEIM_EVP_PKCS11_H 1
     37 
     38 /* symbol renaming */
     39 
     40 #define EVP_pkcs11_md4() hc_EVP_pkcs11_md4()
     41 #define EVP_pkcs11_md5() hc_EVP_pkcs11_md5()
     42 #define EVP_pkcs11_sha1() hc_EVP_pkcs11_sha1()
     43 #define EVP_pkcs11_sha256() hc_EVP_pkcs11_sha256()
     44 #define EVP_pkcs11_sha384() hc_EVP_pkcs11_sha384()
     45 #define EVP_pkcs11_sha512() hc_EVP_pkcs11_sha512()
     46 #define EVP_pkcs11_des_cbc() hc_EVP_pkcs11_des_cbc()
     47 #define EVP_pkcs11_des_ede3_cbc() hc_EVP_pkcs11_des_ede3_cbc()
     48 #define EVP_pkcs11_aes_128_cbc() hc_EVP_pkcs11_aes_128_cbc()
     49 #define EVP_pkcs11_aes_192_cbc() hc_EVP_pkcs11_aes_192_cbc()
     50 #define EVP_pkcs11_aes_256_cbc() hc_EVP_pkcs11_aes_256_cbc()
     51 #define EVP_pkcs11_aes_128_cfb8() hc_EVP_pkcs11_aes_128_cfb8()
     52 #define EVP_pkcs11_aes_192_cfb8() hc_EVP_pkcs11_aes_192_cfb8()
     53 #define EVP_pkcs11_aes_256_cfb8() hc_EVP_pkcs11_aes_256_cfb8()
     54 #define EVP_pkcs11_rc4() hc_EVP_pkcs11_rc4()
     55 #define EVP_pkcs11_rc4_40() hc_EVP_pkcs11_rc4_40()
     56 #define EVP_pkcs11_rc2_40_cbc() hc_EVP_pkcs11_rc2_40_cbc()
     57 #define EVP_pkcs11_rc2_64_cbc() hc_EVP_pkcs11_rc2_64_cbc()
     58 #define EVP_pkcs11_rc2_cbc() hc_EVP_pkcs11_rc2_cbc()
     59 #define EVP_pkcs11_camellia_128_cbc() hc_EVP_pkcs11_camellia_128_cbc()
     60 #define EVP_pkcs11_camellia_192_cbc() hc_EVP_pkcs11_camellia_192_cbc()
     61 #define EVP_pkcs11_camellia_256_cbc() hc_EVP_pkcs11_camellia_256_cbc()
     62 
     63 #define EVP_pkcs11_hcrypto_md4() hc_EVP_pkcs11_hcrypto_md4()
     64 #define EVP_pkcs11_hcrypto_md5() hc_EVP_pkcs11_hcrypto_md5()
     65 #define EVP_pkcs11_hcrypto_sha1() hc_EVP_pkcs11_hcrypto_sha1()
     66 #define EVP_pkcs11_hcrypto_sha256() hc_EVP_pkcs11_hcrypto_sha256()
     67 #define EVP_pkcs11_hcrypto_sha384() hc_EVP_pkcs11_hcrypto_sha384()
     68 #define EVP_pkcs11_hcrypto_sha512() hc_EVP_pkcs11_hcrypto_sha512()
     69 #define EVP_pkcs11_hcrypto_des_cbc() hc_EVP_pkcs11_hcrypto_des_cbc()
     70 #define EVP_pkcs11_hcrypto_des_ede3_cbc() hc_EVP_pkcs11_hcrypto_des_ede3_cbc()
     71 #define EVP_pkcs11_hcrypto_aes_128_cbc() hc_EVP_pkcs11_hcrypto_aes_128_cbc()
     72 #define EVP_pkcs11_hcrypto_aes_192_cbc() hc_EVP_pkcs11_hcrypto_aes_192_cbc()
     73 #define EVP_pkcs11_hcrypto_aes_256_cbc() hc_EVP_pkcs11_hcrypto_aes_256_cbc()
     74 #define EVP_pkcs11_hcrypto_aes_128_cfb8() hc_EVP_pkcs11_hcrypto_aes_128_cfb8()
     75 #define EVP_pkcs11_hcrypto_aes_192_cfb8() hc_EVP_pkcs11_hcrypto_aes_192_cfb8()
     76 #define EVP_pkcs11_hcrypto_aes_256_cfb8() hc_EVP_pkcs11_hcrypto_aes_256_cfb8()
     77 #define EVP_pkcs11_hcrypto_rc4() hc_EVP_pkcs11_hcrypto_rc4()
     78 #define EVP_pkcs11_hcrypto_rc4_40() hc_EVP_pkcs11_hcrypto_rc4_40()
     79 #define EVP_pkcs11_hcrypto_rc2_40_cbc() hc_EVP_pkcs11_hcrypto_rc2_40_cbc()
     80 #define EVP_pkcs11_hcrypto_rc2_64_cbc() hc_EVP_pkcs11_hcrypto_rc2_64_cbc()
     81 #define EVP_pkcs11_hcrypto_rc2_cbc() hc_EVP_pkcs11_hcrypto_rc2_cbc()
     82 #define EVP_pkcs11_hcrypto_camellia_128_cbc() hc_EVP_pkcs11_hcrypto_camellia_128_cbc()
     83 #define EVP_pkcs11_hcrypto_camellia_192_cbc() hc_EVP_pkcs11_hcrypto_camellia_192_cbc()
     84 #define EVP_pkcs11_hcrypto_camellia_256_cbc() hc_EVP_pkcs11_hcrypto_camellia_256_cbc()
     85 
     86 HC_CPP_BEGIN
     87 
     88 /*
     89  * Strict PKCS#11 implementations (these will return NULL if the underlying
     90  * PKCS#11 implementation does not implement the cipher or hash).
     91  */
     92 const EVP_MD * hc_EVP_pkcs11_md4(void);
     93 const EVP_MD * hc_EVP_pkcs11_md5(void);
     94 const EVP_MD * hc_EVP_pkcs11_sha1(void);
     95 const EVP_MD * hc_EVP_pkcs11_sha256(void);
     96 const EVP_MD * hc_EVP_pkcs11_sha384(void);
     97 const EVP_MD * hc_EVP_pkcs11_sha512(void);
     98 
     99 const EVP_CIPHER * hc_EVP_pkcs11_rc2_cbc(void);
    100 const EVP_CIPHER * hc_EVP_pkcs11_rc2_40_cbc(void);
    101 const EVP_CIPHER * hc_EVP_pkcs11_rc2_64_cbc(void);
    102 
    103 const EVP_CIPHER * hc_EVP_pkcs11_rc4(void);
    104 const EVP_CIPHER * hc_EVP_pkcs11_rc4_40(void);
    105 
    106 const EVP_CIPHER * hc_EVP_pkcs11_des_cbc(void);
    107 const EVP_CIPHER * hc_EVP_pkcs11_des_ede3_cbc(void);
    108 
    109 const EVP_CIPHER * hc_EVP_pkcs11_aes_128_cbc(void);
    110 const EVP_CIPHER * hc_EVP_pkcs11_aes_192_cbc(void);
    111 const EVP_CIPHER * hc_EVP_pkcs11_aes_256_cbc(void);
    112 
    113 const EVP_CIPHER * hc_EVP_pkcs11_aes_128_cfb8(void);
    114 const EVP_CIPHER * hc_EVP_pkcs11_aes_192_cfb8(void);
    115 const EVP_CIPHER * hc_EVP_pkcs11_aes_256_cfb8(void);
    116 
    117 const EVP_CIPHER * hc_EVP_pkcs11_camellia_128_cbc(void);
    118 const EVP_CIPHER * hc_EVP_pkcs11_camellia_192_cbc(void);
    119 const EVP_CIPHER * hc_EVP_pkcs11_camellia_256_cbc(void);
    120 
    121 /*
    122  * PKCS#11 implementations with fallback to hcrypto.
    123  */
    124 const EVP_MD * hc_EVP_pkcs11_hcrypto_md4(void);
    125 const EVP_MD * hc_EVP_pkcs11_hcrypto_md5(void);
    126 const EVP_MD * hc_EVP_pkcs11_hcrypto_sha1(void);
    127 const EVP_MD * hc_EVP_pkcs11_hcrypto_sha256(void);
    128 const EVP_MD * hc_EVP_pkcs11_hcrypto_sha384(void);
    129 const EVP_MD * hc_EVP_pkcs11_hcrypto_sha512(void);
    130 
    131 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_rc2_cbc(void);
    132 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_rc2_40_cbc(void);
    133 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_rc2_64_cbc(void);
    134 
    135 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_rc4(void);
    136 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_rc4_40(void);
    137 
    138 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_des_cbc(void);
    139 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_des_ede3_cbc(void);
    140 
    141 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_aes_128_cbc(void);
    142 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_aes_192_cbc(void);
    143 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_aes_256_cbc(void);
    144 
    145 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_aes_128_cfb8(void);
    146 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_aes_192_cfb8(void);
    147 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_aes_256_cfb8(void);
    148 
    149 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_camellia_128_cbc(void);
    150 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_camellia_192_cbc(void);
    151 const EVP_CIPHER * hc_EVP_pkcs11_hcrypto_camellia_256_cbc(void);
    152 
    153 HC_CPP_END
    154 
    155 #endif /* HEIM_EVP_PKCS11_H */
    156