#include <grpc/support/port_platform.h>
#include "src/core/tsi/alts/frame_protector/alts_crypter.h"
#include <string.h>
#include <grpc/support/alloc.h>
Go to the source code of this file.
Functions | |
void | alts_crypter_destroy (alts_crypter *crypter) |
size_t | alts_crypter_num_overhead_bytes (const alts_crypter *crypter) |
grpc_status_code | alts_crypter_process_in_place (alts_crypter *crypter, unsigned char *data, size_t data_allocated_size, size_t data_size, size_t *output_size, char **error_details) |
static void | maybe_copy_error_msg (const char *src, char **dst) |
void alts_crypter_destroy | ( | alts_crypter * | crypter | ) |
This method destroys an alts_crypter instance by de-allocating all of its occupied memory. A gsec_aead_crypter instance passed in at alts_crypter instance creation time will be destroyed in this method.
Definition at line 59 of file alts_crypter.cc.
size_t alts_crypter_num_overhead_bytes | ( | const alts_crypter * | crypter | ) |
This method gets the number of overhead bytes needed for sealing data that is the difference in size between the protected and raw data. The counter value used in a seal or unseal operation is locally maintained (not sent or received from the other peer) and therefore, will not be counted as part of overhead bytes.
On success, the method returns the number of overhead bytes. Otherwise, it returns zero.
Definition at line 50 of file alts_crypter.cc.
grpc_status_code alts_crypter_process_in_place | ( | alts_crypter * | crypter, |
unsigned char * | data, | ||
size_t | data_allocated_size, | ||
size_t | data_size, | ||
size_t * | output_size, | ||
char ** | error_details | ||
) |
This method performs either a seal or an unseal operation depending on the alts_crypter instance - crypter passed to the method. If the crypter is an instance implementing a seal operation, the method will perform a seal operation. That is, it seals raw data and stores the result in-place, and the memory allocated for data must be at least data_length + alts_crypter_num_overhead_bytes(). If the crypter is an instance implementing an unseal operation, the method will perform an unseal operation. That is, it unseals protected data and stores the result in-place. The size of unsealed data will be data_length - alts_crypter_num_overhead_bytes(). Integrity tag will be verified during the unseal operation, and if verification fails, the data will be wiped. The counters used in both seal and unseal operations are managed internally.
On success, 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).
Definition at line 34 of file alts_crypter.cc.
|
static |
Definition at line 27 of file alts_crypter.cc.