chore: sdk compiles almost w/o warnings?
This commit is contained in:
@@ -55,6 +55,10 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
// lmao, importing hal_crypto imports the entire fwlib bloat
|
||||
// and conflicts with the variable names
|
||||
#include "rtl8711b_crypto.h"
|
||||
#include "rtl8710b_crypto_api.h"
|
||||
|
||||
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
|
||||
!defined(EFI32)
|
||||
|
||||
@@ -1,74 +1,64 @@
|
||||
#include "rom_ssl_ram_map.h"
|
||||
#include <diag.h>
|
||||
#include "ssl_ram_map.h"
|
||||
|
||||
extern struct _rom_ssl_ram_map rom_ssl_ram_map;
|
||||
|
||||
//AES HW CRYPTO
|
||||
extern int rtl_crypto_aes_ecb_init(IN const u8* key, IN const u32 keylen);
|
||||
extern int rtl_crypto_aes_ecb_decrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
extern int rtl_crypto_aes_ecb_encrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
extern int rtl_crypto_aes_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
extern int rtl_crypto_aes_cbc_decrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
extern int rtl_crypto_aes_cbc_encrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
// AES HW CRYPTO
|
||||
int rtl_crypto_aes_ecb_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_aes_ecb_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_aes_ecb_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_aes_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_aes_cbc_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_aes_cbc_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
|
||||
//DES HW CRYPTO
|
||||
extern int rtl_crypto_des_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
extern int rtl_crypto_des_cbc_decrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
extern int rtl_crypto_des_cbc_encrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
extern int rtl_crypto_3des_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
extern int rtl_crypto_3des_cbc_decrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
extern int rtl_crypto_3des_cbc_encrypt(
|
||||
IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
// DES HW CRYPTO
|
||||
int rtl_crypto_des_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_des_cbc_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_des_cbc_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_3des_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_3des_cbc_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_3des_cbc_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
|
||||
int platform_set_malloc_free( void * (*malloc_func)( size_t ),
|
||||
void (*free_func)( void * ) )
|
||||
{
|
||||
/* OS interface */
|
||||
rom_ssl_ram_map.ssl_malloc = malloc_func;
|
||||
rom_ssl_ram_map.ssl_free = free_func;
|
||||
rom_ssl_ram_map.ssl_printf = (int (*)(char const *, ...))DiagPrintf;
|
||||
int platform_set_malloc_free(void* (*malloc_func)(size_t),
|
||||
void (*free_func)(void*)) {
|
||||
/* OS interface */
|
||||
rom_ssl_ram_map.ssl_malloc = malloc_func;
|
||||
rom_ssl_ram_map.ssl_free = free_func;
|
||||
rom_ssl_ram_map.ssl_printf = (int (*)(char const*, ...))DiagPrintf;
|
||||
|
||||
//AES HW CRYPTO
|
||||
rom_ssl_ram_map.hw_crypto_aes_ecb_init = rtl_crypto_aes_ecb_init;
|
||||
rom_ssl_ram_map.hw_crypto_aes_ecb_decrypt = rtl_crypto_aes_ecb_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_aes_ecb_encrypt = rtl_crypto_aes_ecb_encrypt;
|
||||
rom_ssl_ram_map.hw_crypto_aes_cbc_init = rtl_crypto_aes_cbc_init;
|
||||
rom_ssl_ram_map.hw_crypto_aes_cbc_decrypt = rtl_crypto_aes_cbc_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_aes_cbc_encrypt = rtl_crypto_aes_cbc_encrypt;
|
||||
// AES HW CRYPTO
|
||||
rom_ssl_ram_map.hw_crypto_aes_ecb_init = rtl_crypto_aes_ecb_init;
|
||||
rom_ssl_ram_map.hw_crypto_aes_ecb_decrypt = rtl_crypto_aes_ecb_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_aes_ecb_encrypt = rtl_crypto_aes_ecb_encrypt;
|
||||
rom_ssl_ram_map.hw_crypto_aes_cbc_init = rtl_crypto_aes_cbc_init;
|
||||
rom_ssl_ram_map.hw_crypto_aes_cbc_decrypt = rtl_crypto_aes_cbc_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_aes_cbc_encrypt = rtl_crypto_aes_cbc_encrypt;
|
||||
|
||||
//DES HW CRYPTO
|
||||
rom_ssl_ram_map.hw_crypto_des_cbc_init = rtl_crypto_des_cbc_init;
|
||||
rom_ssl_ram_map.hw_crypto_des_cbc_decrypt = rtl_crypto_des_cbc_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_des_cbc_encrypt = rtl_crypto_des_cbc_encrypt;
|
||||
rom_ssl_ram_map.hw_crypto_3des_cbc_init = rtl_crypto_3des_cbc_init;
|
||||
rom_ssl_ram_map.hw_crypto_3des_cbc_decrypt = rtl_crypto_3des_cbc_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_3des_cbc_encrypt = rtl_crypto_3des_cbc_encrypt;
|
||||
// DES HW CRYPTO
|
||||
rom_ssl_ram_map.hw_crypto_des_cbc_init = rtl_crypto_des_cbc_init;
|
||||
rom_ssl_ram_map.hw_crypto_des_cbc_decrypt = rtl_crypto_des_cbc_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_des_cbc_encrypt = rtl_crypto_des_cbc_encrypt;
|
||||
rom_ssl_ram_map.hw_crypto_3des_cbc_init = rtl_crypto_3des_cbc_init;
|
||||
rom_ssl_ram_map.hw_crypto_3des_cbc_decrypt = rtl_crypto_3des_cbc_decrypt;
|
||||
rom_ssl_ram_map.hw_crypto_3des_cbc_encrypt = rtl_crypto_3des_cbc_encrypt;
|
||||
|
||||
/* Variables */
|
||||
rom_ssl_ram_map.use_hw_crypto_func = 1;
|
||||
/* Variables */
|
||||
rom_ssl_ram_map.use_hw_crypto_func = 1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
52
lib/amb1_sdk/common/network/ssl/ssl_ram_map/ssl_ram_map.h
Normal file
52
lib/amb1_sdk/common/network/ssl/ssl_ram_map/ssl_ram_map.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef SSL_RAM_MAP_H
|
||||
#define SSL_RAM_MAP_H
|
||||
|
||||
#include <diag.h>
|
||||
|
||||
#include "rom_ssl_ram_map.h"
|
||||
|
||||
/* Function declarations */
|
||||
|
||||
/**
|
||||
* @brief Sets up malloc, free and other platform-specific functions for SSL
|
||||
* operations
|
||||
* @param malloc_func Function pointer to memory allocation function
|
||||
* @param free_func Function pointer to memory deallocation function
|
||||
* @return 0 on success
|
||||
*/
|
||||
int platform_set_malloc_free(void* (*malloc_func)(size_t),
|
||||
void (*free_func)(void*));
|
||||
|
||||
/* AES Hardware Crypto Function Declarations */
|
||||
int rtl_crypto_aes_ecb_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_aes_ecb_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_aes_ecb_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_aes_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_aes_cbc_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_aes_cbc_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
|
||||
/* DES Hardware Crypto Function Declarations */
|
||||
int rtl_crypto_des_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_des_cbc_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_des_cbc_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_3des_cbc_init(IN const u8* key, IN const u32 keylen);
|
||||
int rtl_crypto_3des_cbc_decrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
int rtl_crypto_3des_cbc_encrypt(IN const u8* message, IN const u32 msglen,
|
||||
IN const u8* iv, IN const u32 ivlen,
|
||||
OUT u8* pResult);
|
||||
|
||||
#endif /* SSL_RAM_MAP_H */
|
||||
Reference in New Issue
Block a user