Snapdragon® Telematics Application Framework (TelAF) Interface Specification
|
Data Structures | |
struct | _ClientThreadData_t |
Macros | |
#define | LOCK_INIT le_mutex_Lock(le_ifgen_InitMutexRef); |
Locks the mutex. More... | |
#define | UNLOCK_INIT le_mutex_Unlock(le_ifgen_InitMutexRef); |
Unlocks the mutex. More... | |
Variables | |
static le_mem_PoolRef_t | _ClientThreadDataPool |
static pthread_key_t | _ThreadDataKey |
static bool | CommonDataInitialized = false |
le_mutex_Ref_t | le_ifgen_InitMutexRef |
#define LOCK_INIT le_mutex_Lock(le_ifgen_InitMutexRef); |
Locks the mutex.
#define UNLOCK_INIT le_mutex_Unlock(le_ifgen_InitMutexRef); |
Unlocks the mutex.
LE_MEM_DEFINE_STATIC_POOL | ( | taf_ks_ClientThreadData | , |
LE_CDATA_COMPONENT_COUNT | , | ||
sizeof(_ClientThreadData_t) | |||
) |
Static pool for client threads.
|
static |
Initialize thread specific data, and connect to the service for the current thread.
|
static |
Get a pointer to the client thread data for the current thread.
If the current thread does not have client data, then NULL is returned
__attribute__ | ( | (unused) | ) |
Return the sessionRef for the current thread.
If the current thread does not have a session ref, then this is a fatal error.
|
static |
Destructor function for client thread objects.
|
static |
Init data that is common across all threads.
|
static |
Connect to the service, using either blocking or non-blocking calls.
This function implements the details of the public ConnectService functions.
void taf_ks_ConnectService | ( | void | ) |
Connect the current client thread to the service providing this API. Block until the service is available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see apiFilesC_client.
This function is created automatically.
le_result_t taf_ks_TryConnectService | ( | void | ) |
Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see apiFilesC_client.
This function is created automatically.
|
static |
void taf_ks_SetServerDisconnectHandler | ( | taf_ks_DisconnectHandler_t | disconnectHandler, |
void * | contextPtr | ||
) |
Set handler called when server disconnection is detected.
When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.
|
static |
void taf_ks_SetNonExitServerDisconnectHandler | ( | taf_ks_DisconnectHandler_t | disconnectHandler, |
void * | contextPtr | ||
) |
Set handler called when server disconnection is detected without exiting.
When a server connection is lost, call this handler without exit.
void taf_ks_DisconnectService | ( | void | ) |
Disconnect the current client thread from the service providing this API.
Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see apiFilesC_client.
This function is created automatically.
le_result_t taf_ks_CreateKey | ( | const char *LE_NONNULL | keyName, |
taf_ks_KeyUsage_t | keyUsage, | ||
taf_ks_KeyRef_t * | keyRefPtr | ||
) |
Creates a new key.
[in] | keyName | Key name. |
[in] | keyUsage | Key usage. |
[out] | keyRefPtr | Key reference. |
le_result_t taf_ks_GetKey | ( | const char *LE_NONNULL | keyName, |
taf_ks_KeyRef_t * | keyRefPtr | ||
) |
Gets a key by key name.
[in] | keyName | Key name. |
[out] | keyRefPtr | Key reference. |
le_result_t taf_ks_DeleteKey | ( | taf_ks_KeyRef_t | keyRef | ) |
Deletes a key by key reference.
[in] | keyRef | Key reference. |
le_result_t taf_ks_GetKeyUsage | ( | taf_ks_KeyRef_t | keyRef, |
taf_ks_KeyUsage_t * | keyUsagePtr | ||
) |
Gets a key's usage.
[in] | keyRef | Key reference. |
[out] | keyUsagePtr | Key usage. |
le_result_t taf_ks_SetKeyMaxUsesPerBoot | ( | taf_ks_KeyRef_t | keyRef, |
uint32_t | value | ||
) |
Sets the maximum number of times a key may be used between system reboots.
[in] | keyRef | Key reference. |
[in] | value | Uses per boot. |
le_result_t taf_ks_SetKeyMinSecondsBetweenOps | ( | taf_ks_KeyRef_t | keyRef, |
uint32_t | value | ||
) |
Sets the minimum amount of time that elapses between allowed operations using a key.
[in] | keyRef | Key reference. |
[in] | value | Seconds interval between allowed operations. |
le_result_t taf_ks_SetKeyAppData | ( | taf_ks_KeyRef_t | keyRef, |
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Sets application data to the key.
When this attribute is provided to the key, the same data must be also provided through taf_ks_CryptoSessionSetAppData() for each cryptographic operation using the key.
[in] | keyRef | Key reference. |
[in] | dataPtr | Data buffer to hold the application data. |
[in] | dataSize |
le_result_t taf_ks_SetKeyActiveDateTime | ( | taf_ks_KeyRef_t | keyRef, |
uint64_t | value | ||
) |
Sets the date and time at which the key becomes active. Any attempt to use the key prior to this time will fail.
[in] | keyRef | Key reference. |
[in] | value | Milliseconds since January 1, 1970. |
le_result_t taf_ks_SetKeyOriginationExpireDateTime | ( | taf_ks_KeyRef_t | keyRef, |
uint64_t | value | ||
) |
Sets the date and time at which the key expires for signing and encryption. Any attempt to use a key for signing or encryption after this time will fail.
[in] | keyRef | Key reference. |
[in] | value | Milliseconds since January 1, 1970. |
le_result_t taf_ks_SetKeyUsageExpireDateTime | ( | taf_ks_KeyRef_t | keyRef, |
uint64_t | value | ||
) |
Sets the date and time at which the key expires for verification and decryption. Any attempt to use a key for verification and decryption after this time will fail.
[in] | keyRef | Key reference. |
[in] | value | Milliseconds since January 1, 1970. |
le_result_t taf_ks_ProvisionRsaEncKeyValue | ( | taf_ks_KeyRef_t | keyRef, |
taf_ks_RsaKeySize_t | keySize, | ||
taf_ks_RsaEncPadding_t | padding, | ||
const uint8_t * | impDataPtr, | ||
size_t | impDataSize | ||
) |
Provisons or imports a RSA encryption key value to the newly created key.
The impData parameter, if provided, shall hold PKCS#8 DER format of RSA key data for import.
[in] | keyRef | Key reference. |
[in] | keySize | Key size. Shall match the import key size if impData is provided. |
[in] | padding | Padding type of RSA encryption key. |
[in] | impDataPtr | Imported key data. |
[in] | impDataSize |
le_result_t taf_ks_ProvisionRsaSigKeyValue | ( | taf_ks_KeyRef_t | keyRef, |
taf_ks_RsaKeySize_t | keySize, | ||
taf_ks_RsaSigPadding_t | padding, | ||
const uint8_t * | impDataPtr, | ||
size_t | impDataSize | ||
) |
Provisions or imports a RSA signing key value to the newly created key.
The impData parameter, if provided, shall hold PKCS#8 DER format of RSA key data for import.
[in] | keyRef | Key reference. |
[in] | keySize | Key size. Shall match the import key size if impData is provided. |
[in] | padding | Padding type of RSA signing key. |
[in] | impDataPtr | Imported key data. |
[in] | impDataSize |
le_result_t taf_ks_ProvisionEcdsaKeyValue | ( | taf_ks_KeyRef_t | keyRef, |
taf_ks_EccKeySize_t | keySize, | ||
taf_ks_Digest_t | digest, | ||
const uint8_t * | impDataPtr, | ||
size_t | impDataSize | ||
) |
Provisions or imports an ECDSA key value to the newly created key.
The impData parameter, if provided, shall hold PKCS#8 DER format of ECDSA key data for import.
[in] | keyRef | Key reference. |
[in] | keySize | Key size. Shall match the import key size if impData is provided. |
[in] | digest | Digest. |
[in] | impDataPtr | Imported key data. |
[in] | impDataSize |
le_result_t taf_ks_ProvisionAesKeyValue | ( | taf_ks_KeyRef_t | keyRef, |
taf_ks_AesKeySize_t | keySize, | ||
taf_ks_AesBlockMode_t | mode, | ||
const uint8_t * | impDataPtr, | ||
size_t | impDataSize | ||
) |
Provisions or imports an AES key value to the newly created key.
The impData parameter, if provided, shall hold the AES raw key data for import.
[in] | keyRef | Key reference. |
[in] | keySize | Key size. Shall match the import key size if impData is provided. |
[in] | mode | AES block mode. |
[in] | impDataPtr | Imported key data. |
[in] | impDataSize |
le_result_t taf_ks_ProvisionHmacKeyValue | ( | taf_ks_KeyRef_t | keyRef, |
uint32_t | keySize, | ||
taf_ks_Digest_t | digest, | ||
const uint8_t * | impDataPtr, | ||
size_t | impDataSize | ||
) |
Provisions or imports a HMAC key value to the newly created key.
The impData parameter, if provided, shall hold the HMAC raw key data for import.
[in] | keyRef | Key reference. |
[in] | keySize | Key size. Shall match the import key size if impData is provided. |
[in] | digest | Digest. |
[in] | impDataPtr | Imported key data. |
[in] | impDataSize |
le_result_t taf_ks_ExportKey | ( | taf_ks_KeyRef_t | keyRef, |
const uint8_t * | appDataPtr, | ||
size_t | appDataSize, | ||
uint8_t * | expDataPtr, | ||
size_t * | expDataSizePtr | ||
) |
Exports a key into the specified key data format.
For asymmetric key exports the x.509 DER format (SubjectPublicKeyInfo) public key. Currently symmetric key exports are not supported.
[in] | keyRef | Key reference. |
[in] | appDataPtr | Data buffer to hold the application data. |
[in] | appDataSize | |
[out] | expDataPtr | Exported key data. |
[in,out] | expDataSizePtr |
le_result_t taf_ks_CryptoSessionCreate | ( | taf_ks_KeyRef_t | keyRef, |
taf_ks_CryptoSessionRef_t * | sessionRefPtr | ||
) |
Creates a cryptographic operation session for a key.
[in] | keyRef | Key to use for this cryptographic session. |
[out] | sessionRefPtr | Session reference. |
le_result_t taf_ks_CryptoSessionSetAesNonce | ( | taf_ks_CryptoSessionRef_t | sessionRef, |
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Sets the nonce or IVs for AES GCM, CBC, CTR for a cryptographic session. For AES GCM the nonce size must be 12 bytes, for AES CBC, CTR the IV must be 16 bytes.
[in] | sessionRef | Session reference. |
[in] | dataPtr | Data buffer to hold the nonce or IV. |
[in] | dataSize |
le_result_t taf_ks_CryptoSessionSetAppData | ( | taf_ks_CryptoSessionRef_t | sessionRef, |
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Sets the application data for a cryptographic session.
This API must be called before taf_ks_CryptoSessionStart() if the key has set the attribute of application data by taf_ks_SetKeyAppData().
[in] | sessionRef | Session reference. |
[in] | dataPtr | Data buffer to hold the application data. |
[in] | dataSize |
le_result_t taf_ks_CryptoSessionStart | ( | taf_ks_CryptoSessionRef_t | sessionRef, |
taf_ks_CryptoPurpose_t | cryptoPurpose | ||
) |
Starts the cryptographic session for the given operation. The cryptographic session is automatically deleted if an error occurs.
[in] | sessionRef | Session reference. |
[in] | cryptoPurpose | Cryptographic operation purpose. |
le_result_t taf_ks_CryptoSessionProcessAead | ( | taf_ks_CryptoSessionRef_t | sessionRef, |
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Provides AEAD to an AES GCM crypto session started with taf_ks_CryptoSessionStart(). This API can be called multiple times before taf_ks_CryptoSessionProcess() and the cryptographic session will be automatically deleted if an error occurs.
[in] | sessionRef | Session reference. |
[in] | dataPtr | Data buffer to hold the AEAD data. |
[in] | dataSize |
le_result_t taf_ks_CryptoSessionProcess | ( | taf_ks_CryptoSessionRef_t | sessionRef, |
const uint8_t * | inputDataPtr, | ||
size_t | inputDataSize, | ||
uint8_t * | outputDataPtr, | ||
size_t * | outputDataSizePtr | ||
) |
Provides data to, and possibly receives output from, a running cryptographic session started with taf_ks_CryptoSessionStart(). It can be called multiple times before taf_ks_CryptoSessionEnd() is called. The crypto session is automatically deleted if an error occurs.
[in] | sessionRef | Session reference. |
[in] | inputDataPtr | InputData can be one of the following cases.
|
[in] | inputDataSize | |
[out] | outputDataPtr | OutputData can be one of the following cases.
|
[in,out] | outputDataSizePtr |
le_result_t taf_ks_CryptoSessionEnd | ( | taf_ks_CryptoSessionRef_t | sessionRef, |
const uint8_t * | inputDataPtr, | ||
size_t | inputDataSize, | ||
uint8_t * | outputDataPtr, | ||
size_t * | outputDataSizePtr | ||
) |
Finalizes the cryptographic session started with taf_ks_CryptoSessionStart(). This API shall be called once all input data is processed by taf_ks_CryptoSessionProcess(). The cryptographic session will be deleted automatically.
[in] | sessionRef | Session reference. |
[in] | inputDataPtr | Signature to verify for verification session and shall set to NULL for other sessions. |
[in] | inputDataSize | |
[out] | outputDataPtr | OutputData can be one of the following cases.
|
[in,out] | outputDataSizePtr |
le_result_t taf_ks_CryptoSessionAbort | ( | taf_ks_CryptoSessionRef_t | sessionRef | ) |
Aborts the cryptographic session started with taf_ks_CryptoSessionStart(). The cryptographic session will be deleted automatically.
[in] | sessionRef | Session reference. |
|
static |
The memory pool for client thread objects
|
static |
Key under which the pointer to the Thread Object (_ClientThreadData_t) will be kept in thread-local storage. This allows a thread to quickly get a pointer to its own Thread Object.
|
static |
This global flag is shared by all client threads, and is used to indicate whether the common data has been initialized.
le_mutex_Ref_t le_ifgen_InitMutexRef |
Mutex and associated macros for use with the above CommonDataInitialized.