int aws_kms_encrypt_blocking_from_request()

in source/kms.c [2819:2840]


int aws_kms_encrypt_blocking_from_request(
    struct aws_nitro_enclaves_kms_client *client,
    const struct aws_kms_encrypt_request *request_structure,
    struct aws_byte_buf *ciphertext_blob) {
    AWS_PRECONDITION(client != NULL);
    AWS_PRECONDITION(request_structure != NULL);
    AWS_PRECONDITION(ciphertext_blob != NULL);

    struct aws_kms_encrypt_response *response_structure = NULL;
    int rc = AWS_OP_ERR;

    response_structure = s_kms_get_encrypt_response_from_request(client, request_structure);
    if (response_structure == NULL) {
        fprintf(stderr, "Could not read response from KMS\n");
    } else {
        rc = aws_byte_buf_init_copy(ciphertext_blob, client->allocator, &response_structure->ciphertext_blob);
    }

    aws_kms_encrypt_response_destroy(response_structure);

    return rc;
}