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 6686 2026-10-29 23:59:57Z 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
343#ifndef BA_USE_C_RUNTIME_TIME
344#define BA_USE_C_RUNTIME_TIME 1
345#endif
346#if BA_USE_C_RUNTIME_TIME != 0 && BA_USE_C_RUNTIME_TIME != 1
347#error BA_USE_C_RUNTIME_TIME must be 0 or 1
348#endif
349
358#ifndef BA_HAVE_STDIO
359#define BA_HAVE_STDIO 0
360#endif
361#if BA_HAVE_STDIO != 0 && BA_HAVE_STDIO != 1
362#error BA_HAVE_STDIO must be 0 or 1
363#endif
364
373#ifndef BA_ENABLE_LUA_STDIO
374#define BA_ENABLE_LUA_STDIO 1
375#endif
376#if BA_ENABLE_LUA_STDIO != 0 && BA_ENABLE_LUA_STDIO != 1
377#error BA_ENABLE_LUA_STDIO must be 0 or 1
378#endif
379
388#ifndef BA_LUA_USE_DLOPEN
389#define BA_LUA_USE_DLOPEN 1
390#endif
391#if BA_LUA_USE_DLOPEN != 0 && BA_LUA_USE_DLOPEN != 1
392#error BA_LUA_USE_DLOPEN must be 0 or 1
393#endif
394
403#ifndef BA_LUA_OS_LIBRARY_MODE
404#define BA_LUA_OS_LIBRARY_MODE BA_LUA_OS_LIBRARY_FULL
405#endif
406#if BA_LUA_OS_LIBRARY_MODE != BA_LUA_OS_LIBRARY_FULL && BA_LUA_OS_LIBRARY_MODE != BA_LUA_OS_LIBRARY_MINIMAL
407#error Invalid BA_LUA_OS_LIBRARY_MODE
408#endif
409
410/* Shared server, diagnostics, serialization and Lua integration switches. */
419#ifndef BA_ENABLE_SERVER
420#define BA_ENABLE_SERVER 1
421#endif
422#if (BA_ENABLE_SERVER != 0) && (BA_ENABLE_SERVER != 1)
423#error BA_ENABLE_SERVER must be 0 or 1
424#endif
425
433#ifndef BA_ENABLE_HTTP_TRACE
434#define BA_ENABLE_HTTP_TRACE 1
435#endif
436#if (BA_ENABLE_HTTP_TRACE != 0) && (BA_ENABLE_HTTP_TRACE != 1)
437#error BA_ENABLE_HTTP_TRACE must be 0 or 1
438#endif
439
447#ifndef BA_ENABLE_JENCODER_JVAL
448#define BA_ENABLE_JENCODER_JVAL 1
449#endif
450#if (BA_ENABLE_JENCODER_JVAL != 0) && (BA_ENABLE_JENCODER_JVAL != 1)
451#error BA_ENABLE_JENCODER_JVAL must be 0 or 1
452#endif
453
462#ifndef BA_ENABLE_LUA_DEBUG_LIBRARY
463#define BA_ENABLE_LUA_DEBUG_LIBRARY 1
464#endif
465#if (BA_ENABLE_LUA_DEBUG_LIBRARY != 0) && (BA_ENABLE_LUA_DEBUG_LIBRARY != 1)
466#error BA_ENABLE_LUA_DEBUG_LIBRARY must be 0 or 1
467#endif
468
477#ifndef BA_ENABLE_SHARKSSL
478#define BA_ENABLE_SHARKSSL 1
479#endif
480#if (BA_ENABLE_SHARKSSL != 0) && (BA_ENABLE_SHARKSSL != 1)
481#error BA_ENABLE_SHARKSSL must be 0 or 1
482#endif
483
491#ifndef BA_ENABLE_ZLIB
492#define BA_ENABLE_ZLIB 1
493#endif
494#if (BA_ENABLE_ZLIB != 0) && (BA_ENABLE_ZLIB != 1)
495#error BA_ENABLE_ZLIB must be 0 or 1
496#endif
497
505#ifndef BA_ENABLE_LUA_SOCKET_COMPAT
506#define BA_ENABLE_LUA_SOCKET_COMPAT 1
507#endif
508#if (BA_ENABLE_LUA_SOCKET_COMPAT != 0) && (BA_ENABLE_LUA_SOCKET_COMPAT != 1)
509#error BA_ENABLE_LUA_SOCKET_COMPAT must be 0 or 1
510#endif
511
512/* Set BA_ENABLE_EMBEDDED_LUA=0 to link the Lua core separately.
513 * BAS Lua bindings remain selected independently. */
522#ifndef BA_ENABLE_EMBEDDED_LUA
523#define BA_ENABLE_EMBEDDED_LUA 1
524#endif
525#if (BA_ENABLE_EMBEDDED_LUA != 0) && (BA_ENABLE_EMBEDDED_LUA != 1)
526#error BA_ENABLE_EMBEDDED_LUA must be 0 or 1
527#endif
528
529/* Port-selected dispatcher and listener policy. */
538#ifndef BA_USE_EPOLL
539#define BA_USE_EPOLL 0
540#endif
541#if (BA_USE_EPOLL != 0) && (BA_USE_EPOLL != 1)
542#error BA_USE_EPOLL must be 0 or 1
543#endif
544
552#ifndef BA_ENABLE_SOCKET_REUSE_ADDRESS
553#define BA_ENABLE_SOCKET_REUSE_ADDRESS 0
554#endif
555#if (BA_ENABLE_SOCKET_REUSE_ADDRESS != 0) && (BA_ENABLE_SOCKET_REUSE_ADDRESS != 1)
556#error BA_ENABLE_SOCKET_REUSE_ADDRESS must be 0 or 1
557#endif
558
559/* Optional modules. Ports may select defaults before including this header.
560 * Set the same integer 0/1 values for BAS and all application sources. */
561/* Include the AUX API by default:
562 * https://realtimelogic.com/ba/doc/?url=auxlua.html
563 */
573#ifndef BA_ENABLE_AUX_API
574#define BA_ENABLE_AUX_API 1
575#endif
576#if (BA_ENABLE_AUX_API != 0) && (BA_ENABLE_AUX_API != 1)
577#error BA_ENABLE_AUX_API must be 0 or 1
578#endif
579
588#ifndef BA_ENABLE_TLS_TOOLS
589#define BA_ENABLE_TLS_TOOLS 0
590#endif
591#if (BA_ENABLE_TLS_TOOLS != 0) && (BA_ENABLE_TLS_TOOLS != 1)
592#error BA_ENABLE_TLS_TOOLS must be 0 or 1
593#endif
594
605#ifndef BA_ENABLE_LUA_CBOR
606#define BA_ENABLE_LUA_CBOR 0
607#endif
608#if (BA_ENABLE_LUA_CBOR != 0) && (BA_ENABLE_LUA_CBOR != 1)
609#error BA_ENABLE_LUA_CBOR must be 0 or 1
610#endif
611
620#ifndef BA_ENABLE_LUA_DEBUGGER
621#define BA_ENABLE_LUA_DEBUGGER 0
622#endif
623#if (BA_ENABLE_LUA_DEBUGGER != 0) && (BA_ENABLE_LUA_DEBUGGER != 1)
624#error BA_ENABLE_LUA_DEBUGGER must be 0 or 1
625#endif
626
635#ifndef BA_ENABLE_EMBEDDED_CA
636#define BA_ENABLE_EMBEDDED_CA 0
637#endif
638#if (BA_ENABLE_EMBEDDED_CA != 0) && (BA_ENABLE_EMBEDDED_CA != 1)
639#error BA_ENABLE_EMBEDDED_CA must be 0 or 1
640#endif
641
650#ifndef BA_ENABLE_LUA_FORKPTY
651#define BA_ENABLE_LUA_FORKPTY 0
652#endif
653#if (BA_ENABLE_LUA_FORKPTY != 0) && (BA_ENABLE_LUA_FORKPTY != 1)
654#error BA_ENABLE_LUA_FORKPTY must be 0 or 1
655#endif
656
667#ifndef BA_ENABLE_LUA_LPEG
668#define BA_ENABLE_LUA_LPEG 0
669#endif
670#if (BA_ENABLE_LUA_LPEG != 0) && (BA_ENABLE_LUA_LPEG != 1)
671#error BA_ENABLE_LUA_LPEG must be 0 or 1
672#endif
673
681#ifndef BA_ENABLE_LUA_PIPE
682#define BA_ENABLE_LUA_PIPE 0
683#endif
684#if (BA_ENABLE_LUA_PIPE != 0) && (BA_ENABLE_LUA_PIPE != 1)
685#error BA_ENABLE_LUA_PIPE must be 0 or 1
686#endif
687
696#ifndef BA_ENABLE_LUA_OPCUA
697#define BA_ENABLE_LUA_OPCUA 0
698#endif
699#if (BA_ENABLE_LUA_OPCUA != 0) && (BA_ENABLE_LUA_OPCUA != 1)
700#error BA_ENABLE_LUA_OPCUA must be 0 or 1
701#endif
702
713#ifndef BA_ENABLE_LUA_PROTOBUF
714#define BA_ENABLE_LUA_PROTOBUF 0
715#endif
716#if (BA_ENABLE_LUA_PROTOBUF != 0) && (BA_ENABLE_LUA_PROTOBUF != 1)
717#error BA_ENABLE_LUA_PROTOBUF must be 0 or 1
718#endif
719
728#ifndef BA_ENABLE_REVERSE_PROXY
729#define BA_ENABLE_REVERSE_PROXY 0
730#endif
731#if (BA_ENABLE_REVERSE_PROXY != 0) && (BA_ENABLE_REVERSE_PROXY != 1)
732#error BA_ENABLE_REVERSE_PROXY must be 0 or 1
733#endif
734
743#ifndef BA_ENABLE_REVERSE_CONNECTION
744#define BA_ENABLE_REVERSE_CONNECTION 0
745#endif
746#if (BA_ENABLE_REVERSE_CONNECTION != 0) && (BA_ENABLE_REVERSE_CONNECTION != 1)
747#error BA_ENABLE_REVERSE_CONNECTION must be 0 or 1
748#endif
749
758#ifndef BA_ENABLE_UBJSON
759#define BA_ENABLE_UBJSON 0
760#endif
761#if (BA_ENABLE_UBJSON != 0) && (BA_ENABLE_UBJSON != 1)
762#error BA_ENABLE_UBJSON must be 0 or 1
763#endif
764
776#ifndef BA_ENABLE_TPM
777#define BA_ENABLE_TPM 0
778#endif
779#if (BA_ENABLE_TPM != 0) && (BA_ENABLE_TPM != 1)
780#error BA_ENABLE_TPM must be 0 or 1
781#endif
782
783/* Crypto scope: these SHARKSSL_* defaults are seen by both BAS and BWS
784 * through TargConfig.h; Mako/Xedge inherit the BAS configuration. Their
785 * effects depend on the linked SharkSSL implementation and selected provider.
786 * BA_ENABLE_TPM only supplies/checks dependencies here; it does not select
787 * a source module or control host TPM initialization.
788 * See doc/en/C/md/BaConfig.md for the per-option defaults and scope.
789 * The PSA consumer supplies these operations through its provider.
790 */
791#if SHARKSSL_PSA_CONSUMER
792#ifndef SHARKSSL_PSA_CONSUMER_STANDALONE_AES
793#define SHARKSSL_PSA_CONSUMER_STANDALONE_AES 1
794#elif BA_ENABLE_TPM && (SHARKSSL_PSA_CONSUMER_STANDALONE_AES != 1)
795#error BA_ENABLE_TPM requires SHARKSSL_PSA_CONSUMER_STANDALONE_AES=1 with PSA
796#endif
797#ifndef SHARKSSL_ENABLE_RSA_API
798#define SHARKSSL_ENABLE_RSA_API 0
799#endif
800#ifndef SHARKSSL_ENABLE_RSA_OAEP
801#define SHARKSSL_ENABLE_RSA_OAEP 0
802#endif
803#ifndef SHARKSSL_ENABLE_DHE_RSA
804#define SHARKSSL_ENABLE_DHE_RSA 0
805#endif
806#ifndef SHARKSSL_ENABLE_ECDSA_API
807#define SHARKSSL_ENABLE_ECDSA_API 0
808#endif
809#ifndef SHARKSSL_USE_RNG_FORTUNA
810#define SHARKSSL_USE_RNG_FORTUNA 0
811#endif
812#ifndef SHARKSSL_USE_RNG_TINYMT
813#define SHARKSSL_USE_RNG_TINYMT 0
814#endif
815#ifndef SHARKSSL_TLS_1_3_INITIAL_KEY_SHARE_X25519_ONLY
816#define SHARKSSL_TLS_1_3_INITIAL_KEY_SHARE_X25519_ONLY 1
817#endif
818#endif
819
820#ifndef SHARKSSL_ENABLE_ASN1_KEY_CREATION
821#define SHARKSSL_ENABLE_ASN1_KEY_CREATION 1
822#elif BA_ENABLE_TPM && (SHARKSSL_ENABLE_ASN1_KEY_CREATION != 1)
823#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ASN1_KEY_CREATION=1
824#endif
825#ifndef SHARKSSL_ENABLE_RSAKEY_CREATE
826#define SHARKSSL_ENABLE_RSAKEY_CREATE (!SHARKSSL_PSA_CONSUMER)
827#endif
828#ifndef SHARKSSL_ENABLE_ECCKEY_CREATE
829#define SHARKSSL_ENABLE_ECCKEY_CREATE (!SHARKSSL_PSA_CONSUMER)
830#endif
831#ifndef SHARKSSL_ENABLE_CSR_CREATION
832#define SHARKSSL_ENABLE_CSR_CREATION 1
833#elif BA_ENABLE_TPM && (SHARKSSL_ENABLE_CSR_CREATION != 1)
834#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_CSR_CREATION=1
835#endif
836#ifndef SHARKSSL_ENABLE_CSR_SIGNING
837#define SHARKSSL_ENABLE_CSR_SIGNING 1
838#elif BA_ENABLE_TPM && (SHARKSSL_ENABLE_CSR_SIGNING != 1)
839#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_CSR_SIGNING=1
840#endif
841
842/* Preserve the SHA-256 derivation fallback when SHA-512 is explicitly off. */
843#ifndef SHARKSSL_USE_SHA_512
844#define SHARKSSL_USE_SHA_512 1
845#endif
846
847#ifndef SHARKSSL_ECC_USE_SECP256R1
848#define SHARKSSL_ECC_USE_SECP256R1 1
849#elif BA_ENABLE_TPM && (SHARKSSL_ECC_USE_SECP256R1 != 1)
850#error BA_ENABLE_TPM requires SHARKSSL_ECC_USE_SECP256R1=1
851#endif
852#ifndef SHARKSSL_ECC_USE_SECP384R1
853#define SHARKSSL_ECC_USE_SECP384R1 1
854#elif BA_ENABLE_TPM && (SHARKSSL_ECC_USE_SECP384R1 != 1)
855#error BA_ENABLE_TPM requires SHARKSSL_ECC_USE_SECP384R1=1
856#endif
857#ifndef SHARKSSL_ECC_USE_SECP521R1
858#define SHARKSSL_ECC_USE_SECP521R1 1
859#endif
860#ifndef SHARKSSL_ECC_USE_BRAINPOOLP256R1
861#define SHARKSSL_ECC_USE_BRAINPOOLP256R1 1
862#endif
863#ifndef SHARKSSL_ECC_USE_BRAINPOOLP384R1
864#define SHARKSSL_ECC_USE_BRAINPOOLP384R1 1
865#endif
866#ifndef SHARKSSL_ECC_USE_BRAINPOOLP512R1
867#define SHARKSSL_ECC_USE_BRAINPOOLP512R1 1
868#endif
869
870#ifndef SHARKSSL_ENABLE_RSA_OAEP
871#define SHARKSSL_ENABLE_RSA_OAEP 1
872#endif
873
874#if BA_ENABLE_TPM
875#if !BA_ENABLE_SHARKSSL
876#error BA_ENABLE_TPM requires SharkSSL
877#endif
878
879#ifndef SHARKSSL_ENABLE_PEM_API
880#define SHARKSSL_ENABLE_PEM_API 1
881#elif SHARKSSL_ENABLE_PEM_API != 1
882#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_PEM_API=1
883#endif
884#ifndef SHARKSSL_USE_ECC
885#define SHARKSSL_USE_ECC 1
886#elif SHARKSSL_USE_ECC != 1
887#error BA_ENABLE_TPM requires SHARKSSL_USE_ECC=1
888#endif
889#ifndef SHARKSSL_ENABLE_ECDSA
890#define SHARKSSL_ENABLE_ECDSA 1
891#elif SHARKSSL_ENABLE_ECDSA != 1
892#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECDSA=1
893#endif
894#ifndef SHARKSSL_ENABLE_ECDHE_ECDSA
895#define SHARKSSL_ENABLE_ECDHE_ECDSA 1
896#elif SHARKSSL_ENABLE_ECDHE_ECDSA != 1
897#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECDHE_ECDSA=1
898#endif
899#ifndef SHARKSSL_USE_SHA_256
900#define SHARKSSL_USE_SHA_256 1
901#elif SHARKSSL_USE_SHA_256 != 1
902#error BA_ENABLE_TPM requires SHARKSSL_USE_SHA_256=1
903#endif
904#ifndef SHARKSSL_USE_SHA_384
905#define SHARKSSL_USE_SHA_384 1
906#elif SHARKSSL_USE_SHA_384 != 1
907#error BA_ENABLE_TPM requires SHARKSSL_USE_SHA_384=1
908#endif
909#ifndef SHARKSSL_USE_AES_128
910#define SHARKSSL_USE_AES_128 1
911#elif SHARKSSL_USE_AES_128 != 1
912#error BA_ENABLE_TPM requires SHARKSSL_USE_AES_128=1
913#endif
914#ifndef SHARKSSL_USE_AES_256
915#define SHARKSSL_USE_AES_256 1
916#elif SHARKSSL_USE_AES_256 != 1
917#error BA_ENABLE_TPM requires SHARKSSL_USE_AES_256=1
918#endif
919#ifndef SHARKSSL_ENABLE_AES_GCM
920#define SHARKSSL_ENABLE_AES_GCM 1
921#elif SHARKSSL_ENABLE_AES_GCM != 1
922#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_AES_GCM=1
923#endif
924
925#if SHARKSSL_PSA_CONSUMER
926#ifndef SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY
927#define SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY 0
928#elif SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY != 0
929#error BA_ENABLE_TPM requires SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY=0
930#endif
931#if SHARKSSL_ENABLE_RSAKEY_CREATE || SHARKSSL_ENABLE_ECCKEY_CREATE
932#error BA_ENABLE_TPM with PSA requires native RSA/ECC key generation disabled
933#endif
934#else
935#ifndef SHARKSSL_ENABLE_ECDSA_API
936#define SHARKSSL_ENABLE_ECDSA_API 1
937#elif SHARKSSL_ENABLE_ECDSA_API != 1
938#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECDSA_API=1 with softTPM
939#endif
940#if SHARKSSL_ENABLE_ECCKEY_CREATE != 1
941#error BA_ENABLE_TPM requires SHARKSSL_ENABLE_ECCKEY_CREATE=1 with softTPM
942#endif
943#endif
944#endif /* BA_ENABLE_TPM */
945
946/* Fixed BAS crypto requirements, also visible to native BWS/SharkSSL.
947 * SHARKSSL_HMAC_API is consumed by the BAS Lua crypto binding only;
948 * Mako/Xedge inherit that behavior. It is not a native BWS HMAC selector.
949 */
950#if SHARKSSL_PSA_CONSUMER
951/* BAS supplies legacy SHA-1 and MD5 outside the PSA provider. */
952#define SHARKSSL_USE_SHA1 0
953#else
954#define SHARKSSL_USE_SHA1 1
955#define SHARKSSL_USE_MD5 1
956#endif
957#define SHARKSSL_ENABLE_AES_CCM 1
958#define SHARKSSL_HMAC_API 1
959#define SHARKSSL_ENABLE_AES_CBC 1
960#define SHARKSSL_ENABLE_ENCRYPTED_PKCS8_SUPPORT 1
961
962#endif /* _BaConfig_h */