@@ -12,6 +12,7 @@ fn main() {
1212 let sig_rsa = env:: var ( "CARGO_FEATURE_SIG_RSA" ) . is_ok ( ) ;
1313 let sig_rsa3072 = env:: var ( "CARGO_FEATURE_SIG_RSA3072" ) . is_ok ( ) ;
1414 let sig_ecdsa = env:: var ( "CARGO_FEATURE_SIG_ECDSA" ) . is_ok ( ) ;
15+ let sig_ed25519 = env:: var ( "CARGO_FEATURE_SIG_ED25519" ) . is_ok ( ) ;
1516 let overwrite_only = env:: var ( "CARGO_FEATURE_OVERWRITE_ONLY" ) . is_ok ( ) ;
1617 let validate_primary_slot =
1718 env:: var ( "CARGO_FEATURE_VALIDATE_PRIMARY_SLOT" ) . is_ok ( ) ;
@@ -37,7 +38,7 @@ fn main() {
3738 }
3839
3940 // Currently no more than one sig type can be used simultaneously.
40- if vec ! [ sig_rsa, sig_rsa3072, sig_ecdsa] . iter ( )
41+ if vec ! [ sig_rsa, sig_rsa3072, sig_ecdsa, sig_ed25519 ] . iter ( )
4142 . fold ( 0 , |sum, & v| sum + v as i32 ) > 1 {
4243 panic ! ( "mcuboot does not support more than one sig type at the same time" ) ;
4344 }
@@ -83,6 +84,18 @@ fn main() {
8384
8485 conf. file ( "../../ext/mbedtls/src/platform_util.c" ) ;
8586 conf. file ( "../../ext/mbedtls/src/asn1parse.c" ) ;
87+ } else if sig_ed25519 {
88+ conf. define ( "MCUBOOT_SIGN_ED25519" , None ) ;
89+ conf. define ( "MCUBOOT_USE_MBED_TLS" , None ) ;
90+
91+ conf. include ( "mbedtls/include" ) ;
92+ conf. file ( "mbedtls/library/sha256.c" ) ;
93+ conf. file ( "mbedtls/library/sha512.c" ) ;
94+ conf. file ( "csupport/keys.c" ) ;
95+ conf. file ( "../../ext/fiat/src/curve25519.c" ) ;
96+ conf. file ( "mbedtls/library/platform.c" ) ;
97+ conf. file ( "mbedtls/library/platform_util.c" ) ;
98+ conf. file ( "mbedtls/library/asn1parse.c" ) ;
8699 } else {
87100 // Neither signature type, only verify sha256. The default
88101 // configuration file bundled with mbedTLS is sufficient.
@@ -148,6 +161,10 @@ fn main() {
148161 conf. file ( "../../ext/tinycrypt/lib/source/aes_encrypt.c" ) ;
149162 conf. file ( "../../ext/tinycrypt/lib/source/aes_decrypt.c" ) ;
150163 }
164+
165+ if sig_ed25519 {
166+ panic ! ( "ed25519 does not support image encryption with KW yet" ) ;
167+ }
151168 }
152169
153170 if sig_rsa && enc_kw {
@@ -156,6 +173,8 @@ fn main() {
156173 conf. define ( "MBEDTLS_CONFIG_FILE" , Some ( "<config-rsa.h>" ) ) ;
157174 } else if sig_ecdsa && !enc_kw {
158175 conf. define ( "MBEDTLS_CONFIG_FILE" , Some ( "<config-asn1.h>" ) ) ;
176+ } else if sig_ed25519 {
177+ conf. define ( "MBEDTLS_CONFIG_FILE" , Some ( "<config-ed25519.h>" ) ) ;
159178 } else if enc_kw {
160179 conf. define ( "MBEDTLS_CONFIG_FILE" , Some ( "<config-kw.h>" ) ) ;
161180 }
@@ -165,6 +184,8 @@ fn main() {
165184 conf. file ( "../../boot/bootutil/src/image_rsa.c" ) ;
166185 } else if sig_ecdsa {
167186 conf. file ( "../../boot/bootutil/src/image_ec256.c" ) ;
187+ } else if sig_ed25519 {
188+ conf. file ( "../../boot/bootutil/src/image_ed25519.c" ) ;
168189 }
169190 conf. file ( "../../boot/bootutil/src/loader.c" ) ;
170191 conf. file ( "../../boot/bootutil/src/caps.c" ) ;
0 commit comments