From 154841a0836a81f96f3de7e107ebd860f46e25a7 Mon Sep 17 00:00:00 2001 From: Lealem Amedie Date: Mon, 29 Jan 2024 12:50:00 -0700 Subject: [PATCH] MICROCHIP PIC24 support and example project --- .gitignore | 6 + IDE/MPLABX16/README.md | 62 +++ IDE/MPLABX16/include.am | 8 + IDE/MPLABX16/main.c | 39 ++ IDE/MPLABX16/user_settings.h | 414 ++++++++++++++++++ IDE/MPLABX16/wolfcrypt_test.X/Makefile | 113 +++++ .../nbproject/configurations.xml | 285 ++++++++++++ .../wolfcrypt_test.X/nbproject/include.am | 8 + .../nbproject/private/configurations.xml | 25 ++ .../nbproject/private/private.xml | 7 + .../wolfcrypt_test.X/nbproject/project.xml | 33 ++ IDE/MPLABX16/wolfssl.X/Makefile | 113 +++++ .../wolfssl.X/nbproject/configurations.xml | 290 ++++++++++++ IDE/MPLABX16/wolfssl.X/nbproject/include.am | 7 + IDE/MPLABX16/wolfssl.X/nbproject/project.xml | 34 ++ IDE/include.am | 3 + wolfssl/wolfcrypt/types.h | 6 +- 17 files changed, 1451 insertions(+), 2 deletions(-) create mode 100644 IDE/MPLABX16/README.md create mode 100644 IDE/MPLABX16/include.am create mode 100644 IDE/MPLABX16/main.c create mode 100644 IDE/MPLABX16/user_settings.h create mode 100644 IDE/MPLABX16/wolfcrypt_test.X/Makefile create mode 100755 IDE/MPLABX16/wolfcrypt_test.X/nbproject/configurations.xml create mode 100644 IDE/MPLABX16/wolfcrypt_test.X/nbproject/include.am create mode 100644 IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/configurations.xml create mode 100644 IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/private.xml create mode 100755 IDE/MPLABX16/wolfcrypt_test.X/nbproject/project.xml create mode 100644 IDE/MPLABX16/wolfssl.X/Makefile create mode 100644 IDE/MPLABX16/wolfssl.X/nbproject/configurations.xml create mode 100644 IDE/MPLABX16/wolfssl.X/nbproject/include.am create mode 100644 IDE/MPLABX16/wolfssl.X/nbproject/project.xml diff --git a/.gitignore b/.gitignore index 22dc341889..0ff9ef0220 100644 --- a/.gitignore +++ b/.gitignore @@ -406,6 +406,12 @@ user_settings_asm.h /IDE/Espressif/**/sdkconfig /IDE/Espressif/**/sdkconfig.old +# MPLAB +/IDE/MPLABX16/wolfssl.X/dist/default/ +/IDE/MPLABX16/wolfssl.X/.generated_files +/IDE/MPLABX16/wolfcrypt_test.X/dist/default/ +/IDE/MPLABX16/wolfcrypt_test.X/.generated_files + # auto-created CMake backups **/CMakeLists.txt.old diff --git a/IDE/MPLABX16/README.md b/IDE/MPLABX16/README.md new file mode 100644 index 0000000000..a35b6dec27 --- /dev/null +++ b/IDE/MPLABX16/README.md @@ -0,0 +1,62 @@ +# wolfSSL MPLAB X Project Files for XC16 + +This directory contains project files for the Microchip MPLAB X IDE. These +projects have been set up to use the Microchip PIC24 Starter Kit +and the Microchip XC16 compiler. + +In order to generate the necessary auto-generated MPLAB X files, make sure +to import the wolfssl.X project into your MPLAB X workspace before trying to +build the wolfCrypt test. This will correctly set up the respective project's +Makefiles. + +## Included Project Files + +### wolfSSL library (wolfssl.X) + +This project builds a static wolfSSL library. The settings for this project are in `user_settings.h`: +``` +/IDE/MPLABX16/user_settings.h +``` + +After this project has been built, the compiled library will be located at: +``` +/IDE/MPLABX16/wolfssl.X/dist/default/production/wolfssl.X.a +``` + +### wolfCrypt Test App (wolfcrypt_test.X) + +This project tests the wolfCrypt cryptography modules. It is generally a good +idea to run this first on an embedded system after compiling wolfSSL in order +to verify all underlying crypto is working correctly. This project depends on +files generated by Microchip's MCC tool to view the UART output. Follow the +steps below to generate that code. + +## Generating MCC UART code + +1. Open the MPLAB Code Configurator application. + +2. Set the Project path to the wolfSSL/IDE/MPLABX16 and enter your PIC device +into the interface. + +3. Select MCC Clasic as the content type and click `Finish`. + +4. Under the Device Resources section, find the UART entry and add the UART1 +peripheral. + +5. Note the UART settings and check the `Enable UART Interrupts` and +`Redirect Printf to UART` boxes. + +6. Click the `Generate` button. + + +**Note** : If using an older version of `xc16`, you may have to add the +following to `user_settings.h`. +``` +#define WOLFSSL_HAVE_MIN +#define WOLFSSL_HAVE_MAX +``` + +## Support + +Please send questions or comments to support@wolfssl.com + diff --git a/IDE/MPLABX16/include.am b/IDE/MPLABX16/include.am new file mode 100644 index 0000000000..d7f855b1e3 --- /dev/null +++ b/IDE/MPLABX16/include.am @@ -0,0 +1,8 @@ +# vim:ft=automake +# All paths should be given relative to the root +# + +EXTRA_DIST += \ + IDE/MPLABX16/README.md \ + IDE/MPLABX16/main.c \ + IDE/MPLABX16/user_settings.h diff --git a/IDE/MPLABX16/main.c b/IDE/MPLABX16/main.c new file mode 100644 index 0000000000..fadad81d52 --- /dev/null +++ b/IDE/MPLABX16/main.c @@ -0,0 +1,39 @@ +/* main.c + * + * Copyright (C) 2006-2024 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#include + +#include +#include + +#include + +#include "xc.h" +#include "mcc_generated_files/mcc.h" + +int main(void) { + SYSTEM_Initialize(); + + wolfcrypt_test(NULL); + + return 0; +} + diff --git a/IDE/MPLABX16/user_settings.h b/IDE/MPLABX16/user_settings.h new file mode 100644 index 0000000000..d4754db89f --- /dev/null +++ b/IDE/MPLABX16/user_settings.h @@ -0,0 +1,414 @@ +/* Example custom user settings for wolfSSL */ + +#ifndef WOLFSSL_USER_SETTINGS_H +#define WOLFSSL_USER_SETTINGS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* ------------------------------------------------------------------------- */ +/* Platform */ +/* ------------------------------------------------------------------------- */ +#undef WOLFSSL_GENERAL_ALIGNMENT +#define WOLFSSL_GENERAL_ALIGNMENT 4 + +#undef SINGLE_THREADED +#define SINGLE_THREADED + +#undef WOLFSSL_SMALL_STACK +#define WOLFSSL_SMALL_STACK + +#define MICROCHIP_PIC24 + +/* Define for older versions of xc16 */ +#if 0 + #define WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MAX +#endif + +#ifdef MICROCHIP_PIC24 + #define SIZEOF_LONG_LONG 8 + #define SIZEOF_LONG 4 + #define SINGLE_THREADED + #define WOLFSSL_USER_IO + #define NO_WRITEV + #define NO_DEV_RANDOM + #define NO_FILESYSTEM + #define BENCH_EMBEDDED + #define WC_16BIT_CPU + #define WORD64_AVAILABLE + #define WOLFSSL_GENSEED_FORTEST +#endif + +/* ------------------------------------------------------------------------- */ +/* Math Configuration */ +/* ------------------------------------------------------------------------- */ +#if 1 + #undef USE_FAST_MATH + #define USE_FAST_MATH + + #undef FP_MAX_BITS + #define FP_MAX_BITS 2048 +#else + #define WOLFSSL_SP_MATH + #define WOLFSSL_SP_SMALL + #define WOLFSSL_SP_MATH_ALL + #define SP_INT_BITS 256 +#endif + + +#ifdef USE_FAST_MATH + #undef TFM_TIMING_RESISTANT + #define TFM_TIMING_RESISTANT + + /* Optimizations */ + //#define TFM_MIPS +#endif + +/* ------------------------------------------------------------------------- */ +/* Crypto */ +/* ------------------------------------------------------------------------- */ +/* ECC */ +#if 1 + #undef HAVE_ECC + #define HAVE_ECC + + /* Manually define enabled curves */ + #undef ECC_USER_CURVES + #define ECC_USER_CURVES + + /* Reduces heap usage, but slower */ + #undef ECC_TIMING_RESISTANT + #define ECC_TIMING_RESISTANT + + //#define HAVE_ECC192 + //#define HAVE_ECC224 + //#define HAVE_ECC384 + /* Fixed point cache (speeds repeated operations against same private key) */ +#if 1 + #undef FP_ECC + #define FP_ECC + #ifdef FP_ECC + /* Bits / Entries */ + #undef FP_ENTRIES + #define FP_ENTRIES 2 + #undef FP_LUT + #define FP_LUT 4 + #endif + /* Optional ECC calculation method */ + /* Note: doubles heap usage, but slightly faster */ + #undef ECC_SHAMIR + #define ECC_SHAMIR + + + #ifdef USE_FAST_MATH + /* use reduced size math buffers for ecc points */ + #undef ALT_ECC_SIZE + #define ALT_ECC_SIZE + + /* Enable TFM optimizations for ECC */ + #if defined(HAVE_ECC192) || defined(HAVE_ALL_CURVES) + #define TFM_ECC192 + #endif + #if defined(HAVE_ECC224) || defined(HAVE_ALL_CURVES) + #define TFM_ECC224 + #endif + #if !defined(NO_ECC256) || defined(HAVE_ALL_CURVES) + #define TFM_ECC256 + #endif + #if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES) + #define TFM_ECC384 + #endif + #if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES) + #define TFM_ECC521 + #endif + #endif +#endif +#endif + +/* RSA */ +#undef NO_RSA +#if 0 + /* half as much memory but twice as slow */ + #undef RSA_LOW_MEM +#define RSA_LOW_MEM + + #undef WC_RSA_PSS + #define WC_RSA_PSS + + /* timing resistance */ + #undef WC_RSA_BLINDING + #define WC_RSA_BLINDING +#else + #define NO_RSA +#endif + +/* AES */ +#undef NO_AES +#if 1 + #undef HAVE_AES_DECRYPT + #define HAVE_AES_DECRYPT + + #undef HAVE_AESGCM + #define HAVE_AESGCM + + /* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */ + #undef GCM_SMALL + #define GCM_SMALL + + /* #undef HAVE_AESCCM + #define HAVE_AESCCM */ + + /* #undef WOLFSSL_AES_DIRECT + #define WOLFSSL_AES_DIRECT */ + + #undef NO_AES_CBC + #define NO_AES_CBC +#else + #define NO_AES +#endif + +/* DES3 */ +#undef NO_DES3 +#if 0 + #undef WOLFSSL_DES_ECB + #define WOLFSSL_DES_ECB +#else + #define NO_DES3 +#endif + + +/* ChaCha20 / Poly1305 */ +#undef HAVE_CHACHA +#undef HAVE_POLY1305 +#if 0 + #define HAVE_CHACHA + #define HAVE_POLY1305 + + /* Needed for Poly1305 */ + #undef HAVE_ONE_TIME_AUTH + #define HAVE_ONE_TIME_AUTH +#endif + +/* Ed25519 / Curve25519 */ +#undef HAVE_CURVE25519 +#undef HAVE_ED25519 +#if 0 + #define HAVE_CURVE25519 + #define HAVE_ED25519 + + /* Optionally use small math (less flash usage, but much slower) */ + #if 0 + #define CURVED25519_SMALL + #endif +#endif + + +/* ------------------------------------------------------------------------- */ +/* Hashing */ +/* ------------------------------------------------------------------------- */ +/* Sha */ +#undef NO_SHA +#if 0 + /* 1k smaller, but 25% slower */ + #define USE_SLOW_SHA +#else + #define NO_SHA +#endif + +/* Sha256 */ +#undef NO_SHA256 +#if 1 +#else + #define NO_SHA256 +#endif + +/* Sha512 */ +#undef WOLFSSL_SHA512 +#if 0 + #define WOLFSSL_SHA512 + + /* Sha384 */ + #undef WOLFSSL_SHA384 + #if 0 + #define WOLFSSL_SHA384 + #endif + + /* over twice as small, but 50% slower */ + #define USE_SLOW_SHA2 +#endif + + +/* ------------------------------------------------------------------------- */ +/* Benchmark / Test */ +/* ------------------------------------------------------------------------- */ +/* Use reduced benchmark / test sizes */ +#undef BENCH_EMBEDDED +#define BENCH_EMBEDDED + +//#undef USE_CERT_BUFFERS_2048 +//#define USE_CERT_BUFFERS_2048 + +#undef USE_CERT_BUFFERS_1024 +#define USE_CERT_BUFFERS_1024 + +#undef USE_CERT_BUFFERS_256 +#define USE_CERT_BUFFERS_256 + + +/* ------------------------------------------------------------------------- */ +/* Time */ +/* ------------------------------------------------------------------------- */ +#if 0 + /* Override Current Time */ + /* Allows custom "custom_time()" function to be used for benchmark */ + #define WOLFSSL_USER_CURRTIME + #define USER_TICKS + extern unsigned long custom_time(unsigned long* timer); + #define XTIME custom_time +#else + //#warning Time/RTC disabled + #undef NO_ASN_TIME + #define NO_ASN_TIME +#endif + +/* ------------------------------------------------------------------------- */ +/* Debugging */ +/* ------------------------------------------------------------------------- */ +#undef DEBUG_WOLFSSL + +#if 0 + #define DEBUG_WOLFSSL + #define WOLFSSL_DEBUG_TLS + /* Use this to measure / print heap usage */ + #undef USE_WOLFSSL_MEMORY + #define USE_WOLFSSL_MEMORY + #undef WOLFSSL_TRACK_MEMORY + #define WOLFSSL_TRACK_MEMORY +#else + #undef NO_WOLFSSL_MEMORY + #define NO_WOLFSSL_MEMORY +#endif + +/* ------------------------------------------------------------------------- */ +/* Misc */ +/* ------------------------------------------------------------------------- */ +#define WOLFSSL_ASN_TEMPLATE +#define NO_ERROR_STRINGS +#define NO_LARGE_HASH_TEST +#define NO_PKCS12 +#define NO_PKCS8 +#define WOLFSSL_NO_PEM + + +/* ------------------------------------------------------------------------- */ +/* Enable Features */ +/* ------------------------------------------------------------------------- */ +#undef KEEP_PEER_CERT +#define KEEP_PEER_CERT + +#undef HAVE_COMP_KEY +#define HAVE_COMP_KEY + +#undef WOLFSSL_TLS13 +#define WOLFSSL_TLS13 + +#undef HAVE_HKDF +#define HAVE_HKDF + +#undef HAVE_TLS_EXTENSIONS +#define HAVE_TLS_EXTENSIONS + +#ifdef HAVE_ECC +#undef HAVE_SUPPORTED_CURVES +#define HAVE_SUPPORTED_CURVES +#endif + +#undef WOLFSSL_BASE64_ENCODE +#define WOLFSSL_BASE64_ENCODE + +/* TLS Session Cache */ +#if 0 + #define SMALL_SESSION_CACHE +#else + #define NO_SESSION_CACHE +#endif + + +/* ------------------------------------------------------------------------- */ +/* Disable Features */ +/* ------------------------------------------------------------------------- */ +#undef NO_WOLFSSL_SERVER +//#define NO_WOLFSSL_SERVER + +#undef NO_WOLFSSL_CLIENT +#define NO_WOLFSSL_CLIENT + +#undef NO_CRYPT_TEST +//#define NO_CRYPT_TEST + +#undef NO_CRYPT_BENCHMARK +//#define NO_CRYPT_BENCHMARK + +/* In-lining of misc.c functions */ +/* If defined, must include wolfcrypt/src/misc.c in build */ +/* Slower, but about 1k smaller */ +#undef NO_INLINE +#define NO_INLINE + +#undef NO_FILESYSTEM +#define NO_FILESYSTEM + +#undef NO_WRITEV +#define NO_WRITEV + +#undef NO_MAIN_DRIVER +#define NO_MAIN_DRIVER + +#undef NO_DEV_RANDOM +#define NO_DEV_RANDOM + +#undef NO_PSK +#define NO_PSK + +#undef NO_DSA +#define NO_DSA + +#undef NO_DH +#define NO_DH + +#undef NO_RC4 +#define NO_RC4 + +#undef NO_OLD_TLS +#define NO_OLD_TLS + +#undef WOLFSSL_NO_TLS12 +#define WOLFSSL_NO_TLS12 + +#undef NO_PSK +//#define NO_PSK +#define WOLFSSL_STATIC_PSK + +#undef NO_MD4 +#define NO_MD4 + +#undef NO_PWDBASED +#define NO_PWDBASED + +#undef NO_MD5 +#define NO_MD5 + +#undef NO_DES3 +#define NO_DES3 + +#undef NO_CODING +//#define NO_CODING + + +#ifdef __cplusplus +} +#endif + +#endif /* WOLFSSL_USER_SETTINGS_H */ diff --git a/IDE/MPLABX16/wolfcrypt_test.X/Makefile b/IDE/MPLABX16/wolfcrypt_test.X/Makefile new file mode 100644 index 0000000000..fca8e2ccd1 --- /dev/null +++ b/IDE/MPLABX16/wolfcrypt_test.X/Makefile @@ -0,0 +1,113 @@ +# +# There exist several targets which are by default empty and which can be +# used for execution of your targets. These targets are usually executed +# before and after some main targets. They are: +# +# .build-pre: called before 'build' target +# .build-post: called after 'build' target +# .clean-pre: called before 'clean' target +# .clean-post: called after 'clean' target +# .clobber-pre: called before 'clobber' target +# .clobber-post: called after 'clobber' target +# .all-pre: called before 'all' target +# .all-post: called after 'all' target +# .help-pre: called before 'help' target +# .help-post: called after 'help' target +# +# Targets beginning with '.' are not intended to be called on their own. +# +# Main targets can be executed directly, and they are: +# +# build build a specific configuration +# clean remove built files from a configuration +# clobber remove all built files +# all build all configurations +# help print help mesage +# +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and +# .help-impl are implemented in nbproject/makefile-impl.mk. +# +# Available make variables: +# +# CND_BASEDIR base directory for relative paths +# CND_DISTDIR default top distribution directory (build artifacts) +# CND_BUILDDIR default top build directory (object files, ...) +# CONF name of current configuration +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) +# CND_PACKAGE_NAME_${CONF} name of package (current configuration) +# CND_PACKAGE_PATH_${CONF} path to package (current configuration) +# +# NOCDDL + + +# Environment +MKDIR=mkdir +CP=cp +CCADMIN=CCadmin +RANLIB=ranlib + + +# build +build: .build-post + +.build-pre: +# Add your pre 'build' code here... + +.build-post: .build-impl +# Add your post 'build' code here... + + +# clean +clean: .clean-post + +.clean-pre: +# Add your pre 'clean' code here... +# WARNING: the IDE does not call this target since it takes a long time to +# simply run make. Instead, the IDE removes the configuration directories +# under build and dist directly without calling make. +# This target is left here so people can do a clean when running a clean +# outside the IDE. + +.clean-post: .clean-impl +# Add your post 'clean' code here... + + +# clobber +clobber: .clobber-post + +.clobber-pre: +# Add your pre 'clobber' code here... + +.clobber-post: .clobber-impl +# Add your post 'clobber' code here... + + +# all +all: .all-post + +.all-pre: +# Add your pre 'all' code here... + +.all-post: .all-impl +# Add your post 'all' code here... + + +# help +help: .help-post + +.help-pre: +# Add your pre 'help' code here... + +.help-post: .help-impl +# Add your post 'help' code here... + + + +# include project implementation makefile +include nbproject/Makefile-impl.mk + +# include project make variables +include nbproject/Makefile-variables.mk diff --git a/IDE/MPLABX16/wolfcrypt_test.X/nbproject/configurations.xml b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/configurations.xml new file mode 100755 index 0000000000..fe95c871f1 --- /dev/null +++ b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/configurations.xml @@ -0,0 +1,285 @@ + + + + + ../user_settings.h + + + + + + ../mcc_generated_files/clock.c + ../mcc_generated_files/interrupt_manager.c + ../mcc_generated_files/mcc.c + ../mcc_generated_files/pin_manager.c + ../mcc_generated_files/system.c + ../mcc_generated_files/traps.c + ../mcc_generated_files/uart1.c + + ../../../wolfcrypt/test/test.c + ../main.c + + + Makefile + + + + .. + ../../wolfcrypt/test + ../../../wolfcrypt/test + + Makefile + + + + localhost + PIC24FJ1024GB610 + + + PKOBSKDEPlatformTool + XC16 + 2.10 + 4 + + + + + + + + + + + + + + + + + + + false + true + + + + + + + false + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/MPLABX16/wolfcrypt_test.X/nbproject/include.am b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/include.am new file mode 100644 index 0000000000..71506b6f89 --- /dev/null +++ b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/include.am @@ -0,0 +1,8 @@ +j vim:ft=automake +# All paths should be given relative to the root +# + +EXTRA_DIST += \ + IDE/MPLABX16/wolfcrypt_test.X/nbproject/configurations.xml \ + IDE/MPLABX16/wolfcrypt_test.X/nbproject/project.xml + diff --git a/IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/configurations.xml b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/configurations.xml new file mode 100644 index 0000000000..ba95e2451f --- /dev/null +++ b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/configurations.xml @@ -0,0 +1,25 @@ + + + Makefile + 0 + + + + /Applications/microchip/xc16/v2.10/bin + + place holder 1 + place holder 2 + + + + + true + 0 + 0 + 0 + + + + + + diff --git a/IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/private.xml b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/private.xml new file mode 100644 index 0000000000..6807a2ba19 --- /dev/null +++ b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/private/private.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/IDE/MPLABX16/wolfcrypt_test.X/nbproject/project.xml b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/project.xml new file mode 100755 index 0000000000..358f3c7743 --- /dev/null +++ b/IDE/MPLABX16/wolfcrypt_test.X/nbproject/project.xml @@ -0,0 +1,33 @@ + + + com.microchip.mplab.nbide.embedded.makeproject + + + wolfcrypt_test + b34c4937-7042-4352-88b1-7717bcdf8aeb + 0 + c + + h + ISO-8859-1 + + + ../wolfssl.X + + + .. + ../../wolfcrypt/test + ../../../wolfcrypt/test + + + + default + 2 + + + + false + + + + diff --git a/IDE/MPLABX16/wolfssl.X/Makefile b/IDE/MPLABX16/wolfssl.X/Makefile new file mode 100644 index 0000000000..fca8e2ccd1 --- /dev/null +++ b/IDE/MPLABX16/wolfssl.X/Makefile @@ -0,0 +1,113 @@ +# +# There exist several targets which are by default empty and which can be +# used for execution of your targets. These targets are usually executed +# before and after some main targets. They are: +# +# .build-pre: called before 'build' target +# .build-post: called after 'build' target +# .clean-pre: called before 'clean' target +# .clean-post: called after 'clean' target +# .clobber-pre: called before 'clobber' target +# .clobber-post: called after 'clobber' target +# .all-pre: called before 'all' target +# .all-post: called after 'all' target +# .help-pre: called before 'help' target +# .help-post: called after 'help' target +# +# Targets beginning with '.' are not intended to be called on their own. +# +# Main targets can be executed directly, and they are: +# +# build build a specific configuration +# clean remove built files from a configuration +# clobber remove all built files +# all build all configurations +# help print help mesage +# +# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and +# .help-impl are implemented in nbproject/makefile-impl.mk. +# +# Available make variables: +# +# CND_BASEDIR base directory for relative paths +# CND_DISTDIR default top distribution directory (build artifacts) +# CND_BUILDDIR default top build directory (object files, ...) +# CONF name of current configuration +# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) +# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) +# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) +# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) +# CND_PACKAGE_NAME_${CONF} name of package (current configuration) +# CND_PACKAGE_PATH_${CONF} path to package (current configuration) +# +# NOCDDL + + +# Environment +MKDIR=mkdir +CP=cp +CCADMIN=CCadmin +RANLIB=ranlib + + +# build +build: .build-post + +.build-pre: +# Add your pre 'build' code here... + +.build-post: .build-impl +# Add your post 'build' code here... + + +# clean +clean: .clean-post + +.clean-pre: +# Add your pre 'clean' code here... +# WARNING: the IDE does not call this target since it takes a long time to +# simply run make. Instead, the IDE removes the configuration directories +# under build and dist directly without calling make. +# This target is left here so people can do a clean when running a clean +# outside the IDE. + +.clean-post: .clean-impl +# Add your post 'clean' code here... + + +# clobber +clobber: .clobber-post + +.clobber-pre: +# Add your pre 'clobber' code here... + +.clobber-post: .clobber-impl +# Add your post 'clobber' code here... + + +# all +all: .all-post + +.all-pre: +# Add your pre 'all' code here... + +.all-post: .all-impl +# Add your post 'all' code here... + + +# help +help: .help-post + +.help-pre: +# Add your pre 'help' code here... + +.help-post: .help-impl +# Add your post 'help' code here... + + + +# include project implementation makefile +include nbproject/Makefile-impl.mk + +# include project make variables +include nbproject/Makefile-variables.mk diff --git a/IDE/MPLABX16/wolfssl.X/nbproject/configurations.xml b/IDE/MPLABX16/wolfssl.X/nbproject/configurations.xml new file mode 100644 index 0000000000..bd423ae2c1 --- /dev/null +++ b/IDE/MPLABX16/wolfssl.X/nbproject/configurations.xml @@ -0,0 +1,290 @@ + + + + + ../user_settings.h + + + + + + ../../../wolfcrypt/src/aes.c + ../../../wolfcrypt/src/arc4.c + ../../../wolfcrypt/src/asm.c + ../../../wolfcrypt/src/asn.c + ../../../wolfcrypt/src/blake2b.c + ../../../wolfcrypt/src/blake2s.c + ../../../wolfcrypt/src/camellia.c + ../../../wolfcrypt/src/chacha.c + ../../../wolfcrypt/src/chacha20_poly1305.c + ../../../wolfcrypt/src/cmac.c + ../../../wolfcrypt/src/coding.c + ../../../wolfcrypt/src/compress.c + ../../../wolfcrypt/src/cpuid.c + ../../../wolfcrypt/src/cryptocb.c + ../../../wolfcrypt/src/curve25519.c + ../../../wolfcrypt/src/curve448.c + ../../../wolfcrypt/src/des3.c + ../../../wolfcrypt/src/dh.c + ../../../wolfcrypt/src/dilithium.c + ../../../wolfcrypt/src/dsa.c + ../../../wolfcrypt/src/ecc.c + ../../../wolfcrypt/src/ecc_fp.c + ../../../wolfcrypt/src/eccsi.c + ../../../wolfcrypt/src/ed25519.c + ../../../wolfcrypt/src/ed448.c + ../../../wolfcrypt/src/error.c + ../../../wolfcrypt/src/evp.c + ../../../wolfcrypt/src/ext_kyber.c + ../../../wolfcrypt/src/falcon.c + ../../../wolfcrypt/src/fe_448.c + ../../../wolfcrypt/src/fe_low_mem.c + ../../../wolfcrypt/src/fe_operations.c + ../../../wolfcrypt/src/ge_448.c + ../../../wolfcrypt/src/ge_low_mem.c + ../../../wolfcrypt/src/ge_operations.c + ../../../wolfcrypt/src/hash.c + ../../../wolfcrypt/src/hmac.c + ../../../wolfcrypt/src/hpke.c + ../../../wolfcrypt/src/integer.c + ../../../wolfcrypt/src/kdf.c + ../../../wolfcrypt/src/logging.c + ../../../wolfcrypt/src/md2.c + ../../../wolfcrypt/src/md4.c + ../../../wolfcrypt/src/md5.c + ../../../wolfcrypt/src/memory.c + ../../../wolfcrypt/src/misc.c + ../../../wolfcrypt/src/pkcs12.c + ../../../wolfcrypt/src/pkcs7.c + ../../../wolfcrypt/src/poly1305.c + ../../../wolfcrypt/src/pwdbased.c + ../../../wolfcrypt/src/random.c + ../../../wolfcrypt/src/rc2.c + ../../../wolfcrypt/src/ripemd.c + ../../../wolfcrypt/src/rsa.c + ../../../wolfcrypt/src/sakke.c + ../../../wolfcrypt/src/sha.c + ../../../wolfcrypt/src/sha256.c + ../../../wolfcrypt/src/sha3.c + ../../../wolfcrypt/src/sha512.c + ../../../wolfcrypt/src/signature.c + ../../../wolfcrypt/src/siphash.c + ../../../wolfcrypt/src/sp_arm32.c + ../../../wolfcrypt/src/sp_arm64.c + ../../../wolfcrypt/src/sp_armthumb.c + ../../../wolfcrypt/src/sp_c32.c + ../../../wolfcrypt/src/sp_c64.c + ../../../wolfcrypt/src/sp_int.c + ../../../wolfcrypt/src/sphincs.c + ../../../wolfcrypt/src/srp.c + ../../../wolfcrypt/src/tfm.c + ../../../wolfcrypt/src/wc_encrypt.c + ../../../wolfcrypt/src/wc_pkcs11.c + ../../../wolfcrypt/src/wc_port.c + ../../../wolfcrypt/src/wolfevent.c + ../../../wolfcrypt/src/wolfmath.c + + + ../../../src/crl.c + ../../../src/internal.c + ../../../src/keys.c + ../../../src/ssl.c + ../../../src/tls.c + ../../../src/tls13.c + ../../../src/wolfio.c + + + + Makefile + + + + .. + ../../src + ../../wolfcrypt/src + ../../wolfcrypt/test + ../../../src + ../../../wolfcrypt/src + + Makefile + + + + localhost + PIC24FJ1024GB610 + + + noID + XC16 + 2.10 + 4 + + + + + + + + + + + + + + + false + false + + + + + + + false + false + + false + + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/MPLABX16/wolfssl.X/nbproject/include.am b/IDE/MPLABX16/wolfssl.X/nbproject/include.am new file mode 100644 index 0000000000..5ba879e33c --- /dev/null +++ b/IDE/MPLABX16/wolfssl.X/nbproject/include.am @@ -0,0 +1,7 @@ +# vim:ft=automake +# All paths should be given relative to the root +# + +EXTRA_DIST += \ + IDE/MPLABX16/wolfssl.X/nbproject/configurations.xml \ + IDE/MPLABX16/wolfssl.X/nbproject/project.xml diff --git a/IDE/MPLABX16/wolfssl.X/nbproject/project.xml b/IDE/MPLABX16/wolfssl.X/nbproject/project.xml new file mode 100644 index 0000000000..1fb81b58cd --- /dev/null +++ b/IDE/MPLABX16/wolfssl.X/nbproject/project.xml @@ -0,0 +1,34 @@ + + + com.microchip.mplab.nbide.embedded.makeproject + + + wolfssl + 93bbfc3a-a0fa-4d48-bbc8-6cd47a2bd05b + 0 + c + + h + ISO-8859-1 + + + + .. + ../../src + ../../wolfcrypt/src + ../../wolfcrypt/test + ../../../src + ../../../wolfcrypt/src + + + + default + 3 + + + + false + + + + diff --git a/IDE/include.am b/IDE/include.am index 4f84b43fde..0656e8ba78 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -57,6 +57,9 @@ include IDE/STARCORE/include.am include IDE/MDK5-ARM/include.am include IDE/SimplicityStudio/include.am include IDE/apple-universal/include.am +include IDE/MPLABX16/include.am +include IDE/MPLABX16/wolfssl.X/nbproject/include.am +include IDE/MPLABX16/wolfcrypt_test.X/nbproject/include.am EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif EXTRA_DIST+= IDE/OPENSTM32/README.md diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 5db92f3d8b..ea663ffbbb 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -259,7 +259,9 @@ decouple library dependencies with standard string, memory and so on. #endif #elif defined(WC_16BIT_CPU) + #ifndef MICROCHIP_PIC24 #undef WORD64_AVAILABLE + #endif typedef word16 wolfssl_word; #define MP_16BIT /* for mp_int, mp_word needs to be twice as big as \ * mp_digit, no 64 bit type so make mp_digit 16 bit */ @@ -704,7 +706,7 @@ typedef struct w64wrapper { /* XC32 supports str[n]casecmp in version >= 1.0. */ #define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2)) #elif defined(MICROCHIP_PIC32) || defined(WOLFSSL_TIRTOS) || \ - defined(WOLFSSL_ZEPHYR) + defined(WOLFSSL_ZEPHYR) || defined(MICROCHIP_PIC24) /* XC32 version < 1.0 does not support strcasecmp. */ #define USE_WOLF_STRCASECMP #define XSTRCASECMP(s1,s2) wc_strcasecmp(s1,s2) @@ -734,7 +736,7 @@ typedef struct w64wrapper { /* XC32 supports str[n]casecmp in version >= 1.0. */ #define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n)) #elif defined(MICROCHIP_PIC32) || defined(WOLFSSL_TIRTOS) || \ - defined(WOLFSSL_ZEPHYR) + defined(WOLFSSL_ZEPHYR) || defined(MICROCHIP_PIC24) /* XC32 version < 1.0 does not support strncasecmp. */ #define USE_WOLF_STRNCASECMP #define XSTRNCASECMP(s1,s2) wc_strncasecmp(s1,s2)