Skip to content

Commit

Permalink
[crypto] Extract common X509 functions for mbedTLS and PSA (project-c…
Browse files Browse the repository at this point in the history
…hip#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 <[email protected]>
  • Loading branch information
Damian-Nordic and restyled-commits authored Oct 2, 2023
1 parent 1e03c08 commit e3b0cc0
Show file tree
Hide file tree
Showing 5 changed files with 1,163 additions and 2,163 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",
"CHIPCryptoPALmbedTLS.h",
"CHIPCryptoPALmbedTLSCert.cpp",
]
public_deps = [ ":public_headers" ]

if (!chip_external_mbedtls) {
Expand All @@ -114,8 +118,8 @@ if (chip_crypto == "openssl") {
sources = [
"CHIPCryptoPALPSA.cpp",
"CHIPCryptoPALPSA.h",
"PSAOperationalKeystore.cpp",
"PSAOperationalKeystore.h",
"CHIPCryptoPALmbedTLS.h",
"CHIPCryptoPALmbedTLSCert.cpp",
]
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 e3b0cc0

Please sign in to comment.