Skip to content

Commit

Permalink
[crypto] Extract X509 functions for mbedTLS and PSA
Browse files Browse the repository at this point in the history
PSA crypto backend uses mbedTLS API to implement functions
for certificate generation and parsing, so the functions
are duplicated between PSA and mbedTLS backends.

Extract the functions to reduce the code duplication.
  • Loading branch information
Damian-Nordic committed Sep 28, 2023
1 parent aedf2d5 commit 6673bc5
Show file tree
Hide file tree
Showing 5 changed files with 1,163 additions and 2,137 deletions.
12 changes: 9 additions & 3 deletions src/crypto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ if (chip_crypto == "openssl") {
import("//build_overrides/mbedtls.gni")

source_set("cryptopal_mbedtls") {
sources = [ "CHIPCryptoPALmbedTLS.cpp" ]
sources = [
"CHIPCryptoPALmbedTLS.cpp",
"CHIPCryptoPALmbedTLSCert.cpp",
"CHIPCryptoPALmbedTLS.h",
]
public_deps = [ ":public_headers" ]

if (!chip_external_mbedtls) {
Expand All @@ -112,10 +116,10 @@ if (chip_crypto == "openssl") {

source_set("cryptopal_psa") {
sources = [
"CHIPCryptoPALmbedTLSCert.cpp",
"CHIPCryptoPALmbedTLS.h",
"CHIPCryptoPALPSA.cpp",
"CHIPCryptoPALPSA.h",
"PSAOperationalKeystore.cpp",
"PSAOperationalKeystore.h",
]
public_deps = [ ":public_headers" ]

Expand All @@ -139,6 +143,8 @@ static_library("crypto") {

if (chip_crypto == "psa") {
sources += [
"PSAOperationalKeystore.cpp",
"PSAOperationalKeystore.h",
"PSASessionKeystore.cpp",
"PSASessionKeystore.h",
]
Expand Down
Loading

0 comments on commit 6673bc5

Please sign in to comment.