| 1 |
/* |
| 2 |
* COPYRIGHT (c) International Business Machines Corp. 2002-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 |
/*************************************************************************** |
| 12 |
Change Log |
| 13 |
========== |
| 14 |
4/25/03 Kapil Sood ([email protected]) |
| 15 |
Added DH key pair generation and DH shared key derivation |
| 16 |
functions. |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
****************************************************************************/ |
| 21 |
|
| 22 |
// SAB FIXME need to figure out a better way... |
| 23 |
// // to get the variant dependency out |
| 24 |
#ifndef __TOK_STRUCT_H |
| 25 |
#define __TOK_STRUCT_H |
| 26 |
#include <pkcs11types.h> |
| 27 |
|
| 28 |
#include "tok_spec_struct.h" |
| 29 |
|
| 30 |
#ifndef SW_CONFIG_PATH |
| 31 |
|
| 32 |
#ifndef CONFIG_PATH |
| 33 |
#warning CONFIG_PATH not set, using default (/usr/local/var/lib/opencryptoki) |
| 34 |
#define CONFIG_PATH "/usr/local/var/lib/opencryptoki" |
| 35 |
#endif // #ifndef CONFIG_PATH |
| 36 |
|
| 37 |
#define SW_CONFIG_PATH CONFIG_PATH "/ep11tok" |
| 38 |
#endif // #ifndef SW_CONFIG_PATH |
| 39 |
|
| 40 |
token_spec_t token_specific = { |
| 41 |
SW_CONFIG_PATH, |
| 42 |
"ep11tok", |
| 43 |
TRUE, // secure key token |
| 44 |
// Token data info: |
| 45 |
{ |
| 46 |
FALSE, // Don't use per guest data store |
| 47 |
TRUE, // Use master key |
| 48 |
CKM_DES3_CBC, // Data store encryption |
| 49 |
(CK_BYTE *)"12345678", // Default initialization vector for pins |
| 50 |
(CK_BYTE *)"10293847", // Default initialization vector for objects |
| 51 |
}, |
| 52 |
NULL, // t_creatlock |
| 53 |
NULL, // t_attach_shm |
| 54 |
NULL, // init |
| 55 |
NULL, // init_token_data |
| 56 |
NULL, // load_token_data |
| 57 |
NULL, // save_token_data |
| 58 |
&token_specific_get_token_info, |
| 59 |
&token_specific_rng, |
| 60 |
NULL, // final |
| 61 |
NULL, // init_token |
| 62 |
NULL, // token_specific_login, |
| 63 |
NULL, // token_specific_logout, |
| 64 |
NULL, // init_pin, |
| 65 |
NULL, // set_pin |
| 66 |
// DES |
| 67 |
NULL, // des_key_gen, |
| 68 |
NULL, // des_ecb, |
| 69 |
NULL, // des_cbc, |
| 70 |
// Triple DES |
| 71 |
NULL, // tdes_ecb, |
| 72 |
NULL, // tdes_cbc, |
| 73 |
NULL, // des3_ofb |
| 74 |
NULL, // des3_cfb |
| 75 |
NULL, // des3_mac |
| 76 |
NULL, // des3_cmac |
| 77 |
// RSA |
| 78 |
NULL, // rsa_decrypt |
| 79 |
NULL, // rsa_encrypt |
| 80 |
&token_specific_rsa_sign, |
| 81 |
&token_specific_rsa_verify, |
| 82 |
NULL, // rsa_verify_recover |
| 83 |
NULL, // rsa_x509_decrypt |
| 84 |
NULL, // rsa_x509_encrypt |
| 85 |
NULL, // rsa_x509_sign |
| 86 |
NULL, // rsa_x509_verify |
| 87 |
NULL, // rsa_x509_verify_recover |
| 88 |
NULL, // rsa_oaep_decrypt |
| 89 |
NULL, // rsa_oaep_encrypt |
| 90 |
&token_specific_rsa_pss_sign, |
| 91 |
&token_specific_rsa_pss_verify, |
| 92 |
NULL, // rsa_generate_keypair |
| 93 |
// Elliptic Curve |
| 94 |
&token_specific_ec_sign, |
| 95 |
&token_specific_ec_verify, |
| 96 |
&token_specific_ec_edwards_sign, |
| 97 |
&token_specific_ec_edwards_verify, |
| 98 |
NULL, // ec_generate_keypair |
| 99 |
NULL, // ec_edwards_generate_keypair |
| 100 |
NULL, // ec_montgomery_generate_keypair |
| 101 |
NULL, // ecdh_derive |
| 102 |
NULL, // ecdh_derive_kdf |
| 103 |
// DH |
| 104 |
NULL, // dh_pkcs_derive, |
| 105 |
NULL, // dh_pkcs_key_pair_gen |
| 106 |
// SHA |
| 107 |
&token_specific_sha_init, |
| 108 |
&token_specific_sha, |
| 109 |
&token_specific_sha_update, |
| 110 |
&token_specific_sha_final, |
| 111 |
// SHAKE derive |
| 112 |
NULL, // shake_key_derive |
| 113 |
// HMAC |
| 114 |
NULL, // hmac_sign_init |
| 115 |
NULL, // hmac_sign |
| 116 |
NULL, // hmac_sign_update |
| 117 |
NULL, // hmac_sign_final |
| 118 |
NULL, // hmac_verify_init |
| 119 |
NULL, // hmac_verify |
| 120 |
NULL, // hmac_verify_update |
| 121 |
NULL, // hmac_verify_final |
| 122 |
NULL, // generic_secret_key_gen |
| 123 |
// AES |
| 124 |
NULL, // aes_key_gen, |
| 125 |
NULL, // aes_xts_key_gen |
| 126 |
#ifndef NO_PKEY |
| 127 |
&token_specific_aes_ecb, |
| 128 |
&token_specific_aes_cbc, |
| 129 |
#else |
| 130 |
NULL, // aes_ecb |
| 131 |
NULL, // aes_cbc |
| 132 |
#endif |
| 133 |
NULL, // aes_ctr |
| 134 |
NULL, // aes_gcm_init |
| 135 |
NULL, // aes_gcm |
| 136 |
NULL, // aes_gcm_update |
| 137 |
NULL, // aes_gcm_final |
| 138 |
NULL, // aes_ofb |
| 139 |
NULL, // aes_cfb |
| 140 |
NULL, // aes_mac |
| 141 |
#ifndef NO_PKEY |
| 142 |
&token_specific_aes_cmac, |
| 143 |
&token_specific_aes_xts, // aes_xts |
| 144 |
#else |
| 145 |
NULL, // aes_cmac |
| 146 |
NULL, // aes_xts |
| 147 |
#endif |
| 148 |
NULL, // aes_key_wrap |
| 149 |
// DSA |
| 150 |
NULL, // dsa_generate_keypair, |
| 151 |
NULL, // dsa_sign |
| 152 |
NULL, // dsa_verify |
| 153 |
// PQC |
| 154 |
NULL, // ibm_ml_dsa_generate_keypair |
| 155 |
NULL, // ibm_ml_dsa_sign |
| 156 |
NULL, // ibm_ml_dsa_verify |
| 157 |
NULL, // ibm_ml_kem_generate_keypair |
| 158 |
NULL, // ibm_ml_kem_derive |
| 159 |
NULL, // ml_dsa_generate_keypair |
| 160 |
&token_specific_ml_dsa_sign, |
| 161 |
&token_specific_ml_dsa_verify, |
| 162 |
NULL, // ml_kem_generate_keypair |
| 163 |
&token_specific_ml_kem_encapsulate_key, |
| 164 |
&token_specific_ml_kem_decapsulate_key, |
| 165 |
NULL, // get_mechanism_list |
| 166 |
NULL, // get mechanism_info |
| 167 |
&token_specific_object_add, |
| 168 |
NULL, // key_wrap |
| 169 |
NULL, // key_unwrap |
| 170 |
&token_specific_encapsulate_rsa_sym_keygen, |
| 171 |
&token_specific_encapsulate_rsa_key_wrap, |
| 172 |
&token_specific_encapsulate_rsa_key_unwrap, |
| 173 |
&token_specific_encapsulate_dh_ecdh_key_pair_gen, |
| 174 |
&token_specific_en_decapsulate_dh_ecdh_derive_key, |
| 175 |
&token_specific_reencrypt_single, |
| 176 |
&token_specific_set_attribute_values, |
| 177 |
&token_specific_set_attrs_for_new_object, |
| 178 |
&token_specific_handle_event, |
| 179 |
&token_specific_check_obj_access, |
| 180 |
}; |
| 181 |
|
| 182 |
#endif |