Skip to content

Commit e3b0cc0

Browse files
[crypto] Extract common X509 functions for mbedTLS and PSA (project-chip#29484)
* [crypto] Extract X509 functions for mbedTLS and PSA 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. * Restyled by whitespace * Restyled by gn * Code review --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 1e03c08 commit e3b0cc0

5 files changed

+1163
-2163
lines changed

src/crypto/BUILD.gn

+9-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ if (chip_crypto == "openssl") {
100100
import("//build_overrides/mbedtls.gni")
101101

102102
source_set("cryptopal_mbedtls") {
103-
sources = [ "CHIPCryptoPALmbedTLS.cpp" ]
103+
sources = [
104+
"CHIPCryptoPALmbedTLS.cpp",
105+
"CHIPCryptoPALmbedTLS.h",
106+
"CHIPCryptoPALmbedTLSCert.cpp",
107+
]
104108
public_deps = [ ":public_headers" ]
105109

106110
if (!chip_external_mbedtls) {
@@ -114,8 +118,8 @@ if (chip_crypto == "openssl") {
114118
sources = [
115119
"CHIPCryptoPALPSA.cpp",
116120
"CHIPCryptoPALPSA.h",
117-
"PSAOperationalKeystore.cpp",
118-
"PSAOperationalKeystore.h",
121+
"CHIPCryptoPALmbedTLS.h",
122+
"CHIPCryptoPALmbedTLSCert.cpp",
119123
]
120124
public_deps = [ ":public_headers" ]
121125

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

140144
if (chip_crypto == "psa") {
141145
sources += [
146+
"PSAOperationalKeystore.cpp",
147+
"PSAOperationalKeystore.h",
142148
"PSASessionKeystore.cpp",
143149
"PSASessionKeystore.h",
144150
]

0 commit comments

Comments
 (0)