Skip to content

Commit 01f8eb1

Browse files
committedMar 20, 2025·
[#430] Added more commonly changed defines to build flags
1 parent 8ad2d5e commit 01f8eb1

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed
 

‎CMakeLists.txt

+12-5
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,37 @@ option(SA_MARIADB "Security Association - MariaDB" OFF)
5656
option(SUPPORT "Support" OFF)
5757
option(SYSTEM_INSTALL "SystemInstall" OFF)
5858
option(TEST "Test" OFF)
59-
# option(TEST_ENC "Tests - Encryption" OFF)
6059
option(SA_FILE "Save Security Association to File" OFF)
6160
option(KEY_VALIDATION "Validate existance of key duplication" OFF)
62-
6361
OPTION(KMC_MDB_RH "KMC-MDB-RedHat-Integration-Testing" OFF) #Disabled by default, enable with: -DKMC_MDB_RH=ON
6462
OPTION(KMC_MDB_DB "KMC-MDB-Debian-Integration-Testing" OFF) #Disabled by default, enable with: -DKMC_MDB_DB=ON
6563
OPTION(KMC_CFFI_EXCLUDE "KMC-Exclude-Problematic-CFFI-Code" OFF) #Disabled by default, enable with: -DKMC_CFFI_EXCLUDE=ON
66-
6764
OPTION(CRYPTO_EPROC "Enables the building and use of Extended Procedures" OFF) #Disabled by default, enable with -DCRYPTO_EPROC=ON
65+
6866
OPTION(MAC_SIZE "The size of the max MAC buffer in bytes")
6967
OPTION(IV_SIZE "The size of the max IV buffer in bytes")
68+
Option(NUM_SA "The max number of SAs that will be used")
69+
Option(NUM_KEYS "The max number of keys that will be used")
7070

7171
#
72-
# Max Buffer Size Defines
72+
# Max Size Defines
7373
#
74+
if(NUM_SA)
75+
add_compile_definitions(NUM_SA=${NUM_SA})
76+
message(STATUS "NUM_SA set to: ${NUM_SA}")
77+
endif()
7478
if(MAC_SIZE)
7579
add_compile_definitions(MAC_SIZE=${MAC_SIZE})
7680
message(STATUS "MAC_SIZE set to: ${MAC_SIZE}")
7781
endif()
78-
7982
if(IV_SIZE)
8083
add_compile_definitions(IV_SIZE=${IV_SIZE})
8184
message(STATUS "IV_SIZE set to: ${IV_SIZE}")
8285
endif()
86+
if(NUM_KEYS)
87+
add_compile_definitions(NUM_KEYS=${NUM_KEYS})
88+
message(STATUS "NUM_KEYS set to: ${NUM_KEYS}")
89+
endif()
8390

8491
#
8592
# Custom Module Paths

‎include/crypto_config.h

+14-8
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,17 @@
108108
#define SA_AUTHENTICATED_ENCRYPTION 3
109109

110110
// Generic Defines
111-
#define NUM_SA 64
112111
#define SPI_LEN 2 /* bytes */
113112
#define SPI_MIN 0
114113
#define SPI_MAX NUM_SA - 1
115114
#define KEY_SIZE 512 /* bytes */
116115
#define KEY_ID_SIZE 8
117116
#define MKID_MAX 128
118-
#define NUM_KEYS 256
119117
#define DISABLED 0
120118
#define ENABLED 1
121-
#ifndef IV_SIZE
122-
#define IV_SIZE 16 /* TM IV size bytes */
123-
#endif
124119
#define IV_SIZE_TC 4 /* TC IV size bytes */
125120
#define REF_SIZE 250
126121
#define OCF_SIZE 4
127-
#ifndef MAC_SIZE
128-
#define MAC_SIZE 16 /* bytes */
129-
#endif
130122
#define FHECF_SIZE 2
131123
#define FECF_SIZE 2
132124
#define TC_SEGMENT_HDR_SIZE 1
@@ -142,6 +134,20 @@
142134
#define CRYPTOLIB_APPID 128
143135
#define MAX_IV_LEN 32 /* bytes */
144136

137+
// Configurable via build flags
138+
#ifndef NUM_SA
139+
#define NUM_SA 64
140+
#endif
141+
#ifndef MAC_SIZE
142+
#define MAC_SIZE 16 /* bytes */
143+
#endif
144+
#ifndef IV_SIZE
145+
#define IV_SIZE 16 /* TM IV size bytes */
146+
#endif
147+
#ifndef NUM_KEYS
148+
#define NUM_KEYS 256
149+
#endif
150+
145151
// Monitoring and Control Defines
146152
#define EMV_SIZE 4 /* bytes */
147153
#define LOG_SIZE 50 /* packets */

0 commit comments

Comments
 (0)
Please sign in to comment.