chore: sdk compiles almost w/o warnings?

This commit is contained in:
2024-12-17 03:13:08 +06:00
parent 31efbc726f
commit 7c7b36a6b3
55 changed files with 658 additions and 514 deletions

View File

@@ -32,6 +32,8 @@
#ifndef __CPU_H__
#define __CPU_H__
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif /* __CPU_H__ */

View File

@@ -163,6 +163,9 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p)
return ERR_OK;
}
extern s8 rltk_mii_send(struct eth_drv_sg *sg_list, int sg_len, int total_len);
extern void rltk_mii_recv(struct eth_drv_sg *sg_list, int sg_len);
/*for ethernet mii interface*/
static err_t low_level_output_mii(struct netif *netif, struct pbuf *p)
{
@@ -311,27 +314,27 @@ err_t ethernetif_init(struct netif *netif)
return ERR_OK;
}
err_t ethernetif_mii_init(struct netif *netif)
{
LWIP_ASSERT("netif != NULL", (netif != NULL));
// err_t ethernetif_mii_init(struct netif *netif)
// {
// LWIP_ASSERT("netif != NULL", (netif != NULL));
#if LWIP_NETIF_HOSTNAME
netif->hostname = "lwip2";
#endif /* LWIP_NETIF_HOSTNAME */
// #if LWIP_NETIF_HOSTNAME
// netif->hostname = "lwip2";
// #endif /* LWIP_NETIF_HOSTNAME */
netif->output = etharp_output;
//#if LWIP_IPV6
// netif->output_ip6 = ethip6_output;
//#endif
netif->linkoutput = low_level_output_mii;
// netif->output = etharp_output;
// //#if LWIP_IPV6
// // netif->output_ip6 = ethip6_output;
// //#endif
// netif->linkoutput = low_level_output_mii;
/* initialize the hardware */
low_level_init(netif);
// /* initialize the hardware */
// low_level_init(netif);
etharp_init();
// etharp_init();
return ERR_OK;
}
// return ERR_OK;
// }
static void arp_timer(void *arg)
{

View File

@@ -80,6 +80,7 @@
#include "lwip/dhcp.h"
#include "lwip/autoip.h"
#include "lwip/dns.h"
#include "lwip/igmp.h"
#include "netif/etharp.h"
#include <string.h>

View File

@@ -92,6 +92,7 @@ err_t igmp_start(struct netif *netif);
err_t igmp_stop(struct netif *netif);
void igmp_report_groups(struct netif *netif);
struct igmp_group *igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr);
void igmp_report_groups_leave(struct netif *netif);
void igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest);
err_t igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr);
err_t igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr);

View File

@@ -121,6 +121,7 @@ err_t dhcp_start(struct netif *netif);
err_t dhcp_renew(struct netif *netif);
/** release the DHCP lease, usually called before dhcp_stop()*/
err_t dhcp_release(struct netif *netif);
err_t dhcp_release_unicast(struct netif *netif); //Realtek add
/** stop DHCP configuration */
void dhcp_stop(struct netif *netif);
/** inform server of our manual IP address */

View File

@@ -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)

View File

@@ -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;
}

View 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 */