This also adds a note about the potential limitation of the signature
formats, depending on the tailoring.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
It is already nearly independent of `LTC_DER`, so simply `#ifdef` that
code path instead of multiplying the APIs by the number of signature
formats.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
Instead of wrongfully always returning OK, return the real error code.
This was uncovered by the amalgamation via the warning:
```
pre_gen/tomcrypt_amalgam.c: In function ‘der_decode_custom_type_ex’:
pre_gen/tomcrypt_amalgam.c:49820:10: warning: ‘*(unsigned int *)((char *)&ident + offsetof(ltc_asn1_list, type))’ may be used uninitialized [-Wmaybe-uninitialized]
49820 | if ((ident.type != root->type) ||
| ^
pre_gen/tomcrypt_amalgam.c:49780:18: note: ‘*(unsigned int *)((char *)&ident + offsetof(ltc_asn1_list, type))’ was declared here
49780 | ltc_asn1_list ident;
| ^~~~~
```
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
```
pre_gen/tomcrypt_amalgam.c: In function ‘pkcs_1_oaep_encode’:
pre_gen/tomcrypt_amalgam.c:64485:18: warning: ‘DB’ may be used uninitialized [-Wmaybe-uninitialized]
64485 | if ((err = hash_memory(lparam_hash_used, DB, 0, DB, &x)) != CRYPT_OK) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pre_gen/tomcrypt_amalgam.c:22613:5: note: by argument 2 of type ‘const unsigned char *’ to ‘hash_memory’ declared here
22613 | int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
| ^~~~~~~~~~~
```
Use `out` instead of `DB`, since `out` is `LTC_ARGCHK`'ed.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
contrib/libtomcrypt.cmake is a snippet that can be used by any CMake
based project that wants to link with libtomcrypt, no matter if it
was installed with libtomcrypt-config.cmake or libtomcrypt.pc.
Fixes#681
This ensures that va_list, which is used in that file, gets properly
declared.
As a consequence, the following pattern in other files can be reduced:
#include "tomcrypt_private.h"
#include <stdarg.h>
Fixes#679
* Rename `siv_{en,de}crypt()` to `siv_{en,de}crypt_memory()`.
* The number of AAD components per SIV operation must not exceed 126.
* Init OMAC only once per SIV operation.
All OMAC operations start off with the same key. Instead of
re-initializing the OMAC context for each operation, init once and
store the context.
* Add SIV to timing demo.
* Add 1000-times-encrypt-then-decrypt test for SIV.
* Update docs.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>