Skip to content

Commit d314657

Browse files
committed
add check in the builder regarding the usage of "build.keys.type" properties
1 parent fcbe6d5 commit d314657

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

legacy/builder/setup_build_properties.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/arduino/arduino-cli/legacy/builder/types"
2727
properties "github.com/arduino/go-properties-orderedmap"
2828
timeutils "github.com/arduino/go-timeutils"
29+
"github.com/pkg/errors"
2930
)
3031

3132
type SetupBuildProperties struct{}
@@ -126,6 +127,17 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
126127

127128
buildProperties.Merge(ctx.PackageManager.CustomGlobalProperties)
128129

130+
// we check if the properties referring to secure boot have been set correctly.
131+
if buildProperties.ContainsKey("build.keys.type") {
132+
if buildProperties.Get("build.keys.type") == "public_keys" {
133+
if !buildProperties.ContainsKey("build.keys.keychain") || !buildProperties.ContainsKey("build.keys.sign_key") || !buildProperties.ContainsKey("build.keys.encrypt_key") {
134+
return errors.Errorf("%s core does not specify correctly default sign and encryption keys", ctx.BuildCore)
135+
}
136+
} else {
137+
return errors.New("\"build.keys.type\" key only supports \"public_keys\" value for now")
138+
}
139+
}
140+
129141
ctx.BuildProperties = buildProperties
130142

131143
return nil

0 commit comments

Comments
 (0)