#include <grpc/support/port_platform.h>
#include "src/core/tsi/alts/crypt/gsec.h"
#include <stdio.h>
#include <string.h>
#include <grpc/support/alloc.h>
Go to the source code of this file.
Functions | |
grpc_status_code | gsec_aead_crypter_decrypt (gsec_aead_crypter *crypter, const uint8_t *nonce, size_t nonce_length, const uint8_t *aad, size_t aad_length, const uint8_t *ciphertext_and_tag, size_t ciphertext_and_tag_length, uint8_t *plaintext, size_t plaintext_length, size_t *bytes_written, char **error_details) |
grpc_status_code | gsec_aead_crypter_decrypt_iovec (gsec_aead_crypter *crypter, const uint8_t *nonce, size_t nonce_length, const struct iovec *aad_vec, size_t aad_vec_length, const struct iovec *ciphertext_vec, size_t ciphertext_vec_length, struct iovec plaintext_vec, size_t *plaintext_bytes_written, char **error_details) |
void | gsec_aead_crypter_destroy (gsec_aead_crypter *crypter) |
grpc_status_code | gsec_aead_crypter_encrypt (gsec_aead_crypter *crypter, const uint8_t *nonce, size_t nonce_length, const uint8_t *aad, size_t aad_length, const uint8_t *plaintext, size_t plaintext_length, uint8_t *ciphertext_and_tag, size_t ciphertext_and_tag_length, size_t *bytes_written, char **error_details) |
grpc_status_code | gsec_aead_crypter_encrypt_iovec (gsec_aead_crypter *crypter, const uint8_t *nonce, size_t nonce_length, const struct iovec *aad_vec, size_t aad_vec_length, const struct iovec *plaintext_vec, size_t plaintext_vec_length, struct iovec ciphertext_vec, size_t *ciphertext_bytes_written, char **error_details) |
grpc_status_code | gsec_aead_crypter_key_length (const gsec_aead_crypter *crypter, size_t *key_length_to_return, char **error_details) |
grpc_status_code | gsec_aead_crypter_max_ciphertext_and_tag_length (const gsec_aead_crypter *crypter, size_t plaintext_length, size_t *max_ciphertext_and_tag_length_to_return, char **error_details) |
grpc_status_code | gsec_aead_crypter_max_plaintext_length (const gsec_aead_crypter *crypter, size_t ciphertext_and_tag_length, size_t *max_plaintext_length_to_return, char **error_details) |
grpc_status_code | gsec_aead_crypter_nonce_length (const gsec_aead_crypter *crypter, size_t *nonce_length_to_return, char **error_details) |
grpc_status_code | gsec_aead_crypter_tag_length (const gsec_aead_crypter *crypter, size_t *tag_length_to_return, char **error_details) |
static void | maybe_copy_error_msg (const char *src, char **dst) |
Variables | |
static const char | vtable_error_msg [] |
grpc_status_code gsec_aead_crypter_decrypt | ( | gsec_aead_crypter * | crypter, |
const uint8_t * | nonce, | ||
size_t | nonce_length, | ||
const uint8_t * | aad, | ||
size_t | aad_length, | ||
const uint8_t * | ciphertext_and_tag, | ||
size_t | ciphertext_and_tag_length, | ||
uint8_t * | plaintext, | ||
size_t | plaintext_length, | ||
size_t * | bytes_written, | ||
char ** | error_details | ||
) |
This method performs an AEAD decrypt operation.
On the success of decryption, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_decrypt_iovec | ( | gsec_aead_crypter * | crypter, |
const uint8_t * | nonce, | ||
size_t | nonce_length, | ||
const struct iovec * | aad_vec, | ||
size_t | aad_vec_length, | ||
const struct iovec * | ciphertext_vec, | ||
size_t | ciphertext_vec_length, | ||
struct iovec | plaintext_vec, | ||
size_t * | plaintext_bytes_written, | ||
char ** | error_details | ||
) |
This method performs an AEAD decrypt operation.
On the success of decryption, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
void gsec_aead_crypter_destroy | ( | gsec_aead_crypter * | crypter | ) |
grpc_status_code gsec_aead_crypter_encrypt | ( | gsec_aead_crypter * | crypter, |
const uint8_t * | nonce, | ||
size_t | nonce_length, | ||
const uint8_t * | aad, | ||
size_t | aad_length, | ||
const uint8_t * | plaintext, | ||
size_t | plaintext_length, | ||
uint8_t * | ciphertext_and_tag, | ||
size_t | ciphertext_and_tag_length, | ||
size_t * | bytes_written, | ||
char ** | error_details | ||
) |
This method performs an AEAD encrypt operation.
On the success of encryption, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_encrypt_iovec | ( | gsec_aead_crypter * | crypter, |
const uint8_t * | nonce, | ||
size_t | nonce_length, | ||
const struct iovec * | aad_vec, | ||
size_t | aad_vec_length, | ||
const struct iovec * | plaintext_vec, | ||
size_t | plaintext_vec_length, | ||
struct iovec | ciphertext_vec, | ||
size_t * | ciphertext_bytes_written, | ||
char ** | error_details | ||
) |
This method performs an AEAD encrypt operation.
On the success of encryption, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_key_length | ( | const gsec_aead_crypter * | crypter, |
size_t * | key_length_to_return, | ||
char ** | error_details | ||
) |
This method returns a valid size of key array used at the construction of AEAD crypter instance. It is also the size that should be passed to encrypt and decrypt methods executed on the instance.
On the success of execution, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_max_ciphertext_and_tag_length | ( | const gsec_aead_crypter * | crypter, |
size_t | plaintext_length, | ||
size_t * | max_ciphertext_and_tag_length_to_return, | ||
char ** | error_details | ||
) |
This method computes the size of ciphertext+tag buffer that must be passed to gsec_aead_crypter_encrypt function to ensure correct encryption of a plaintext. The actual size of ciphertext+tag written to the buffer could be smaller.
On the success of execution, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_max_plaintext_length | ( | const gsec_aead_crypter * | crypter, |
size_t | ciphertext_and_tag_length, | ||
size_t * | max_plaintext_length_to_return, | ||
char ** | error_details | ||
) |
This method computes the size of plaintext buffer that must be passed to gsec_aead_crypter_decrypt function to ensure correct decryption of a ciphertext. The actual size of plaintext written to the buffer could be smaller.
On the success of execution, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_nonce_length | ( | const gsec_aead_crypter * | crypter, |
size_t * | nonce_length_to_return, | ||
char ** | error_details | ||
) |
This method returns a valid size of nonce array used at the construction of AEAD crypter instance. It is also the size that should be passed to encrypt and decrypt methods executed on the instance.
On the success of execution, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
grpc_status_code gsec_aead_crypter_tag_length | ( | const gsec_aead_crypter * | crypter, |
size_t * | tag_length_to_return, | ||
char ** | error_details | ||
) |
This method returns a valid size of tag array used at the construction of AEAD crypter instance. It is also the size that should be passed to encrypt and decrypt methods executed on the instance.
On the success of execution, the method returns GRPC_STATUS_OK. Otherwise, it returns an error status code along with its details specified in error_details (if error_details is not nullptr).
|
static |