 |
m2mb API docs
25.20.008
m2mb API sets documentation
|
Go to the documentation of this file.
25 #ifndef M2M_M2MB_CRYPTO_H
26 #define M2M_M2MB_CRYPTO_H
34 #define m2mb_crypto_md_free m2mb_crypto_md_deinit
35 #define m2mb_crypto_hmac_free m2mb_crypto_hmac_deinit
36 #define m2mb_crypto_cmac_free m2mb_crypto_cmac_deinit
37 #define m2mb_crypto_aes_free m2mb_crypto_aes_deinit
38 #define m2mb_crypto_des_free m2mb_crypto_des_deinit
39 #define m2mb_crypto_rsa_free m2mb_crypto_rsa_deinit
40 #define m2mb_crypto_ecc_free m2mb_crypto_ecc_deinit
49 #define Object_isOK(err) ((err) == 0)
50 #define Object_isERROR(err) ((err) != 0)
54 #define Object_OK 0 // non-specific success code
55 #define Object_ERROR 1 // non-specific error
56 #define Object_ERROR_INVALID 2 // unsupported/unrecognized request
57 #define Object_ERROR_SIZE_IN 3 // supplied buffer/string too large
58 #define Object_ERROR_SIZE_OUT 4 // supplied output buffer too small
60 #define Object_ERROR_USERBASE 10 // start of user-defined error range
64 #define Object_ERROR_DEFUNCT -90 // object no longer exists
65 #define Object_ERROR_ABORT -91 // calling thread must exit
66 #define Object_ERROR_BADOBJ -92 // invalid object context
67 #define Object_ERROR_NOSLOTS -93 // caller's object table full
68 #define Object_ERROR_MAXARGS -94 // too many args
69 #define Object_ERROR_MAXDATA -95 // buffers too large
70 #define Object_ERROR_UNAVAIL -96 // the request could not be processed
71 #define Object_ERROR_KMEM -97 // kernel out of memory
72 #define Object_ERROR_REMOTE -98 // local method sent to remote object
85 M2MB_CRYPTO_CTX_ALG_NONE=0,
86 M2MB_CRYPTO_CTX_ALG_MD2,
87 M2MB_CRYPTO_CTX_ALG_MD4,
88 M2MB_CRYPTO_CTX_ALG_MD5,
89 M2MB_CRYPTO_CTX_ALG_SHA1,
90 M2MB_CRYPTO_CTX_ALG_SHA224,
91 M2MB_CRYPTO_CTX_ALG_SHA256,
92 M2MB_CRYPTO_CTX_ALG_SHA384,
93 M2MB_CRYPTO_CTX_ALG_SHA512,
94 M2MB_CRYPTO_CTX_ALG_HMAC,
95 M2MB_CRYPTO_CTX_ALG_CMAC,
96 M2MB_CRYPTO_CTX_ALG_RSA,
97 M2MB_CRYPTO_CTX_ALG_ECC,
98 M2MB_CRYPTO_CTX_ALG_AES,
99 M2MB_CRYPTO_CTX_ALG_DES,
158 M2MB_CRYPTO_MD_ALG_NONE=0,
159 M2MB_CRYPTO_MD_ALG_MD2,
160 M2MB_CRYPTO_MD_ALG_MD4,
161 M2MB_CRYPTO_MD_ALG_MD5,
162 M2MB_CRYPTO_MD_ALG_SHA1,
163 M2MB_CRYPTO_MD_ALG_SHA224,
164 M2MB_CRYPTO_MD_ALG_SHA256,
165 M2MB_CRYPTO_MD_ALG_SHA384,
166 M2MB_CRYPTO_MD_ALG_SHA512,
711 M2MB_CRYPTO_CMAC_ALG_AES_128 = 1,
712 M2MB_CRYPTO_CMAC_ALG_AES_192 = 2,
713 M2MB_CRYPTO_CMAC_ALG_AES_256 = 3,
714 ENUM_TO_INT( M2MB_CRYPTO_CMAC_ALG_E )
715 } M2MB_CRYPTO_CMAC_ALG_E;
976 M2MB_CRYPTO_AES_MODE_ENCRYPT,
977 M2MB_CRYPTO_AES_MODE_DECRYPT,
982 #define M2MB_CRYPTO_AES_ECB_BLOCK_SIZE 16
985 #define M2MB_CRYPTO_AES_IV_SIZE 16
1130 UINT32 *keyblob_length );
1167 const UINT8 *keyblob,
1168 UINT32 keyblob_length );
1311 M2MB_CRYPTO_ALG_DES,
1312 M2MB_CRYPTO_ALG_3DES,
1319 M2MB_CRYPTO_DES_MODE_ENCRYPT,
1320 M2MB_CRYPTO_DES_MODE_DECRYPT,
1325 #define M2MB_CRYPTO_DES_KEY_SIZE 8
1328 #define M2MB_CRYPTO_3DES_KEY2_SIZE 16
1331 #define M2MB_CRYPTO_3DES_KEY3_SIZE 24
1334 #define M2MB_CRYPTO_DES_BLOCK_BYTE_LEN 8
1337 #define M2MB_CRYPTO_DES_IV_BYTE_LEN 8
1559 const UINT8 *keyblob,
1560 UINT32 keyblob_length );
1597 UINT32 *keyblob_length );
1733 M2MB_CRYPTO_RSA_PUBLIC,
1734 M2MB_CRYPTO_RSA_PRIVATE,
1909 UINT32 public_exponent );
1946 UINT32 *keyblob_length );
1982 const UINT8 *keyblob,
1983 UINT32 keyblob_length );
2026 UINT32 *modulus_size,
2027 UINT8 *public_exponent,
2028 UINT32 *public_exponent_size );
2070 const UINT8 *modulus,
2071 UINT32 modulus_size,
2072 const UINT8 *public_exponent,
2073 UINT32 public_exponent_size );
2136 const UINT8 *modulus,
2137 UINT32 modulus_size,
2138 const UINT8 *p_factor,
2139 UINT32 p_factor_size,
2140 const UINT8 *q_factor,
2141 UINT32 q_factor_size,
2142 const UINT8 *public_exponent,
2143 UINT32 public_exponent_size,
2144 const UINT8 *private_exponent,
2145 UINT32 private_exponent_size,
2337 UINT32 pubkey_length,
2377 #define M2MB_CRYPTO_ECC_BIGLEN 18
2383 #define M2MB_MAX_ECC_KEY_SIZE 32
2397 INT32 key_size_bytes;
2406 M2MB_CRYPTO_ECC_DP_P,
2407 M2MB_CRYPTO_ECC_DP_A,
2408 M2MB_CRYPTO_ECC_DP_B,
2409 M2MB_CRYPTO_ECC_DP_G_X,
2410 M2MB_CRYPTO_ECC_DP_G_Y,
2411 M2MB_CRYPTO_ECC_DP_N,
2412 M2MB_CRYPTO_ECC_DP_H,
2542 const UINT8 *param);
2680 UINT8 *shared_keyblob,
2681 UINT16 *shared_keyblob_len,
2748 UINT16 *keyblob_length );
2784 const UINT8 *keyblob,
2785 UINT32 keyblob_length );
2889 UINT16 *private_key_len);
2925 const UINT8 *privkey,
2926 UINT16 privkey_len );
2967 #define M2MB_CRYPTO_PRNG_MAX_BYTES 512
2999 UINT32 prng_data_len );
M2MB_RESULT_E m2mb_crypto_rsa_sign(M2MB_CRYPTO_RSA_CONTEXT ctx, M2MB_CRYPTO_RSA_MODE_E mode, M2MB_CRYPTO_MD_ALG_E md_alg, UINT32 hashlen, const UINT8 *hash, UINT8 *sig)
Generic RSA PKCS#1 signature creation method. The signature is created using the context key (create...
M2MB_RESULT_E m2mb_crypto_ecc_keyblob_export(M2MB_CRYPTO_ECC_CONTEXT ctx, UINT8 *keyblob, UINT16 *keyblob_length)
Exports an ECC key pair blob from the given context. The blob is encrypted with a device specific ke...
Definition: m2mb_crypto.h:1718
M2MB_CRYPTO_CTX_ALG_E m2mb_crypto_get_algo(M2MB_CRYPTO_GEN_CONTEXT ctx)
Returns the Crypto algorithm.
Definition: m2mb_crypto.h:1716
UINT8 * m2mb_crypto_cmac(M2MB_CRYPTO_CMAC_ALG_E cmac_alg, const UINT8 *key, const SIZE_T keylen, const UINT8 *input, const SIZE_T inlen, UINT8 *cmac)
This function will compute the CMAC in one shot without needing any context.
M2MB_RESULT_E m2mb_crypto_cmac_setup(M2MB_CRYPTO_CMAC_CONTEXT ctx, const UINT8 *key, SIZE_T keylen)
Sets up an M2MB_CRYPTO_CMAC_CONTEXT structure.
struct M2MB_CRYPTO_AES_CONTEXT_TAG * M2MB_CRYPTO_AES_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:132
#define M2MB_CRYPTO_AES_IV_SIZE
Definition: m2mb_crypto.h:985
Definition: m2mb_crypto.h:2366
#define M2MB_CRYPTO_DES_KEY_SIZE
Definition: m2mb_crypto.h:1325
M2MB_RESULT_E m2mb_crypto_3des_2externalkey_import(M2MB_CRYPTO_DES_CONTEXT ctx, const UINT8 key[M2MB_CRYPTO_3DES_KEY2_SIZE])
Sets up a 3DES encryption key (128 bits = 112 effective bits key + parity) for a given context.
M2MB_CRYPTO_DES_MODE_E
Definition: m2mb_crypto.h:1317
M2MB_RESULT_E m2mb_crypto_3des_3externalkey_import(M2MB_CRYPTO_DES_CONTEXT ctx, const UINT8 key[M2MB_CRYPTO_3DES_KEY3_SIZE])
Sets up a 3DES encryption key (192 bits = 168 effective bits key + parity) for a given context.
M2MB_RESULT_E m2mb_crypto_rsa_generate_key(M2MB_CRYPTO_RSA_CONTEXT ctx, UINT32 key_size, UINT32 public_exponent)
Generates an RSA key pair.
M2MB_RESULT_E m2mb_crypto_aes_keyblob_export(M2MB_CRYPTO_AES_CONTEXT ctx, UINT8 *keyblob, UINT32 *keyblob_length)
Exports the AES symmetric key from the given context.
M2MB_RESULT_E m2mb_crypto_rsa_public(M2MB_CRYPTO_RSA_CONTEXT ctx, const UINT8 *in, UINT8 *out)
RSA public key operation.
M2MB_CRYPTO_AES_MODE_E
AES operation mode (encrypt decrypt)
Definition: m2mb_crypto.h:974
M2MB_RESULT_E m2mb_crypto_des_deinit(M2MB_CRYPTO_DES_CONTEXT ctx)
Free an M2MB_CRYPTO_DES_CONTEXT structure.
UINT32 m2mb_crypto_prng_get_data(UINT8 *prng_data, UINT32 prng_data_len)
Generates prng data.
M2MB_RESULT_E m2mb_crypto_aes_keyblob_import(M2MB_CRYPTO_AES_CONTEXT ctx, const UINT8 *keyblob, UINT32 keyblob_length)
Import a symmetric key, previously generated on the same device, into a given context.
M2MB_CRYPTO_ECC_DOMAIN_GROUP_ID_E
Definition: m2mb_crypto.h:2363
M2MB_RESULT_E m2mb_crypto_ecdh_shared_key_derive(M2MB_CRYPTO_ECC_CONTEXT ctx, UINT8 *shared_keyblob, UINT16 *shared_keyblob_len, const M2MB_CRYPTO_ECC_AFFINE_POINT_T *pubkey)
Function to derive the shared key for the DH algorithm.
M2MB_RESULT_E m2mb_crypto_hmac_deinit(M2MB_CRYPTO_HMAC_CONTEXT ctx)
This function free an HMAC context.
Definition: m2mb_crypto.h:1722
struct M2MB_CRYPTO_DES_CONTEXT_TAG * M2MB_CRYPTO_DES_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:138
M2MB_RESULT_E m2mb_crypto_rsa_encrypt(M2MB_CRYPTO_RSA_CONTEXT ctx, M2MB_CRYPTO_RSA_MODE_E mode, SIZE_T inlen, const UINT8 *in, UINT8 *out)
Generic RSA PKCS#1 encryption method.
M2MB_RESULT_E m2mb_crypto_hmac_final(M2MB_CRYPTO_HMAC_CONTEXT ctx, UINT8 *hmac)
This function computes the final HMAC for all previously provided messages for the given context.
Definition: m2mb_crypto.h:2365
M2MB_RESULT_E m2mb_crypto_rsa_keyblob_import(M2MB_CRYPTO_RSA_CONTEXT ctx, const UINT8 *keyblob, UINT32 keyblob_length)
Imports an RSA key pair into the context.
M2MB_CRYPTO_RSA_MODE_E
The operation mode (encrypt/decrypt).
Definition: m2mb_crypto.h:1731
M2MB_RESULT_E m2mb_crypto_ecc_keyblob_import(M2MB_CRYPTO_ECC_CONTEXT ctx, const UINT8 *keyblob, UINT32 keyblob_length)
Imports an ECC key pair keyblob into the context.
M2MB_RESULT_E m2mb_crypto_ecc_public_key_import(M2MB_CRYPTO_ECC_CONTEXT ctx, const M2MB_CRYPTO_ECC_AFFINE_POINT_T *pubkey)
Imports an ECC public key to the given context.
M2MB_RESULT_E m2mb_crypto_md_init(M2MB_CRYPTO_MD_CONTEXT *ctx)
Allocates an M2MB_CRYPTO_MD_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_cmac_init(M2MB_CRYPTO_CMAC_CONTEXT *ctx)
Allocates a M2MB_CRYPTO_CMAC_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_aes_ecb_encdec(M2MB_CRYPTO_AES_CONTEXT ctx, M2MB_CRYPTO_AES_MODE_E mode, const UINT8 in[M2MB_CRYPTO_AES_ECB_BLOCK_SIZE], UINT8 out[M2MB_CRYPTO_AES_ECB_BLOCK_SIZE])
Encrypts/decrypts a single 16 bytes block onto the output buffer using the AES ECB algorithm.
M2MB_RESULT_E m2mb_crypto_cmac_update(M2MB_CRYPTO_CMAC_CONTEXT ctx, const UINT8 *data, SIZE_T len)
continuously CMAC of data. This function can be called repeatedly similar to streaming
M2MB_RESULT_E m2mb_crypto_md_update(M2MB_CRYPTO_MD_CONTEXT ctx, const UINT8 *data, SIZE_T len)
continuously hashing of data. This function should be called repeatedly with chunks of the message to...
struct M2MB_CRYPTO_MD_CONTEXT_TAG * M2MB_CRYPTO_MD_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:114
M2MB_RESULT_E m2mb_crypto_rsa_init(M2MB_CRYPTO_RSA_CONTEXT *ctx, M2MB_CRYPTO_RSA_PADDING_TYPE_E padding_type, M2MB_CRYPTO_MD_ALG_E hash_id)
Allocates an M2MB_CRYPTO_RSA_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_ecdsa_sign(M2MB_CRYPTO_ECC_CONTEXT ctx, UINT8 *msg, UINT32 msg_len, UINT8 *sig, SIZE_T sig_len)
ECDSA signature function.
UINT32 m2mb_crypto_ctx_info_for_tee(M2MB_CRYPTO_GEN_CONTEXT ctx, UINT8 *info)
Returns the context ID for the given context structure.
M2MB_RESULT_E m2mb_crypto_aes_externalkey_import(M2MB_CRYPTO_AES_CONTEXT ctx, const UINT8 *key, UINT32 keylength)
Imports a symmetric key into the given context. This is a plaintext key that may have been generated...
M2MB_RESULT_E m2mb_crypto_rsa_keyblob_export(M2MB_CRYPTO_RSA_CONTEXT ctx, UINT8 *keyblob, UINT32 *keyblob_length)
Exports an RSA key pair blob from the given context. The blob is encrypted with a device specific ke...
#define M2MB_CRYPTO_DES_BLOCK_BYTE_LEN
Definition: m2mb_crypto.h:1334
M2MB_RESULT_E m2mb_crypto_rsa_deinit(M2MB_CRYPTO_RSA_CONTEXT ctx)
Free an M2MB_CRYPTO_RSA_CONTEXT structure.
struct M2MB_CRYPTO_RSA_CONTEXT_TAG * M2MB_CRYPTO_RSA_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:144
M2MB_RESULT_E m2mb_crypto_ecc_init(M2MB_CRYPTO_ECC_CONTEXT *ctx, M2MB_CRYPTO_ECC_DOMAIN_GROUP_ID_E curve_domain_params)
Allocates an M2MB_CRYPTO_ECC_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_md_final(M2MB_CRYPTO_MD_CONTEXT ctx, UINT8 *md)
This function computes the final digest for the hash process.
M2MB_RESULT_E m2mb_crypto_md_setup(M2MB_CRYPTO_MD_CONTEXT ctx, const M2MB_CRYPTO_MD_ALG_E md_info)
Sets up a M2MB_CRYPTO_MD_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_ecc_public_key_export(M2MB_CRYPTO_ECC_CONTEXT ctx, M2MB_CRYPTO_ECC_AFFINE_POINT_T *pubkey)
Exports an ECC public key from the given context.
Structure representing the X,Y coordinates of a point. The point is zero, or "at infinity",...
Definition: m2mb_crypto.h:2392
M2MB_CRYPTO_GEN_CONTEXT m2mb_crypto_retrieve_ctx(UINT8 *info)
Returns the context pointer for the given context ID.
#define M2MB_MAX_ECC_KEY_SIZE
Maximum size for key size (x or y coordinates in binary format, private key).
Definition: m2mb_crypto.h:2383
M2MB_CRYPTO_DES_ALG_TYPE_E
Definition: m2mb_crypto.h:1309
M2MB_RESULT_E m2mb_crypto_des_externalkey_import(M2MB_CRYPTO_DES_CONTEXT ctx, const UINT8 key[M2MB_CRYPTO_DES_KEY_SIZE])
Sets up a DES encryption key (64 bits = 56 effective bits key + parity) for a given context.
M2MB_RESULT_E m2mb_crypto_md_deinit(M2MB_CRYPTO_MD_CONTEXT ctx)
This function frees an MD context.
M2MB_RESULT_E m2mb_crypto_ecc_private_key_import(M2MB_CRYPTO_ECC_CONTEXT ctx, const UINT8 *privkey, UINT16 privkey_len)
Imports an ECC private key to the given context.
M2MB_RESULT_E m2mb_crypto_hmac_setup(M2MB_CRYPTO_HMAC_CONTEXT ctx, M2MB_CRYPTO_MD_ALG_E md_info, const UINT8 *key, SIZE_T keylen)
Sets up an M2MB_CRYPTO_HMAC_CONTEXT structure.
struct M2MB_CRYPTO_ECC_CONTEXT_TAG * M2MB_CRYPTO_ECC_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:150
M2MB_CRYPTO_ECC_DP_E
Enumeration representing all the ECC Domain Parameters.
Definition: m2mb_crypto.h:2404
M2MB_RESULT_E m2mb_crypto_cmac_deinit(M2MB_CRYPTO_CMAC_CONTEXT ctx)
This function free an CMAC context.
UINT8 * m2mb_crypto_md(const M2MB_CRYPTO_MD_ALG_E md_info, const UINT8 *data, SIZE_T len, UINT8 *md)
This function will compute the message digest in one shot.
M2MB_CRYPTO_MD_ALG_E
Enumeration respresenting all supported HASH algorithms.
Definition: m2mb_crypto.h:156
M2MB_RESULT_E m2mb_crypto_des_init(M2MB_CRYPTO_DES_CONTEXT *ctx, M2MB_CRYPTO_DES_ALG_TYPE_E des_alg)
Allocates an M2MB_CRYPTO_DES_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_hmac_init(M2MB_CRYPTO_HMAC_CONTEXT *ctx)
Opaque structure for context.
M2MB_RESULT_E m2mb_crypto_des_cbc_encdec(M2MB_CRYPTO_DES_CONTEXT ctx, M2MB_CRYPTO_DES_MODE_E mode, const UINT8 *in, UINT8 *out, SIZE_T inlen, UINT8 ivec[M2MB_CRYPTO_DES_IV_BYTE_LEN])
Encrypts/decrypts a given buffer with a given length using the DES CBC. The length must be a multipl...
M2MB_RESULT_E m2mb_crypto_ecc_dp_import(M2MB_CRYPTO_ECC_CONTEXT ctx, M2MB_CRYPTO_ECC_DP_E domain, UINT32 len, const UINT8 *param)
Imports an ECC Domain Parameter to the given context.
M2MB_CRYPTO_CTX_ALG_E
Enumeration representing all supported Crypto algorithms.
Definition: m2mb_crypto.h:83
#define M2MB_CRYPTO_DES_IV_BYTE_LEN
Definition: m2mb_crypto.h:1337
UINT8 * m2mb_crypto_hmac(M2MB_CRYPTO_MD_ALG_E md_info, const UINT8 *key, const SIZE_T keylen, const UINT8 *input, const SIZE_T inlen, UINT8 *hmac)
This function will compute the HMAC in one shot without needing any context.
M2MB_RESULT_E m2mb_crypto_ecdsa_verify(M2MB_CRYPTO_ECC_CONTEXT ctx, UINT8 *msg, UINT32 msg_len, M2MB_CRYPTO_ECC_AFFINE_POINT_T *pubkey, UINT8 *sig, SIZE_T sig_len)
ECDSA signature verification function.
#define M2MB_CRYPTO_3DES_KEY2_SIZE
Definition: m2mb_crypto.h:1328
struct M2MB_CRYPTO_CMAC_CONTEXT_TAG * M2MB_CRYPTO_CMAC_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:126
struct M2MB_CRYPTO_HMAC_CONTEXT_TAG * M2MB_CRYPTO_HMAC_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:120
M2MB_RESULT_E m2mb_crypto_aes_deinit(M2MB_CRYPTO_AES_CONTEXT ctx)
Free an M2MB_CRYPTO_AES_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_aes_init(M2MB_CRYPTO_AES_CONTEXT *ctx)
Allocates an M2MB_CRYPTO_AES_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_ecc_keypair_generate(M2MB_CRYPTO_ECC_CONTEXT ctx)
Function to generate an ECC keypair.
M2MB_RESULT_E m2mb_crypto_des_keyblob_import(M2MB_CRYPTO_DES_CONTEXT ctx, const UINT8 *keyblob, UINT32 keyblob_length)
Imports a DES/3DES symmetric key into the context.
M2MB_CRYPTO_RSA_PADDING_TYPE_E
Padding types for RSA encryption.
Definition: m2mb_crypto.h:1711
M2MB_RESULT_E m2mb_crypto_rsa_private(M2MB_CRYPTO_RSA_CONTEXT ctx, const UINT8 *in, UINT8 *out)
RSA private key operation.
M2MB_RESULT_E m2mb_crypto_rsa_public_key_import(M2MB_CRYPTO_RSA_CONTEXT ctx, const UINT8 *modulus, UINT32 modulus_size, const UINT8 *public_exponent, UINT32 public_exponent_size)
Imports an RSA public key to the given context.
M2MB_RESULT_E m2mb_crypto_cmac_reset(M2MB_CRYPTO_CMAC_CONTEXT ctx)
Prepare to run CMAC for a new message.
M2MB_RESULT_E m2mb_crypto_hmac_update(M2MB_CRYPTO_HMAC_CONTEXT ctx, const UINT8 *data, SIZE_T len)
continuously HMAC of data. This function can be called repeatedly similar to streaming
Definition: m2mb_crypto.h:2367
M2MB_RESULT_E m2mb_crypto_rsa_externalkey_import(M2MB_CRYPTO_RSA_CONTEXT ctx, const UINT8 *modulus, UINT32 modulus_size, const UINT8 *p_factor, UINT32 p_factor_size, const UINT8 *q_factor, UINT32 q_factor_size, const UINT8 *public_exponent, UINT32 public_exponent_size, const UINT8 *private_exponent, UINT32 private_exponent_size, M2MB_CRYPTO_RSA_PADDING_TYPE_E padding_type)
Imports an externally generated RSA key pair into the context.
M2MB_RESULT_E m2mb_crypto_des_keyblob_export(M2MB_CRYPTO_DES_CONTEXT ctx, UINT8 *keyblob, UINT32 *keyblob_length)
Exports a DES key blob from the given context. The blob is encrypted with a device specific key and ...
M2MB_RESULT_E m2mb_crypto_hmac_reset(M2MB_CRYPTO_HMAC_CONTEXT ctx)
Prepare to run HMAC for a new message.
M2MB_RESULT_E m2mb_crypto_rsa_public_key_export(M2MB_CRYPTO_RSA_CONTEXT ctx, UINT8 *modulus, UINT32 *modulus_size, UINT8 *public_exponent, UINT32 *public_exponent_size)
Exports an RSA public key from the given context.
M2MB_RESULT_E m2mb_crypto_rsa_decrypt(M2MB_CRYPTO_RSA_CONTEXT ctx, M2MB_CRYPTO_RSA_MODE_E mode, SIZE_T *outlen, UINT8 *out, SIZE_T out_max_len, const UINT8 *in)
Generic RSA PKCS#1 decryption method.
Definition: m2mb_crypto.h:1714
M2MB_RESULT_E m2mb_crypto_cmac_final(M2MB_CRYPTO_CMAC_CONTEXT ctx, UINT8 *cmac)
This function computes the final CMAC for all previously provided messages for the given context.
M2MB_RESULT_E m2mb_crypto_ecc_dp_init(M2MB_CRYPTO_ECC_CONTEXT ctx, UINT8 *p, UINT8 *a, UINT8 *b, UINT8 *g_x, UINT8 *g_y, UINT8 *n, UINT32 *h)
Allocates an M2MB_CRYPTO_ECC_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_des_generate_key(M2MB_CRYPTO_DES_CONTEXT ctx, UINT32 keybits)
Generates a DES encryption key for a given context.
struct M2MB_CRYPTO_GEN_CONTEXT_TAG * M2MB_CRYPTO_GEN_CONTEXT
Opaque structure for context.
Definition: m2mb_crypto.h:107
#define M2MB_CRYPTO_3DES_KEY3_SIZE
Definition: m2mb_crypto.h:1331
M2MB_RESULT_E m2mb_crypto_des_ecb_encdec(M2MB_CRYPTO_DES_CONTEXT ctx, M2MB_CRYPTO_DES_MODE_E mode, const UINT8 in[M2MB_CRYPTO_DES_BLOCK_BYTE_LEN], UINT8 out[M2MB_CRYPTO_DES_BLOCK_BYTE_LEN])
Encrypts/decrypts a single 8 bytes block onto the output buffer using the DES ECB algorithm.
Definition: m2mb_crypto.h:1720
M2MB_RESULT_E m2mb_crypto_aes_cbc_encdec(M2MB_CRYPTO_AES_CONTEXT ctx, M2MB_CRYPTO_AES_MODE_E mode, const UINT8 *in, UINT8 *out, SIZE_T inlen, UINT8 ivec[M2MB_CRYPTO_AES_IV_SIZE])
Encrypts/decrypts a given buffer with a given length using the AES CBC. The length must be a multiple...
M2MB_RESULT_E m2mb_crypto_rsa_verify(M2MB_CRYPTO_RSA_CONTEXT ctx, UINT8 *pubkey, UINT32 pubkey_length, M2MB_CRYPTO_MD_ALG_E md_alg, UINT32 hashlen, const UINT8 *hash, const UINT8 *sig)
Generic RSA PKCS#1 signature verification method.
#define M2MB_CRYPTO_AES_ECB_BLOCK_SIZE
Definition: m2mb_crypto.h:982
M2MB_RESULT_E m2mb_crypto_ecc_deinit(M2MB_CRYPTO_ECC_CONTEXT ctx)
Free an M2MB_CRYPTO_ECC_CONTEXT structure.
M2MB_RESULT_E m2mb_crypto_aes_generate_key(M2MB_CRYPTO_AES_CONTEXT ctx, UINT32 keybits)
Generates an AES encryption key for a given context.