[core] Update Arduino compatibility, fix MD5 library

This commit is contained in:
Kuba Szczodrzyński
2023-03-17 17:33:43 +01:00
parent 2882eaa0c2
commit 2e30d34021
7 changed files with 32 additions and 9 deletions

View File

@@ -9,3 +9,9 @@
#undef ntohs
#undef htonl
#undef ntohl
// fix conflicts with std::max() and std::min()
#ifdef __cplusplus
#undef max
#undef min
#endif

View File

@@ -0,0 +1,8 @@
/* Copyright (c) Kuba Szczodrzyński 2023-03-14. */
#include_next "include.h"
#pragma once
// force including fixups/generic.h, even by BDK/include.h
#include "generic.h"

View File

@@ -4,7 +4,6 @@
#include <Arduino.h>
#if 0 // maybe simply using void* is easier? this is not C++ so it will link anyway
// available built-in implementations
#if LT_ARD_MD5_POLARSSL
#include "MD5PolarSSLImpl.h"
@@ -15,7 +14,6 @@
#if LT_ARD_MD5_HOSTAPD
#include "MD5HostapdImpl.h"
#endif
#endif
// common API
#ifdef __cplusplus

View File

@@ -6,12 +6,12 @@
extern "C" {
#endif
#include <stdint.h>
struct MD5Context {
unsigned long buf[4];
unsigned long bits[2];
unsigned char in[64];
};
typedef uint32_t u32;
typedef uint8_t u8;
#include <crypto/md5_i.h>
#define LT_MD5_CTX_T struct MD5Context
#ifdef __cplusplus

View File

@@ -6,7 +6,12 @@
extern "C" {
#endif
#include <mbedtls/md5.h>
typedef struct {
unsigned long total[2]; /*!< number of bytes processed */
unsigned long state[4]; /*!< intermediate digest state */
unsigned char buffer[64]; /*!< data block being processed */
} mbedtls_md5_context;
#define LT_MD5_CTX_T mbedtls_md5_context
#ifdef __cplusplus

View File

@@ -6,7 +6,12 @@
extern "C" {
#endif
#include <polarssl/md5.h>
typedef struct {
unsigned long total[2]; /*!< number of bytes processed */
unsigned long state[4]; /*!< intermediate digest state */
unsigned char buffer[64]; /*!< data block being processed */
} md5_context;
#define LT_MD5_CTX_T md5_context
#ifdef __cplusplus

View File

@@ -36,6 +36,7 @@ using std::min;
// FreeRTOS kernel
#include <FreeRTOS.h>
#include <task.h>
// Define available serial ports
#if defined(__cplusplus) && LT_ARD_HAS_SERIAL