196 nulldev,
197 tpm_attach,
198 tpm_detach,
199 nodev, /* no reset - nodev returns ENXIO */
200 &tpm_cb_ops,
201 (struct bus_ops *)NULL,
202 nodev, /* no power */
203 tpm_quiesce
204 };
205
206 /* modldrv structure */
207 static struct modldrv modldrv = {
208 &mod_driverops, /* Type: This is a driver */
209 "TPM 1.2 driver", /* Name of the module. */
210 &tpm_dev_ops
211 };
212
213 /* modlinkage structure */
214 static struct modlinkage tpm_ml = {
215 MODREV_1,
216 &modldrv,
217 NULL
218 };
219
220
221 #ifdef KCF_TPM_RNG_PROVIDER
222
223 #define IDENT_TPMRNG "TPM Random Number Generator"
224
225 #include <sys/crypto/common.h>
226 #include <sys/crypto/impl.h>
227 #include <sys/crypto/spi.h>
228 /*
229 * CSPI information (entry points, provider info, etc.)
230 */
231 static void tpmrng_provider_status(crypto_provider_handle_t, uint_t *);
232
233 static crypto_control_ops_t tpmrng_control_ops = {
234 tpmrng_provider_status
235 };
236
237 static int tpmrng_seed_random(crypto_provider_handle_t, crypto_session_id_t,
243 static crypto_random_number_ops_t tpmrng_random_number_ops = {
244 tpmrng_seed_random,
245 tpmrng_generate_random
246 };
247
248 static int tpmrng_ext_info(crypto_provider_handle_t,
249 crypto_provider_ext_info_t *,
250 crypto_req_handle_t);
251
252 static crypto_provider_management_ops_t tpmrng_extinfo_op = {
253 tpmrng_ext_info,
254 NULL,
255 NULL,
256 NULL
257 };
258
259 static int tpmrng_register(tpm_state_t *);
260 static int tpmrng_unregister(tpm_state_t *);
261
262 static crypto_ops_t tpmrng_crypto_ops = {
263 &tpmrng_control_ops,
264 NULL,
265 NULL,
266 NULL,
267 NULL,
268 NULL,
269 NULL,
270 NULL,
271 &tpmrng_random_number_ops,
272 NULL,
273 NULL,
274 NULL,
275 &tpmrng_extinfo_op,
276 NULL,
277 NULL
278 };
279
280 static crypto_provider_info_t tpmrng_prov_info = {
281 CRYPTO_SPI_VERSION_2,
282 "TPM Random Number Provider",
283 CRYPTO_HW_PROVIDER,
284 NULL,
285 NULL,
286 &tpmrng_crypto_ops,
287 0,
288 NULL,
289 0,
290 NULL
291 };
292 #endif /* KCF_TPM_RNG_PROVIDER */
293
294 static void *statep = NULL;
295
296 /*
297 * Inline code to get exclusive lock on the TPM device and to make sure
|
196 nulldev,
197 tpm_attach,
198 tpm_detach,
199 nodev, /* no reset - nodev returns ENXIO */
200 &tpm_cb_ops,
201 (struct bus_ops *)NULL,
202 nodev, /* no power */
203 tpm_quiesce
204 };
205
206 /* modldrv structure */
207 static struct modldrv modldrv = {
208 &mod_driverops, /* Type: This is a driver */
209 "TPM 1.2 driver", /* Name of the module. */
210 &tpm_dev_ops
211 };
212
213 /* modlinkage structure */
214 static struct modlinkage tpm_ml = {
215 MODREV_1,
216 { &modldrv, NULL }
217 };
218
219
220 #ifdef KCF_TPM_RNG_PROVIDER
221
222 #define IDENT_TPMRNG "TPM Random Number Generator"
223
224 #include <sys/crypto/common.h>
225 #include <sys/crypto/impl.h>
226 #include <sys/crypto/spi.h>
227 /*
228 * CSPI information (entry points, provider info, etc.)
229 */
230 static void tpmrng_provider_status(crypto_provider_handle_t, uint_t *);
231
232 static crypto_control_ops_t tpmrng_control_ops = {
233 tpmrng_provider_status
234 };
235
236 static int tpmrng_seed_random(crypto_provider_handle_t, crypto_session_id_t,
242 static crypto_random_number_ops_t tpmrng_random_number_ops = {
243 tpmrng_seed_random,
244 tpmrng_generate_random
245 };
246
247 static int tpmrng_ext_info(crypto_provider_handle_t,
248 crypto_provider_ext_info_t *,
249 crypto_req_handle_t);
250
251 static crypto_provider_management_ops_t tpmrng_extinfo_op = {
252 tpmrng_ext_info,
253 NULL,
254 NULL,
255 NULL
256 };
257
258 static int tpmrng_register(tpm_state_t *);
259 static int tpmrng_unregister(tpm_state_t *);
260
261 static crypto_ops_t tpmrng_crypto_ops = {
262 .co_control_ops = &tpmrng_control_ops,
263 .co_random_ops = &tpmrng_random_number_ops,
264 .co_provider_ops = &tpmrng_extinfo_op
265 };
266
267 static crypto_provider_info_t tpmrng_prov_info = {
268 CRYPTO_SPI_VERSION_2,
269 "TPM Random Number Provider",
270 CRYPTO_HW_PROVIDER,
271 NULL,
272 NULL,
273 &tpmrng_crypto_ops,
274 0,
275 NULL,
276 0,
277 NULL
278 };
279 #endif /* KCF_TPM_RNG_PROVIDER */
280
281 static void *statep = NULL;
282
283 /*
284 * Inline code to get exclusive lock on the TPM device and to make sure
|