file/log_file_encrypted/crypto.h

/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#pragma once
#include "gos.h"
typedef struct
{
mbedtls_aes_context aes;
} crypt_context_t;
void calculate_mac(const uint8_t *key, const uint8_t *buffer, uint32_t buffer_length, uint8_t *mac);
void encrypt_block(crypt_context_t *context, uint8_t *ptr);
void encrypt_unaligned_block(crypt_context_t *context, uint8_t *ptr, uint8_t size);
void encrypt_buffer(crypt_context_t *context, uint8_t *ptr, int32_t size);
// NOTE: encrypt/decrypt in CTR mode is symmetric, so these function do the *exact* same thing
#define decrypt_block encrypt_block
#define decrypt_buffer encrypt_buffer