Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
BaConfig.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: BaConfig.h 6807 2026-11-08 14:20:27Z wini $
15 *
16 * COPYRIGHT: Real Time Logic LLC, 2023 - 2026
17 *
18 * This software is copyrighted by and is the sole property of Real
19 * Time Logic LLC. All rights, title, ownership, or other interests in
20 * the software remain the property of Real Time Logic LLC. This
21 * software may only be used in accordance with the terms and
22 * conditions stipulated in the corresponding license agreement under
23 * which the software has been supplied. Any unauthorized use,
24 * duplication, transmission, distribution, or disclosure of this
25 * software is expressly forbidden.
26 *
27 * This Copyright notice may not be removed or modified without prior
28 * written consent of Real Time Logic LLC.
29 *
30 * Real Time Logic LLC. reserves the right to modify this software
31 * without notice.
32 *
33 * http://www.realtimelogic.com
34 ****************************************************************************
35 *
36 * Shared BAS/BWS configuration defaults and dependency checks.
37 * TargConfig.h loads BaConfigOpts.h before port defaults, then includes
38 * this header before the configured interfaces are consumed.
39 */
40
51#ifndef _TargConfig_h
52#error Include TargConfig.h to load the port and BAS configuration
53#endif
54
55#ifndef _BaConfig_h
56#define _BaConfig_h
57#include <BaConfigDefs.h>
58
59/* Internal include bookkeeping for BAS/BWS and their Mako/Xedge hosts.
60 * Ports load overrides early; also support direct configuration consumers.
61 * BA_INTERNAL_CONFIG_OPTS_LOADED is not an application feature switch.
62 */
63#ifndef BA_INTERNAL_CONFIG_OPTS_LOADED
64#define BA_INTERNAL_CONFIG_OPTS_LOADED 1
65#include <BaConfigOpts.h>
66#endif
67
68#include <BaConfigTypes.h>
69
70/* Port facts and application overrides precede final byte-order validation. */
71#include <BaConfigEndian.h>
72
73/* BA_ALLOCATOR_DEFAULT keeps the port's normal allocation hooks. */
82#ifndef BA_ALLOCATOR
83#define BA_ALLOCATOR BA_ALLOCATOR_DEFAULT
84#endif
85#if BA_ALLOCATOR != BA_ALLOCATOR_DEFAULT && BA_ALLOCATOR != BA_ALLOCATOR_DLMALLOC && BA_ALLOCATOR != BA_ALLOCATOR_MQX
86#error BA_ALLOCATOR must select DEFAULT, DLMALLOC or MQX
87#endif
96#ifndef BA_THREAD_STACK_SIZE
97#define BA_THREAD_STACK_SIZE 24000
98#endif
99#if BA_THREAD_STACK_SIZE <= 0
100#error BA_THREAD_STACK_SIZE must be positive
101#endif
105#ifndef BA_ENABLE_THREAD_NAMES
106#define BA_ENABLE_THREAD_NAMES 0
107#endif
108#if BA_ENABLE_THREAD_NAMES != 0 && BA_ENABLE_THREAD_NAMES != 1
109#error BA_ENABLE_THREAD_NAMES must be 0 or 1
110#endif
119#ifndef BA_TIMER_SOURCE
120#define BA_TIMER_SOURCE BA_TIMER_SOURCE_INTERNAL
121#endif
122#if BA_TIMER_SOURCE != BA_TIMER_SOURCE_INTERNAL && BA_TIMER_SOURCE != BA_TIMER_SOURCE_EXTERNAL
123#error BA_TIMER_SOURCE must select INTERNAL or EXTERNAL
124#endif
125
126/* Optional native BWS source selection. BAS retains the implementations
127 * required by its Lua bindings. These switches are not a promise to remove
128 * the corresponding components from BAS or from every generated package.
129 */
138#ifndef BA_ENABLE_AUTHENTICATION
139#define BA_ENABLE_AUTHENTICATION 1
140#endif
141#if (BA_ENABLE_AUTHENTICATION != 0) && (BA_ENABLE_AUTHENTICATION != 1)
142#error BA_ENABLE_AUTHENTICATION must be 0 or 1
143#endif
144
153#ifndef BA_ENABLE_JSON_USER_DATABASE
154#define BA_ENABLE_JSON_USER_DATABASE 0
155#endif
156#if (BA_ENABLE_JSON_USER_DATABASE != 0) && (BA_ENABLE_JSON_USER_DATABASE != 1)
157#error BA_ENABLE_JSON_USER_DATABASE must be 0 or 1
158#endif
159
168#ifndef BA_ENABLE_HTTP_THREAD_POOL
169#define BA_ENABLE_HTTP_THREAD_POOL 0
170#endif
171#if (BA_ENABLE_HTTP_THREAD_POOL != 0) && (BA_ENABLE_HTTP_THREAD_POOL != 1)
172#error BA_ENABLE_HTTP_THREAD_POOL must be 0 or 1
173#endif
174
183#ifndef BA_ENABLE_HTTP_UPLOAD
184#define BA_ENABLE_HTTP_UPLOAD 0
185#endif
186#if (BA_ENABLE_HTTP_UPLOAD != 0) && (BA_ENABLE_HTTP_UPLOAD != 1)
187#error BA_ENABLE_HTTP_UPLOAD must be 0 or 1
188#endif
189
198#ifndef BA_ENABLE_WEBDAV
199#define BA_ENABLE_WEBDAV 0
200#endif
201#if (BA_ENABLE_WEBDAV != 0) && (BA_ENABLE_WEBDAV != 1)
202#error BA_ENABLE_WEBDAV must be 0 or 1
203#endif
204
213#ifndef BA_ENABLE_ZIP_IO
214#define BA_ENABLE_ZIP_IO 0
215#endif
216#if (BA_ENABLE_ZIP_IO != 0) && (BA_ENABLE_ZIP_IO != 1)
217#error BA_ENABLE_ZIP_IO must be 0 or 1
218#endif
219
228#ifndef BA_ENABLE_JSON
229#define BA_ENABLE_JSON 0
230#endif
231#if (BA_ENABLE_JSON != 0) && (BA_ENABLE_JSON != 1)
232#error BA_ENABLE_JSON must be 0 or 1
233#endif
234
243#ifndef BA_ENABLE_WEBSOCKET
244#define BA_ENABLE_WEBSOCKET 1
245#endif
246#if (BA_ENABLE_WEBSOCKET != 0) && (BA_ENABLE_WEBSOCKET != 1)
247#error BA_ENABLE_WEBSOCKET must be 0 or 1
248#endif
249
258#ifndef BA_ENABLE_MDNS
259#define BA_ENABLE_MDNS 0
260#endif
261#if (BA_ENABLE_MDNS != 0) && (BA_ENABLE_MDNS != 1)
262#error BA_ENABLE_MDNS must be 0 or 1
263#endif
264
272#ifndef BA_ENABLE_MDNS_LUA
273#define BA_ENABLE_MDNS_LUA 0
274#endif
275#if (BA_ENABLE_MDNS_LUA != 0) && (BA_ENABLE_MDNS_LUA != 1)
276#error BA_ENABLE_MDNS_LUA must be 0 or 1
277#endif
278
279#if BA_ENABLE_WEBDAV && !BA_ENABLE_HTTP_UPLOAD
280#error BA_ENABLE_WEBDAV requires BA_ENABLE_HTTP_UPLOAD=1
281#endif
282#if BA_ENABLE_JSON_USER_DATABASE && (!BA_ENABLE_AUTHENTICATION || !BA_ENABLE_JSON)
283#error BA_ENABLE_JSON_USER_DATABASE requires authentication and JSON
284#endif
285#if BA_ENABLE_MDNS_LUA && !BA_ENABLE_MDNS
286#error BA_ENABLE_MDNS_LUA requires BA_ENABLE_MDNS=1
287#endif
288
297#ifndef MAKO_ENABLE_LUA_MODULE_INTERFACE
298#define MAKO_ENABLE_LUA_MODULE_INTERFACE 0
299#endif
300#if (MAKO_ENABLE_LUA_MODULE_INTERFACE != 0) && (MAKO_ENABLE_LUA_MODULE_INTERFACE != 1)
301#error MAKO_ENABLE_LUA_MODULE_INTERFACE must be 0 or 1
302#endif
303
312#ifndef BA_ENABLE_SYSLOG
313#define BA_ENABLE_SYSLOG 0
314#endif
315#if (BA_ENABLE_SYSLOG != 0) && (BA_ENABLE_SYSLOG != 1)
316#error BA_ENABLE_SYSLOG must be 0 or 1
317#endif
318
319/* Lua runtime capabilities; port defaults precede this header. */
328#ifndef BA_HAVE_LOG2
329#define BA_HAVE_LOG2 1
330#endif
331#if BA_HAVE_LOG2 != 0 && BA_HAVE_LOG2 != 1
332#error BA_HAVE_LOG2 must be 0 or 1
333#endif
334
344#ifndef BA_USE_C_RUNTIME_TIME
345#define BA_USE_C_RUNTIME_TIME 1
346#endif
347#if BA_USE_C_RUNTIME_TIME != 0 && BA_USE_C_RUNTIME_TIME != 1
348#error BA_USE_C_RUNTIME_TIME must be 0 or 1
349#endif
350
359#ifndef BA_HAVE_STDIO
360#define BA_HAVE_STDIO 0
361#endif
362#if BA_HAVE_STDIO != 0 && BA_HAVE_STDIO != 1
363#error BA_HAVE_STDIO must be 0 or 1
364#endif
365
374#ifndef BA_ENABLE_LUA_STDIO
375#define BA_ENABLE_LUA_STDIO 1
376#endif
377#if BA_ENABLE_LUA_STDIO != 0 && BA_ENABLE_LUA_STDIO != 1
378#error BA_ENABLE_LUA_STDIO must be 0 or 1
379#endif
380
389#ifndef BA_LUA_USE_DLOPEN
390#define BA_LUA_USE_DLOPEN 1
391#endif
392#if BA_LUA_USE_DLOPEN != 0 && BA_LUA_USE_DLOPEN != 1
393#error BA_LUA_USE_DLOPEN must be 0 or 1
394#endif
395
404#ifndef BA_LUA_OS_LIBRARY_MODE
405#define BA_LUA_OS_LIBRARY_MODE BA_LUA_OS_LIBRARY_FULL
406#endif
407#if BA_LUA_OS_LIBRARY_MODE != BA_LUA_OS_LIBRARY_FULL && BA_LUA_OS_LIBRARY_MODE != BA_LUA_OS_LIBRARY_MINIMAL
408#error Invalid BA_LUA_OS_LIBRARY_MODE
409#endif
410
411/* Shared server, diagnostics, serialization and Lua integration switches. */
420#ifndef BA_ENABLE_SERVER
421#define BA_ENABLE_SERVER 1
422#endif
423#if (BA_ENABLE_SERVER != 0) && (BA_ENABLE_SERVER != 1)
424#error BA_ENABLE_SERVER must be 0 or 1
425#endif
426
434#ifndef BA_ENABLE_HTTP_TRACE
435#define BA_ENABLE_HTTP_TRACE 1
436#endif
437#if (BA_ENABLE_HTTP_TRACE != 0) && (BA_ENABLE_HTTP_TRACE != 1)
438#error BA_ENABLE_HTTP_TRACE must be 0 or 1
439#endif
440
448#ifndef BA_ENABLE_JENCODER_JVAL
449#define BA_ENABLE_JENCODER_JVAL 1
450#endif
451#if (BA_ENABLE_JENCODER_JVAL != 0) && (BA_ENABLE_JENCODER_JVAL != 1)
452#error BA_ENABLE_JENCODER_JVAL must be 0 or 1
453#endif
454
463#ifndef BA_ENABLE_LUA_DEBUG_LIBRARY
464#define BA_ENABLE_LUA_DEBUG_LIBRARY 1
465#endif
466#if (BA_ENABLE_LUA_DEBUG_LIBRARY != 0) && (BA_ENABLE_LUA_DEBUG_LIBRARY != 1)
467#error BA_ENABLE_LUA_DEBUG_LIBRARY must be 0 or 1
468#endif
469
478#ifndef BA_ENABLE_SHARKSSL
479#define BA_ENABLE_SHARKSSL 1
480#endif
481#if (BA_ENABLE_SHARKSSL != 0) && (BA_ENABLE_SHARKSSL != 1)
482#error BA_ENABLE_SHARKSSL must be 0 or 1
483#endif
484
492#ifndef BA_ENABLE_ZLIB
493#define BA_ENABLE_ZLIB 1
494#endif
495#if (BA_ENABLE_ZLIB != 0) && (BA_ENABLE_ZLIB != 1)
496#error BA_ENABLE_ZLIB must be 0 or 1
497#endif
498
506#ifndef BA_ENABLE_LUA_SOCKET_COMPAT
507#define BA_ENABLE_LUA_SOCKET_COMPAT 1
508#endif
509#if (BA_ENABLE_LUA_SOCKET_COMPAT != 0) && (BA_ENABLE_LUA_SOCKET_COMPAT != 1)
510#error BA_ENABLE_LUA_SOCKET_COMPAT must be 0 or 1
511#endif
512
513/* Set BA_ENABLE_EMBEDDED_LUA=0 to link the Lua core separately.
514 * BAS Lua bindings remain selected independently. */
523#ifndef BA_ENABLE_EMBEDDED_LUA
524#define BA_ENABLE_EMBEDDED_LUA 1
525#endif
526#if (BA_ENABLE_EMBEDDED_LUA != 0) && (BA_ENABLE_EMBEDDED_LUA != 1)
527#error BA_ENABLE_EMBEDDED_LUA must be 0 or 1
528#endif
529
530/* Port-selected dispatcher and listener policy. */
536#ifndef BA_USE_POLL
537#define BA_USE_POLL 0
538#endif
539#if (BA_USE_POLL != 0) && (BA_USE_POLL != 1)
540#error BA_USE_POLL must be 0 or 1
541#endif
542
551#ifndef BA_USE_EPOLL
552#define BA_USE_EPOLL 0
553#endif
554#if (BA_USE_EPOLL != 0) && (BA_USE_EPOLL != 1)
555#error BA_USE_EPOLL must be 0 or 1
556#endif
557#if BA_USE_POLL && BA_USE_EPOLL
558#error Select only one of BA_USE_POLL and BA_USE_EPOLL
559#endif
560
568#ifndef BA_ENABLE_SOCKET_REUSE_ADDRESS
569#define BA_ENABLE_SOCKET_REUSE_ADDRESS 0
570#endif
571#if (BA_ENABLE_SOCKET_REUSE_ADDRESS != 0) && (BA_ENABLE_SOCKET_REUSE_ADDRESS != 1)
572#error BA_ENABLE_SOCKET_REUSE_ADDRESS must be 0 or 1
573#endif
574
575/* Optional modules. Ports may select defaults before including this header.
576 * Set the same integer 0/1 values for BAS and all application sources. */
577/* Include the AUX API by default:
578 * https://realtimelogic.com/ba/doc/?url=auxlua.html
579 */
589#ifndef BA_ENABLE_AUX_API
590#define BA_ENABLE_AUX_API 1
591#endif
592#if (BA_ENABLE_AUX_API != 0) && (BA_ENABLE_AUX_API != 1)
593#error BA_ENABLE_AUX_API must be 0 or 1
594#endif
595
604#ifndef BA_ENABLE_TLS_TOOLS
605#define BA_ENABLE_TLS_TOOLS 0
606#endif
607#if (BA_ENABLE_TLS_TOOLS != 0) && (BA_ENABLE_TLS_TOOLS != 1)
608#error BA_ENABLE_TLS_TOOLS must be 0 or 1
609#endif
610
621#ifndef BA_ENABLE_LUA_CBOR
622#define BA_ENABLE_LUA_CBOR 0
623#endif
624#if (BA_ENABLE_LUA_CBOR != 0) && (BA_ENABLE_LUA_CBOR != 1)
625#error BA_ENABLE_LUA_CBOR must be 0 or 1
626#endif
627
636#ifndef BA_ENABLE_LUA_DEBUGGER
637#define BA_ENABLE_LUA_DEBUGGER 0
638#endif
639#if (BA_ENABLE_LUA_DEBUGGER != 0) && (BA_ENABLE_LUA_DEBUGGER != 1)
640#error BA_ENABLE_LUA_DEBUGGER must be 0 or 1
641#endif
642
651#ifndef BA_ENABLE_EMBEDDED_CA
652#define BA_ENABLE_EMBEDDED_CA 0
653#endif
654#if (BA_ENABLE_EMBEDDED_CA != 0) && (BA_ENABLE_EMBEDDED_CA != 1)
655#error BA_ENABLE_EMBEDDED_CA must be 0 or 1
656#endif
657
666#ifndef BA_ENABLE_LUA_FORKPTY
667#define BA_ENABLE_LUA_FORKPTY 0
668#endif
669#if (BA_ENABLE_LUA_FORKPTY != 0) && (BA_ENABLE_LUA_FORKPTY != 1)
670#error BA_ENABLE_LUA_FORKPTY must be 0 or 1
671#endif
672
683#ifndef BA_ENABLE_LUA_LPEG
684#define BA_ENABLE_LUA_LPEG 0
685#endif
686#if (BA_ENABLE_LUA_LPEG != 0) && (BA_ENABLE_LUA_LPEG != 1)
687#error BA_ENABLE_LUA_LPEG must be 0 or 1
688#endif
689
697#ifndef BA_ENABLE_LUA_PIPE
698#define BA_ENABLE_LUA_PIPE 0
699#endif
700#if (BA_ENABLE_LUA_PIPE != 0) && (BA_ENABLE_LUA_PIPE != 1)
701#error BA_ENABLE_LUA_PIPE must be 0 or 1
702#endif
703
712#ifndef BA_ENABLE_LUA_OPCUA
713#define BA_ENABLE_LUA_OPCUA 0
714#endif
715#if (BA_ENABLE_LUA_OPCUA != 0) && (BA_ENABLE_LUA_OPCUA != 1)
716#error BA_ENABLE_LUA_OPCUA must be 0 or 1
717#endif
718
729#ifndef BA_ENABLE_LUA_PROTOBUF
730#define BA_ENABLE_LUA_PROTOBUF 0
731#endif
732#if (BA_ENABLE_LUA_PROTOBUF != 0) && (BA_ENABLE_LUA_PROTOBUF != 1)
733#error BA_ENABLE_LUA_PROTOBUF must be 0 or 1
734#endif
735
744#ifndef BA_ENABLE_REVERSE_PROXY
745#define BA_ENABLE_REVERSE_PROXY 0
746#endif
747#if (BA_ENABLE_REVERSE_PROXY != 0) && (BA_ENABLE_REVERSE_PROXY != 1)
748#error BA_ENABLE_REVERSE_PROXY must be 0 or 1
749#endif
750
759#ifndef BA_ENABLE_REVERSE_CONNECTION
760#define BA_ENABLE_REVERSE_CONNECTION 0
761#endif
762#if (BA_ENABLE_REVERSE_CONNECTION != 0) && (BA_ENABLE_REVERSE_CONNECTION != 1)
763#error BA_ENABLE_REVERSE_CONNECTION must be 0 or 1
764#endif
765
774#ifndef BA_ENABLE_UBJSON
775#define BA_ENABLE_UBJSON 0
776#endif
777#if (BA_ENABLE_UBJSON != 0) && (BA_ENABLE_UBJSON != 1)
778#error BA_ENABLE_UBJSON must be 0 or 1
779#endif
780
792#ifndef BA_ENABLE_TPM
793#define BA_ENABLE_TPM 0
794#endif
795#if (BA_ENABLE_TPM != 0) && (BA_ENABLE_TPM != 1)
796#error BA_ENABLE_TPM must be 0 or 1
797#endif
798
799/* Crypto scope: these SHARKSSL_* defaults are seen by both BAS and BWS
800 * through TargConfig.h; Mako/Xedge inherit the BAS configuration. Their
801 * effects depend on the linked SharkSSL implementation and selected provider.
802 * BA_ENABLE_TPM only supplies/checks dependencies here; it does not select
803 * a source module or control host TPM initialization.
804 * See doc/en/C/md/BaConfig.md for the per-option defaults and scope.
805 * The PSA consumer supplies these operations through its provider.
806 */
807#if SHARKSSL_PSA_CONSUMER
808#ifndef SHARKSSL_PSA_CONSUMER_STANDALONE_AES
809#define SHARKSSL_PSA_CONSUMER_STANDALONE_AES 1
810#elif BA_ENABLE_TPM && (SHARKSSL_PSA_CONSUMER_STANDALONE_AES != 1)
811#error BA_ENABLE_TPM requires SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1 with PSA
812#endif
813#ifndef SHARKSSL_ENABLE_RSA_API
814#define SHARKSSL_ENABLE_RSA_API 0
815#endif
816#ifndef SHARKSSL_ENABLE_RSA_OAEP
817#define SHARKSSL_ENABLE_RSA_OAEP 0
818#endif
819#ifndef SHARKSSL_ENABLE_DHE_RSA
820#define SHARKSSL_ENABLE_DHE_RSA 0
821#endif
822#ifndef SHARKSSL_ENABLE_ECDSA_API
823#define SHARKSSL_ENABLE_ECDSA_API 0
824#endif
825#ifndef SHARKSSL_USE_RNG_FORTUNA
826#define SHARKSSL_USE_RNG_FORTUNA 0
827#endif
828#ifndef SHARKSSL_USE_RNG_TINYMT
829#define SHARKSSL_USE_RNG_TINYMT 0
830#endif
831#ifndef SHARKSSL_TLS_1_3_INITIAL_KEY_SHARE_X25519_ONLY
832#define SHARKSSL_TLS_1_3_INITIAL_KEY_SHARE_X25519_ONLY 1
833#endif
834#endif
835
836#ifndef SHARKSSL_ENABLE_ASN1_KEY_CREATION
837#define SHARKSSL_ENABLE_ASN1_KEY_CREATION 1
838#elif BA_ENABLE_TPM && (SHARKSSL_ENABLE_ASN1_KEY_CREATION != 1)
839#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ASN1_KEY_CREATION=1
840#endif
841#ifndef SHARKSSL_ENABLE_RSAKEY_CREATE
842#define SHARKSSL_ENABLE_RSAKEY_CREATE (!SHARKSSL_PSA_CONSUMER)
843#endif
844#ifndef SHARKSSL_ENABLE_ECCKEY_CREATE
845#define SHARKSSL_ENABLE_ECCKEY_CREATE (!SHARKSSL_PSA_CONSUMER)
846#endif
847#ifndef SHARKSSL_ENABLE_CSR_CREATION
848#define SHARKSSL_ENABLE_CSR_CREATION 1
849#elif BA_ENABLE_TPM && (SHARKSSL_ENABLE_CSR_CREATION != 1)
850#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_CSR_CREATION=1
851#endif
852#ifndef SHARKSSL_ENABLE_CSR_SIGNING
853#define SHARKSSL_ENABLE_CSR_SIGNING 1
854#elif BA_ENABLE_TPM && (SHARKSSL_ENABLE_CSR_SIGNING != 1)
855#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_CSR_SIGNING=1
856#endif
857
858/* Preserve the SHA-256 derivation fallback when SHA-512 is explicitly off. */
859#ifndef SHARKSSL_USE_SHA_512
860#define SHARKSSL_USE_SHA_512 1
861#endif
862
863#ifndef SHARKSSL_ECC_USE_SECP256R1
864#define SHARKSSL_ECC_USE_SECP256R1 1
865#elif BA_ENABLE_TPM && (SHARKSSL_ECC_USE_SECP256R1 != 1)
866#error BA_ENABLE_TPM requires SHARKSSL_ECC_USE_SECP256R1=1
867#endif
868#ifndef SHARKSSL_ECC_USE_SECP384R1
869#define SHARKSSL_ECC_USE_SECP384R1 1
870#elif BA_ENABLE_TPM && (SHARKSSL_ECC_USE_SECP384R1 != 1)
871#error BA_ENABLE_TPM requires SHARKSSL_ECC_USE_SECP384R1=1
872#endif
873#ifndef SHARKSSL_ECC_USE_SECP521R1
874#define SHARKSSL_ECC_USE_SECP521R1 1
875#endif
876#ifndef SHARKSSL_ECC_USE_BRAINPOOLP256R1
877#define SHARKSSL_ECC_USE_BRAINPOOLP256R1 1
878#endif
879#ifndef SHARKSSL_ECC_USE_BRAINPOOLP384R1
880#define SHARKSSL_ECC_USE_BRAINPOOLP384R1 1
881#endif
882#ifndef SHARKSSL_ECC_USE_BRAINPOOLP512R1
883#define SHARKSSL_ECC_USE_BRAINPOOLP512R1 1
884#endif
885
886#ifndef SHARKSSL_ENABLE_RSA_OAEP
887#define SHARKSSL_ENABLE_RSA_OAEP 1
888#endif
889
890#if BA_ENABLE_TPM
891#if !BA_ENABLE_SHARKSSL
892#error BA_ENABLE_TPM requires SharkSSL
893#endif
894
895#ifndef SHARKSSL_ENABLE_PEM_API
896#define SHARKSSL_ENABLE_PEM_API 1
897#elif SHARKSSL_ENABLE_PEM_API != 1
898#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_PEM_API=1
899#endif
900#ifndef SHARKSSL_USE_ECC
901#define SHARKSSL_USE_ECC 1
902#elif SHARKSSL_USE_ECC != 1
903#error BA_ENABLE_TPM requires SHARKSSL_USE_ECC=1
904#endif
905#ifndef SHARKSSL_ENABLE_ECDSA
906#define SHARKSSL_ENABLE_ECDSA 1
907#elif SHARKSSL_ENABLE_ECDSA != 1
908#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECDSA=1
909#endif
910#ifndef SHARKSSL_ENABLE_ECDHE_ECDSA
911#define SHARKSSL_ENABLE_ECDHE_ECDSA 1
912#elif SHARKSSL_ENABLE_ECDHE_ECDSA != 1
913#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECDHE_ECDSA=1
914#endif
915#ifndef SHARKSSL_USE_SHA_256
916#define SHARKSSL_USE_SHA_256 1
917#elif SHARKSSL_USE_SHA_256 != 1
918#error BA_ENABLE_TPM requires SHARKSSL_USE_SHA_256=1
919#endif
920#ifndef SHARKSSL_USE_SHA_384
921#define SHARKSSL_USE_SHA_384 1
922#elif SHARKSSL_USE_SHA_384 != 1
923#error BA_ENABLE_TPM requires SHARKSSL_USE_SHA_384=1
924#endif
925#ifndef SHARKSSL_USE_AES_128
926#define SHARKSSL_USE_AES_128 1
927#elif SHARKSSL_USE_AES_128 != 1
928#error BA_ENABLE_TPM requires SHARKSSL_USE_AES_128=1
929#endif
930#ifndef SHARKSSL_USE_AES_256
931#define SHARKSSL_USE_AES_256 1
932#elif SHARKSSL_USE_AES_256 != 1
933#error BA_ENABLE_TPM requires SHARKSSL_USE_AES_256=1
934#endif
935#ifndef SHARKSSL_ENABLE_AES_GCM
936#define SHARKSSL_ENABLE_AES_GCM 1
937#elif SHARKSSL_ENABLE_AES_GCM != 1
938#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_AES_GCM=1
939#endif
940
941#if SHARKSSL_PSA_CONSUMER
942#ifndef SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY
943#define SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY 0
944#elif SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY != 0
945#error BA_ENABLE_TPM requires SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY=0
946#endif
947#if SHARKSSL_ENABLE_RSAKEY_CREATE || SHARKSSL_ENABLE_ECCKEY_CREATE
948#error BA_ENABLE_TPM with PSA requires native RSA/ECC key generation disabled
949#endif
950#else
951#ifndef SHARKSSL_ENABLE_ECDSA_API
952#define SHARKSSL_ENABLE_ECDSA_API 1
953#elif SHARKSSL_ENABLE_ECDSA_API != 1
954#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECDSA_API=1 with softTPM
955#endif
956#if SHARKSSL_ENABLE_ECCKEY_CREATE != 1
957#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECCKEY_CREATE=1 with softTPM
958#endif
959#endif
960#endif /* BA_ENABLE_TPM */
961
962/* Fixed BAS crypto requirements, also visible to native BWS/SharkSSL.
963 * SHARKSSL_HMAC_API is consumed by the BAS Lua crypto binding only;
964 * Mako/Xedge inherit that behavior. It is not a native BWS HMAC selector.
965 */
966#if SHARKSSL_PSA_CONSUMER
967/* BAS supplies legacy SHA-1 and MD5 outside the PSA provider. */
968#define SHARKSSL_USE_SHA1 0
969#else
970#define SHARKSSL_USE_SHA1 1
971#define SHARKSSL_USE_MD5 1
972#endif
973#define SHARKSSL_ENABLE_AES_CCM 1
974#define SHARKSSL_HMAC_API 1
975#define SHARKSSL_ENABLE_AES_CBC 1
976#define SHARKSSL_ENABLE_ENCRYPTED_PKCS8_SUPPORT 1
977
978#endif /* _BaConfig_h */