Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
727 changes: 721 additions & 6 deletions doc/crypt.tex

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions libtomcrypt_VS2008.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,10 @@
RelativePath="src\headers\tomcrypt_pkcs.h"
>
</File>
<File
RelativePath="src\headers\tomcrypt_pqc.h"
>
</File>
<File
RelativePath="src\headers\tomcrypt_private.h"
>
Expand Down Expand Up @@ -2812,6 +2816,70 @@
</File>
</Filter>
</Filter>
<Filter
Name="pqc"
>
<File
RelativePath="src\pqc\mldsa.c"
>
</File>
<File
RelativePath="src\pqc\mldsa_export.c"
>
</File>
<File
RelativePath="src\pqc\mldsa_import.c"
>
</File>
<File
RelativePath="src\pqc\mldsa_import_pkcs8.c"
>
</File>
<File
RelativePath="src\pqc\mldsa_import_x509.c"
>
</File>
<File
RelativePath="src\pqc\mlkem.c"
>
</File>
<File
RelativePath="src\pqc\mlkem_export.c"
>
</File>
<File
RelativePath="src\pqc\mlkem_import.c"
>
</File>
<File
RelativePath="src\pqc\mlkem_import_pkcs8.c"
>
</File>
<File
RelativePath="src\pqc\mlkem_import_x509.c"
>
</File>
<File
RelativePath="src\pqc\slhdsa.c"
>
</File>
<File
RelativePath="src\pqc\slhdsa_export.c"
>
</File>
<File
RelativePath="src\pqc\slhdsa_import.c"
>
</File>
<File
RelativePath="src\pqc\slhdsa_import_pkcs8.c"
>
</File>
<File
RelativePath="src\pqc\slhdsa_import_x509.c"
>
</File>
</Filter>
<Filter
Name="prngs"
>
Expand Down
13 changes: 9 additions & 4 deletions makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_set.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_sign_saltlen_get.o src/pk/rsa/rsa_verify_hash.o src/pk/x25519/x25519_export.o \
src/pk/x25519/x25519_import.o src/pk/x25519/x25519_import_pkcs8.o src/pk/x25519/x25519_import_raw.o \
src/pk/x25519/x25519_import_x509.o src/pk/x25519/x25519_make_key.o \
src/pk/x25519/x25519_shared_secret.o src/prngs/chacha20.o src/prngs/fortuna.o src/prngs/rc4.o \
src/pk/x25519/x25519_shared_secret.o src/pqc/mldsa.o src/pqc/mldsa_export.o src/pqc/mldsa_import.o \
src/pqc/mldsa_import_pkcs8.o src/pqc/mldsa_import_x509.o src/pqc/mlkem.o src/pqc/mlkem_export.o \
src/pqc/mlkem_import.o src/pqc/mlkem_import_pkcs8.o src/pqc/mlkem_import_x509.o src/pqc/slhdsa.o \
src/pqc/slhdsa_export.o src/pqc/slhdsa_import.o src/pqc/slhdsa_import_pkcs8.o \
src/pqc/slhdsa_import_x509.o src/prngs/chacha20.o src/prngs/fortuna.o src/prngs/rc4.o \
src/prngs/rng_get_bytes.o src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o \
src/prngs/yarrow.o src/stream/chacha/chacha_crypt.o src/stream/chacha/chacha_done.o \
src/stream/chacha/chacha_ivctr32.o src/stream/chacha/chacha_ivctr64.o \
Expand All @@ -242,15 +246,16 @@ tests/dh_test.o tests/dsa_test.o tests/ecc_test.o tests/ed25519_test.o tests/fil
tests/misc_test.o tests/modes_test.o tests/mpi_test.o tests/multi_test.o \
tests/no_null_termination_check_test.o tests/no_prng.o tests/padding_test.o tests/pem_test.o \
tests/pk_oid_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o tests/pkcs_1_oaep_test.o \
tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o tests/rotate_test.o tests/rsa_test.o \
tests/scrypt_test.o tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o
tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/pqc_mldsa_test.o tests/pqc_mlkem_test.o \
tests/pqc_slhdsa_test.o tests/prng_test.o tests/rotate_test.o tests/rsa_test.o tests/scrypt_test.o \
tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o

