Skip to content

Commit

Permalink
build(core): add ML-KEM
Browse files Browse the repository at this point in the history
  • Loading branch information
onvej-sl committed Feb 20, 2025
1 parent 7856bd4 commit 2181bb1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/SConscript.firmware
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ SOURCE_MOD_CRYPTO += [
'vendor/trezor-crypto/slip39_english.c',
'vendor/trezor-crypto/tls_prf.c',
]
SOURCE_MOD_MLKEM = [
'vendor/mlkem-native/mlkem/compress.c',
'vendor/mlkem-native/mlkem/indcpa.c',
'vendor/mlkem-native/mlkem/kem.c',
'vendor/mlkem-native/mlkem/poly.c',
'vendor/mlkem-native/mlkem/poly_k.c',
'vendor/mlkem-native/mlkem/sampling.c',
'vendor/mlkem-native/mlkem/verify.c',
'vendor/mlkem-native/mlkem/fips202/fips202.c',
'vendor/mlkem-native/mlkem/fips202/fips202x4.c',
'vendor/mlkem-native/mlkem/fips202/keccakf1600.c',
'vendor/trezor-crypto/mlkem.c',
]
if EVERYTHING:
SOURCE_MOD_CRYPTO += [
'vendor/trezor-crypto/cardano.c',
Expand Down Expand Up @@ -718,6 +731,7 @@ obj_program.extend(env.Object(source=SOURCE_FIRMWARE))
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON))
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON_SPEED, COPT='-O3'))
obj_program.extend(env.Object(source=SOURCE_HAL))
obj_program.extend(env.Object(source=SOURCE_MOD_MLKEM))
if FROZEN:
obj_program.extend(env.Object(source=source_mpyc))

Expand Down
14 changes: 14 additions & 0 deletions core/SConscript.unix
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ if FEATURE_FLAGS["SECP256K1_ZKP"]:
'vendor/trezor-crypto/zkp_ecdsa.c',
'vendor/trezor-crypto/zkp_bip340.c',
]
SOURCE_MOD_MLKEM = [
'vendor/mlkem-native/mlkem/compress.c',
'vendor/mlkem-native/mlkem/indcpa.c',
'vendor/mlkem-native/mlkem/kem.c',
'vendor/mlkem-native/mlkem/poly.c',
'vendor/mlkem-native/mlkem/poly_k.c',
'vendor/mlkem-native/mlkem/sampling.c',
'vendor/mlkem-native/mlkem/verify.c',
'vendor/mlkem-native/mlkem/fips202/fips202.c',
'vendor/mlkem-native/mlkem/fips202/fips202x4.c',
'vendor/mlkem-native/mlkem/fips202/keccakf1600.c',
'vendor/trezor-crypto/mlkem.c',
]

# AES-GCM
if FEATURE_FLAGS["AES_GCM"]:
Expand Down Expand Up @@ -778,6 +791,7 @@ if FEATURE_FLAGS["SECP256K1_ZKP"]:
source_files.extend(SOURCE_MOD_SECP256K1_ZKP)
obj_program.extend(env.Object(source=SOURCE_MICROPYTHON))
obj_program.extend(env.Object(source=SOURCE_UNIX))
obj_program.extend(env.Object(source=SOURCE_MOD_MLKEM, CCFLAGS='$CCFLAGS'))
if FROZEN:
obj_program.extend(env.Object(source=source_mpyc))

Expand Down
1 change: 1 addition & 0 deletions core/vendor/mlkem-native

0 comments on commit 2181bb1

Please sign in to comment.