Crate mc_sgx_tcrypto_sys

Source
Expand description

§MobileCoin SGX: Crypto FFI Bindings

Project ChatLicenseTargetCrates.ioDocs StatusDependency Status

FFI linkage for the sgx_tcrypto library.

Structs§

sgx_ec256_dh_shared_t
sgx_ec256_private_t
sgx_ec256_public_t
sgx_ec256_signature_t
sgx_rsa3072_key_t
sgx_rsa3072_public_key_t
sgx_rsa_key_type_t
sgx_rsa_result_t

Functions§

sgx_aes_ctr_decrypt
sgx_aes_ctr_encrypt
AES-CTR 128-bit - Only 128-bit key size is supported.
sgx_aes_gcm128_enc_get_mac
Get authentication tag from the given AES-GCM state.
sgx_aes_gcm128_enc_init
Allocate and initialize AES-GCM encryption state.
sgx_aes_gcm128_enc_update
Encrypt plaintext from p_src into p_dst.
sgx_aes_gcm_close
Clear and free AES-GCM state.
sgx_calculate_ecdsa_priv_key
Generates an ECDSA private key based on input random seed.
sgx_cmac128_close
Clean up the CMAC state
sgx_cmac128_final
Returns Hash calculation and clean up CMAC state.
sgx_cmac128_init
Allocates and initializes CMAC state.
sgx_cmac128_update
Updates CMAC has calculation based on the input message.
sgx_create_rsa_key_pair
Create RSA key pair with <n_byte_size> key size and <e_byte_size> public exponent.
sgx_create_rsa_priv1_key
Create RSA private key using input buffer factors - little endian.
sgx_create_rsa_priv2_key
Create RSA private key using input buffer factors in little endian.
sgx_create_rsa_pub1_key
Create RSA public key using input buffer factors in little endian.
sgx_ecc256_calculate_pub_from_priv
Generates an ECC public key based on a given ECC private key.
sgx_ecc256_check_point
Checks whether the input point is a valid point on the given elliptic curve. Parameters: Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system sgx_ec256_public_t *p_point - Pointer to perform validity check on - LITTLE ENDIAN Output: int *p_valid - Return 0 if the point is an invalid point on ECC curve
sgx_ecc256_close_context
Cleans up ecc context. Return: If context pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. Parameters: Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h Output: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system
sgx_ecc256_compute_shared_dhkey
Computes DH shared key based on own (local) private key and remote public Ga Key. NOTE: Caller code allocates memory for Shared key pointer to be populated
sgx_ecc256_create_key_pair
Populates private/public key pair. NOTE: Caller code allocates memory for Private & Public key pointers to be populated
sgx_ecc256_open_context
Elliptic Curve Cryptography based on GF(p), 256 bit.
sgx_ecdsa_sign
Computes signature for data based on private key.
sgx_ecdsa_verify
Verifies the signature for the given data based on the public key. This API verifies the hash of input data verify(SHA256(p_data)). First it’ll calculate SHA256 hash for given data and then verify the signature for this hash.
sgx_ecdsa_verify_hash
Directly verify the signature for the given data based on the public key. (Without calculating data’s hash) see sgx_ecdsa_verify.
sgx_free_rsa_key
Clear and free RSA key which was generated by one of the Tcrypto “sgx_create_rsa_*” APIs.
sgx_hmac256_close
sgx_hmac256_final
sgx_hmac256_init
sgx_hmac256_update
sgx_hmac_sha256_msg
sgx_rijndael128GCM_decrypt
sgx_rijndael128GCM_encrypt
Rijndael AES-GCM - Only 128-bit key AES-GCM Encryption/Decryption is supported
sgx_rijndael128_cmac_msg
Message Authentication Rijndael 128 CMAC - Only 128-bit key size is supported. NOTE: Use sgx_rijndael128_cmac_msg if the src ptr contains the complete msg to perform hash (Option 1) Else use the Init, Update, Update, …, Final, Close procedure (Option 2) Option 1: If the complete dataset is available for hashing, sgx_rijndael128_cmac_msg is a single API call for generating the 128-bit hash for the given dataset. Return: If source, key, or MAC pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. If hash function fails then SGX_ERROR_UNEXPECTED is returned. Option 2: If the hash is to be performed over multiple data sets, then use: A. sgx_cmac128_init - to create the context - context memory is allocated by this function. Return: If key pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. If context creation fails then SGX_ERROR_UNEXPECTED is returned. B. sgx_cmac128_update - updates hash based on input source data This function should be called for each chunk of data to be included in the hash including the 1st and final chunks. Return: If source pointer or context pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. If hash function fails then SGX_ERROR_UNEXPECTED is returned. C. sgx_cmac128_final - function obtains the hash value Upon completing the process of computing a hash over a set of data or sets of data, this function populates the hash value. Return: If hash pointer or context pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. If the function fails then SGX_ERROR_UNEXPECTED is returned. D. sgx_cmac128_close - SHOULD BE CALLED to clean up the CMAC state Upon populating the hash value over a set of data or sets of data, this function is used to free the CMAC state. Return: If CMAC state pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned.
sgx_rsa3072_sign
Computes signature for a given data based on RSA 3072 private key
sgx_rsa3072_sign_ex
Computes signature for a given data based on RSA 3072 private key and optional corresponding public key.
sgx_rsa3072_verify
Verifies the signature for the given data based on the RSA 3072 public key.
sgx_rsa_priv_decrypt_sha256
Decrypt ciphertext [pin_data] using RSA private key, with OAEP SHA-256
sgx_rsa_pub_encrypt_sha256
Encrypt input data [pin_data] using RSA public key, with OAEP SHA-256
sgx_sha1_close
sgx_sha1_get_hash
sgx_sha1_init
sgx_sha1_msg
sgx_sha1_update
sgx_sha256_close
sgx_sha256_get_hash
sgx_sha256_init
sgx_sha256_msg
sgx_sha256_update
sgx_sha384_close
Cleans up SHA state
sgx_sha384_get_hash
Returns Hash calculation
sgx_sha384_init
Allocates and initializes sha state
sgx_sha384_msg
SHA Hashing functions - NOTE: ONLY 256/160-bit is supported.
sgx_sha384_update
Updates sha calculation based on the input message

Type Aliases§

sgx_aes_ctr_128bit_key_t
sgx_aes_gcm_128bit_key_t
sgx_aes_gcm_128bit_tag_t
sgx_aes_state_handle_t
sgx_cmac_128bit_key_t
sgx_cmac_128bit_tag_t
sgx_cmac_state_handle_t
sgx_ecc_state_handle_t
sgx_hmac_state_handle_t
sgx_rsa3072_signature_t
sgx_sha1_hash_t
sgx_sha256_hash_t
sgx_sha384_hash_t
sgx_sha_state_handle_t