BOLOS TEE
|
Limited libsodium/NaCl implementation. More...
Go to the source code of this file.
Functions | |
int | crypto_secretbox_easy (unsigned char *c, const unsigned char *m, unsigned long mlen, const unsigned char *n, const unsigned char *k) |
Authenticated Encryption (XSalsa20 + Poly1305) of a message using a symmetric key. More... | |
int | crypto_secretbox_open_easy (unsigned char *m, const unsigned char *c, unsigned long clen, const unsigned char *n, const unsigned char *k) |
Decrypt a message encrypted by crypto_secretbox_easy. More... | |
int | crypto_auth (unsigned char *out, const unsigned char *in, unsigned long inlen, const unsigned char *k) |
Compute an authentication (HMAC) of a message using a symmetric key. More... | |
int | crypto_auth_verify (const unsigned char *h, const unsigned char *in, unsigned long inlen, const unsigned char *k) |
Verify an authentication (HMAC) of a message generated by crypto_auth. More... | |
int | crypto_box_keypair (unsigned char *pk, unsigned char *sk) |
Generate a keypair to be used for Authenticated Encryption with crypto_box functions. More... | |
int | crypto_box_easy (unsigned char *c, const unsigned char *m, unsigned long mlen, const unsigned char *n, const unsigned char *pk, const unsigned char *sk) |
Authenticated Encryption (X25519 + XSalsa20 + Poly1305) of a message using an asymmetric keypair. More... | |
int | crypto_box_open_easy (unsigned char *m, const unsigned char *c, unsigned long clen, const unsigned char *n, const unsigned char *pk, const unsigned char *sk) |
Decrypt a message encrypted by crypto_box_easy. More... | |
int | crypto_box_seal (unsigned char *c, const unsigned char *m, unsigned long mlen, const unsigned char *pk) |
Anonymous encryption (X25519, XSalsa20, Poly1305) of a message using an asymmetric keypair. More... | |
int | crypto_box_seal_open (unsigned char *m, const unsigned char *c, unsigned long clen, const unsigned char *pk, const unsigned char *sk) |
Decrypt a message encrypted by crypto_box_seal. More... | |
int | crypto_sign_keypair (unsigned char *pk, unsigned char *sk) |
Generate a keypair to be used for Signature with crypto_sign functions. More... | |
int | crypto_sign (unsigned char *sm, unsigned long *smlen_p, const unsigned char *m, unsigned long mlen, const unsigned char *sk) |
Generate a Combined Signature (Ed25519) of a message using an asymmetric keypair. More... | |
int | crypto_sign_open (unsigned char *m, unsigned long *mlen_p, const unsigned char *sm, unsigned long smlen, const unsigned char *pk) |
Unwrap a message wrapped by crypto_sign. More... | |
Limited libsodium/NaCl implementation.
Provide an interface to the box, secretbox, auth, and signature on ED25519 APIs from libsodium / NaCl
This API is specific to the TEE implementation. Support on other platforms is being added.
int crypto_auth | ( | unsigned char * | out, |
const unsigned char * | in, | ||
unsigned long | inlen, | ||
const unsigned char * | k | ||
) |
Compute an authentication (HMAC) of a message using a symmetric key.
[out] | out | Destination buffer, should be at least crypto_auth_BYTES bytes long |
[in] | in | Source buffer |
[in] | inlen | Size of the message to process |
[in] | k | Symmetric key, should be crypto_auth_KEYBYTES bytes long |
int crypto_auth_verify | ( | const unsigned char * | h, |
const unsigned char * | in, | ||
unsigned long | inlen, | ||
const unsigned char * | k | ||
) |
Verify an authentication (HMAC) of a message generated by crypto_auth.
[in] | h | Buffer containing the tag returned by crypto_auth |
[in] | in | Source buffer |
[in] | inlen | Size of the message to process |
[in] | k | Symmetric key used for crypto_auth |
int crypto_box_easy | ( | unsigned char * | c, |
const unsigned char * | m, | ||
unsigned long | mlen, | ||
const unsigned char * | n, | ||
const unsigned char * | pk, | ||
const unsigned char * | sk | ||
) |
Authenticated Encryption (X25519 + XSalsa20 + Poly1305) of a message using an asymmetric keypair.
[out] | c | Destination buffer, should be at least crypto_box_SEALBYTES + mlen bytes long |
[in] | m | Source buffer |
[in] | mlen | Size of the message to process |
[in] | n | Nonce, should be crypto_box_NONCEBYTES bytes long |
[in] | pk | Public key of the recipient generated previously |
[in] | sk | Private key of the sender generated previously |
int crypto_box_keypair | ( | unsigned char * | pk, |
unsigned char * | sk | ||
) |
Generate a keypair to be used for Authenticated Encryption with crypto_box functions.
[out] | pk | Destination buffer for the public key, should be at least crypto_box_PUBLICKEYBYTES bytes long |
[out] | sk | Destination buffer for the private key, should be at least crypto_box_SECRETKEYBYTES bytes long |
int crypto_box_open_easy | ( | unsigned char * | m, |
const unsigned char * | c, | ||
unsigned long | clen, | ||
const unsigned char * | n, | ||
const unsigned char * | pk, | ||
const unsigned char * | sk | ||
) |
Decrypt a message encrypted by crypto_box_easy.
[out] | m | Destination buffer, should be at least clen - crypto_box_MACBYTES bytes long |
[in] | c | Source buffer |
[in] | clen | Size of the encrypted message to process |
[in] | n | Nonce used for crypto_box_easy |
[in] | pk | Public key of the sender generated previously |
[in] | sk | Private key of the recipient generated previously |
int crypto_box_seal | ( | unsigned char * | c, |
const unsigned char * | m, | ||
unsigned long | mlen, | ||
const unsigned char * | pk | ||
) |
Anonymous encryption (X25519, XSalsa20, Poly1305) of a message using an asymmetric keypair.
[out] | c | Destination buffer, should be at least crypto_box_SEALBYTES + mlen bytes long |
[in] | m | Source buffer |
[in] | mlen | Size of the message to process |
[in] | pk | Public key of the recipient generated previously |
int crypto_box_seal_open | ( | unsigned char * | m, |
const unsigned char * | c, | ||
unsigned long | clen, | ||
const unsigned char * | pk, | ||
const unsigned char * | sk | ||
) |
Decrypt a message encrypted by crypto_box_seal.
[out] | m | Destination buffer, should be at least clen - crypto_box_SEALBYTES bytes long |
[in] | c | Source buffer |
[in] | clen | Size of the encrypted message to process |
[in] | pk | Public key of the recipient generated previously |
[in] | sk | Private key of the recipient generated previously |
int crypto_secretbox_easy | ( | unsigned char * | c, |
const unsigned char * | m, | ||
unsigned long | mlen, | ||
const unsigned char * | n, | ||
const unsigned char * | k | ||
) |
Authenticated Encryption (XSalsa20 + Poly1305) of a message using a symmetric key.
[out] | c | Destination buffer, should be at least crypto_secretbox_MACBYTES + mlen bytes long |
[in] | m | Source buffer |
[in] | mlen | Size of the message to process |
[in] | n | Nonce, should be crypto_secretbox_NONCEBYTES bytes long |
[in] | k | Symmetric key, should be crypto_secretbox_KEYBYTES bytes long |
int crypto_secretbox_open_easy | ( | unsigned char * | m, |
const unsigned char * | c, | ||
unsigned long | clen, | ||
const unsigned char * | n, | ||
const unsigned char * | k | ||
) |
Decrypt a message encrypted by crypto_secretbox_easy.
[out] | m | Destination buffer, should be at least clen - crypto_secretbox_MACBYTES bytes long |
[in] | c | Source buffer |
[in] | clen | Size of the encrypted message to process |
[in] | n | Nonce used for crypto_secretbox_easy |
[in] | k | Symmetric key used for crypto_secretbox_easy |
int crypto_sign | ( | unsigned char * | sm, |
unsigned long * | smlen_p, | ||
const unsigned char * | m, | ||
unsigned long | mlen, | ||
const unsigned char * | sk | ||
) |
Generate a Combined Signature (Ed25519) of a message using an asymmetric keypair.
[out] | sm | Destination buffer, should be at least crypto_sign_BYTES + mlen bytes long |
[in,out] | smlem_p | Pointer to the length of the destination buffer, filled with the actual length of the result |
[in] | m | Source buffer |
[in] | mlen | Size of the message to process |
[in] | sk | Private key of the sender generated previously |
int crypto_sign_keypair | ( | unsigned char * | pk, |
unsigned char * | sk | ||
) |
Generate a keypair to be used for Signature with crypto_sign functions.
[out] | pk | Destination buffer for the public key, should be at least crypto_sign_PUBLICKEYBYTES bytes long |
[out] | sk | Destination buffer for the private key, should be at least crypto_sign_SECRETKEYBYTES bytes long |
int crypto_sign_open | ( | unsigned char * | m, |
unsigned long * | mlen_p, | ||
const unsigned char * | sm, | ||
unsigned long | smlen, | ||
const unsigned char * | pk | ||
) |
Unwrap a message wrapped by crypto_sign.
[out] | m | Destination buffer, should be at least smlen bytes long |
[in,out] | mlem_p | Pointer to the length of the destination buffer, filled with the actual length of the result |
[in] | sm | Source buffer |
[in] | smlen | Size of the message to process |
[in] | pk | Public key of the sender generated previously |