#The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
src/headers/tomcrypt_pqc.h src/headers/tomcrypt_prng.h

HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h

Expand Down
13 changes: 9 additions & 4 deletions makefile.msvc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ src/pk/rsa/rsa_make_key.obj src/pk/rsa/rsa_set.obj src/pk/rsa/rsa_sign_hash.obj
src/pk/rsa/rsa_sign_saltlen_get.obj src/pk/rsa/rsa_verify_hash.obj src/pk/x25519/x25519_export.obj \
src/pk/x25519/x25519_import.obj src/pk/x25519/x25519_import_pkcs8.obj src/pk/x25519/x25519_import_raw.obj \
src/pk/x25519/x25519_import_x509.obj src/pk/x25519/x25519_make_key.obj \
src/pk/x25519/x25519_shared_secret.obj src/prngs/chacha20.obj src/prngs/fortuna.obj src/prngs/rc4.obj \
src/pk/x25519/x25519_shared_secret.obj src/pqc/mldsa.obj src/pqc/mldsa_export.obj src/pqc/mldsa_import.obj \
src/pqc/mldsa_import_pkcs8.obj src/pqc/mldsa_import_x509.obj src/pqc/mlkem.obj src/pqc/mlkem_export.obj \
src/pqc/mlkem_import.obj src/pqc/mlkem_import_pkcs8.obj src/pqc/mlkem_import_x509.obj src/pqc/slhdsa.obj \
src/pqc/slhdsa_export.obj src/pqc/slhdsa_import.obj src/pqc/slhdsa_import_pkcs8.obj \
src/pqc/slhdsa_import_x509.obj src/prngs/chacha20.obj src/prngs/fortuna.obj src/prngs/rc4.obj \
src/prngs/rng_get_bytes.obj src/prngs/rng_make_prng.obj src/prngs/sober128.obj src/prngs/sprng.obj \
src/prngs/yarrow.obj src/stream/chacha/chacha_crypt.obj src/stream/chacha/chacha_done.obj \
src/stream/chacha/chacha_ivctr32.obj src/stream/chacha/chacha_ivctr64.obj \
Expand All @@ -235,15 +239,16 @@ tests/dh_test.obj tests/dsa_test.obj tests/ecc_test.obj tests/ed25519_test.obj t
tests/misc_test.obj tests/modes_test.obj tests/mpi_test.obj tests/multi_test.obj \
tests/no_null_termination_check_test.obj tests/no_prng.obj tests/padding_test.obj tests/pem_test.obj \
tests/pk_oid_test.obj tests/pkcs_1_eme_test.obj tests/pkcs_1_emsa_test.obj tests/pkcs_1_oaep_test.obj \
tests/pkcs_1_pss_test.obj tests/pkcs_1_test.obj tests/prng_test.obj tests/rotate_test.obj tests/rsa_test.obj \
tests/scrypt_test.obj tests/ssh_test.obj tests/store_test.obj tests/test.obj tests/x25519_test.obj
tests/pkcs_1_pss_test.obj tests/pkcs_1_test.obj tests/pqc_mldsa_test.obj tests/pqc_mlkem_test.obj \
tests/pqc_slhdsa_test.obj tests/prng_test.obj tests/rotate_test.obj tests/rsa_test.obj tests/scrypt_test.obj \
tests/ssh_test.obj tests/store_test.obj tests/test.obj tests/x25519_test.obj

#The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
src/headers/tomcrypt_pqc.h src/headers/tomcrypt_prng.h

HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h

