in source/header.c [160:187]
static inline int parse_edk(
struct aws_allocator *allocator, struct aws_cryptosdk_edk *edk, struct aws_byte_cursor *cur) {
uint16_t field_len;
memset(edk, 0, sizeof(*edk));
if (!aws_byte_cursor_read_be16(cur, &field_len)) goto SHORT_BUF;
if (aws_byte_buf_init(&edk->provider_id, allocator, field_len)) goto MEM_ERR;
if (!aws_byte_cursor_read_and_fill_buffer(cur, &edk->provider_id)) goto SHORT_BUF;
if (!aws_byte_cursor_read_be16(cur, &field_len)) goto SHORT_BUF;
if (aws_byte_buf_init(&edk->provider_info, allocator, field_len)) goto MEM_ERR;
if (!aws_byte_cursor_read_and_fill_buffer(cur, &edk->provider_info)) goto SHORT_BUF;
if (!aws_byte_cursor_read_be16(cur, &field_len)) goto SHORT_BUF;
if (aws_byte_buf_init(&edk->ciphertext, allocator, field_len)) goto MEM_ERR;
if (!aws_byte_cursor_read_and_fill_buffer(cur, &edk->ciphertext)) goto SHORT_BUF;
return AWS_OP_SUCCESS;
SHORT_BUF:
aws_cryptosdk_edk_clean_up(edk);
return aws_raise_error(AWS_ERROR_SHORT_BUFFER);
MEM_ERR:
aws_cryptosdk_edk_clean_up(edk);
// The _init function should have already raised an AWS_ERROR_OOM
return AWS_OP_ERR;
}