Introduce LTC_NO_STRUCT_PADDING.

Directly use it in `ltc_rsa_op_parameters`.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel 2026-04-29 11:03:12 +02:00 committed by Karel Miko
parent 459bd79006
commit f50d056258
4 changed files with 11 additions and 1 deletions

View file

@ -18,6 +18,7 @@ options=(
-DLTC_MECC_FP -DLTC_MECC_FP
-DLTC_NO_TABLES -DLTC_NO_TABLES
-DLTC_NO_FAST -DLTC_NO_FAST
-DLTC_NO_STRUCT_PADDING
-DLTC_NO_ASM -DLTC_NO_ASM
-DLTC_NO_DEPRECATED_APIS -DLTC_NO_DEPRECATED_APIS
-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_ECC_TIMING_RESISTANT

View file

@ -9454,6 +9454,10 @@ file I/O on embedded platforms.
When this functions is defined the functions that store key material on the stack will clean up afterwards. When this functions is defined the functions that store key material on the stack will clean up afterwards.
Assumes that you have no memory paging with the stack. Assumes that you have no memory paging with the stack.
\subsection{LTC\_NO\_STRUCT\_PADDING}
Per default the library adds padding to some structs, which are likely to be extended sometime in the future, in order
to provide ABI compatibility to previous versions. To trim down struct sizes where possible, define this macro.
\subsection{LTC\_TEST} \subsection{LTC\_TEST}
When this has been defined the various self--test functions (for ciphers, hashes, prngs, etc) are included in the build. This is the default configuration. When this has been defined the various self--test functions (for ciphers, hashes, prngs, etc) are included in the build. This is the default configuration.
If LTC\_NO\_TEST has been defined, the testing routines will be compacted and only return CRYPT\_NOP. If LTC\_NO\_TEST has been defined, the testing routines will be compacted and only return CRYPT\_NOP.

View file

@ -153,6 +153,9 @@
/* clean the stack of functions which put private information on stack */ /* clean the stack of functions which put private information on stack */
/* #define LTC_CLEAN_STACK */ /* #define LTC_CLEAN_STACK */
/* enable this in case you want to disable padding elements in structs */
/* #define LTC_NO_STRUCT_PADDING */
/* disable all file related functions */ /* disable all file related functions */
/* #define LTC_NO_FILE */ /* #define LTC_NO_FILE */

View file

@ -125,8 +125,10 @@ typedef struct ltc_rsa_op_parameters {
const unsigned char *lparam; const unsigned char *lparam;
unsigned long lparamlen; unsigned long lparamlen;
} crypt; } crypt;
#ifndef LTC_NO_STRUCT_PADDING
/* let's make space for potential future extensions */ /* let's make space for potential future extensions */
ulong64 dummy[8]; void* padding[8];
#endif
} u; } u;
} ltc_rsa_op_parameters; } ltc_rsa_op_parameters;