keymaster0_device Struct Reference

keymaster0_device Struct Reference

#include < keymaster0.h >

Data Fields

struct hw_device_t   common
 
uint32_t  client_version
 
uint32_t  flags
 
void *  context
 
int(*  generate_keypair )(const struct keymaster0_device *dev, const keymaster_keypair_t key_type, const void *key_params, uint8_t **key_blob, size_t *key_blob_length)
 
int(*  import_keypair )(const struct keymaster0_device *dev, const uint8_t *key, const size_t key_length, uint8_t **key_blob, size_t *key_blob_length)
 
int(*  get_keypair_public )(const struct keymaster0_device *dev, const uint8_t *key_blob, const size_t key_blob_length, uint8_t **x509_data, size_t *x509_data_length)
 
int(*  delete_keypair )(const struct keymaster0_device *dev, const uint8_t *key_blob, const size_t key_blob_length)
 
int(*  delete_all )(const struct keymaster0_device *dev)
 
int(*  sign_data )(const struct keymaster0_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *data, const size_t data_length, uint8_t **signed_data, size_t *signed_data_length)
 
int(*  verify_data )(const struct keymaster0_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *signed_data, const size_t signed_data_length, const uint8_t *signature, const size_t signature_length)
 

Detailed Description

Keymaster0 device definition.

Definition at line 27 of file keymaster0.h .

Field Documentation

uint32_t client_version

THIS IS DEPRECATED. Use the new "module_api_version" and "hal_api_version" fields in the keymaster_module initialization instead.

Definition at line 40 of file keymaster0.h .

struct hw_device_t common

Common methods of the keymaster device. This must be the first member of keymaster0_device as users of this structure will cast a hw_device_t to keymaster0_device pointer in contexts where it's known the hw_device_t references a keymaster0_device .

Definition at line 34 of file keymaster0.h .

void* context

Definition at line 47 of file keymaster0.h .

int(* delete_all)(const struct keymaster0_device *dev)

Deletes all keys in the hardware keystore. Used when keystore is reset completely.

This function is optional and should be set to NULL if it is not implemented.

Returns 0 on success or an error code less than 0.

Definition at line 102 of file keymaster0.h .

int(* delete_keypair)(const struct keymaster0_device *dev, const uint8_t *key_blob, const size_t key_blob_length)

Deletes the key pair associated with the key blob.

This function is optional and should be set to NULL if it is not implemented.

Returns 0 on success or an error code less than 0.

Definition at line 90 of file keymaster0.h .

uint32_t flags

See flags defined for keymaster0_device::flags in keymaster_common.h

Definition at line 45 of file keymaster0.h .

int(* generate_keypair)(const struct keymaster0_device *dev, const keymaster_keypair_t key_type, const void *key_params, uint8_t **key_blob, size_t *key_blob_length)

Generates a public and private key. The key-blob returned is opaque and must subsequently provided for signing and verification.

Returns: 0 on success or an error code less than 0.

Definition at line 55 of file keymaster0.h .

int(* get_keypair_public)(const struct keymaster0_device *dev, const uint8_t *key_blob, const size_t key_blob_length, uint8_t **x509_data, size_t *x509_data_length)

Gets the public key part of a key pair. The public key must be in X.509 format (Java standard) encoded byte array.

Returns: 0 on success or an error code less than 0. On error, x509_data should not be allocated.

Definition at line 78 of file keymaster0.h .

int(* import_keypair)(const struct keymaster0_device *dev, const uint8_t *key, const size_t key_length, uint8_t **key_blob, size_t *key_blob_length)

Imports a public and private key pair. The imported keys will be in PKCS#8 format with DER encoding (Java standard). The key-blob returned is opaque and will be subsequently provided for signing and verification.

Returns: 0 on success or an error code less than 0.

Definition at line 67 of file keymaster0.h .

int(* sign_data)(const struct keymaster0_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *data, const size_t data_length, uint8_t **signed_data, size_t *signed_data_length)

Signs data using a key-blob generated before. This can use either an asymmetric key or a secret key.

Returns: 0 on success or an error code less than 0.

Definition at line 110 of file keymaster0.h .

int(* verify_data)(const struct keymaster0_device *dev, const void *signing_params, const uint8_t *key_blob, const size_t key_blob_length, const uint8_t *signed_data, const size_t signed_data_length, const uint8_t *signature, const size_t signature_length)

Verifies data signed with a key-blob. This can use either an asymmetric key or a secret key.

Returns: 0 on successful verification or an error code less than 0.

Definition at line 122 of file keymaster0.h .


The documentation for this struct was generated from the following file: