#include <grpc/support/port_platform.h>
#include "src/core/tsi/alts/frame_protector/alts_frame_protector.h"
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/crash.h"
#include "src/core/tsi/alts/crypt/gsec.h"
#include "src/core/tsi/alts/frame_protector/alts_crypter.h"
#include "src/core/tsi/alts/frame_protector/frame_handler.h"
#include "src/core/tsi/transport_security.h"
constexpr size_t kMinFrameLength = …;
constexpr size_t kDefaultFrameLength = …;
constexpr size_t kMaxFrameLength = …;
constexpr size_t kAltsRecordProtocolRekeyFrameLimit = …;
constexpr size_t kAltsRecordProtocolFrameLimit = …;
struct alts_frame_protector { … };
static tsi_result seal(alts_frame_protector* impl) { … }
static size_t max_encrypted_payload_bytes(alts_frame_protector* impl) { … }
static tsi_result alts_protect_flush(tsi_frame_protector* self,
unsigned char* protected_output_frames,
size_t* protected_output_frames_size,
size_t* still_pending_size) { … }
static tsi_result alts_protect(tsi_frame_protector* self,
const unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size,
unsigned char* protected_output_frames,
size_t* protected_output_frames_size) { … }
static tsi_result unseal(alts_frame_protector* impl) { … }
static void ensure_buffer_size(alts_frame_protector* impl) { … }
static tsi_result alts_unprotect(tsi_frame_protector* self,
const unsigned char* protected_frames_bytes,
size_t* protected_frames_bytes_size,
unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size) { … }
static void alts_destroy(tsi_frame_protector* self) { … }
static const tsi_frame_protector_vtable alts_frame_protector_vtable = …;
static grpc_status_code create_alts_crypters(const uint8_t* key,
size_t key_size, bool is_client,
bool is_rekey,
alts_frame_protector* impl,
char** error_details) { … }
tsi_result alts_create_frame_protector(const uint8_t* key, size_t key_size,
bool is_client, bool is_rekey,
size_t* max_protected_frame_size,
tsi_frame_protector** self) { … }