Skip to content

Commit

Permalink
[Silabs] PSA Crypto PAL customized for EFR32.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasallas-silabs committed Nov 20, 2024
1 parent c197bc2 commit fdb3e6b
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 131 deletions.
5 changes: 3 additions & 2 deletions src/crypto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ buildconfig_header("crypto_buildconfig") {
"CHIP_CRYPTO_MBEDTLS=${chip_crypto_mbedtls}",
"CHIP_CRYPTO_PSA=${chip_crypto_psa}",
"CHIP_CRYPTO_PSA_SPAKE2P=${chip_crypto_psa_spake2p}",
"CHIP_CRYPTO_PSA_CUSTOM=${chip_crypto_psa_custom}",
"CHIP_CRYPTO_OPENSSL=${chip_crypto_openssl}",
"CHIP_CRYPTO_BORINGSSL=${chip_crypto_boringssl}",
"CHIP_CRYPTO_PLATFORM=${chip_crypto_platform}",
Expand Down Expand Up @@ -144,14 +145,14 @@ static_library("crypto") {
"RandUtils.h",
]

if (chip_crypto == "psa") {
if (chip_crypto == "psa" || chip_crypto_psa_custom) {
sources += [
"PSAOperationalKeystore.cpp",
"PSAOperationalKeystore.h",
"PSASessionKeystore.cpp",
"PSASessionKeystore.h",
]
} else {
} else if (!chip_crypto_psa_custom) {
sources += [
"RawKeySessionKeystore.cpp",
"RawKeySessionKeystore.h",
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/DefaultSessionKeystore.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <crypto/CryptoBuildConfig.h>
#endif

#if CHIP_CRYPTO_PSA
#if CHIP_CRYPTO_PSA || CHIP_CRYPTO_PSA_CUSTOM
#include <crypto/PSASessionKeystore.h>
#else
#include <crypto/RawKeySessionKeystore.h>
Expand All @@ -34,7 +34,7 @@ namespace Crypto {
// when the PSA crypto backend is used, AES encryption/decryption function assume that the input
// key handle carries a key reference instead of raw key material, so PSASessionKeystore must be
// used instead of RawKeySessionKeystore to initialize the key handle.
#if CHIP_CRYPTO_PSA
#if CHIP_CRYPTO_PSA || CHIP_CRYPTO_PSA_CUSTOM
using DefaultSessionKeystore = PSASessionKeystore;
#else
using DefaultSessionKeystore = RawKeySessionKeystore;
Expand Down
3 changes: 3 additions & 0 deletions src/crypto/crypto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ declare_args() {

# Use PSA Spake2+ implementation. Only used if chip_crypto == "psa"
chip_crypto_psa_spake2p = false

# Use custom PSA crypto.
chip_crypto_psa_custom = false
}

assert(
Expand Down
Loading

0 comments on commit fdb3e6b

Please sign in to comment.