Expand Down
13 changes: 9 additions & 4 deletions makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_set.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_sign_saltlen_get.o src/pk/rsa/rsa_verify_hash.o src/pk/x25519/x25519_export.o \
src/pk/x25519/x25519_import.o src/pk/x25519/x25519_import_pkcs8.o src/pk/x25519/x25519_import_raw.o \
src/pk/x25519/x25519_import_x509.o src/pk/x25519/x25519_make_key.o \
src/pk/x25519/x25519_shared_secret.o src/prngs/chacha20.o src/prngs/fortuna.o src/prngs/rc4.o \
src/pk/x25519/x25519_shared_secret.o src/pqc/mldsa.o src/pqc/mldsa_export.o src/pqc/mldsa_import.o \
src/pqc/mldsa_import_pkcs8.o src/pqc/mldsa_import_x509.o src/pqc/mlkem.o src/pqc/mlkem_export.o \
src/pqc/mlkem_import.o src/pqc/mlkem_import_pkcs8.o src/pqc/mlkem_import_x509.o src/pqc/slhdsa.o \
src/pqc/slhdsa_export.o src/pqc/slhdsa_import.o src/pqc/slhdsa_import_pkcs8.o \
src/pqc/slhdsa_import_x509.o src/prngs/chacha20.o src/prngs/fortuna.o src/prngs/rc4.o \
src/prngs/rng_get_bytes.o src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o \
src/prngs/yarrow.o src/stream/chacha/chacha_crypt.o src/stream/chacha/chacha_done.o \
src/stream/chacha/chacha_ivctr32.o src/stream/chacha/chacha_ivctr64.o \
Expand All @@ -256,15 +260,16 @@ tests/dh_test.o tests/dsa_test.o tests/ecc_test.o tests/ed25519_test.o tests/fil
tests/misc_test.o tests/modes_test.o tests/mpi_test.o tests/multi_test.o \
tests/no_null_termination_check_test.o tests/no_prng.o tests/padding_test.o tests/pem_test.o \
tests/pk_oid_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o tests/pkcs_1_oaep_test.o \
tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o tests/rotate_test.o tests/rsa_test.o \
tests/scrypt_test.o tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o
tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/pqc_mldsa_test.o tests/pqc_mlkem_test.o \
tests/pqc_slhdsa_test.o tests/prng_test.o tests/rotate_test.o tests/rsa_test.o tests/scrypt_test.o \
tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o

#The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
src/headers/tomcrypt_pqc.h src/headers/tomcrypt_prng.h

HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h

Expand Down
13 changes: 9 additions & 4 deletions makefile_include.mk
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@ src/pk/rsa/rsa_make_key.o src/pk/rsa/rsa_set.o src/pk/rsa/rsa_sign_hash.o \
src/pk/rsa/rsa_sign_saltlen_get.o src/pk/rsa/rsa_verify_hash.o src/pk/x25519/x25519_export.o \
src/pk/x25519/x25519_import.o src/pk/x25519/x25519_import_pkcs8.o src/pk/x25519/x25519_import_raw.o \
src/pk/x25519/x25519_import_x509.o src/pk/x25519/x25519_make_key.o \
src/pk/x25519/x25519_shared_secret.o src/prngs/chacha20.o src/prngs/fortuna.o src/prngs/rc4.o \
src/pk/x25519/x25519_shared_secret.o src/pqc/mldsa.o src/pqc/mldsa_export.o src/pqc/mldsa_import.o \
src/pqc/mldsa_import_pkcs8.o src/pqc/mldsa_import_x509.o src/pqc/mlkem.o src/pqc/mlkem_export.o \
src/pqc/mlkem_import.o src/pqc/mlkem_import_pkcs8.o src/pqc/mlkem_import_x509.o src/pqc/slhdsa.o \
src/pqc/slhdsa_export.o src/pqc/slhdsa_import.o src/pqc/slhdsa_import_pkcs8.o \
src/pqc/slhdsa_import_x509.o src/prngs/chacha20.o src/prngs/fortuna.o src/prngs/rc4.o \
src/prngs/rng_get_bytes.o src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o \
src/prngs/yarrow.o src/stream/chacha/chacha_crypt.o src/stream/chacha/chacha_done.o \
src/stream/chacha/chacha_ivctr32.o src/stream/chacha/chacha_ivctr64.o \
Expand Down Expand Up @@ -432,15 +436,16 @@ tests/dh_test.o tests/dsa_test.o tests/ecc_test.o tests/ed25519_test.o tests/fil
tests/misc_test.o tests/modes_test.o tests/mpi_test.o tests/multi_test.o \
tests/no_null_termination_check_test.o tests/no_prng.o tests/padding_test.o tests/pem_test.o \
tests/pk_oid_test.o tests/pkcs_1_eme_test.o tests/pkcs_1_emsa_test.o tests/pkcs_1_oaep_test.o \
tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_test.o tests/rotate_test.o tests/rsa_test.o \
tests/scrypt_test.o tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o
tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/pqc_mldsa_test.o tests/pqc_mlkem_test.o \
tests/pqc_slhdsa_test.o tests/prng_test.o tests/rotate_test.o tests/rsa_test.o tests/scrypt_test.o \
tests/ssh_test.o tests/store_test.o tests/test.o tests/x25519_test.o

