GRPC Core
9.0.0
|
#include <grpc/support/port_platform.h>
#include <stdbool.h>
#include "src/core/tsi/alts/crypt/gsec.h"
Go to the source code of this file.
Typedefs | |
typedef struct iovec | iovec_t |
typedef struct alts_iovec_record_protocol | alts_iovec_record_protocol |
Functions | |
size_t | alts_iovec_record_protocol_get_header_length () |
This method gets the length of record protocol frame header. More... | |
size_t | alts_iovec_record_protocol_get_tag_length (const alts_iovec_record_protocol *rp) |
This method gets the length of record protocol frame tag. More... | |
size_t | alts_iovec_record_protocol_max_unprotected_data_size (const alts_iovec_record_protocol *rp, size_t max_protected_frame_size) |
This method returns maximum allowed unprotected data size, given maximum protected frame size. More... | |
grpc_status_code | alts_iovec_record_protocol_integrity_only_protect (alts_iovec_record_protocol *rp, const iovec_t *unprotected_vec, size_t unprotected_vec_length, iovec_t header, iovec_t tag, char **error_details) |
This method performs integrity-only protect operation on a alts_iovec_record_protocol instance, i.e., compute frame header and tag. More... | |
grpc_status_code | alts_iovec_record_protocol_integrity_only_unprotect (alts_iovec_record_protocol *rp, const iovec_t *protected_vec, size_t protected_vec_length, iovec_t header, iovec_t tag, char **error_details) |
This method performs integrity-only unprotect operation on a alts_iovec_record_protocol instance, i.e., verify frame header and tag. More... | |
grpc_status_code | alts_iovec_record_protocol_privacy_integrity_protect (alts_iovec_record_protocol *rp, const iovec_t *unprotected_vec, size_t unprotected_vec_length, iovec_t protected_frame, char **error_details) |
This method performs privacy-integrity protect operation on a alts_iovec_record_protocol instance, i.e., compute a protected frame. More... | |
grpc_status_code | alts_iovec_record_protocol_privacy_integrity_unprotect (alts_iovec_record_protocol *rp, iovec_t header, const iovec_t *protected_vec, size_t protected_vec_length, iovec_t unprotected_data, char **error_details) |
This method performs privacy-integrity unprotect operation on a alts_iovec_record_protocol instance given a full protected frame, i.e., compute the unprotected data. More... | |
grpc_status_code | alts_iovec_record_protocol_create (gsec_aead_crypter *crypter, size_t overflow_size, bool is_client, bool is_integrity_only, bool is_protect, alts_iovec_record_protocol **rp, char **error_details) |
This method creates an alts_iovec_record_protocol instance, given a gsec_aead_crypter instance, a flag indicating if the created instance will be used at the client or server side, and a flag indicating if the created instance will be used for integrity-only mode or privacy-integrity mode. More... | |
void | alts_iovec_record_protocol_destroy (alts_iovec_record_protocol *rp) |
This method destroys an alts_iovec_record_protocol instance by de-allocating all of its occupied memory. More... | |
Variables | |
constexpr size_t | kZeroCopyFrameMessageType = 0x06 |
constexpr size_t | kZeroCopyFrameLengthFieldSize = 4 |
constexpr size_t | kZeroCopyFrameMessageTypeFieldSize = 4 |
constexpr size_t | kZeroCopyFrameHeaderSize |
constexpr size_t | kAltsRecordProtocolRekeyFrameLimit = 8 |
constexpr size_t | kAltsRecordProtocolFrameLimit = 5 |
typedef struct alts_iovec_record_protocol alts_iovec_record_protocol |
grpc_status_code alts_iovec_record_protocol_create | ( | gsec_aead_crypter * | crypter, |
size_t | overflow_size, | ||
bool | is_client, | ||
bool | is_integrity_only, | ||
bool | is_protect, | ||
alts_iovec_record_protocol ** | rp, | ||
char ** | error_details | ||
) |
This method creates an alts_iovec_record_protocol instance, given a gsec_aead_crypter instance, a flag indicating if the created instance will be used at the client or server side, and a flag indicating if the created instance will be used for integrity-only mode or privacy-integrity mode.
The ownership of gsec_aead_crypter instance is transferred to this new object.
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).
void alts_iovec_record_protocol_destroy | ( | alts_iovec_record_protocol * | rp | ) |
This method destroys an alts_iovec_record_protocol instance by de-allocating all of its occupied memory.
A gsec_aead_crypter instance passed in at gsec_alts_crypter instance creation time will be destroyed in this method.
size_t alts_iovec_record_protocol_get_header_length | ( | ) |
This method gets the length of record protocol frame header.
size_t alts_iovec_record_protocol_get_tag_length | ( | const alts_iovec_record_protocol * | rp | ) |
This method gets the length of record protocol frame tag.
On success, the method returns the length of record protocol frame tag. Otherwise, it returns zero.
grpc_status_code alts_iovec_record_protocol_integrity_only_protect | ( | alts_iovec_record_protocol * | rp, |
const iovec_t * | unprotected_vec, | ||
size_t | unprotected_vec_length, | ||
iovec_t | header, | ||
iovec_t | tag, | ||
char ** | error_details | ||
) |
This method performs integrity-only protect operation on a alts_iovec_record_protocol instance, i.e., compute frame header and tag.
The caller needs to allocate the memory for header and tag prior to calling this method.
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).
grpc_status_code alts_iovec_record_protocol_integrity_only_unprotect | ( | alts_iovec_record_protocol * | rp, |
const iovec_t * | protected_vec, | ||
size_t | protected_vec_length, | ||
iovec_t | header, | ||
iovec_t | tag, | ||
char ** | error_details | ||
) |
This method performs integrity-only unprotect operation on a alts_iovec_record_protocol instance, i.e., verify frame header and tag.
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).
size_t alts_iovec_record_protocol_max_unprotected_data_size | ( | const alts_iovec_record_protocol * | rp, |
size_t | max_protected_frame_size | ||
) |
This method returns maximum allowed unprotected data size, given maximum protected frame size.
On success, the method returns the maximum allowed unprotected data size. Otherwise, it returns zero.
grpc_status_code alts_iovec_record_protocol_privacy_integrity_protect | ( | alts_iovec_record_protocol * | rp, |
const iovec_t * | unprotected_vec, | ||
size_t | unprotected_vec_length, | ||
iovec_t | protected_frame, | ||
char ** | error_details | ||
) |
This method performs privacy-integrity protect operation on a alts_iovec_record_protocol instance, i.e., compute a protected frame.
The caller needs to allocate the memory for the protected frame prior to calling this method.
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).
grpc_status_code alts_iovec_record_protocol_privacy_integrity_unprotect | ( | alts_iovec_record_protocol * | rp, |
iovec_t | header, | ||
const iovec_t * | protected_vec, | ||
size_t | protected_vec_length, | ||
iovec_t | unprotected_data, | ||
char ** | error_details | ||
) |
This method performs privacy-integrity unprotect operation on a alts_iovec_record_protocol instance given a full protected frame, i.e., compute the unprotected data.
The caller needs to allocated the memory for the unprotected data prior to calling this method.
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).
constexpr size_t kAltsRecordProtocolFrameLimit = 5 |
constexpr size_t kAltsRecordProtocolRekeyFrameLimit = 8 |
constexpr size_t kZeroCopyFrameHeaderSize |
constexpr size_t kZeroCopyFrameLengthFieldSize = 4 |
constexpr size_t kZeroCopyFrameMessageType = 0x06 |
constexpr size_t kZeroCopyFrameMessageTypeFieldSize = 4 |