서해원

Add src/

Showing 77 changed files with 4929 additions and 0 deletions
/src/Numaker-PFM-M2351/PulseMonitoring/Secure/Objects
/src/Numaker-PFM-M2351/PulseMonitoring/Secure/Listings
/src/Numaker-PFM-M2351/PulseMonitoring/NonSecure/Objects
/src/Numaker-PFM-M2351/PulseMonitoring/NonSecure/Listings
# ARM-TrustZone-based-Pulse-Monitoring
2021-1 Capston Project
# Instruction
## src/Numaker-PFM-M2351
+ Need a Keil uVision5
+ Place a `src/Numaker-PFM-M2351` directory in a `M2351Series_BSP_CMSIS_V3.00.004` directory so that you can use the library.
## src/Server
+ Need a docker engine
+ In src/Server/
+ docker build
```
docker build -t server
```
+ docker run
```
docker run --name=server -it -p80:80 -p443:443 -p2351:2351 server
```
# Contact
+ `shw2662@khu.ac.kr`
......
<?xml version="1.0" encoding="utf-8"?>
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
<component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component-->
<events>
</events>
</component_viewer>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
/*
* Copyright (c) 2013-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* -----------------------------------------------------------------------------
*
* $Revision: V5.1.0
*
* Project: CMSIS-RTOS RTX
* Title: RTX Configuration
*
* -----------------------------------------------------------------------------
*/
#include "cmsis_compiler.h"
#include "rtx_os.h"
// OS Idle Thread
__WEAK __NO_RETURN void osRtxIdleThread (void *argument) {
(void)argument;
for (;;) {}
}
// OS Error Callback function
__WEAK uint32_t osRtxErrorNotify (uint32_t code, void *object_id) {
(void)object_id;
switch (code) {
case osRtxErrorStackUnderflow:
// Stack overflow detected for thread (thread_id=object_id)
break;
case osRtxErrorISRQueueOverflow:
// ISR Queue overflow detected when inserting object (object_id)
break;
case osRtxErrorTimerQueueOverflow:
// User Timer Callback Queue overflow detected for timer (timer_id=object_id)
break;
case osRtxErrorClibSpace:
// Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
break;
case osRtxErrorClibMutex:
// Standard C/C++ library mutex initialization failed
break;
default:
// Reserved
break;
}
for (;;) {}
//return 0U;
}
/*------------------------------------------------------------------------------
* MDK Middleware - Component ::Network
* Copyright (c) 2004-2019 Arm Limited (or its affiliates). All rights reserved.
*------------------------------------------------------------------------------
* Name: Net_Config.c
* Purpose: Network Configuration
* Rev.: V7.1.0
*----------------------------------------------------------------------------*/
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
// <h>Network System Settings
// <i>Global Network System definitions
// <s.15>Local Host Name
// <i>This is the name under which embedded host can be
// <i>accessed on a local area network.
// <i>Default: "my_host"
#define NET_HOST_NAME "my_host"
// <o>Memory Pool Size <1536-262144:4>
// <i>This is the size of a memory pool in bytes. Buffers for
// <i>network packets are allocated from this memory pool.
// <i>Default: 12000 bytes
#define NET_MEM_POOL_SIZE 12000
// <q>Start System Services
// <i>If enabled, the system will automatically start server services
// <i>(HTTP, FTP, TFTP server, ...) when initializing the network system.
// <i>Default: Enabled
#define NET_START_SERVICE 1
// <h>OS Resource Settings
// <i>These settings are used to optimize usage of OS resources.
// <o>Core Thread Stack Size <512-65535:4>
// <i>Default: 1024 bytes
#define NET_THREAD_STACK_SIZE 1024
// Core Thread Priority
#define NET_THREAD_PRIORITY osPriorityNormal
// </h>
// </h>
//------------- <<< end of configuration section >>> ---------------------------
#include "RTE_Components.h"
#ifdef RTE_Network_Interface_ETH_0
#include "Net_Config_ETH_0.h"
#endif
#ifdef RTE_Network_Interface_ETH_1
#include "Net_Config_ETH_1.h"
#endif
#ifdef RTE_Network_Interface_WiFi_0
#include "Net_Config_WiFi_0.h"
#endif
#ifdef RTE_Network_Interface_WiFi_1
#include "Net_Config_WiFi_1.h"
#endif
#ifdef RTE_Network_Interface_PPP
#include "Net_Config_PPP.h"
#endif
#ifdef RTE_Network_Interface_SLIP
#include "Net_Config_SLIP.h"
#endif
#ifdef RTE_Network_Socket_UDP
#include "Net_Config_UDP.h"
#endif
#ifdef RTE_Network_Socket_TCP
#include "Net_Config_TCP.h"
#endif
#ifdef RTE_Network_Socket_BSD
#include "Net_Config_BSD.h"
#endif
#ifdef RTE_Network_Web_Server_RO
#include "Net_Config_HTTP_Server.h"
#endif
#ifdef RTE_Network_Web_Server_FS
#include "Net_Config_HTTP_Server.h"
#endif
#ifdef RTE_Network_Telnet_Server
#include "Net_Config_Telnet_Server.h"
#endif
#ifdef RTE_Network_TFTP_Server
#include "Net_Config_TFTP_Server.h"
#endif
#ifdef RTE_Network_TFTP_Client
#include "Net_Config_TFTP_Client.h"
#endif
#ifdef RTE_Network_FTP_Server
#include "Net_Config_FTP_Server.h"
#endif
#ifdef RTE_Network_FTP_Client
#include "Net_Config_FTP_Client.h"
#endif
#ifdef RTE_Network_DNS_Client
#include "Net_Config_DNS_Client.h"
#endif
#ifdef RTE_Network_SMTP_Client
#include "Net_Config_SMTP_Client.h"
#endif
#ifdef RTE_Network_SNMP_Agent
#include "Net_Config_SNMP_Agent.h"
#endif
#ifdef RTE_Network_SNTP_Client
#include "Net_Config_SNTP_Client.h"
#endif
#include "net_config.h"
/**
\addtogroup net_genFunc
@{
*/
/**
\fn void net_sys_error (NET_ERROR error)
\ingroup net_cores
\brief Network system error handler.
*/
void net_sys_error (NET_ERROR error) {
/* This function is called when a fatal error is encountered. */
/* The normal program execution is not possible anymore. */
switch (error) {
case NET_ERROR_MEM_ALLOC:
/* Out of memory */
break;
case NET_ERROR_MEM_FREE:
/* Trying to release non existing memory block */
break;
case NET_ERROR_MEM_CORRUPT:
/* Memory Link pointer corrupted */
/* More data written than the size of allocated memory block */
break;
case NET_ERROR_CONFIG:
/* Network configuration error detected */
break;
case NET_ERROR_UDP_ALLOC:
/* Out of UDP Sockets */
break;
case NET_ERROR_TCP_ALLOC:
/* Out of TCP Sockets */
break;
case NET_ERROR_TCP_STATE:
/* TCP State machine in undefined state */
break;
}
/* End-less loop */
while (1);
}
/**
@}
*/
/*------------------------------------------------------------------------------
* MDK Middleware - Component ::Network:Socket
* Copyright (c) 2004-2019 Arm Limited (or its affiliates). All rights reserved.
*------------------------------------------------------------------------------
* Name: Net_Config_TCP.h
* Purpose: Network Configuration for TCP Sockets
* Rev.: V7.1.1
*----------------------------------------------------------------------------*/
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
// <h>TCP Sockets
#define TCP_ENABLE 1
// <o>Number of TCP Sockets <1-20>
// <i>Number of available TCP sockets
// <i>Default: 6
#define TCP_NUM_SOCKS 6
// <o>Number of Retries <0-20>
// <i>How many times TCP module will try to retransmit data
// <i>before giving up. Increase this value for high-latency
// <i>and low throughput networks.
// <i>Default: 5
#define TCP_MAX_RETRY 5
// <o>Retry Timeout in seconds <1-10>
// <i>If data frame not acknowledged within this time frame,
// <i>TCP module will try to resend the data again.
// <i>Default: 4
#define TCP_RETRY_TOUT 4
// <o>Default Connect Timeout in seconds <1-65535>
// <i>If no TCP data frame has been exchanged during this time,
// <i>the TCP connection is either closed or a keep-alive frame
// <i>is sent to verify that the connection still exists.
// <i>Default: 120
#define TCP_DEFAULT_TOUT 120
// <o>Maximum Segment Size <536-1440>
// <i>The Maximum Segment Size specifies the maximum
// <i>number of bytes in the TCP segment's Data field.
// <i>Default: 1440
#define TCP_MAX_SEG_SIZE 1440
// <o>Receive Window Size <536-65535>
// <i>Receive Window Size specifies the size of data,
// <i>that the socket is able to buffer in flow-control mode.
// <i>Default: 4320
#define TCP_RECEIVE_WIN_SIZE 4320
// </h>
// TCP Initial Retransmit period in seconds
#define TCP_INITIAL_RETRY_TOUT 1
// TCP SYN frame retransmit period in seconds
#define TCP_SYN_RETRY_TOUT 2
// Number of retries to establish a connection
#define TCP_CONNECT_RETRY 7
// Dynamic port start (default 49152)
#define TCP_DYN_PORT_START 49152
// Dynamic port end (default 65535)
#define TCP_DYN_PORT_END 65535
//------------- <<< end of configuration section >>> ---------------------------
/*
* Configuration template
*
* Copyright (C) 2006-2021, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This set of compile-time options may be used to enable
* or disable features selectively, and reduce the global
* memory footprint.
*/
#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H
/* System support */
//#define MBEDTLS_HAVE_ASM
//#define MBEDTLS_HAVE_TIME
//#define MBEDTLS_HAVE_TIME_DATE
//#define MBEDTLS_PLATFORM_MEMORY
//#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
//#define MBEDTLS_CHECK_PARAMS
/* mbed TLS feature support */
//#define MBEDTLS_AES_ROM_TABLES
//#define MBEDTLS_AES_FEWER_TABLES
//#define MBEDTLS_CAMELLIA_SMALL_MEMORY
//#define MBEDTLS_CIPHER_MODE_CBC
//#define MBEDTLS_CIPHER_MODE_CFB
//#define MBEDTLS_CIPHER_MODE_CTR
//#define MBEDTLS_CIPHER_MODE_OFB
//#define MBEDTLS_CIPHER_MODE_XTS
//#define MBEDTLS_CIPHER_PADDING_PKCS7
//#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
//#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
//#define MBEDTLS_CIPHER_PADDING_ZEROS
//#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
//#define MBEDTLS_REMOVE_3DES_CIPHERSUITES
//#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
//#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
//#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
//#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
//#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
//#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
//#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
//#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
//#define MBEDTLS_ECP_DP_BP256R1_ENABLED
//#define MBEDTLS_ECP_DP_BP384R1_ENABLED
//#define MBEDTLS_ECP_DP_BP512R1_ENABLED
//#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
//#define MBEDTLS_ECP_DP_CURVE448_ENABLED
//#define MBEDTLS_ECP_NIST_OPTIM
//#define MBEDTLS_ECP_RESTARTABLE
//#define MBEDTLS_ECDSA_DETERMINISTIC
//#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
//#define MBEDTLS_PK_PARSE_EC_EXTENDED
//#define MBEDTLS_ERROR_STRERROR_DUMMY
//#define MBEDTLS_GENPRIME
//#define MBEDTLS_FS_IO
//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
//#define MBEDTLS_NO_PLATFORM_ENTROPY
//#define MBEDTLS_ENTROPY_FORCE_SHA256
//#define MBEDTLS_ENTROPY_NV_SEED
//#define MBEDTLS_MEMORY_DEBUG
//#define MBEDTLS_MEMORY_BACKTRACE
//#define MBEDTLS_PK_RSA_ALT_SUPPORT
//#define MBEDTLS_PKCS1_V15
//#define MBEDTLS_PKCS1_V21
//#define MBEDTLS_PSA_CRYPTO_SPM
//#define MBEDTLS_RSA_NO_CRT
//#define MBEDTLS_SELF_TEST
//#define MBEDTLS_SHA256_SMALLER
//#define MBEDTLS_SHA512_SMALLER
//#define MBEDTLS_SHA512_NO_SHA384
//#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
//#define MBEDTLS_SSL_RECORD_CHECKING
//#define MBEDTLS_SSL_DTLS_CONNECTION_ID
//#define MBEDTLS_SSL_ASYNC_PRIVATE
//#define MBEDTLS_SSL_CONTEXT_SERIALIZATION
//#define MBEDTLS_SSL_DEBUG_ALL
//#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
//#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
//#define MBEDTLS_SSL_FALLBACK_SCSV
//#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
//#define MBEDTLS_SSL_HW_RECORD_ACCEL
//#define MBEDTLS_SSL_CBC_RECORD_SPLITTING
//#define MBEDTLS_SSL_RENEGOTIATION
//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
//#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
//#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
//#define MBEDTLS_SSL_PROTO_SSL3
//#define MBEDTLS_SSL_PROTO_TLS1
//#define MBEDTLS_SSL_PROTO_TLS1_1
//#define MBEDTLS_SSL_PROTO_TLS1_2
//#define MBEDTLS_SSL_PROTO_DTLS
//#define MBEDTLS_SSL_ALPN
//#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
//#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
//#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
//#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
//#define MBEDTLS_SSL_SESSION_TICKETS
//#define MBEDTLS_SSL_EXPORT_KEYS
//#define MBEDTLS_SSL_SERVER_NAME_INDICATION
//#define MBEDTLS_SSL_TRUNCATED_HMAC
//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
//#define MBEDTLS_USE_PSA_CRYPTO
//#define MBEDTLS_VERSION_FEATURES
//#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
//#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
//#define MBEDTLS_X509_CHECK_KEY_USAGE
//#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
//#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
//#define MBEDTLS_ZLIB_SUPPORT
/* mbed TLS modules */
//#define MBEDTLS_AES_C
//#define MBEDTLS_ARC4_C
//#define MBEDTLS_ASN1_PARSE_C
//#define MBEDTLS_ASN1_WRITE_C
//#define MBEDTLS_BASE64_C
//#define MBEDTLS_BIGNUM_C
//#define MBEDTLS_BLOWFISH_C
//#define MBEDTLS_CAMELLIA_C
//#define MBEDTLS_ARIA_C
//#define MBEDTLS_CCM_C
//#define MBEDTLS_CERTS_C
//#define MBEDTLS_CHACHA20_C
//#define MBEDTLS_CHACHAPOLY_C
//#define MBEDTLS_CIPHER_C
//#define MBEDTLS_CMAC_C
//#define MBEDTLS_CTR_DRBG_C
//#define MBEDTLS_DEBUG_C
//#define MBEDTLS_DES_C
//#define MBEDTLS_DHM_C
//#define MBEDTLS_ECDH_C
//#define MBEDTLS_ECDSA_C
//#define MBEDTLS_ECJPAKE_C
//#define MBEDTLS_ECP_C
//#define MBEDTLS_ENTROPY_C
//#define MBEDTLS_ERROR_C
//#define MBEDTLS_GCM_C
//#define MBEDTLS_HAVEGE_C
//#define MBEDTLS_HKDF_C
//#define MBEDTLS_HMAC_DRBG_C
//#define MBEDTLS_NIST_KW_C
//#define MBEDTLS_MD_C
//#define MBEDTLS_MD2_C
//#define MBEDTLS_MD4_C
//#define MBEDTLS_MD5_C
//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
//#define MBEDTLS_NET_C
//#define MBEDTLS_OID_C
//#define MBEDTLS_PEM_PARSE_C
//#define MBEDTLS_PEM_WRITE_C
//#define MBEDTLS_PK_C
//#define MBEDTLS_PK_PARSE_C
//#define MBEDTLS_PK_WRITE_C
//#define MBEDTLS_PKCS5_C
//#define MBEDTLS_PKCS11_C
//#define MBEDTLS_PKCS12_C
//#define MBEDTLS_PLATFORM_C
//#define MBEDTLS_POLY1305_C
//#define MBEDTLS_PSA_CRYPTO_C
//#define MBEDTLS_PSA_CRYPTO_SE_C
//#define MBEDTLS_PSA_CRYPTO_STORAGE_C
//#define MBEDTLS_PSA_ITS_FILE_C
//#define MBEDTLS_RIPEMD160_C
//#define MBEDTLS_RSA_C
//#define MBEDTLS_SHA1_C
//#define MBEDTLS_SHA256_C
//#define MBEDTLS_SHA512_C
//#define MBEDTLS_SSL_CACHE_C
//#define MBEDTLS_SSL_COOKIE_C
//#define MBEDTLS_SSL_TICKET_C
//#define MBEDTLS_SSL_CLI_C
//#define MBEDTLS_SSL_SRV_C
//#define MBEDTLS_SSL_TLS_C
//#define MBEDTLS_THREADING_C
//#define MBEDTLS_TIMING_C
//#define MBEDTLS_VERSION_C
//#define MBEDTLS_X509_USE_C
//#define MBEDTLS_X509_CRT_PARSE_C
//#define MBEDTLS_X509_CRL_PARSE_C
//#define MBEDTLS_X509_CSR_PARSE_C
//#define MBEDTLS_X509_CREATE_C
//#define MBEDTLS_X509_CRT_WRITE_C
//#define MBEDTLS_X509_CSR_WRITE_C
//#define MBEDTLS_XTEA_C
#include "mbedtls/check_config.h"
#endif /* MBEDTLS_CONFIG_H */
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'NonSecure'
* Target: 'NonSecure'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "M2351.h"
/* ARM::PSA:Crypto:mbed TLS:2.24.0 */
#define RTE_PSA_API_CRYPTO
#endif /* RTE_COMPONENTS_H */
/******************************************************************************
**************************Hardware interface layer*****************************
* | file : DEV_Config.c
* | version : V1.0
* | date : 2017-08-14
* | function :
Provide the hardware underlying interface
******************************************************************************/
#include "DEV_Config.h"
//#include "stm32f1xx_hal_i2c.h"
//#include "i2c.h"
//#include "stm32f1xx_hal_spi.h"
//#include "spi.h"
//#include "usart.h"
#include <stdio.h> //printf()
#include <string.h>
#include <stdlib.h>
/********************************************************************************
function: System Init
note:
Initialize the communication method
********************************************************************************/
uint8_t System_Init(void)
{
#if USE_SPI_4W
//printf("USE 4wire spi\r\n");
#elif USE_IIC
printf("USE i2c\r\n");
//DC = 1 => addrdess = 0X3D
//DC = 0 => addrdess = 0X3C
OLED_DC_1;
#endif
return 0;
}
void System_Exit(void)
{
}
/********************************************************************************
function: Hardware interface
note:
SPI4W_Write_Byte(value) :
HAL library hardware SPI
Register hardware SPI
Gpio analog SPI
I2C_Write_Byte(value, cmd):
HAL library hardware I2C
********************************************************************************/
void SPI4W_Write_Byte(uint8_t value)
{
SPI_WRITE_TX(SPI1_NS, value);
while (SPI_IS_BUSY(SPI1_NS));
//printf("[RX] : %d\t [TX] : %d(%#x) \n", SPI_READ_RX(SPI0), value, value);
}
/********************************************************************************
function: Delay function
note:
Driver_Delay_ms(xms) : Delay x ms
Driver_Delay_us(xus) : Delay x us
********************************************************************************/
void Driver_Delay_ms(uint32_t xms)
{
CLK_SysTickDelay(xms * 1000);
}
void Driver_Delay_us(uint32_t xus)
{
int j;
for(j=xus; j > 0; j--);
}
/******************************************************************************
**************************Hardware interface layer*****************************
* | file : DEV_Config.h
* | version : V1.0
* | date : 2017-08-14
* | function :
Provide the hardware underlying interface
******************************************************************************/
#ifndef _DEV_CONFIG_H_
#define _DEV_CONFIG_H_
//#include "stm32f1xx_hal.h"
//#include "stm32f1xx_hal_gpio.h"
//#include "main.h"
#include <stdint.h>
#include "NuMicro.h"
#define USE_SPI_4W 1
#define USE_IIC 0
#define IIC_CMD 0X00
#define IIC_RAM 0X40
//#define SPI0_SCK PD2_NS
//#define SPI0_SCK_GPIO_Port GPIOD
//#define SPI0_MISO PD1_NS
//#define SPI0_MISO_GPIO_Port GPIOD
//#define SPI0_MOSI PD0_NS
//#define SPI0_MOSI_GPIO_Port GPIOD
#define OLED_DC PC11_NS
#define OLED_DC_GPIO_Port GPIOC
#define OLED_RST PC12_NS
#define OLED_RST_GPIO_Port GPIOC
#define OLED_CS PH9_NS
#define OLED_CS_GPIO_Port GPIOH
/*
#define I2C1_SCL_Pin GPIO_PIN_8
#define I2C1_SCL_GPIO_Port GPIOB
#define I2C1_SDA_Pin GPIO_PIN_9
#define I2C1_SDA_GPIO_Port GPIOB
//OLED GPIO
#define OLED_CS_0 HAL_GPIO_WritePin(OLED_CS_GPIO_Port, OLED_CS_Pin, GPIO_PIN_RESET)
#define OLED_CS_1 HAL_GPIO_WritePin(OLED_CS_GPIO_Port, OLED_CS_Pin, GPIO_PIN_SET)
#define OLED_DC_0 HAL_GPIO_WritePin(OLED_DC_GPIO_Port, OLED_DC_Pin, GPIO_PIN_RESET)
#define OLED_DC_1 HAL_GPIO_WritePin(OLED_DC_GPIO_Port, OLED_DC_Pin, GPIO_PIN_SET)
#define OLED_RST_0 HAL_GPIO_WritePin(OLED_RST_GPIO_Port, OLED_RST_Pin, GPIO_PIN_RESET)
#define OLED_RST_1 HAL_GPIO_WritePin(OLED_RST_GPIO_Port, OLED_RST_Pin, GPIO_PIN_SET)
//SPI GPIO
#define SPI1_SCK_0 HAL_GPIO_WritePin(SPI1_SCK_GPIO_Port, SPI1_SCK_Pin, GPIO_PIN_RESET)
#define SPI1_SCK_1 HAL_GPIO_WritePin(SPI1_SCK_GPIO_Port, SPI1_SCK_Pin, GPIO_PIN_SET)
#define SPI1_MOSI_0 HAL_GPIO_WritePin(SPI1_MOSI_GPIO_Port, SPI1_MOSI_Pin, GPIO_PIN_RESET)
#define SPI1_MOSI_1 HAL_GPIO_WritePin(SPI1_MOSI_GPIO_Port, SPI1_MOSI_Pin, GPIO_PIN_SET)
*/
/*------------------------------------------------------------------------------------------------------*/
uint8_t System_Init(void);
void System_Exit(void);
void SPI4W_Write_Byte(uint8_t value);
//void I2C_Write_Byte(uint8_t value, uint8_t Cmd);
void Driver_Delay_ms(uint32_t xms);
void Driver_Delay_us(uint32_t xus);
#endif
/******************************************************************************
***************************Intermediate driver layer***************************
* | file : OLED_Driver.c
* | version : V1.0
* | date : 2017-11-09
* | function : SSD1327 Drive function
note:
Image scanning:
Please use progressive scanning to generate images or fonts
******************************************************************************/
#include "OLED_Driver.h"
#include <stdio.h>
COLOR Buffer[OLED_WIDTH / 2 * OLED_HEIGHT];
OLED_DIS sOLED_DIS;
/*******************************************************************************
function:
Hardware reset
*******************************************************************************/
static void OLED_Reset(void)
{
OLED_RST = 1;
//PC12 = 1;
Driver_Delay_ms(100);
OLED_RST = 0;
//PC12 = 0;
Driver_Delay_ms(100);
OLED_RST = 1;
//PC12 = 1;
Driver_Delay_ms(100);
}
/*******************************************************************************
function:
Write register address and data
*******************************************************************************/
void OLED_WriteReg(uint8_t Reg)
{
#if USE_SPI_4W
OLED_DC = 0;
OLED_CS = 0;
SPI4W_Write_Byte(Reg);
OLED_CS = 1;
#elif USE_IIC
I2C_Write_Byte(Reg,IIC_CMD);
#endif
}
void OLED_WriteData(uint8_t Data)
{
#if USE_SPI_4W
OLED_DC = 1;
OLED_CS = 0;
SPI4W_Write_Byte(Data);
OLED_CS = 1;
#elif USE_IIC
I2C_Write_Byte(Data,IIC_RAM);
#endif
}
/*******************************************************************************
function:
Common register initialization
*******************************************************************************/
static void OLED_InitReg(void)
{
OLED_WriteReg(0xae);//--turn off oled panel
OLED_WriteReg(0x15); // set column address
OLED_WriteReg(0x00); // start column 0
OLED_WriteReg(0x7f); // end column 127
OLED_WriteReg(0x75); // set row address
OLED_WriteReg(0x00); // start row 0
OLED_WriteReg(0x7f); // end row 127
OLED_WriteReg(0x81); // set contrast control
OLED_WriteReg(0x80);
OLED_WriteReg(0xa0); // gment remap
OLED_WriteReg(0x51); //51
OLED_WriteReg(0xa1); // start line
OLED_WriteReg(0x00);
OLED_WriteReg(0xa2); // display offset
OLED_WriteReg(0x00);
OLED_WriteReg(0xa4); // rmal display
OLED_WriteReg(0xa8); // set multiplex ratio
OLED_WriteReg(0x7f);
OLED_WriteReg(0xb1); // set phase leghth
OLED_WriteReg(0xf1);
OLED_WriteReg(0xb3); // set dclk
OLED_WriteReg(0x00); //80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30 120Hz:0x50 130Hz:0x70 01
OLED_WriteReg(0xab); //
OLED_WriteReg(0x01); //
OLED_WriteReg(0xb6); // set phase leghth
OLED_WriteReg(0x0f);
OLED_WriteReg(0xbe);
OLED_WriteReg(0x0f);
OLED_WriteReg(0xbc);
OLED_WriteReg(0x08);
OLED_WriteReg(0xd5);
OLED_WriteReg(0x62);
OLED_WriteReg(0xfd);
OLED_WriteReg(0x12);
}
/********************************************************************************
function: Set the display scan and color transfer modes
parameter:
Scan_dir : Scan direction
Colorchose : RGB or GBR color format
********************************************************************************/
void OLED_SetGramScanWay(OLED_SCAN_DIR Scan_dir)
{
//Get the screen scan direction
sOLED_DIS.OLED_Scan_Dir = Scan_dir;
//Get GRAM and OLED width and height
if(Scan_dir == L2R_U2D || Scan_dir == L2R_D2U || Scan_dir == R2L_U2D || Scan_dir == R2L_D2U) {
sOLED_DIS.OLED_Dis_Column = OLED_WIDTH;
sOLED_DIS.OLED_Dis_Page = OLED_HEIGHT;
sOLED_DIS.OLED_X_Adjust = OLED_X;
sOLED_DIS.OLED_Y_Adjust = OLED_Y;
} else {
sOLED_DIS.OLED_Dis_Column = OLED_HEIGHT;
sOLED_DIS.OLED_Dis_Page = OLED_WIDTH;
sOLED_DIS.OLED_X_Adjust = OLED_Y;
sOLED_DIS.OLED_Y_Adjust = OLED_X;
}
}
/********************************************************************************
function:
initialization
********************************************************************************/
void OLED_Init(OLED_SCAN_DIR OLED_ScanDir)
{
//Hardware reset
OLED_Reset();
//Set the initialization register
OLED_InitReg();
//Set the display scan and color transfer modes
OLED_SetGramScanWay(OLED_ScanDir);
Driver_Delay_ms(200);
//Turn on the OLED display
OLED_WriteReg(0xAF);
}
/********************************************************************************
function: Set the display point(Xpoint, Ypoint)
parameter:
xStart : X direction Start coordinates
xEnd : X direction end coordinates
********************************************************************************/
void OLED_SetCursor(POINT Xpoint, POINT Ypoint)
{
if((Xpoint > sOLED_DIS.OLED_Dis_Column) || (Ypoint > sOLED_DIS.OLED_Dis_Page))
return;
OLED_WriteReg(0x15);
OLED_WriteReg(Xpoint);
OLED_WriteReg(Xpoint);
OLED_WriteReg(0x75);
OLED_WriteReg(Ypoint);
OLED_WriteReg(Ypoint);
}
/********************************************************************************
function: Set the display Window(Xstart, Ystart, Xend, Yend)
parameter:
xStart : X direction Start coordinates
Ystart : Y direction Start coordinates
Xend : X direction end coordinates
Yend : Y direction end coordinates
********************************************************************************/
void OLED_SetWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend)
{
if((Xstart > sOLED_DIS.OLED_Dis_Column) || (Ystart > sOLED_DIS.OLED_Dis_Page) ||
(Xend > sOLED_DIS.OLED_Dis_Column) || (Yend > sOLED_DIS.OLED_Dis_Page))
return;
OLED_WriteReg(0x15);
OLED_WriteReg(Xstart);
OLED_WriteReg(Xend - 1);
OLED_WriteReg(0x75);
OLED_WriteReg(Ystart);
OLED_WriteReg(Yend - 1);
}
/********************************************************************************
function: Set show color
parameter:
Color : Set show color,16-bit depth
********************************************************************************/
//static void OLED_SetColor(LENGTH Dis_Width, LENGTH Dis_Height, COLOR Color ){
void OLED_SetColor(POINT Xpoint, POINT Ypoint, COLOR Color)
{
if(Xpoint > sOLED_DIS.OLED_Dis_Column || Ypoint > sOLED_DIS.OLED_Dis_Page) {
return;
}
//1 byte control two points
if(Xpoint % 2 == 0) {
Buffer[Xpoint / 2 + Ypoint * 64] = (Color << 4) | Buffer[Xpoint / 2 + Ypoint * 64];
} else {
Buffer[Xpoint / 2 + Ypoint * 64] = (Color & 0x0f) | Buffer[Xpoint / 2 + Ypoint * 64];
}
}
/********************************************************************************
function:
Clear screen
********************************************************************************/
void OLED_Clear(COLOR Color)
{
unsigned int i,m;
//OLED_SetWindow(0, 0, sOLED_DIS.OLED_Dis_Column, sOLED_DIS.OLED_Dis_Page);
for(i = 0; i < sOLED_DIS.OLED_Dis_Page; i++) {
for(m = 0; m < (sOLED_DIS.OLED_Dis_Column / 2); m++) {
Buffer[i * (sOLED_DIS.OLED_Dis_Column / 2) + m] = Color | (Color << 4);
}
}
}
/********************************************************************************
function: Update all memory to LCD
********************************************************************************/
void OLED_Display(void)
{
uint16_t page, Column;
COLOR *pBuf = (COLOR *)Buffer;
OLED_SetWindow(0, 0, sOLED_DIS.OLED_Dis_Column, sOLED_DIS.OLED_Dis_Page);
//write data
for (page = 0; page < sOLED_DIS.OLED_Dis_Page; page++) {
for(Column = 0; Column < sOLED_DIS.OLED_Dis_Column / 2; Column++ ) {
OLED_WriteData(*pBuf);
pBuf++;
}
}
}
/********************************************************************************
function:
Clear Window
********************************************************************************/
void OLED_ClearWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend, COLOR Color)
{
uint16_t i,m, Xpoint, Ypoint;
Xpoint = (Xend - Xstart) / 2;
Ypoint = Yend - Ystart;
uint16_t Num = Xstart + Ystart * (sOLED_DIS.OLED_Dis_Column / 2);
for(i = 0; i < Ypoint; i++) {
for(m = 0; m < Xpoint; m++) {
Buffer[Num + m] = 0x00;
}
Num = Xstart + (Ystart + i + 1) * (sOLED_DIS.OLED_Dis_Column / 2);
}
}
/********************************************************************************
function: Update Window memory to LCD
********************************************************************************/
void OLED_DisWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend)
{
uint16_t page, Column, Xpoint, Ypoint;
Xpoint = (Xend - Xstart) / 2;
Ypoint = Yend - Ystart;
OLED_SetWindow(Xstart, Ystart, Xend, Yend);
//write data
COLOR *pBuf = (COLOR *)Buffer + Xstart + Ystart * (sOLED_DIS.OLED_Dis_Column / 2);
for (page = 0; page < Ypoint; page++) {
for(Column = 0; Column < Xpoint; Column++ ) {
OLED_WriteData(*pBuf);
pBuf++;
}
pBuf = (COLOR *)Buffer + Xstart + (Ystart + page + 1) * (sOLED_DIS.OLED_Dis_Column / 2);
}
}
/******************************************************************************
***************************Intermediate driver layer***************************
* | file : OLED_Driver.h
* | version : V1.0
* | date : 2017-11-09
* | function : SSD1327 Drive function
note:
Image scanning:
Please use progressive scanning to generate images or fonts
******************************************************************************/
#ifndef __OLED_DRIVER_H
#define __OLED_DRIVER_H
#include <stdint.h>
#include "DEV_Config.h"
#define COLOR uint16_t //The variable type of the color (unsigned short)
#define POINT uint16_t //The type of coordinate (unsigned short)
#define LENGTH uint16_t //The type of coordinate (unsigned short)
/********************************************************************************
function:
Define the full screen height length of the display
********************************************************************************/
#define OLED_X_MAXPIXEL 128 //OLED width maximum memory
#define OLED_Y_MAXPIXEL 128 //OLED height maximum memory
#define OLED_X 0
#define OLED_Y 0
#define OLED_WIDTH (OLED_X_MAXPIXEL - 2 * OLED_X) //OLED width
#define OLED_HEIGHT OLED_Y_MAXPIXEL //OLED height
/********************************************************************************
function:
scanning method
********************************************************************************/
typedef enum{
L2R_U2D = 0, //The display interface is displayed , left to right, up to down
L2R_D2U ,
R2L_U2D ,
R2L_D2U ,
U2D_L2R ,
U2D_R2L ,
D2U_L2R ,
D2U_R2L ,
}OLED_SCAN_DIR;
#define SCAN_DIR_DFT L2R_U2D //Default scan direction = L2R_U2D
/********************************************************************************
function:
Defines the total number of rows in the display area
********************************************************************************/
typedef struct{
LENGTH OLED_Dis_Column; //COLUMN
LENGTH OLED_Dis_Page; //PAGE
OLED_SCAN_DIR OLED_Scan_Dir;
POINT OLED_X_Adjust; //OLED x actual display position calibration
POINT OLED_Y_Adjust; //OLED y actual display position calibration
}OLED_DIS;
/********************************************************************************
function:
Macro definition variable name
********************************************************************************/
void OLED_Init(OLED_SCAN_DIR OLED_ScanDir);
void OLED_SetGramScanWay(OLED_SCAN_DIR Scan_dir);
void OLED_WriteReg(uint8_t Reg);
void OLED_WriteData(uint8_t Data);
//OLED set cursor + windows + color
void OLED_SetCursor(POINT Xpoint, POINT Ypoint);
void OLED_SetColor(POINT Xpoint, POINT Ypoint, COLOR Color);
void OLED_SetWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend);
void OLED_Clear(COLOR Color);
void OLED_Display(void);
void OLED_ClearWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend, COLOR Color);
void OLED_DisWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend);
#endif
This diff could not be displayed because it is too large.
/**
******************************************************************************
* @file fonts.h
* @author MCD Application Team
* @version V1.0.0
* @date 18-February-2014
* @brief Header for fonts.c file
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __FONTS_H
#define __FONTS_H
/* Max size of bitmap will based on a font24 (17x24) */
#define MAX_HEIGHT_FONT 24
#define MAX_WIDTH_FONT 17
#define OFFSET_BITMAP 54
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
typedef struct _tFont
{
const uint8_t *table;
uint16_t Width;
uint16_t Height;
} sFONT;
extern sFONT Font24;
extern sFONT Font20;
extern sFONT Font16;
extern sFONT Font12;
extern sFONT Font8;
#ifdef __cplusplus
}
#endif
#endif /* __FONTS_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
This diff is collapsed. Click to expand it.
/**********************************************************
*
* @file : wifi.h
* @author : HaewonSeo
*
* @note : ESP8266 WiFi Module
*
**********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "NuMicro.h"
#include "cssd_lib.h"
#ifndef __WIFI_H__
#define __WIFI_H__
#define WIFI_PORT UART3_NS // Used to connect to WIFI module
#define BYPASS_PORT UART0_NS // Used to byass WIFI module
//#define LED_Y PC11_NS // Yellow LED
//#define LED_G PC12_NS // Green LED
#define PWR_OFF PD7_NS
#define FW_UPDATE_OFF PD6_NS
#define IOCTL_INIT { \
PD_NS->MODE = (GPIO_MODE_OUTPUT << 6*2) | (GPIO_MODE_OUTPUT << 7*2); }\
//PC_NS->MODE = (GPIO_MODE_OUTPUT << 11*2) | (GPIO_MODE_OUTPUT << 12*2); } \
//PA->MODE = (GPIO_MODE_OUTPUT << 10*2) | (GPIO_MODE_OUTPUT << 11*2) ;}
typedef struct s_netData
{
char *data;
int len;
} t_netData;
void printNetworkData(t_netData *netData);
void WIFI_Init();
void WIFI_Connect();
void WIFI_Read(int);
void WIFI_Write(int, const char *, int);
int WIFI_ReceiveData(int, t_netData *);
int WIFI_SendData(int print, t_netData *netData, int port);
void WIFI_Send_BPM(int pulse);
void WIFI_Send_EncryptedMsg(uint8_t *encryptedMsg, int encryptedMsgBytes, uint32_t body);
void WIFI_Send_DigitallySignedData(t_digitallySignedData *dsd);
void WIFI_Send_EncryptedDigitallySignedData(t_digitallySignedData *dsd);
#endif /* __WIFI_H__ */
/**********************************************************
*
* @file : cssd_lib.h
* @author : HaewonSeo
*
* @note : M2351 Collaborative Secure Software Development Library header file
*
**********************************************************/
#include <stdint.h>
#ifndef __CSSD_LIB_H__
#define __CSSD_LIB_H__
typedef struct s_digitallySignedData
{
uint8_t data[17];
uint8_t pubKey1[25];
uint8_t pubKey2[25];
uint8_t R[25];
uint8_t S[25];
} t_digitallySignedData;
/*----------------------------------------------------------------------------
NonSecure Callable Functions from Secure Region
*----------------------------------------------------------------------------*/
extern uint32_t GetSystemCoreClock(void);
extern int32_t Secure_OLED_On_callback(void (*)(uint32_t));
extern int32_t Secure_OLED_Off_callback(void (*)(uint32_t));
/*----------------------------------------------------------------------------
MAX30102 Heart-Rate Sensor functions
*----------------------------------------------------------------------------*/
extern uint32_t Get_BPM();
extern uint32_t Get_EncryptedDigitallySignedData(t_digitallySignedData *dsd);
/*----------------------------------------------------------------------------
CRYPTO functions
*----------------------------------------------------------------------------*/
extern int32_t Encrypt_data(uint8_t *plainData, uint8_t *encryptedData, uint32_t bytes);
extern int32_t Decrypt_data(uint8_t *encryptedData, uint8_t *resultData, uint32_t bytes);
extern void M2351_LoadKey();
extern void M2351_DeleteKey();
/*----------------------------------------------------------------------------
PRINT functions
*----------------------------------------------------------------------------*/
extern void printBlock(uint8_t *block);
extern void printSecure(char *string, void *ptr, uint8_t val);
extern int32_t printDigitallySignedData(t_digitallySignedData *dsd);
#endif //__CSSD_LIB_H__
/**********************************************************
*
* @file : main_ns.c
* @author : HaewonSeo
*
* @note : Main of Non-secure world, Non-secure code for Collaborative Secure Software Development
*
**********************************************************/
#include <arm_cmse.h>
#include <string.h>
#include "NuMicro.h" /* Device header */
#include "cssd_lib.h" /* Collaborative Secure Software Development Library header */
#include "wifi.h"
#include "OLED_GUI.h"
#define SW2 PB0_NS
#define SW3 PB1_NS
extern const char ATCommand_CIPSTART[];
extern void OLED_BPM(uint32_t bpm);
/*----------------------------------------------------------------------------
NonSecure Functions from NonSecure Region
*----------------------------------------------------------------------------*/
void Control_SW3()
{
int result = 0;
t_netData *send;
send = calloc(1, sizeof(t_netData));
send->data = calloc(33, sizeof(char));
send->len = 0;
//result = WIFI_ReceiveData(1, rec);
const char msg[] = "Hello..";
send->len = strlen(msg);
strcpy(send->data, msg);
WIFI_SendData(1, send, 1);
free(send->data);
free(send);
t_netData *rec = malloc(sizeof(t_netData));
rec->data = malloc(sizeof(char)*33);
(rec->data)[32] = '\0';
rec->len = 0;
WIFI_ReceiveData(1, rec);
free(rec->data);
free(rec);
return ;
}
/*----------------------------------------------------------------------------
SysTick IRQ Handler
*----------------------------------------------------------------------------*/
void SysTick_Handler(void)
{
static uint32_t u32Ticks;
switch(u32Ticks++)
{
case 0:
break;
case 100:
break;
case 200:
break;
case 300:
break;
case 400:
break;
case 500:
break;
case 600:
u32Ticks = 0;
break;
default:
if(u32Ticks > 600)
{
u32Ticks = 0;
}
}
}
/*----------------------------------------------------------------------------
Main function
*----------------------------------------------------------------------------*/
int main(void)
{
int32_t i = 0;
int32_t ispulse = 0;
uint32_t pulse = 0;
t_digitallySignedData dsd;
memset(&dsd, 0, sizeof(t_digitallySignedData));
int32_t SW2_toggle = 0;
int32_t ns_ticks = 0;
printf("\n");
printf("+---------------------------------------------+\n");
printf("| Non-Secure is running ... |\n");
printf("+---------------------------------------------+\n");
/* register NonSecure callbacks in Secure application */
Secure_OLED_On_callback(&OLED_BPM);
//Secure_OLED_Off_callback(&NonSecure_OLED_Off);
/* Call secure API to get system core clock */
SystemCoreClock = GetSystemCoreClock();
/* Generate Systick interrupt each 10 ms */
SysTick_Config(SystemCoreClock / 100);
printf("\n");
printf("+---------------------------------------------+\n");
printf("| SDK1327 OLED Init |\n");
printf("+---------------------------------------------+\n");
OLED_Config();
printf("\n");
printf("+---------------------------------------------+\n");
printf("| ESP8266 WiFi Module Start |\n");
printf("+---------------------------------------------+\n");
WIFI_Connect();
while(1)
{
/* SW2 */
if(SW2 == 0)
{
while(SW2 == 0);
SW2_toggle = !SW2_toggle;
printf("\nSW2 ON in Non-secure code ...\n\n");
if(SW2_toggle)
{
ns_ticks = 0;
printf("\nMAX30102 On ...\n\n");
M2351_LoadKey();
OLED_Background_On();
}
else
{
printf("\nMAX30102 Off ...\n\n");
M2351_DeleteKey();
OLED_Off();
}
}
/* SW3 */
if(SW3 == 0)
{
while(SW3 == 0);
printf("\nSW3 ON in Non-secure code ...\n\n");
Control_SW3();
}
if(SW2_toggle)
{
/* Get digitally signed data of BPM from MAX30102 */
ispulse = Get_EncryptedDigitallySignedData(&dsd);
ns_ticks++;
if (ns_ticks >= 60)
{
ns_ticks = 0;
if (ispulse)
{
printf("\nEncrypted digitallySignedData\n");
printDigitallySignedData(&dsd);
/* Send digitally signed data of BPM to Server */
//WIFI_Send_BPM(ispulse);
WIFI_Send_EncryptedDigitallySignedData(&dsd);
}
}
}
}
}
//CLK_SysTickLongDelay(300000); //300000us = 300ms = 0.3s
/*
void testCryptDeCrypt() {
//Test Function to cipher and decypher data
//__attribute__((aligned(4))) uint8_t plainData[16] = {0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34};
__attribute__((aligned(4))) uint8_t plainData[16] = {0};
__attribute__((aligned(4))) uint8_t cipheredData[16] = {0};
__attribute__((aligned(4))) uint8_t resultData[16] = {0};
__attribute__((aligned(4))) uint8_t key[16] =
{
0x7f, 0x35, 0x91, 0xd3, 0x6f, 0xd5, 0x17, 0xa3, 0x7b, 0x6d, 0xe9, 0xe0, 0xdf, 0x93, 0x4b, 0x7a
};
__attribute__((aligned(4))) uint8_t iv[16] = {0};
sprintf((char *)plainData, "%d", 123);
printf("%s\n", plainData);
if (DEMO) {
//printSecure("&key = %p\n",key);
//printBlock(key);
//printSecure("&iv = %p\n",iv);
//printBlock(iv);
printSecure("&plainData = %p\n",plainData, NULL);
printBlock(plainData);
CLK_SysTickLongDelay(500000);
}
// Store_key(key);
// Store_iv(iv);
int c = Encrypt_data(plainData, cipheredData, 16);
if (c == NULL) printSecure("Error : 128bits only", NULL, NULL);
if (DEMO) {
CLK_SysTickLongDelay(500000);
printSecure("| Nonsecure is running ... |\n",NULL, NULL);
printSecure("&cipheredData = %p\n",cipheredData, NULL);
printBlock(cipheredData);
}
int r = Decrypt_data(cipheredData, resultData, 16);
if (r == NULL) printSecure("Error : 128bits only", NULL, NULL);
if (DEMO) {
CLK_SysTickLongDelay(500000);
printSecure("| Nonsecure is running ... |\n",NULL, NULL);
printSecure("&resultData = %p\n",resultData, NULL);
printBlock(resultData);
uint8_t error = 0;
for (uint8_t i = 0 ; i < 16 ; i++) {
if (resultData[i] != plainData[i]) error++;
}
if (error != 0) printSecure("Error plainData is not equal to resultData", NULL, NULL);
else printSecure("No error plainData is equal to resultData", NULL, NULL);
}
}
*/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectWorkspace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_mpw.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<WorkspaceName>WorkSpace</WorkspaceName>
<project>
<PathAndName>.\Secure\Secure.uvprojx</PathAndName>
<NodeIsExpanded>1</NodeIsExpanded>
</project>
<project>
<PathAndName>.\NonSecure\NonSecure.uvprojx</PathAndName>
<NodeIsActive>1</NodeIsActive>
<NodeIsExpanded>1</NodeIsExpanded>
</project>
</ProjectWorkspace>
/**********************************************************
*
* @file : M2351_crypto.h
* @author : HaewonSeo
*
* @note : M2351 Cryptographic Accelerator
**********************************************************/
#include <stdio.h>
#include <string.h>
#include "NuMicro.h"
#ifndef M2351_CRYPTO_H_
#define M2351_CRYPTO_H_
#define ENCRYPT 1
#define DECRYPT 0
static volatile int32_t g_AES_done;
void CRPT_IRQHandler(void);
void M2351_Crypto_Init(uint8_t, uint8_t);
void M2351_Crypto_UseSessionKey(uint8_t );
void M2351_Crypto_UseMasterKey(void);
void M2351_Encrypt_Data(uint8_t, uint8_t *, uint8_t *, uint32_t);
void M2351_Decrypt_Data(uint8_t, uint8_t *, uint8_t *, uint32_t);
void M2351_FMC_Read_Key(uint32_t num, uint32_t len, char *priKey);
void M2351_FMC_Write_Key(void);
void M2351_ECC_GenerateKey(char *priKey, char *gKey1, char *gKey2);
void M2351_SHA_Hash(uint8_t *msg, uint8_t *hash_msg);
void M2351_ECDSA_GenerateSignature(uint8_t *msg, char *priKey, char* R, char *S);
void M2351_ECDSA_VerificationSignature(char *hash_msg, char *pubKey1, char* pubKey2, char* R, char *S);
#endif /* M2351_CRYPTO_H_ */
#include "crypto_aes.h"
#include "nsc.h"
uint8_t cipheredSessionKey[16];
uint8_t sessionIv[16];
void CRPT_IRQHandler()
{
if(AES_GET_INT_FLAG(CRPT))
{
g_AES_done = 1;
AES_CLR_INT_FLAG(CRPT);
}
}
void M2351_Crypto_Init(uint8_t channel, uint8_t modeAES)
{
if(modeAES != ENCRYPT && modeAES != DECRYPT)
printf("Error mode , mode must be ENCRYPT or DECRYPT value\n");
NVIC_EnableIRQ(CRPT_IRQn);
AES_ENABLE_INT(CRPT);
AES_Open(CRPT, channel, modeAES, AES_MODE_CBC, AES_KEY_SIZE_128, AES_IN_OUT_SWAP);
}
void M2351_Crypto_UseMasterKey()
{
CRPT_T *crpt = CRPT;
uint32_t u32Channel = 1;
/* Load Key */
uint32_t key_reg_addr;
// 0x3CUL : channel size
key_reg_addr = (uint32_t)&crpt->AES0_KEY[0] + (u32Channel * 0x3CUL);
/* Enable FMC ISP function */
FMC_Open();
outpw(key_reg_addr, FMC_ReadUID(0));
outpw(key_reg_addr+4UL, FMC_ReadUID(1));
outpw(key_reg_addr+8UL, FMC_ReadUID(2));
outpw(key_reg_addr+12UL, FMC_ReadUID(0));
//printf("\nmasterKey = %08x%08x%08x%08x\n",FMC_ReadUID(0),FMC_ReadUID(1),FMC_ReadUID(2),FMC_ReadUID(0));
/* Disable FMC ISP function */
FMC_Close();
//outpw(key_reg_addr, 0x2b7e1516);
//outpw(key_reg_addr+4UL, 0x28aed2a6);
//outpw(key_reg_addr+8UL, 0xabf71588);
//outpw(key_reg_addr+12UL, 0x09cf4f3c);
/* Load IV */
uint32_t iv_reg_addr;
iv_reg_addr = (uint32_t)&crpt->AES0_IV[0] + (u32Channel * 0x3CUL);
outpw(iv_reg_addr, 0x00000000);
outpw(iv_reg_addr+4UL, 0x00000000);
outpw(iv_reg_addr+8UL, 0x00000000);
outpw(iv_reg_addr+12UL, 0x00000000);
}
void M2351_Crypto_UseSessionKey(uint8_t channel)
{
uint8_t sessionKey[16] = {0};
//printf("&cipheredSessionKey = %p\n", cipheredSessionKey);
//printBlock(cipheredSessionKey);
//M2351_Crypto_Init(1, DECRYPT);
//M2351_Crypto_UseMasterKey();
//if (DEMO)
// printf("| Secure is running ... decrypt sessionKey |\n");
//M2351_Decrypt_Data(1, cipheredSessionKey, sessionKey);
//printf("&sessionKey = %p\n", sessionKey);
//printBlock(sessionKey);
if (DEMO)
printf("| Secure is running ... Use sessionKey |\n");
uint32_t tmp_sk[4];
uint32_t tmp_si[4];
for (uint8_t z = 0; z < 4; z++)
{
tmp_sk[z] = (sessionKey[0+(4*z)] << 24) | (sessionKey[1+(4*z)] << 16) | (sessionKey[2+(4*z)] << 8) | sessionKey[3+(4*z)];
tmp_si[z] = (sessionIv[0+(4*z)] << 24) | (sessionIv[1+(4*z)] << 16) | (sessionIv[2+(4*z)] << 8) | sessionIv[3+(4*z)];
}
AES_SetKey(CRPT, channel, tmp_sk, AES_KEY_SIZE_128);
AES_SetInitVect(CRPT, channel, tmp_si);
/* Reset memory */
for (uint8_t z = 0; z < 16; z++) sessionKey[z] = 0;
for (uint8_t z = 0; z < 4; z++) {
tmp_sk[z] = 0;
tmp_si[z] = 0;
}
}
/* Function M2351_encrypt_data is same as Nuvoton_M2351_decrypt_data */
void M2351_Encrypt_Data(uint8_t channel, uint8_t InputData[], uint8_t OutputData[])
{
//printf("AES ECB encrypt start.\n");
//printf("&inputData = %p\n",InputData);
//printf("&outputData = %p\n",OutputData);
AES_SetDMATransfer(CRPT, channel, (uint32_t)InputData, (uint32_t)OutputData, 16);
/*
printf("before start AES : \n"
"CRPT->AES0_CNT : %d\n"
"CRPT->AES0_DADDR : %d\n"
"CRPT->AES0_IV : %d\n"
"CRPT->AES0_KEY : %d\n"
"CRPT->AES0_SADDR : %d\n", CRPT->AES0_CNT,CRPT->AES0_DADDR,CRPT->AES0_IV, CRPT->AES0_KEY, CRPT->AES0_SADDR);
*/
g_AES_done = 0;
/* Start AES encrypt */
AES_Start(CRPT, channel, CRYPTO_DMA_ONE_SHOT);
/* Waiting for AES calculation */
while(!g_AES_done);
//printf("AES CBC encrypt done.\n");
}
/* Function M2351_decrypt_data is same as Nuvoton_M2351_encrypt_data */
void M2351_Decrypt_Data(uint8_t channel, uint8_t InputData[], uint8_t OutputData[])
{
//printf("AES ECB decrypt start.\n");
/*
printf("&inputData = %p\n",InputData);
printf("&outputData = %p\n",OutputData);
*/
AES_SetDMATransfer(CRPT, channel, (uint32_t)InputData, (uint32_t)OutputData, 16);
/*
printf("before start AES : \n"
"CRPT->AES0_CNT : %d\n"
"CRPT->AES0_DADDR : %d\n"
"CRPT->AES0_IV : %d\n"
"CRPT->AES0_KEY : %d\n"
"CRPT->AES0_SADDR : %d\n", CRPT->AES0_CNT,CRPT->AES0_DADDR,CRPT->AES0_IV, CRPT->AES0_KEY, CRPT->AES0_SADDR);
*/
g_AES_done = 0;
/* Start AES decrypt */
AES_Start(CRPT, channel, CRYPTO_DMA_ONE_SHOT);
/* Waiting for AES calculation */
while(!g_AES_done);
//printf("AES CBC decrypt done.\n");
}
#include <stdio.h>
#include <string.h>
#include "NuMicro.h"
#ifndef CRYPTO_AES_H_
#define CRYPTO_AES_H_
#define ENCRYPT 1
#define DECRYPT 0
static volatile int32_t g_AES_done;
void CRPT_IRQHandler(void);
void M2351_Crypto_Init(uint8_t, uint8_t);
void M2351_Crypto_UseSessionKey(uint8_t );
void M2351_Crypto_UseMasterKey(void);
void M2351_Encrypt_Data(uint8_t, uint8_t *, uint8_t *);
void M2351_Decrypt_Data(uint8_t, uint8_t *, uint8_t *);
#endif /* CRYPTO_AES_H_ */
<?xml version="1.0" encoding="utf-8"?>
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
<component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component-->
<events>
</events>
</component_viewer>
///*************************************************************************
// * @file MAX30102.c
// * @brief
// * MAX30102 driver header file
// *
// * @note
// ********************************************************************** **/
/*
Optical Heart Rate Detection (PBA Algorithm)
By: Nathan Seidle
SparkFun Electronics
Date: October 2nd, 2016
Given a series of IR samples from the MAX30105 we discern when a heart beat is occurring
Let's have a brief chat about what this code does. We're going to try to detect
heart-rate optically. This is tricky and prone to give false readings. We really don't
want to get anyone hurt so use this code only as an example of how to process optical
data. Build fun stuff with our MAX30105 breakout board but don't use it for actual
medical diagnosis.
Excellent background on optical heart rate detection:
http://www.ti.com/lit/an/slaa655/slaa655.pdf
Good reading:
http://www.techforfuture.nl/fjc_documents/mitrabaratchi-measuringheartratewithopticalsensor.pdf
https://fruct.org/publications/fruct13/files/Lau.pdf
This is an implementation of Maxim's PBA (Penpheral Beat Amplitude) algorithm. It's been
converted to work within the Arduino framework.
*/
/* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Maxim Integrated
* Products, Inc. shall not be used except as stated in the Maxim Integrated
* Products, Inc. Branding Policy.
*
* The mere transfer of this software does not imply any licenses
* of trade secrets, proprietary technology, copyrights, patents,
* trademarks, maskwork rights, or any other form of intellectual
* property whatsoever. Maxim Integrated Products, Inc. retains all
* ownership rights.
*
*/
#include "NuMicro.h"
#include "MAX30102.h"
// Data buffer
uint8_t au8RDataBuf[6];
// Raw HR & SPo2 data from MAX30102 DATA FIFO
volatile int32_t hr_val;
volatile int32_t spo2_val;
extern volatile uint32_t millis_counter;
//extern uint32_t GetMillis();
extern uint32_t OLED_printTime;
int16_t IR_AC_Max = 20;
int16_t IR_AC_Min = -20;
int16_t IR_AC_Signal_Current = 0;
int16_t IR_AC_Signal_Previous;
int16_t IR_AC_Signal_min = 0;
int16_t IR_AC_Signal_max = 0;
int16_t IR_Average_Estimated;
int16_t positiveEdge = 0;
int16_t negativeEdge = 0;
int32_t ir_avg_reg = 0;
int16_t cbuf[32];
uint8_t offset = 0;
static const uint16_t FIRCoeffs[12] = {172, 321, 579, 927, 1360, 1858, 2390, 2916, 3391, 3768, 4012, 4096};
const int32_t RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
int32_t rates[RATE_SIZE]; //Array of heart rates
int32_t rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;
/*
Configuration MAX30102 by write data to a MAX30102 and check return value
*/
void MAX30102_Config()
{
uint8_t ret = 2;
printf("+---------------------------------------------+\n");
printf("| Configuration MAX30102 in SECURE |\n");
printf("+---------------------------------------------+\n");
/* FIFO Config
Sample_AVG 4, FIFO_ROLLOVER_EN
1*/
ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX30102_FIFO_CONFIG, 0x50);
printf("| [1] MAX30102_FIFO_CONFIG ..... |\n");
/* Mode Config
Mode conrtol, Active LED Channels : Multi-LED Mode
*/
ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX30102_MODE_CONFIG, 0x07);
printf("| [2] MAX30102_MODE_CONFIG ..... |\n");
/* SpO2 Config
SPO2 ADC range control(4096), SPO2 sample rate 400/1s,
LED pulse width = 411, ADC Resolution = 18bit
0b00101111
*/
ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX30102_SPO2_CONFIG, 0x2F);
printf("| [3] MAX30102_SPO2_CONFIG ..... |\n");
/* LED Pulse Amplitude
Typical LED1(RED) current : 2.0mA
Typical LED2(IR) current : 6.2mA
*/
ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX30102_LED1_AMP, 0x0A);
printf("| [4] MAX30102_LED1_AMP ..... |\n");
ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX30102_LED2_AMP, 0x1F);
printf("| [5] MAX30102_LED2_AMP ..... |\n");
/* Multi-LED Mode Control Registers
Slot1 : LED1(RED), Slot2 : LED2(IR)
*/
ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX31012_MLED_CTRL1, 0x21);
printf("| [6] MAX31012_MLED_CTRL1 ..... |\n");
//ret = I2C_WriteByteOneReg(I2C0, MAX30102_ADDR, MAX31012_MLED_CTRL2, 0x00);
//printf("| [5]MAX31012_MLED_CTRL2 --- ret %d |\n", ret);
if (ret)
printf("| MAX31012 Configuration Error! |\n");
printf("+---------------------------------------------+\n");
}
// Heart Rate Monitor functions takes a sample value and the sample number
// Returns true if a beat is detected
// A running average of four samples is recommended for display on the screen.
int checkForBeat(int32_t sample)
{
int beatDetected = 0;
// Save current state
IR_AC_Signal_Previous = IR_AC_Signal_Current;
//This is good to view for debugging
//Serial.print("Signal_Current: ");
//Serial.println(IR_AC_Signal_Current);
// Process next data sample
IR_Average_Estimated = averageDCEstimator(&ir_avg_reg, sample);
IR_AC_Signal_Current = lowPassFIRFilter(sample - IR_Average_Estimated);
//printf("\n\t\t\t\t\t\t IR_AC_Signal_Previous(%d), IR_AC_Signal_Current(%d)\n", IR_AC_Signal_Previous , IR_AC_Signal_Current);
// Detect positive zero crossing (rising edge)
if ((IR_AC_Signal_Previous < 0) & (IR_AC_Signal_Current >= 0))
{
IR_AC_Max = IR_AC_Signal_max; //Adjust our AC max and min
IR_AC_Min = IR_AC_Signal_min;
positiveEdge = 1;
negativeEdge = 0;
IR_AC_Signal_max = 0;
//printf("\n\t\t\t\t\t\tIR_AC_Max(%d) - IR_AC_Min(%d) : %d --------------------------------------------------------\n", IR_AC_Max, IR_AC_Max, IR_AC_Min - IR_AC_Min);
//if ((IR_AC_Max - IR_AC_Min) > 20 & (IR_AC_Max - IR_AC_Min) < 1000)
if ((IR_AC_Max - IR_AC_Min) > 20 & (IR_AC_Max - IR_AC_Min) < 1000)
{
//Heart beat!!!
beatDetected = 1;
}
}
// Detect negative zero crossing (falling edge)
if ((IR_AC_Signal_Previous > 0) & (IR_AC_Signal_Current <= 0))
{
positiveEdge = 0;
negativeEdge = 1;
IR_AC_Signal_min = 0;
}
// Find Maximum value in positive cycle
if (positiveEdge & (IR_AC_Signal_Current > IR_AC_Signal_Previous))
{
IR_AC_Signal_max = IR_AC_Signal_Current;
}
// Find Minimum value in negative cycle
if (negativeEdge & (IR_AC_Signal_Current < IR_AC_Signal_Previous))
{
IR_AC_Signal_min = IR_AC_Signal_Current;
}
return(beatDetected);
}
// Average DC Estimator
int16_t averageDCEstimator(int32_t *p, uint16_t x)
{
*p += ((((long) x << 15) - *p) >> 4);
return (*p >> 15);
}
// Low Pass FIR Filter
int16_t lowPassFIRFilter(int16_t din)
{
cbuf[offset] = din;
int32_t z = mul16(FIRCoeffs[11], cbuf[(offset - 11) & 0x1F]);
for (uint8_t i = 0 ; i < 11 ; i++)
{
z += mul16(FIRCoeffs[i], cbuf[(offset - i) & 0x1F] + cbuf[(offset - 22 + i) & 0x1F]);
}
offset++;
offset %= 32; //Wrap condition
return(z >> 15);
}
// Integer multiplier
int32_t mul16(int16_t x, int16_t y)
{
return((long)x * (long)y);
}
/* Get FIFO from MAX30102 */
void MAX30102_GetFIFO()
{
I2C_ReadMultiBytesOneReg(I2C0, MAX30102_ADDR, MAX30102_FIFO_DATA, au8RDataBuf, 6);
hr_val = (au8RDataBuf[0]<<16)|(au8RDataBuf[1]<<8)|au8RDataBuf[2]; //RED LED
spo2_val = (au8RDataBuf[3]<<16)|(au8RDataBuf[4]<<8)|au8RDataBuf[5]; //IR LED(pulse oximetry)
//printf("\n+---------------------------------------------+\n");
//printf("HR_val : %#08x(%d)\t \n", hr_val, hr_val);
//printf("HR_val : %#08x(%d),\t Spo2_val : %#08x(%d) \r\n", hr_val, hr_val, spo2_val, spo2_val);
//printf("+---------------------------------------------+\n");
//CLK_SysTickDelay(300000); //300000us = 300ms = 0.3s
}
uint32_t MAX30102_ComputeBPM()
{
int i;
long irValue;
long delta;
MAX30102_GetFIFO();
irValue = (long)spo2_val;
if (checkForBeat(irValue) == 1)
{
//printf("\nWe sensed a beat!\n");
//printf("\nmillis = %d\t delta = %ld\n", millis_counter, delta);
delta = (millis_counter - lastBeat) - OLED_printTime;
lastBeat = millis_counter;
beatsPerMinute = 60 / (delta / 1000.0);
if (beatsPerMinute < 150 && beatsPerMinute > 20)
{
rates[rateSpot++] = (int)beatsPerMinute; //Store this reading in the array
rateSpot %= RATE_SIZE; //Wrap variable
//Take average of readings
beatAvg = 0;
for (i = 0 ; i < RATE_SIZE ; i++)
beatAvg += rates[i];
beatAvg /= RATE_SIZE;
}
}
printf("\nIR = %ld\t", irValue);
printf("BPM = %f\t", beatsPerMinute);
printf("Avg BPM = %d\t", beatAvg);
if (irValue < 50000)
{
printf("[No Finger]");
return 0;
}
return 1;
}
/**********************************************************
*
* @file : MAX30102.h
* @author : HaewonSeo
*
* @note : MAX30102-Heart-Rate Sensor
**********************************************************/
#ifndef __I2C_MAX30102_H__
#define __I2C_MAX30102_H__
#include <stdio.h>
#include "M2351.h"
/* MAX30102 I2C-ADDRESS */
#define MAX30102_ADDR 0x57 // 8bit address converted to 7bit
/* MAX30102 Register Map */
#define MAX30102_INT_STATUS1 0x00 // Which interrupts are tripped
#define MAX30102_INT_STATUS2 0x01 // Which interrupts are tripped
#define MAX30102_INT_ENABLE1 0x02 // Which interrupts are active
#define MAX30102_INT_ENABLE2 0x03 // Which interrupts are active
#define MAX30102_FIFO_WR_PTR 0x04 // Where data is being written
#define MAX30102_OVRFLOW_CTR 0x05 // Number of lost samples
#define MAX30102_FIFO_RD_PTR 0x06 // Where to read from
#define MAX30102_FIFO_DATA 0x07 // Ouput data buffer
#define MAX30102_FIFO_CONFIG 0x08
#define MAX30102_MODE_CONFIG 0x09 // Control register
#define MAX30102_SPO2_CONFIG 0x0A // Oximetry settings
#define MAX30102_LED1_AMP 0x0C
#define MAX30102_LED2_AMP 0x0D
#define MAX30102_PILOT 0x10
#define MAX31012_MLED_CTRL1 0x11
#define MAX31012_MLED_CTRL2 0x12
#define MAX30102_TEMP_INTG 0x1F // Temperature value, whole number
#define MAX30102_TEMP_FRAC 0x20 // Temperature value, fraction
#define MAX30102_DIE_TEMP 0x21
#define MAX30102_PROX_INT_TRESH 0x30
#define MAX30102_REV_ID 0xFE // Part revision
#define MAX30102_PART_ID 0xFF // Part ID, normally 0x11
//void Get_Data_From_MAX30102();
void MAX30102_Config();
int checkForBeat(int32_t sample);
int16_t averageDCEstimator(int32_t *p, uint16_t x);
int16_t lowPassFIRFilter(int16_t din);
int32_t mul16(int16_t x, int16_t y);
void MAX30102_GetFIFO();
uint32_t MAX30102_ComputeBPM();
//extern void I2C1_Init(void);
//extern int32_t I2C0_Read_Write_SLAVE(uint8_t u8SlvAddr);
//extern int32_t I2C0_Read(uint8_t u8SlvAddr, uint8_t u8Reg, uint8_t u8Byte);
#endif //__I2C_MAX30102_H__
/*** (C) COPYRIGHT 2019 Nuvoton Technology Corp. ***/
This diff is collapsed. Click to expand it.
/*
* Copyright (c) 2013-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* -----------------------------------------------------------------------------
*
* $Revision: V5.1.0
*
* Project: CMSIS-RTOS RTX
* Title: RTX Configuration
*
* -----------------------------------------------------------------------------
*/
#include "cmsis_compiler.h"
#include "rtx_os.h"
// OS Idle Thread
__WEAK __NO_RETURN void osRtxIdleThread (void *argument) {
(void)argument;
for (;;) {}
}
// OS Error Callback function
__WEAK uint32_t osRtxErrorNotify (uint32_t code, void *object_id) {
(void)object_id;
switch (code) {
case osRtxErrorStackUnderflow:
// Stack overflow detected for thread (thread_id=object_id)
break;
case osRtxErrorISRQueueOverflow:
// ISR Queue overflow detected when inserting object (object_id)
break;
case osRtxErrorTimerQueueOverflow:
// User Timer Callback Queue overflow detected for timer (timer_id=object_id)
break;
case osRtxErrorClibSpace:
// Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
break;
case osRtxErrorClibMutex:
// Standard C/C++ library mutex initialization failed
break;
default:
// Reserved
break;
}
for (;;) {}
//return 0U;
}
/* -----------------------------------------------------------------------------
* Copyright (c) 2019 Arm Limited (or its affiliates). All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* $Date: 12. November 2019
* $Revision: V1.0
*
* Project: ESP8266 WiFi Driver
* -------------------------------------------------------------------------- */
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
// <h>ESP8266 WiFi Driver Configuration
// <o> WiFi Driver Number (Driver_WiFi#) <0-255>
// <i> Defines exported WiFi driver control block number (Driver_WiFi#)
// <i> Default: 0
#define WIFI_ESP8266_DRIVER_NUMBER 0
// <o>Connect to hardware via Driver_USART# <0-255>
// <i>Defines the serial driver control block number (Driver_USART#)
// <i> Default: 0
#define WIFI_ESP8266_SERIAL_DRIVER 0
// <o> Serial interface baudrate <115200=>115200
// <230400=>230400
// <460800=>460800
// <921600=>921600
// <i> Defines the serial interface baudrate.
// <i> Default: 115200
#define WIFI_ESP8266_SERIAL_BAUDRATE 115200
// <o> WiFi thread priority <0=>osPriorityLow
// <1=>osPriorityBelowNormal
// <2=>osPriorityNormal
// <3=>osPriorityAboveNormal
// <4=>osPriorityHigh
// <5=>osPriorityRealtime
// <i> Defines the WiFi driver thread priority.
// <i> The priority of the WiFi thread should be higher as application thread priority.
// <i> Default: 3
#define WIFI_ESP8266_THREAD_PRIORITY 3
// <o> WiFi thread stack size [bytes] <96-1073741824:8>
// <i> Defines stack size for the WiFi Thread.
// <i> Default: 512
#define WIFI_ESP8266_THREAD_STACK_SIZE 512
// <o> Socket buffer block size <128-16384:128>
// <i> Defines the size of one memory block used for socket data buffering.
// <i> Socket buffering consists of multiple blocks which are distributed across multiple sockets.
// <i> Default: 512
#define WIFI_ESP8266_SOCKET_BLOCK_SIZE 512
// <o> Socket buffer block count <5-256>
// <i> Defines the total number of memory blocks used for socket data buffering.
// <i> Socket buffering consists of multiple blocks which are distributed across multiple sockets.
// <i> Default: 8
#define WIFI_ESP8266_SOCKET_BLOCK_COUNT 8
// <o> Serial parser buffer block size
// <i> Defines the size of one memory block in serial parser buffer.
// <i> The total size of serial parser buffer is defined by memory block size and number of blocks.
// <i> Default: 256
#define WIFI_ESP8266_PARSER_BLOCK_SIZE 256
// <o> Serial parser buffer block count
// <i> Defines the number of memory blocks in serial parser buffer.
// <i> The total size of serial parser buffer is defined by memory block size and number of blocks.
// <i> Default: 8
#define WIFI_ESP8266_PARSER_BLOCK_COUNT 8
// </h>
//------------- <<< end of configuration section >>> -------------------------
/*------------------------------------------------------------------------------
* MDK Middleware - Component ::Network
* Copyright (c) 2004-2019 Arm Limited (or its affiliates). All rights reserved.
*------------------------------------------------------------------------------
* Name: Net_Config.c
* Purpose: Network Configuration
* Rev.: V7.1.0
*----------------------------------------------------------------------------*/
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
// <h>Network System Settings
// <i>Global Network System definitions
// <s.15>Local Host Name
// <i>This is the name under which embedded host can be
// <i>accessed on a local area network.
// <i>Default: "my_host"
#define NET_HOST_NAME "my_host"
// <o>Memory Pool Size <1536-262144:4>
// <i>This is the size of a memory pool in bytes. Buffers for
// <i>network packets are allocated from this memory pool.
// <i>Default: 12000 bytes
#define NET_MEM_POOL_SIZE 12000
// <q>Start System Services
// <i>If enabled, the system will automatically start server services
// <i>(HTTP, FTP, TFTP server, ...) when initializing the network system.
// <i>Default: Enabled
#define NET_START_SERVICE 1
// <h>OS Resource Settings
// <i>These settings are used to optimize usage of OS resources.
// <o>Core Thread Stack Size <512-65535:4>
// <i>Default: 1024 bytes
#define NET_THREAD_STACK_SIZE 1024
// Core Thread Priority
#define NET_THREAD_PRIORITY osPriorityNormal
// </h>
// </h>
//------------- <<< end of configuration section >>> ---------------------------
#include "RTE_Components.h"
#ifdef RTE_Network_Interface_ETH_0
#include "Net_Config_ETH_0.h"
#endif
#ifdef RTE_Network_Interface_ETH_1
#include "Net_Config_ETH_1.h"
#endif
#ifdef RTE_Network_Interface_WiFi_0
#include "Net_Config_WiFi_0.h"
#endif
#ifdef RTE_Network_Interface_WiFi_1
#include "Net_Config_WiFi_1.h"
#endif
#ifdef RTE_Network_Interface_PPP
#include "Net_Config_PPP.h"
#endif
#ifdef RTE_Network_Interface_SLIP
#include "Net_Config_SLIP.h"
#endif
#ifdef RTE_Network_Socket_UDP
#include "Net_Config_UDP.h"
#endif
#ifdef RTE_Network_Socket_TCP
#include "Net_Config_TCP.h"
#endif
#ifdef RTE_Network_Socket_BSD
#include "Net_Config_BSD.h"
#endif
#ifdef RTE_Network_Web_Server_RO
#include "Net_Config_HTTP_Server.h"
#endif
#ifdef RTE_Network_Web_Server_FS
#include "Net_Config_HTTP_Server.h"
#endif
#ifdef RTE_Network_Telnet_Server
#include "Net_Config_Telnet_Server.h"
#endif
#ifdef RTE_Network_TFTP_Server
#include "Net_Config_TFTP_Server.h"
#endif
#ifdef RTE_Network_TFTP_Client
#include "Net_Config_TFTP_Client.h"
#endif
#ifdef RTE_Network_FTP_Server
#include "Net_Config_FTP_Server.h"
#endif
#ifdef RTE_Network_FTP_Client
#include "Net_Config_FTP_Client.h"
#endif
#ifdef RTE_Network_DNS_Client
#include "Net_Config_DNS_Client.h"
#endif
#ifdef RTE_Network_SMTP_Client
#include "Net_Config_SMTP_Client.h"
#endif
#ifdef RTE_Network_SNMP_Agent
#include "Net_Config_SNMP_Agent.h"
#endif
#ifdef RTE_Network_SNTP_Client
#include "Net_Config_SNTP_Client.h"
#endif
#include "net_config.h"
/**
\addtogroup net_genFunc
@{
*/
/**
\fn void net_sys_error (NET_ERROR error)
\ingroup net_cores
\brief Network system error handler.
*/
void net_sys_error (NET_ERROR error) {
/* This function is called when a fatal error is encountered. */
/* The normal program execution is not possible anymore. */
switch (error) {
case NET_ERROR_MEM_ALLOC:
/* Out of memory */
break;
case NET_ERROR_MEM_FREE:
/* Trying to release non existing memory block */
break;
case NET_ERROR_MEM_CORRUPT:
/* Memory Link pointer corrupted */
/* More data written than the size of allocated memory block */
break;
case NET_ERROR_CONFIG:
/* Network configuration error detected */
break;
case NET_ERROR_UDP_ALLOC:
/* Out of UDP Sockets */
break;
case NET_ERROR_TCP_ALLOC:
/* Out of TCP Sockets */
break;
case NET_ERROR_TCP_STATE:
/* TCP State machine in undefined state */
break;
}
/* End-less loop */
while (1);
}
/**
@}
*/
/*------------------------------------------------------------------------------
* MDK Middleware - Component ::Network:Socket
* Copyright (c) 2004-2019 Arm Limited (or its affiliates). All rights reserved.
*------------------------------------------------------------------------------
* Name: Net_Config_TCP.h
* Purpose: Network Configuration for TCP Sockets
* Rev.: V7.1.1
*----------------------------------------------------------------------------*/
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
// <h>TCP Sockets
#define TCP_ENABLE 1
// <o>Number of TCP Sockets <1-20>
// <i>Number of available TCP sockets
// <i>Default: 6
#define TCP_NUM_SOCKS 6
// <o>Number of Retries <0-20>
// <i>How many times TCP module will try to retransmit data
// <i>before giving up. Increase this value for high-latency
// <i>and low throughput networks.
// <i>Default: 5
#define TCP_MAX_RETRY 5
// <o>Retry Timeout in seconds <1-10>
// <i>If data frame not acknowledged within this time frame,
// <i>TCP module will try to resend the data again.
// <i>Default: 4
#define TCP_RETRY_TOUT 4
// <o>Default Connect Timeout in seconds <1-65535>
// <i>If no TCP data frame has been exchanged during this time,
// <i>the TCP connection is either closed or a keep-alive frame
// <i>is sent to verify that the connection still exists.
// <i>Default: 120
#define TCP_DEFAULT_TOUT 120
// <o>Maximum Segment Size <536-1440>
// <i>The Maximum Segment Size specifies the maximum
// <i>number of bytes in the TCP segment's Data field.
// <i>Default: 1440
#define TCP_MAX_SEG_SIZE 1440
// <o>Receive Window Size <536-65535>
// <i>Receive Window Size specifies the size of data,
// <i>that the socket is able to buffer in flow-control mode.
// <i>Default: 4320
#define TCP_RECEIVE_WIN_SIZE 4320
// </h>
// TCP Initial Retransmit period in seconds
#define TCP_INITIAL_RETRY_TOUT 1
// TCP SYN frame retransmit period in seconds
#define TCP_SYN_RETRY_TOUT 2
// Number of retries to establish a connection
#define TCP_CONNECT_RETRY 7
// Dynamic port start (default 49152)
#define TCP_DYN_PORT_START 49152
// Dynamic port end (default 65535)
#define TCP_DYN_PORT_END 65535
//------------- <<< end of configuration section >>> ---------------------------
/*------------------------------------------------------------------------------
* MDK Middleware - Component ::Network:Interface
* Copyright (c) 2004-2020 Arm Limited (or its affiliates). All rights reserved.
*------------------------------------------------------------------------------
* Name: Net_Config_WiFi_0.h
* Purpose: Network Configuration for WiFi Interface
* Rev.: V7.1.0
*----------------------------------------------------------------------------*/
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
// <h>WiFi Network Interface
#define WIFI0_ENABLE 1
// <o>Connect to hardware via Driver_WiFi# <0-255>
// <i>Select driver control block for WiFi interface
#define WIFI0_DRIVER 0
// <o>WiFi Mode <0=>Station
// <1=>Access Point
// <i>Mode control setting for the WiFi driver
#define WIFI0_MODE 0
// <e>WiFi MAC
// <i>If this option is enabled, a configured MAC address
// <i>will be used. If disabled, MAC address provided in
// <i>the WiFi module will be used.
// <i>Default: disabled
#define WIFI0_MAC_CONFIG 0
// <s.17>MAC Address
// <i>MAC Address in text representation
// <i>Value FF-FF-FF-FF-FF-FF is not allowed,
// <i>LSB of first byte must be 0 (Multicast bit).
// <i>Default: "1E-30-6C-32-78-F8"
#define WIFI0_MAC_ADDR "1E-30-6C-32-78-F8"
// </e>
// <e>IPv4
// <i>Enable IPv4 Protocol for Network Interface
#define WIFI0_IP4_ENABLE 1
// <s.15>IP Address
// <i>Static IPv4 Address in text representation
// <i>Default: "192.168.1.100"
#define WIFI0_IP4_ADDR "192.168.1.100"
// <s.15>Subnet mask
// <i>Local Subnet mask in text representation
// <i>Default: "255.255.255.0"
#define WIFI0_IP4_MASK "255.255.255.0"
// <s.15>Default Gateway
// <i>IP Address of Default Gateway in text representation
// <i>Default: "192.168.1.254"
#define WIFI0_IP4_GATEWAY "192.168.1.254"
// <s.15>Primary DNS Server
// <i>IP Address of Primary DNS Server in text representation
// <i>Default: "8.8.8.8"
#define WIFI0_IP4_PRIMARY_DNS "8.8.8.8"
// <s.15>Secondary DNS Server
// <i>IP Address of Secondary DNS Server in text representation
// <i>Default: "8.8.4.4"
#define WIFI0_IP4_SECONDARY_DNS "8.8.4.4"
// <e>IP Fragmentation
// <i>This option enables fragmentation of outgoing IP datagrams,
// <i>and reassembling the fragments of incoming IP datagrams.
// <i>Default: enabled
#define WIFI0_IP4_FRAG_ENABLE 1
// <o>MTU size <576-1500>
// <i>Maximum Transmission Unit in bytes
// <i>Default: 1500
#define WIFI0_IP4_MTU 1500
// </e>
// <h>ARP Address Resolution
// <i>ARP cache and node address resolver settings
// <o>Cache Table size <5-100>
// <i>Number of cached MAC/IP addresses
// <i>Default: 10
#define WIFI0_ARP_TAB_SIZE 10
// <o>Cache Timeout in seconds <5-255>
// <i>A timeout for cached hardware/IP addresses
// <i>Default: 150
#define WIFI0_ARP_CACHE_TOUT 150
// <o>Number of Retries <0-20>
// <i>Number of Retries to resolve an IP address
// <i>before ARP module gives up
// <i>Default: 4
#define WIFI0_ARP_MAX_RETRY 4
// <o>Resend Timeout in seconds <1-10>
// <i>A timeout to resend the ARP Request
// <i>Default: 2
#define WIFI0_ARP_RESEND_TOUT 2
// <q>Send Notification on Address changes
// <i>When this option is enabled, the embedded host
// <i>will send a Gratuitous ARP notification at startup,
// <i>or when the device IP address has changed.
// <i>Default: Disabled
#define WIFI0_ARP_NOTIFY 0
// </h>
// <e>IGMP Group Management
// <i>Enable or disable Internet Group Management Protocol
#define WIFI0_IGMP_ENABLE 0
// <o>Membership Table size <2-50>
// <i>Number of Groups this host can join
// <i>Default: 5
#define WIFI0_IGMP_TAB_SIZE 5
// </e>
// <q>NetBIOS Name Service
// <i>When this option is enabled, the embedded host can be
// <i>accessed by its name on local LAN using NBNS protocol.
#define WIFI0_NBNS_ENABLE 1
// <e>Dynamic Host Configuration
// <i>When this option is enabled, local IP address, Net Mask
// <i>and Default Gateway are obtained automatically from
// <i>the DHCP Server on local LAN.
#define WIFI0_DHCP_ENABLE 1
// <s.40>Vendor Class Identifier
// <i>This value is optional. If specified, it is added
// <i>to DHCP request message, identifying vendor type.
// <i>Default: ""
#define WIFI0_DHCP_VCID ""
// <q>Bootfile Name
// <i>This value is optional. If enabled, the Bootfile Name
// <i>(option 67) is also requested from DHCP server.
// <i>Default: disabled
#define WIFI0_DHCP_BOOTFILE 0
// <q>NTP Servers
// <i>This value is optional. If enabled, a list of NTP Servers
// <i>(option 42) is also requested from DHCP server.
// <i>Default: disabled
#define WIFI0_DHCP_NTP_SERVERS 0
// </e>
// Disable ICMP Echo response
#define WIFI0_ICMP_NO_ECHO 0
// </e>
// <e>IPv6
// <i>Enable IPv6 Protocol for Network Interface
#define WIFI0_IP6_ENABLE 1
// <s.40>IPv6 Address
// <i>Static IPv6 Address in text representation
// <i>Use unspecified address "::" when static
// <i>IPv6 address is not used.
// <i>Default: "fec0::2"
#define WIFI0_IP6_ADDR "fec0::2"
// <o>Subnet prefix-length <1-128>
// <i>Number of bits that define network address
// <i>Default: 64
#define WIFI0_IP6_PREFIX_LEN 64
// <s.40>Default Gateway
// <i>Default Gateway IPv6 Address in text representation
// <i>Default: "fec0::1"
#define WIFI0_IP6_GATEWAY "fec0::1"
// <s.40>Primary DNS Server
// <i>Primary DNS Server IPv6 Address in text representation
// <i>Default: "2001:4860:4860::8888"
#define WIFI0_IP6_PRIMARY_DNS "2001:4860:4860::8888"
// <s.40>Secondary DNS Server
// <i>Secondary DNS Server IPv6 Address in text representation
// <i>Default: "2001:4860:4860::8844"
#define WIFI0_IP6_SECONDARY_DNS "2001:4860:4860::8844"
// <h>Neighbor Discovery
// <i>Neighbor cache and node address resolver settings
// <o>Cache Table size <5-100>
// <i>Number of cached node addresses
// <i>Default: 5
#define WIFI0_NDP_TAB_SIZE 5
// <o>Cache Timeout in seconds <5-255>
// <i>Timeout for cached node addresses
// <i>Default: 150
#define WIFI0_NDP_CACHE_TOUT 150
// <o>Number of Retries <0-20>
// <i>Number of retries to resolve an IP address
// <i>before NDP module gives up
// <i>Default: 4
#define WIFI0_NDP_MAX_RETRY 4
// <o>Resend Timeout in seconds <1-10>
// <i>A timeout to resend Neighbor Solicitation
// <i>Default: 2
#define WIFI0_NDP_RESEND_TOUT 2
// </h>
// <e>Dynamic Host Configuration
// <i>When this option is enabled, local IPv6 address is
// <i>automatically configured.
#define WIFI0_DHCP6_ENABLE 1
// <o>DHCPv6 Client Mode <0=>Stateless Mode <1=>Statefull Mode
// <i>Stateless DHCPv6 Client uses router advertisements
// <i>for IPv6 address autoconfiguration (SLAAC).
// <i>Statefull DHCPv6 Client connects to DHCPv6 server for a
// <i>leased IPv6 address and DNS server IPv6 addresses.
#define WIFI0_DHCP6_MODE 1
// <e>Vendor Class Option
// <i>If enabled, Vendor Class option is added to DHCPv6
// <i>request message, identifying vendor type.
// <i>Default: disabled
#define WIFI0_DHCP6_VCLASS_ENABLE 0
// <o>Enterprise ID
// <i>Enterprise-number as registered with IANA.
// <i>Default: 0 (Reserved)
#define WIFI0_DHCP6_VCLASS_EID 0
// <s.40>Vendor Class Data
// <i>This string identifies vendor type.
// <i>Default: ""
#define WIFI0_DHCP6_VCLASS_DATA ""
// </e>
// </e>
// Disable ICMP6 Echo response
#define WIFI0_ICMP6_NO_ECHO 0
// </e>
// <h>OS Resource Settings
// <i>These settings are used to optimize usage of OS resources.
// <o>Interface Thread Stack Size <512-65535:4>
// <i>Default: 512 bytes
#define WIFI0_THREAD_STACK_SIZE 512
// Interface Thread Priority
#define WIFI0_THREAD_PRIORITY osPriorityAboveNormal
// </h>
// </h>
//------------- <<< end of configuration section >>> ---------------------------
/*
* Configuration template
*
* Copyright (C) 2006-2021, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This set of compile-time options may be used to enable
* or disable features selectively, and reduce the global
* memory footprint.
*/
#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H
/* System support */
//#define MBEDTLS_HAVE_ASM
//#define MBEDTLS_HAVE_TIME
//#define MBEDTLS_HAVE_TIME_DATE
//#define MBEDTLS_PLATFORM_MEMORY
//#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
//#define MBEDTLS_CHECK_PARAMS
/* mbed TLS feature support */
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#define MBEDTLS_AES_ROM_TABLES
//#define MBEDTLS_AES_FEWER_TABLES
//#define MBEDTLS_CAMELLIA_SMALL_MEMORY
#define MBEDTLS_CIPHER_MODE_CBC
#define MBEDTLS_CIPHER_MODE_CFB
#define MBEDTLS_CIPHER_MODE_CTR
//#define MBEDTLS_CIPHER_MODE_OFB
//#define MBEDTLS_CIPHER_MODE_XTS
#define MBEDTLS_CIPHER_PADDING_PKCS7
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
#define MBEDTLS_CIPHER_PADDING_ZEROS
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
#define MBEDTLS_REMOVE_3DES_CIPHERSUITES
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
#define MBEDTLS_ECP_NIST_OPTIM
//#define MBEDTLS_ECP_RESTARTABLE
#define MBEDTLS_ECDSA_DETERMINISTIC
#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
#define MBEDTLS_PK_PARSE_EC_EXTENDED
#define MBEDTLS_ERROR_STRERROR_DUMMY
#define MBEDTLS_GENPRIME
//#define MBEDTLS_FS_IO
//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
#define MBEDTLS_NO_PLATFORM_ENTROPY
//#define MBEDTLS_ENTROPY_FORCE_SHA256
//#define MBEDTLS_ENTROPY_NV_SEED
//#define MBEDTLS_MEMORY_DEBUG
//#define MBEDTLS_MEMORY_BACKTRACE
#define MBEDTLS_PK_RSA_ALT_SUPPORT
#define MBEDTLS_PKCS1_V15
#define MBEDTLS_PKCS1_V21
//#define MBEDTLS_PSA_CRYPTO_SPM
//#define MBEDTLS_RSA_NO_CRT
#define MBEDTLS_SELF_TEST
//#define MBEDTLS_SHA256_SMALLER
//#define MBEDTLS_SHA512_SMALLER
//#define MBEDTLS_SHA512_NO_SHA384
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
//#define MBEDTLS_SSL_RECORD_CHECKING
//#define MBEDTLS_SSL_DTLS_CONNECTION_ID
//#define MBEDTLS_SSL_ASYNC_PRIVATE
//#define MBEDTLS_SSL_CONTEXT_SERIALIZATION
//#define MBEDTLS_SSL_DEBUG_ALL
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
#define MBEDTLS_SSL_FALLBACK_SCSV
//#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
//#define MBEDTLS_SSL_HW_RECORD_ACCEL
#define MBEDTLS_SSL_CBC_RECORD_SPLITTING
#define MBEDTLS_SSL_RENEGOTIATION
//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
//#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
#define MBEDTLS_SSL_PROTO_SSL3
#define MBEDTLS_SSL_PROTO_TLS1
#define MBEDTLS_SSL_PROTO_TLS1_1
#define MBEDTLS_SSL_PROTO_TLS1_2
#define MBEDTLS_SSL_PROTO_DTLS
#define MBEDTLS_SSL_ALPN
#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
#define MBEDTLS_SSL_SESSION_TICKETS
//#define MBEDTLS_SSL_EXPORT_KEYS
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
#define MBEDTLS_SSL_TRUNCATED_HMAC
//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
//#define MBEDTLS_USE_PSA_CRYPTO
#define MBEDTLS_VERSION_FEATURES
//#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
//#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
#define MBEDTLS_X509_CHECK_KEY_USAGE
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
//#define MBEDTLS_ZLIB_SUPPORT
/* mbed TLS modules */
#define MBEDTLS_AES_C
#define MBEDTLS_ARC4_C
#define MBEDTLS_ASN1_PARSE_C
#define MBEDTLS_ASN1_WRITE_C
#define MBEDTLS_BASE64_C
#define MBEDTLS_BIGNUM_C
#define MBEDTLS_BLOWFISH_C
#define MBEDTLS_CAMELLIA_C
//#define MBEDTLS_ARIA_C
#define MBEDTLS_CCM_C
#define MBEDTLS_CERTS_C
//#define MBEDTLS_CHACHA20_C
//#define MBEDTLS_CHACHAPOLY_C
#define MBEDTLS_CIPHER_C
//#define MBEDTLS_CMAC_C
#define MBEDTLS_CTR_DRBG_C
#define MBEDTLS_DEBUG_C
#define MBEDTLS_DES_C
#define MBEDTLS_DHM_C
#define MBEDTLS_ECDH_C
#define MBEDTLS_ECDSA_C
//#define MBEDTLS_ECJPAKE_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ENTROPY_C
#define MBEDTLS_ERROR_C
#define MBEDTLS_GCM_C
//#define MBEDTLS_HAVEGE_C
//#define MBEDTLS_HKDF_C
#define MBEDTLS_HMAC_DRBG_C
//#define MBEDTLS_NIST_KW_C
#define MBEDTLS_MD_C
//#define MBEDTLS_MD2_C
//#define MBEDTLS_MD4_C
#define MBEDTLS_MD5_C
//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
#define MBEDTLS_NET_C
#define MBEDTLS_OID_C
#define MBEDTLS_PEM_PARSE_C
#define MBEDTLS_PEM_WRITE_C
#define MBEDTLS_PK_C
#define MBEDTLS_PK_PARSE_C
#define MBEDTLS_PK_WRITE_C
#define MBEDTLS_PKCS5_C
//#define MBEDTLS_PKCS11_C
#define MBEDTLS_PKCS12_C
#define MBEDTLS_PLATFORM_C
//#define MBEDTLS_POLY1305_C
//#define MBEDTLS_PSA_CRYPTO_C
//#define MBEDTLS_PSA_CRYPTO_SE_C
//#define MBEDTLS_PSA_CRYPTO_STORAGE_C
//#define MBEDTLS_PSA_ITS_FILE_C
#define MBEDTLS_RIPEMD160_C
#define MBEDTLS_RSA_C
#define MBEDTLS_SHA1_C
#define MBEDTLS_SHA256_C
#define MBEDTLS_SHA512_C
#define MBEDTLS_SSL_CACHE_C
#define MBEDTLS_SSL_COOKIE_C
#define MBEDTLS_SSL_TICKET_C
#define MBEDTLS_SSL_CLI_C
//#define MBEDTLS_SSL_SRV_C
#define MBEDTLS_SSL_TLS_C
//#define MBEDTLS_THREADING_C
//#define MBEDTLS_TIMING_C
#define MBEDTLS_VERSION_C
#define MBEDTLS_X509_USE_C
#define MBEDTLS_X509_CRT_PARSE_C
#define MBEDTLS_X509_CRL_PARSE_C
#define MBEDTLS_X509_CSR_PARSE_C
#define MBEDTLS_X509_CREATE_C
#define MBEDTLS_X509_CRT_WRITE_C
#define MBEDTLS_X509_CSR_WRITE_C
#define MBEDTLS_XTEA_C
#include "mbedtls/check_config.h"
#endif /* MBEDTLS_CONFIG_H */
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'Secure'
* Target: 'Secure'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "M2351.h"
/* ARM::Security:mbed TLS:2.24.0 */
#define RTE_Security_mbedTLS /* Security mbed TLS */
#endif /* RTE_COMPONENTS_H */
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
/*
* Configuration template
*
* Copyright (C) 2006-2021, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This set of compile-time options may be used to enable
* or disable features selectively, and reduce the global
* memory footprint.
*/
#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H
/* System support */
//#define MBEDTLS_HAVE_ASM
//#define MBEDTLS_HAVE_TIME
//#define MBEDTLS_HAVE_TIME_DATE
//#define MBEDTLS_PLATFORM_MEMORY
//#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
//#define MBEDTLS_CHECK_PARAMS
/* mbed TLS feature support */
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#define MBEDTLS_AES_ROM_TABLES
//#define MBEDTLS_AES_FEWER_TABLES
//#define MBEDTLS_CAMELLIA_SMALL_MEMORY
#define MBEDTLS_CIPHER_MODE_CBC
#define MBEDTLS_CIPHER_MODE_CFB
#define MBEDTLS_CIPHER_MODE_CTR
//#define MBEDTLS_CIPHER_MODE_OFB
//#define MBEDTLS_CIPHER_MODE_XTS
#define MBEDTLS_CIPHER_PADDING_PKCS7
#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
#define MBEDTLS_CIPHER_PADDING_ZEROS
#define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
#define MBEDTLS_REMOVE_3DES_CIPHERSUITES
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
#define MBEDTLS_ECP_DP_BP256R1_ENABLED
#define MBEDTLS_ECP_DP_BP384R1_ENABLED
#define MBEDTLS_ECP_DP_BP512R1_ENABLED
#define MBEDTLS_ECP_DP_CURVE25519_ENABLED
#define MBEDTLS_ECP_DP_CURVE448_ENABLED
#define MBEDTLS_ECP_NIST_OPTIM
//#define MBEDTLS_ECP_RESTARTABLE
#define MBEDTLS_ECDSA_DETERMINISTIC
#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
#define MBEDTLS_PK_PARSE_EC_EXTENDED
#define MBEDTLS_ERROR_STRERROR_DUMMY
#define MBEDTLS_GENPRIME
//#define MBEDTLS_FS_IO
//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
#define MBEDTLS_NO_PLATFORM_ENTROPY
//#define MBEDTLS_ENTROPY_FORCE_SHA256
//#define MBEDTLS_ENTROPY_NV_SEED
//#define MBEDTLS_MEMORY_DEBUG
//#define MBEDTLS_MEMORY_BACKTRACE
#define MBEDTLS_PK_RSA_ALT_SUPPORT
#define MBEDTLS_PKCS1_V15
#define MBEDTLS_PKCS1_V21
//#define MBEDTLS_PSA_CRYPTO_SPM
//#define MBEDTLS_RSA_NO_CRT
#define MBEDTLS_SELF_TEST
//#define MBEDTLS_SHA256_SMALLER
//#define MBEDTLS_SHA512_SMALLER
//#define MBEDTLS_SHA512_NO_SHA384
#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
//#define MBEDTLS_SSL_RECORD_CHECKING
//#define MBEDTLS_SSL_DTLS_CONNECTION_ID
//#define MBEDTLS_SSL_ASYNC_PRIVATE
//#define MBEDTLS_SSL_CONTEXT_SERIALIZATION
//#define MBEDTLS_SSL_DEBUG_ALL
#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
#define MBEDTLS_SSL_FALLBACK_SCSV
//#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
//#define MBEDTLS_SSL_HW_RECORD_ACCEL
#define MBEDTLS_SSL_CBC_RECORD_SPLITTING
#define MBEDTLS_SSL_RENEGOTIATION
//#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
//#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
#define MBEDTLS_SSL_PROTO_SSL3
#define MBEDTLS_SSL_PROTO_TLS1
#define MBEDTLS_SSL_PROTO_TLS1_1
#define MBEDTLS_SSL_PROTO_TLS1_2
#define MBEDTLS_SSL_PROTO_DTLS
#define MBEDTLS_SSL_ALPN
#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
#define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
#define MBEDTLS_SSL_SESSION_TICKETS
//#define MBEDTLS_SSL_EXPORT_KEYS
#define MBEDTLS_SSL_SERVER_NAME_INDICATION
#define MBEDTLS_SSL_TRUNCATED_HMAC
//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
//#define MBEDTLS_USE_PSA_CRYPTO
#define MBEDTLS_VERSION_FEATURES
//#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
//#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
#define MBEDTLS_X509_CHECK_KEY_USAGE
#define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
//#define MBEDTLS_ZLIB_SUPPORT
/* mbed TLS modules */
#define MBEDTLS_AES_C
#define MBEDTLS_ARC4_C
#define MBEDTLS_ASN1_PARSE_C
#define MBEDTLS_ASN1_WRITE_C
#define MBEDTLS_BASE64_C
#define MBEDTLS_BIGNUM_C
#define MBEDTLS_BLOWFISH_C
#define MBEDTLS_CAMELLIA_C
//#define MBEDTLS_ARIA_C
#define MBEDTLS_CCM_C
#define MBEDTLS_CERTS_C
//#define MBEDTLS_CHACHA20_C
//#define MBEDTLS_CHACHAPOLY_C
#define MBEDTLS_CIPHER_C
//#define MBEDTLS_CMAC_C
#define MBEDTLS_CTR_DRBG_C
#define MBEDTLS_DEBUG_C
#define MBEDTLS_DES_C
#define MBEDTLS_DHM_C
#define MBEDTLS_ECDH_C
#define MBEDTLS_ECDSA_C
//#define MBEDTLS_ECJPAKE_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ENTROPY_C
#define MBEDTLS_ERROR_C
#define MBEDTLS_GCM_C
//#define MBEDTLS_HAVEGE_C
//#define MBEDTLS_HKDF_C
#define MBEDTLS_HMAC_DRBG_C
//#define MBEDTLS_NIST_KW_C
#define MBEDTLS_MD_C
//#define MBEDTLS_MD2_C
//#define MBEDTLS_MD4_C
#define MBEDTLS_MD5_C
//#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
#define MBEDTLS_NET_C
#define MBEDTLS_OID_C
#define MBEDTLS_PEM_PARSE_C
#define MBEDTLS_PEM_WRITE_C
#define MBEDTLS_PK_C
#define MBEDTLS_PK_PARSE_C
#define MBEDTLS_PK_WRITE_C
#define MBEDTLS_PKCS5_C
//#define MBEDTLS_PKCS11_C
#define MBEDTLS_PKCS12_C
#define MBEDTLS_PLATFORM_C
//#define MBEDTLS_POLY1305_C
//#define MBEDTLS_PSA_CRYPTO_C
//#define MBEDTLS_PSA_CRYPTO_SE_C
//#define MBEDTLS_PSA_CRYPTO_STORAGE_C
//#define MBEDTLS_PSA_ITS_FILE_C
#define MBEDTLS_RIPEMD160_C
#define MBEDTLS_RSA_C
#define MBEDTLS_SHA1_C
#define MBEDTLS_SHA256_C
#define MBEDTLS_SHA512_C
#define MBEDTLS_SSL_CACHE_C
#define MBEDTLS_SSL_COOKIE_C
#define MBEDTLS_SSL_TICKET_C
#define MBEDTLS_SSL_CLI_C
//#define MBEDTLS_SSL_SRV_C
#define MBEDTLS_SSL_TLS_C
//#define MBEDTLS_THREADING_C
//#define MBEDTLS_TIMING_C
#define MBEDTLS_VERSION_C
#define MBEDTLS_X509_USE_C
#define MBEDTLS_X509_CRT_PARSE_C
#define MBEDTLS_X509_CRL_PARSE_C
#define MBEDTLS_X509_CSR_PARSE_C
#define MBEDTLS_X509_CREATE_C
#define MBEDTLS_X509_CRT_WRITE_C
#define MBEDTLS_X509_CSR_WRITE_C
#define MBEDTLS_XTEA_C
#include "mbedtls/check_config.h"
#endif /* MBEDTLS_CONFIG_H */
/**********************************************************
*
* @file : nsc.c
* @author : HaewonSeo
*
* @note : Non-Secure callable
**********************************************************/
#include "nsc.h"
uint32_t startTime, endTime, OLED_printTime;
extern char priKey[49];
extern char pubKey1[49], pubKey2[49];
extern char R[49], S[49];
t_digitallySignedData gDSD;
/*----------------------------------------------------------------------------
NonSecure callable function for NonSecure callback
*----------------------------------------------------------------------------*/
NonSecure_funcptr pfNonSecure_OLED_On = (NonSecure_funcptr)NULL;
NonSecure_funcptr pfNonSecure_OLED_Off = (NonSecure_funcptr)NULL;
__NONSECURE_ENTRY
int32_t Secure_OLED_On_callback(NonSecure_funcptr *callback)
{
pfNonSecure_OLED_On = (NonSecure_funcptr)cmse_nsfptr_create(callback);
return 0;
}
__NONSECURE_ENTRY
int32_t Secure_OLED_Off_callback(NonSecure_funcptr *callback)
{
pfNonSecure_OLED_Off = (NonSecure_funcptr)cmse_nsfptr_create(callback);
return 0;
}
/*----------------------------------------------------------------------------
Secure functions exported to NonSecure application
Must place in Non-secure Callable
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
uint32_t GetSystemCoreClock(void)
{
//printf("System core clock = %d.\n", SystemCoreClock);
return SystemCoreClock;
}
__NONSECURE_ENTRY
uint32_t Get_BPM()
{
uint32_t ret;
static uint32_t ticks;
ret = MAX30102_ComputeBPM();
ticks++;
if (ticks == 60)
{
ticks = 0;
startTime = millis_counter;
/* Refresh OLED */
pfNonSecure_OLED_On(9999);
pfNonSecure_OLED_On(beatAvg);
endTime = millis_counter;
OLED_printTime = endTime - startTime;
//printf("OLED print time = %u\n", OLED_printTime);
}
else
OLED_printTime = 0;
if (ret == 0)
return 0;
return beatAvg;
}
__NONSECURE_ENTRY
uint32_t Get_EncryptedDigitallySignedData(t_digitallySignedData *dsd)
{
uint32_t ret;
static uint32_t ticks;
__attribute__((aligned(4))) uint8_t plainBPM[16] = //{0};
{
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30
};
ret = MAX30102_ComputeBPM();
ticks++;
if (ticks >= 60)
{
ticks = 0;
startTime = millis_counter;
/* Refresh OLED */
pfNonSecure_OLED_On(9999);
pfNonSecure_OLED_On(beatAvg);
endTime = millis_counter;
OLED_printTime = endTime - startTime;
//printf("OLED print time = %u\n", OLED_printTime);
/* Encyrpt beatAvg */
memcpy(plainBPM, &beatAvg, sizeof(uint8_t));
/* hashing(sha1) -> Generate Signature -> Encrypt plainBPM & Signiture */
M2351_ECDSA_GenerateSignature((uint8_t *)plainBPM, priKey, R, S);
Encrypt_data((uint8_t *)plainBPM, (uint8_t *)dsd->data, sizeof(plainBPM));
Encrypt_data((uint8_t *)pubKey1, (uint8_t *)dsd->pubKey1, 24);
Encrypt_data((uint8_t *)pubKey2, (uint8_t *)dsd->pubKey2, 24);
Encrypt_data((uint8_t *)R, (uint8_t *)dsd->R, 24);
Encrypt_data((uint8_t *)S, (uint8_t *)dsd->S, 24);
printf("\nplainBPM\n");
printBlock(plainBPM);
printf("\nencryptedBPM\n");
printBlock((uint8_t *)dsd->data);
}
else
OLED_printTime = 0;
if (beatAvg == 0)
return 0;
return 1;
}
/*----------------------------------------------------------------------------
CRYPTO Secure functions exported to NonSecure application
Must place in Non-secure Callable
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
int32_t Encrypt_data(uint8_t *plainData, uint8_t *encryptedData, uint32_t bytes) {
if (DEMO) printf("\n| Secure is running ... Encrypt_data |\n");
M2351_Crypto_Init(0, ENCRYPT);
M2351_Crypto_UseSessionKey(0);
M2351_Encrypt_Data(0, plainData, encryptedData, bytes);
//M2351_crypto_init(1, ENCRYPT);
//M2351_crypto_useMasterKey();
//M2351_encrypt_data(1, plainData, cipheredData);
return (int32_t)encryptedData;
}
__NONSECURE_ENTRY
int32_t Decrypt_data(uint8_t *encryptedData, uint8_t *resultData, uint32_t bytes) {
if (DEMO) printf("\n| Secure is running ... Decrypt_data |\n");
M2351_Crypto_Init(0, DECRYPT);
M2351_Crypto_UseSessionKey(0);
M2351_Decrypt_Data(0, encryptedData, resultData, bytes);
//M2351_crypto_init(1, DECRYPT);
//M2351_crypto_useMasterKey();
//M2351_decrypt_data(1, cipheredData, resultData);
return (int32_t)resultData;
}
__NONSECURE_ENTRY
void M2351_LoadKey()
{
static int called;
if (called)
return ;
called = 1;
printf("+---------------------------------------------+\n");
printf("| Load PriKey from OTP & Generate PubKey |\n");
printf("+---------------------------------------------+\n");
M2351_FMC_Read_Key(0, 3, priKey);
printf("prikey(%d-bits) : %s\n", strlen(priKey) * 4, priKey);
M2351_ECC_GenerateKey(priKey, pubKey1, pubKey2);
printf("pubKey1(%d-bits) : %s\npubKey2(%d-bits) : %s\n", strlen(pubKey1) * 4, pubKey1, strlen(pubKey2) * 4, pubKey2);
return ;
}
__NONSECURE_ENTRY
void M2351_DeleteKey()
{
memset(priKey, 0, sizeof(char) * 49);
memset(pubKey1, 0, sizeof(char) * 49);
memset(pubKey2, 0, sizeof(char) * 49);
memset(R, 0, sizeof(char) * 49);
memset(S, 0, sizeof(char) * 49);
//memset(&gDSD, 0, sizeof(t_digitallySignedData));
printf("\nDelete Key & Signature OK.\n");
}
/*----------------------------------------------------------------------------
PRINT Secure functions exported to NonSecure application
Must place in Non-secure Callable
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
int32_t printBlock(uint8_t *block) {
//printf("&block = %p\n",block);
for (uint8_t i = 0; i < 4; i++) {
printf("|");
for (uint8_t j = 0; j < 16; j = j+4) {
printf(" %02x",block[i+j]);
}
printf(" |\n");
}
printf("\n");
return 1;
}
__NONSECURE_ENTRY
int32_t printSecure(char *string, void *ptr, uint8_t val) {
if (ptr == NULL && val == NULL) printf("%s\n",string);
if (ptr == NULL && val != NULL) printf(string,val);
if (ptr != NULL && val == NULL) printf(string,ptr);
return 1;
}
__NONSECURE_ENTRY
int32_t printDigitallySignedData(t_digitallySignedData *dsd)
{
int32_t i;
printf(".data(%d-bits):\n", (sizeof(dsd->data)-1) * 8);
for(i=0; i<16; i++)
printf("%02x", dsd->data[i]);
//printf("\n.pubKey1(%d-bits):\n", (sizeof(dsd->pubKey1)-1) * 8);
//for(i=0; i<24; i++)
// printf("%02x", dsd->pubKey1[i]);
//printf("\n.pubKey2(%d-bits):\n", (sizeof(dsd->pubKey2)-1) * 8);
//for(i=0; i<24; i++)
// printf("%02x", dsd->pubKey2[i]);
printf("\n.SignatureR(%d-bits):\n", (sizeof(dsd->R)-1) * 8);
for(i=0; i<24; i++)
printf("%02x", dsd->R[i]);
printf("\n.SignatureS(%d-bits):\n", (sizeof(dsd->S)-1) * 8);
for(i=0; i<24; i++)
printf("%02x", dsd->S[i]);
printf("\n");
return 1;
}
/**********************************************************
*
* @file : nsc.h
* @author : HaewonSeo
*
* @note : Non-Secure callable
**********************************************************/
#ifndef __NSC_H__
#define __NSC_H__
#include <arm_cmse.h>
#include <stdio.h>
#include <stdlib.h>
#include "NuMicro.h"
#include "M2351_crypto.h"
#include "MAX30102.h"
#define DEMO 1
#define SUCCESS 1
#define FAIL 0
// Raw HR & SPo2 data from FIFO
extern volatile int32_t hr_val;
extern volatile int32_t spo2_val;
/* typedef for NonSecure callback functions */
typedef __NONSECURE_CALL void (*NonSecure_funcptr)(uint32_t);
extern volatile uint32_t millis_counter;
extern float beatsPerMinute;
extern uint32_t beatAvg;
typedef struct s_netData
{
char *data;
int len;
} t_netData;
typedef struct s_digitallySignedData
{
uint8_t data[17];
uint8_t pubKey1[25];
uint8_t pubKey2[25];
uint8_t R[25];
uint8_t S[25];
} t_digitallySignedData;
__NONSECURE_ENTRY
uint32_t GetSystemCoreClock(void);
/*----------------------------------------------------------------------------
NonSecure callable function for NonSecure callback
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
int32_t Secure_OLED_On_callback(NonSecure_funcptr *callback);
__NONSECURE_ENTRY
int32_t Secure_OLED_On_callback(NonSecure_funcptr *callback);
/*----------------------------------------------------------------------------
MAX30102 Heart-Rate Sensor functions exported to NonSecure application
Must place in Non-secure Callable
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
uint32_t Get_BPM();
__NONSECURE_ENTRY
uint32_t Get_EncryptedDigitallySignedData();
/*----------------------------------------------------------------------------
CRYPTO functions exported to NonSecure application
Must place in Non-secure Callable
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
int32_t Encrypt_data(uint8_t *,uint8_t *, uint32_t);
__NONSECURE_ENTRY
int32_t Decrypt_data(uint8_t *,uint8_t *, uint32_t);
__NONSECURE_ENTRY
void M2351_LoadKey();
__NONSECURE_ENTRY
void M2351_DeleteKey();
/*----------------------------------------------------------------------------
PRINT functions exported to NonSecure application
Must place in Non-secure Callable
*----------------------------------------------------------------------------*/
__NONSECURE_ENTRY
int32_t printBlock(uint8_t *);
__NONSECURE_ENTRY
int32_t printSecure(char *,void *,uint8_t);
__NONSECURE_ENTRY
int32_t printDigitallySignedData(t_digitallySignedData *dsd);
#endif /* __NSC_H__ */
This diff is collapsed. Click to expand it.
/*
* SSL client demonstration program
*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
#else
#include <stdio.h>
#include <stdlib.h>
#define mbedtls_time time
#define mbedtls_time_t time_t
#define mbedtls_fprintf fprintf
#define mbedtls_printf printf
#define mbedtls_exit exit
#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif /* MBEDTLS_PLATFORM_C */
#if !defined(MBEDTLS_BIGNUM_C) || !defined(MBEDTLS_ENTROPY_C) || \
!defined(MBEDTLS_SSL_TLS_C) || !defined(MBEDTLS_SSL_CLI_C) || \
!defined(MBEDTLS_NET_C) || !defined(MBEDTLS_RSA_C) || \
!defined(MBEDTLS_CERTS_C) || !defined(MBEDTLS_PEM_PARSE_C) || \
!defined(MBEDTLS_CTR_DRBG_C) || !defined(MBEDTLS_X509_CRT_PARSE_C)
int main( void )
{
mbedtls_printf("MBEDTLS_BIGNUM_C and/or MBEDTLS_ENTROPY_C and/or "
"MBEDTLS_SSL_TLS_C and/or MBEDTLS_SSL_CLI_C and/or "
"MBEDTLS_NET_C and/or MBEDTLS_RSA_C and/or "
"MBEDTLS_CTR_DRBG_C and/or MBEDTLS_X509_CRT_PARSE_C "
"not defined.\n");
mbedtls_exit( 0 );
}
#else
#include "mbedtls/net_sockets.h"
#include "mbedtls/debug.h"
#include "mbedtls/ssl.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/error.h"
#include "mbedtls/certs.h"
#include <string.h>
#define SERVER_PORT "4433"
#define SERVER_NAME "172.27.145.87"
//#define SERVER_PORT "443"
//#define SERVER_NAME "tls.mbed.org"
#define GET_REQUEST "GET / HTTP/1.0\r\n\r\n"
#define DEBUG_LEVEL 1
static void my_debug( void *ctx, int level,
const char *file, int line,
const char *str )
{
((void) level);
mbedtls_fprintf( (FILE *) ctx, "%s:%04d: %s", file, line, str );
fflush( (FILE *) ctx );
}
int ssl_client1( void )
{
int ret = 1, len;
int exit_code = MBEDTLS_EXIT_FAILURE;
mbedtls_net_context server_fd;
uint32_t flags;
unsigned char buf[1024];
const char *pers = "ssl_client1";
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl;
mbedtls_ssl_config conf;
mbedtls_x509_crt cacert;
#if defined(MBEDTLS_DEBUG_C)
mbedtls_debug_set_threshold( DEBUG_LEVEL );
#endif
/*
* 0. Initialize the RNG and the session data
*/
mbedtls_net_init( &server_fd );
mbedtls_ssl_init( &ssl );
mbedtls_ssl_config_init( &conf );
mbedtls_x509_crt_init( &cacert );
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_printf( "\n . Seeding the random number generator..." );
fflush( stdout );
mbedtls_entropy_init( &entropy );
if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
(const unsigned char *) pers,
strlen( pers ) ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d\n", ret );
goto exit;
}
mbedtls_printf( " ok\n" );
/*
* 0. Initialize certificates
*/
mbedtls_printf( " . Loading the CA root certificate ..." );
fflush( stdout );
ret = mbedtls_x509_crt_parse( &cacert, (const unsigned char *) mbedtls_test_cas_pem,
mbedtls_test_cas_pem_len );
if( ret < 0 )
{
mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse returned -0x%x\n\n", (unsigned int) -ret );
goto exit;
}
mbedtls_printf( " ok (%d skipped)\n", ret );
/*
* 1. Start the connection
*/
mbedtls_printf( " . Connecting to tcp/%s/%s...", SERVER_NAME, SERVER_PORT );
fflush( stdout );
if( ( ret = mbedtls_net_connect( &server_fd, SERVER_NAME,
SERVER_PORT, MBEDTLS_NET_PROTO_TCP ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_net_connect returned %d\n\n", ret );
goto exit;
}
mbedtls_printf( " ok\n" );
/*
* 2. Setup stuff
*/
mbedtls_printf( " . Setting up the SSL/TLS structure..." );
fflush( stdout );
if( ( ret = mbedtls_ssl_config_defaults( &conf,
MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_config_defaults returned %d\n\n", ret );
goto exit;
}
mbedtls_printf( " ok\n" );
/* OPTIONAL is not optimal for security,
* but makes interop easier in this simplified example */
mbedtls_ssl_conf_authmode( &conf, MBEDTLS_SSL_VERIFY_OPTIONAL );
mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL );
mbedtls_ssl_conf_rng( &conf, mbedtls_ctr_drbg_random, &ctr_drbg );
mbedtls_ssl_conf_dbg( &conf, my_debug, stdout );
if( ( ret = mbedtls_ssl_setup( &ssl, &conf ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret );
goto exit;
}
if( ( ret = mbedtls_ssl_set_hostname( &ssl, SERVER_NAME ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_set_hostname returned %d\n\n", ret );
goto exit;
}
mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL );
/*
* 4. Handshake
*/
mbedtls_printf( " . Performing the SSL/TLS handshake..." );
fflush( stdout );
while( ( ret = mbedtls_ssl_handshake( &ssl ) ) != 0 )
{
if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", (unsigned int) -ret );
goto exit;
}
}
mbedtls_printf( " ok\n" );
/*
* 5. Verify the server certificate
*/
mbedtls_printf( " . Verifying peer X.509 certificate..." );
/* In real life, we probably want to bail out when ret != 0 */
if( ( flags = mbedtls_ssl_get_verify_result( &ssl ) ) != 0 )
{
char vrfy_buf[512];
mbedtls_printf( " failed\n" );
mbedtls_x509_crt_verify_info( vrfy_buf, sizeof( vrfy_buf ), " ! ", flags );
mbedtls_printf( "%s\n", vrfy_buf );
}
else
mbedtls_printf( " ok\n" );
/*
* 3. Write the GET request
*/
mbedtls_printf( " > Write to server:" );
fflush( stdout );
len = sprintf( (char *) buf, GET_REQUEST );
while( ( ret = mbedtls_ssl_write( &ssl, buf, len ) ) <= 0 )
{
if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_write returned %d\n\n", ret );
goto exit;
}
}
len = ret;
mbedtls_printf( " %d bytes written\n\n%s", len, (char *) buf );
/*
* 7. Read the HTTP response
*/
mbedtls_printf( " < Read from server:" );
fflush( stdout );
do
{
len = sizeof( buf ) - 1;
memset( buf, 0, sizeof( buf ) );
ret = mbedtls_ssl_read( &ssl, buf, len );
if( ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE )
continue;
if( ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY )
break;
if( ret < 0 )
{
mbedtls_printf( "failed\n ! mbedtls_ssl_read returned %d\n\n", ret );
break;
}
if( ret == 0 )
{
mbedtls_printf( "\n\nEOF\n\n" );
break;
}
len = ret;
mbedtls_printf( " %d bytes read\n\n%s", len, (char *) buf );
}
while( 1 );
mbedtls_ssl_close_notify( &ssl );
exit_code = MBEDTLS_EXIT_SUCCESS;
exit:
#ifdef MBEDTLS_ERROR_C
if( exit_code != MBEDTLS_EXIT_SUCCESS )
{
char error_buf[100];
mbedtls_strerror( ret, error_buf, 100 );
mbedtls_printf("Last error was: %d - %s\n\n", ret, error_buf );
}
#endif
mbedtls_net_free( &server_fd );
mbedtls_x509_crt_free( &cacert );
mbedtls_ssl_free( &ssl );
mbedtls_ssl_config_free( &conf );
mbedtls_ctr_drbg_free( &ctr_drbg );
mbedtls_entropy_free( &entropy );
#if defined(_WIN32)
mbedtls_printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
mbedtls_exit( exit_code );
}
#endif /* MBEDTLS_BIGNUM_C && MBEDTLS_ENTROPY_C && MBEDTLS_SSL_TLS_C &&
MBEDTLS_SSL_CLI_C && MBEDTLS_NET_C && MBEDTLS_RSA_C &&
MBEDTLS_CERTS_C && MBEDTLS_PEM_PARSE_C && MBEDTLS_CTR_DRBG_C &&
MBEDTLS_X509_CRT_PARSE_C */
FROM debian:buster
LABEL maintainer="shw2662@khu.ac.kr"
RUN apt-get update && apt-get install -y \
nginx \
openssl \
vim \
php-fpm \
mariadb-server \
php-mysql \
php-mbstring \
wget \
php \
gcc \
libssl-dev \
netstat
COPY ./srcs/default ./tmp/
COPY ./srcs/wordpress-5.6.2.tar.gz ./tmp/
COPY ./srcs/wp-config.php ./tmp/
COPY ./srcs/phpMyAdmin-4.9.7-all-languages.tar.gz ./tmp/
COPY ./srcs/config.inc.php ./tmp/
COPY ./srcs/run.sh ./
COPY ./srcs/input.php ./tmp/
COPY ./srcs/process.php ./tmp/
COPY ./srcs/highcharts.php ./tmp/
COPY ./srcs/socket.php ./tmp/
COPY ./srcs/tcp.h ./home/
COPY ./srcs/tcps.s ./home/
EXPOSE 80 443 2351
CMD bash run.sh
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in documentation in the doc/ folder
* or at <https://docs.phpmyadmin.net/>.
*
* @package PhpMyAdmin
*/
/**
* This is needed for cookie based authentication to encrypt password in
* cookie. Needs to be 32 chars long.
*/
$cfg['blowfish_secret'] = '0k}CJ:h,X,mt0Dp.,IAPww,0.6gSor,B'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/**
* Servers configuration
*/
$i = 0;
/**
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
/**
* phpMyAdmin configuration storage settings.
*/
/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
/**
* End of servers configuration
*/
/**
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
/**
* Whether to display icons or text or both icons and text in table row
* action segment. Value can be either of 'icons', 'text' or 'both'.
* default = 'both'
*/
//$cfg['RowActionType'] = 'icons';
/**
* Defines whether a user should be displayed a "show all (records)"
* button in browse mode or not.
* default = false
*/
//$cfg['ShowAll'] = true;
/**
* Number of rows displayed when browsing a result set. If the result
* set contains more rows, "Previous" and "Next".
* Possible values: 25, 50, 100, 250, 500
* default = 25
*/
//$cfg['MaxRows'] = 50;
/**
* Disallow editing of binary fields
* valid values are:
* false allow editing
* 'blob' allow editing except for BLOB fields
* 'noblob' disallow editing except for BLOB fields
* 'all' disallow editing
* default = 'blob'
*/
//$cfg['ProtectBinary'] = false;
/**
* Default language to use, if not browser-defined or user-defined
* (you find all languages in the locale folder)
* uncomment the desired line:
* default = 'en'
*/
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';
/**
* How many columns should be used for table display of a database?
* (a value larger than 1 results in some information being hidden)
* default = 1
*/
//$cfg['PropertiesNumColumns'] = 2;
/**
* Set to true if you want DB-based query history.If false, this utilizes
* JS-routines to display query history (lost by window close)
*
* This requires configuration storage enabled, see above.
* default = false
*/
//$cfg['QueryHistoryDB'] = true;
/**
* When using DB-based query history, how many entries should be kept?
* default = 25
*/
//$cfg['QueryHistoryMax'] = 100;
/**
* Whether or not to query the user before sending the error report to
* the phpMyAdmin team when a JavaScript error occurs
*
* Available options
* ('ask' | 'always' | 'never')
* default = 'ask'
*/
//$cfg['SendErrorReports'] = 'always';
/**
* You can find more configuration options in the documentation
* in the doc/ folder or at <https://docs.phpmyadmin.net/>.
*/
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80;
listen [::]:80;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html input.php;
server_name ft_server80;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# autoindex on;
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
ssl on;
ssl_certificate /etc/ssl/certs/localhost.dev.crt;
ssl_certificate_key /etc/ssl/private/localhost.dev.key;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name ft_server;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
autoindex on;
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
<?php
$mysql_host = 'localhost';
$mysql_user = 'haseo';
$mysql_password = 'haseo';
$mysql_db = 'M2351';
// DB 접속
$conn = mysqli_connect($mysql_host, $mysql_user, $mysql_password, $mysql_db);
// charset 설정, 설정하지 않으면 기본 mysql 설정으로 됨, 대체적으로 euc-kr를 많이 사용
//mysql_query("set names utf8");
// $sql="
// select * from (
// SELECT DATE_FORMAT( regday, '%m-%d %HH' ) mdh , COUNT( * ) cnt, SUM( temperature ) , round(SUM( temperature ) / COUNT( * ),2) atemper
// FROM `temperature`
// GROUP BY DATE_FORMAT( regday, '%Y%m%d%H' )
// order by regday desc
// limit 12
// ) t_a
// order by t_a.mdh
// ";
//echo $sql;
//$sql = "SELECT * FROM pulseTable";
$sql = "SELECT * FROM
(SELECT * FROM pulseTable ORDER BY date DESC LIMIT 30) A ORDER BY A.date ASC";
//echo $sql;
$result = mysqli_query($conn, $sql);
//echo $result;
$str_date="";
$str_heartrate="";
while ($row = mysqli_fetch_assoc($result))
{
$str_date .="'".$row['date']."',";
$str_heartrate .="".$row['pulse'].",";
}
$str_date= substr($str_date,0,-1);
$str_heartrate= substr($str_heartrate,0,-1);
//$str_date= substr($str_date,0,-1);
//$str_heartrate= substr($str_heartrate,0,-1);
//echo $str_date."</br>";
//echo $str_heartrate."</br>";
mysqli_close($conn);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Heart Rate Monitoring</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style type="text/css">
${demo.css}
</style>
<script type="text/javascript">
$(function () {
$('#container').highcharts({
chart: {
type: 'line',
events: {
load: function() {
// set up the updating of the chart each second
var series = this.series[0];
setInterval(function refresh(){
window.location.reload();
}, 3000);
}
}
},
title: {
text: 'Heart Rate Monitoring'
},
subtitle: {
text: 'Data was obtained from the MAX30102 in NuMaker-PFM-M2351 Secure World'
},
xAxis: {
categories: [<?php echo $str_date?>]
},
yAxis: {
title: {
text: 'Heart Rate (bpm)'
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: true,
color: '#FF0000'
}
},
series: [{
name: 'Heart Rate',
data: [<?php echo $str_heartrate?>]
}
]
});
});
</script>
</head>
<body>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<form action="process.php" method="get">
<p>Pulse : <input type="text" name="pulse"></p>
<p>pubKey1 : <input type="text" name="pubKey1"></p>
<p>pubKey2 : <input type="text" name="pubKey2"></p>
<p>signatureR : <input type="text" name="signatureR"></p>
<p>signatureS : <input type="text" name="signatureS"></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
<?php
header("Content-Type: text/html; charset=UTF-8");
$KEY_128 = '0000000000000000';
$IV_128 = '0000000000000000';
echo "[pubKey of Device]<br/>";
$pubKey1 = $_GET['pubKey1'];
echo "pubKey1 = $pubKey1<br/>";
$pubKey2 = $_GET['pubKey2'];
echo "pubKey2 = $pubKey2<br/><br/>";
echo "[Encrypted digitally signed data]<br/>";
$pulse = $_GET['pulse'];
echo "pulse = $pulse<br/>";
//$pubKey1 = $_GET['pubKey1'];
//echo "pubKey1 = $pubKey1<br/>";
//$pubKey2 = $_GET['pubKey2'];
//echo "pubKey2 = $pubKey2<br/>";
$signatureR = $_GET['signatureR'];
echo "signatureR = $signatureR<br/>";
$signatureS = $_GET['signatureS'];
echo "signatureS = $signatureS<br/>";
echo "<br/>[Decrypted digitally signed data]<br/>";
$pulse = hex2bin($pulse);
$pulse = openssl_decrypt($pulse, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
//echo "pulse = $pulse<br/>";
$pulse = bin2hex($pulse);
echo "pulse = $pulse<br/>";
$pubKey1 = openssl_decrypt($pubKey1, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
$pubKey1 = bin2hex($pubKey1);
$pubKey1 = substr($pubKey1, 1, strlen($pubKey1) / 2);
//echo "pubKey1 = $pubKey1<br/>";
$pubKey2 = openssl_decrypt($pubKey2, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
$pubKey2 = bin2hex($pubKey2);
$pubKey2 = substr($pubKey2, 1, strlen($pubKey2) / 2);
//echo "pubKey2 = $pubKey2<br/>";
$signatureR = openssl_decrypt($signatureR, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
$signatureR = bin2hex($signatureR);
$signatureR = substr($signatureR, 1, strlen($signatureR) / 2);
echo "signatureR = $signatureR<br/>";
$signatureS = openssl_decrypt($signatureS, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
$signatureS = bin2hex($signatureS);
$signatureS = substr($signatureS, 1, strlen($signatureS) / 2);
echo "signatureS = $signatureS<br/>";
echo "<br/>[Digital signature verification]<br/>";
$hashPulse = sha1($hashPulse);
echo "hashPulse = $hashPulse<br/>";
echo "Verify signature with hashed data<br/>";
$result = openssl_verify($hashPulse, $signatureR, $pubKey1, 'ecdsa-with-SHA1');
// if ($result == 1) {
// echo "Valid<br/>";
// } elseif ($result == 0) {
// echo "Invalid<br/>";
// } else {
// echo "error: ".openssl_error_string();
// }
$host = 'localhost';
$user = 'haseo';
$pw = 'haseo';
$dbName = 'M2351';
$mysqli = new mysqli($host, $user, $pw, $dbName);
if($mysqli){
echo "<br/>[MySQL successfully connected!]<br/>";
echo "Convert binary to decimal<br/>";
$pulse = hexdec($pulse[0].$pulse[1]);
echo "pulse = $pulse<br/>";
$query = "INSERT INTO pulseTable(pulse) VALUES ('$pulse')";
mysqli_query($mysqli,$query);
echo "<br/>[Success insert pulse data to DB Table!!]";
}
else{
echo "MySQL could not be connected";
}
mysqli_close($mysqli);
/*
$encryptedBPM = $_GET['pulse'];
echo 'encryptedBPM : '.$encryptedBPM.'<br/>';
$decryptedBPM = Hex2Char($encryptedBPM);
echo 'decryptedBPM : '.$decryptedBPM.'<br/><br/>';
//echo 'decryptedBPM : '.hex2bin($decryptedBPM).'<br/><br/>';
//$decryptedBPM = Hex2String($decryptedBPM);
// echo 'decryptedBPM : '.$decryptedBPM.'<br/><br/>'
$decryptedBPM = openssl_encrypt($decryptedBPM, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
echo 'decryptedBPM : '.$decryptedBPM.'<br/><br/>';
$teststr = '414243';
echo 'teststr : '.$teststr.'<br/>';
$teststr = Hex2Char($teststr);
echo 'teststr : '.$teststr.'<br/>';
$teststr = openssl_encrypt($teststr, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
echo 'teststr : '.$teststr.'<br/>';
$teststr = openssl_decrypt($teststr, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
echo 'teststr : '.$teststr.'<br/>';
$plain = '=000000000000000';
$plain = openssl_encrypt($plain, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
echo 'plain : '.bin2hex($plain).'<br/>';
echo 'plain : '.$plain.'<br/>';
$plain = openssl_decrypt($plain, 'AES-128-CBC', $KEY_128, OPENSSL_NO_PADDING, $IV_128);
echo 'plain : '.$plain.'<br/>';
function HexStr2Str($string){
$hex='';
for ($i=0; $i < strlen($string); $i+=2){
$hex .= hex2bin(hexdec(($string[$i].$string[$i+1])));
}
return $hex;
}
function HexStr2DecStr($string){
$hex='';
for ($i=0; $i < strlen($string); $i+=2){
$hex .= hexdec(($string[$i].$string[$i+1]));
}
return $hex;
}
function Hex2Char($hex){
$string='';
for ($i=0; $i < strlen($hex); $i+=2){
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
return $string;
}
function HexStr2Hex($str)
{
}
*/
?>
#!/bin/bash
service mysql start
# ssl configuration
openssl req -newkey rsa:4096 \
-days 365 \
-nodes \
-x509 \
-subj "/C=KR/ST=Seoul/O=KHU/OU=CSE/CN=localhost" \
-keyout localhost.dev.key \
-out localhost.dev.crt
mv localhost.dev.key /etc/ssl/private/
mv localhost.dev.crt /etc/ssl/certs/
chmod 600 /etc/ssl/private/localhost.dev.key /etc/ssl/certs/localhost.dev.crt
# Nginx configuration
cp -p ./tmp/default /etc/nginx/sites-available
# Wordpress configuration
tar -xvf ./tmp/wordpress-5.6.2.tar.gz
rm ./tmp/wordpress-5.6.2.tar.gz
mv /wordpress/ /var/www/html
cp ./tmp/wp-config.php /var/www/html/wordpress
# Move PHP files
mv ./tmp/input.php /var/www/html
mv ./tmp/process.php /var/www/html
mv ./tmp/highcharts.php /var/www/html
mv ./tmp/socket.php /var/www/html
# MariaDB configuration
echo "CREATE USER 'haseo'@'localhost' IDENTIFIED BY 'haseo';" \
| mysql -u root --skip-password
echo "CREATE DATABASE wordpress;" \
| mysql -u root --skip-password
echo "GRANT ALL PRIVILEGES ON wordpress.* TO 'haseo'@'localhost' WITH GRANT OPTION;" \
| mysql -u root --skip-password
echo "FLUSH PRIVILEGES" \
| mysql -u root --skip-password
echo "CREATE DATABASE M2351;" \
| mysql -u root --skip-password
echo "GRANT ALL PRIVILEGES ON M2351.* TO 'haseo'@'localhost' WITH GRANT OPTION;" \
| mysql -u root --skip-password
echo "FLUSH PRIVILEGES" \
| mysql -u root --skip-password
# phpMyAdmin configuration
tar -xvf ./tmp/phpMyAdmin-4.9.7-all-languages.tar.gz
rm ./tmp/phpMyAdmin-4.9.7-all-languages.tar.gz
mv phpMyAdmin-4.9.7-all-languages phpmyadmin
mv phpmyadmin /var/www/html/
cp ./tmp/config.inc.php /var/www/html/phpmyadmin/
mysql < /var/www/html/phpmyadmin/sql/create_tables.sql
# permission setting
chown -R www-data:www-data /var/www/*
find /var/www -type d -exec chmod 755 {} \;
find /var/www -type f -exec chmod 644 {} \;
# service start
service nginx start
service mysql restart
service php7.3-fpm start
service php7.3-fpm status
bash
#!/usr/local/bin/php -q
<?php
define("_IP", "127.0.0.1");
define("_PORT", "2351");
$sSock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sSock, _IP, _PORT);
socket_listen($sSock);
while($cSock = socket_accept($sSock))
{
socket_getpeername($cSock, $addr, $port);
echo "SERVER >> client connected $addr:$port \n";
$date = date("Y/m/d H:i:s");
socket_write($cSock, $date);
socket_close($cSock);
echo "SERVER >> client Close.\n";
}
?>
#define SERV_TCP_PORT (2351)
#define SERV_HOST_ADDR "127.0.0.1"
typedef struct {
char data[64];
}
MsgType;
// TCP sockek example
// TCP server
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include "tcp.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int Sockfd;
void CloseServer()
{
close(Sockfd);
printf("\nTCP Server exit.....\n");
exit(0);
}
void main(int argc, char *argv[])
{
int newSockfd, cliAddrLen, n;
struct sockaddr_in cliAddr, servAddr; // PF_INET, IPv4
MsgType msg;
// register a signal handler
signal(SIGINT, CloseServer);
// SOCKET
// create a socket for TCP
if ((Sockfd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
{
perror("socket");
exit(1);
}
// initailize a servAddr
bzero((char *)&servAddr, sizeof(servAddr));
servAddr.sin_family = PF_INET; //protocol family
servAddr.sin_addr.s_addr = htonl(INADDR_ANY); // network byte ordered 32-bit address
// receive any IP addresses
servAddr.sin_port = htons(SERV_TCP_PORT);
// BIND
if (bind(Sockfd, (struct sockaddr *)&servAddr, sizeof(servAddr)) < 0)
{
perror("bind");
exit(1);
}
// LISTEN
listen(Sockfd, 5);
printf("TCP Server started.....\n");
// kernel allocate a cliAddr ifself
cliAddrLen = sizeof(cliAddr);
while (1)
{
memset(&msg, 0, sizeof(MsgType));
// ACCEPT
newSockfd = accept(Sockfd, (struct sockaddr *)&cliAddr, &cliAddrLen);
if (newSockfd < 0)
{
perror("accept");
exit(1);
}
printf("Accept a new socket\n");
// READ
if ((n = read(newSockfd, (char *)&msg, sizeof(msg))) < 0)
{
perror("read");
exit(1);
}
printf("Received message from M2351: %s\n", msg.data);
// WRITE
//sprintf(msg.data, "This is a reply from %d.", getpid());
char aesKey[20] = {0x61, 0x62, 0x63, 0x64, 0x65,
0x66, 0x67, 0x68, 0x69, 0x6a,
0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74};
strcpy(msg.data, aesKey);
printf("aesKey : %s\n", msg.data);
if (write(newSockfd, (char *)&msg, sizeof(msg)) < 0)
{
perror("write");
exit(1);
}
printf("Replied.\n");
usleep(5000);
// CLOSE
close(newSockfd);
}
}
This file is too large to display.
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'haseo' );
/** MySQL database password */
define( 'DB_PASSWORD', 'haseo' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';