# The following headers will be installed by "make install"
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
src/headers/tomcrypt_pqc.h src/headers/tomcrypt_prng.h

HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h

Expand Down
17 changes: 17 additions & 0 deletions sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ src/headers/tomcrypt_math.h
src/headers/tomcrypt_misc.h
src/headers/tomcrypt_pk.h
src/headers/tomcrypt_pkcs.h
src/headers/tomcrypt_pqc.h
src/headers/tomcrypt_private.h
src/headers/tomcrypt_prng.h
src/mac/blake2/blake2bmac.c
Expand Down Expand Up @@ -496,6 +497,21 @@ src/pk/x25519/x25519_import_raw.c
src/pk/x25519/x25519_import_x509.c
src/pk/x25519/x25519_make_key.c
src/pk/x25519/x25519_shared_secret.c
src/pqc/mldsa.c
src/pqc/mldsa_export.c
src/pqc/mldsa_import.c
src/pqc/mldsa_import_pkcs8.c
src/pqc/mldsa_import_x509.c
src/pqc/mlkem.c
src/pqc/mlkem_export.c
src/pqc/mlkem_import.c
src/pqc/mlkem_import_pkcs8.c
src/pqc/mlkem_import_x509.c
src/pqc/slhdsa.c
src/pqc/slhdsa_export.c
src/pqc/slhdsa_import.c
src/pqc/slhdsa_import_pkcs8.c
src/pqc/slhdsa_import_x509.c
src/prngs/chacha20.c
src/prngs/fortuna.c
src/prngs/rc4.c
Expand Down Expand Up @@ -549,6 +565,7 @@ src/headers/tomcrypt_math.h
src/headers/tomcrypt_misc.h
src/headers/tomcrypt_pk.h
src/headers/tomcrypt_pkcs.h
src/headers/tomcrypt_pqc.h
src/headers/tomcrypt_prng.h
)

Expand Down
1 change: 1 addition & 0 deletions src/headers/tomcrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ enum {
#include "tomcrypt_mac.h"
#include "tomcrypt_prng.h"
#include "tomcrypt_pk.h"
#include "tomcrypt_pqc.h"
#include "tomcrypt_math.h"
#include "tomcrypt_misc.h"
#include "tomcrypt_argchk.h"
Expand Down
5 changes: 5 additions & 0 deletions src/headers/tomcrypt_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@
/* Ed25519 & X25519 */
#define LTC_CURVE25519

/* Post-Quantum Cryptography */
#define LTC_MLKEM
#define LTC_MLDSA
#define LTC_SLHDSA

/* ECC */
#define LTC_MECC

Expand Down
33 changes: 33 additions & 0 deletions src/headers/tomcrypt_pk.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ enum ltc_pka_id {
LTC_PKA_EC,
LTC_PKA_X25519,
LTC_PKA_ED25519,
LTC_PKA_MLDSA,
LTC_PKA_SLHDSA,
LTC_PKA_MLKEM,
LTC_PKA_DH,
LTC_PKA_NUM
};
Expand Down Expand Up @@ -639,6 +642,36 @@ typedef struct {
#endif
#ifdef LTC_MRSA
rsa_key rsa;
#endif
#ifdef LTC_MLKEM
struct {
int alg;
int type;
unsigned char *pk;
unsigned long pklen;
unsigned char *sk;
unsigned long sklen;
} mlkem;
#endif
#ifdef LTC_MLDSA
struct {
int alg;
int type;
unsigned char *pk;
unsigned long pklen;
unsigned char *sk;
unsigned long sklen;
} mldsa;
#endif
#ifdef LTC_SLHDSA
struct {
int alg;
int type;
unsigned char *pk;
unsigned long pklen;
unsigned char *sk;
unsigned long sklen;
} slhdsa;
#endif
char dummy;
} u;
Expand Down
Loading
Loading