Initial mapping of brand configs to keys

This will excise the key-mgmt config from the current platform configs
and eventually remove the need to proxy key-id mappings through firmware
signing back through to the signer.

Specifically, this will obsolete:
key-id in cros_config schema
DeviceSignerConfig (which proxies through to key-id)

BUG=None
TEST=None

Change-Id: I952ffbb870c7997740423e66efe06d658e280456
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/2414630
Tested-by: C Shapiro <shapiroc@chromium.org>
Reviewed-by: Andrew Lamb <andrewlamb@chromium.org>
Commit-Queue: C Shapiro <shapiroc@chromium.org>
Auto-Submit: C Shapiro <shapiroc@chromium.org>
diff --git a/go/prototype/design_project.pb.go b/go/prototype/design_project.pb.go
index 7a7f444..300e4d6 100644
--- a/go/prototype/design_project.pb.go
+++ b/go/prototype/design_project.pb.go
@@ -37,7 +37,9 @@
 	// Defines config needed to maintain firmware builders for the project.
 	FirmwareConfig *DesignProject_FirmwareConfig `protobuf:"bytes,6,opt,name=firmware_config,json=firmwareConfig,proto3" json:"firmware_config,omitempty"`
 	// Define factory build config needed for manufacturing verification.
-	FactoryConfig        *DesignProject_FactoryConfig `protobuf:"bytes,7,opt,name=factory_config,json=factoryConfig,proto3" json:"factory_config,omitempty"`
+	FactoryConfig *DesignProject_FactoryConfig `protobuf:"bytes,7,opt,name=factory_config,json=factoryConfig,proto3" json:"factory_config,omitempty"`
+	// Defines signing config unique to the given design project.
+	SigningConfig        *DesignProject_SigningConfig `protobuf:"bytes,8,opt,name=signing_config,json=signingConfig,proto3" json:"signing_config,omitempty"`
 	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
 	XXX_unrecognized     []byte                       `json:"-"`
 	XXX_sizecache        int32                        `json:"-"`
@@ -117,6 +119,13 @@
 	return nil
 }
 
+func (m *DesignProject) GetSigningConfig() *DesignProject_SigningConfig {
+	if m != nil {
+		return m.SigningConfig
+	}
+	return nil
+}
+
 type DesignProject_FirmwareConfig struct {
 	// Defines the firmware branch that will be maintained for the project.
 	FirmwareBranch       string   `protobuf:"bytes,1,opt,name=firmware_branch,json=firmwareBranch,proto3" json:"firmware_branch,omitempty"`
@@ -215,35 +224,88 @@
 	return ""
 }
 
+type DesignProject_SigningConfig struct {
+	// Key names have taken historically followed many different patterns.
+	// To support all of the cases, this defines an explicit mapping between the
+	// supported brands and corresponding keys present in the respective
+	// keysets.
+	// Going forward, this could be standardized, removing the need for the
+	// explict mapping, but this will be required for the foreseeable future.
+	BrandIdToKey         map[string]string `protobuf:"bytes,1,rep,name=brand_id_to_key,json=brandIdToKey,proto3" json:"brand_id_to_key,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
+	XXX_unrecognized     []byte            `json:"-"`
+	XXX_sizecache        int32             `json:"-"`
+}
+
+func (m *DesignProject_SigningConfig) Reset()         { *m = DesignProject_SigningConfig{} }
+func (m *DesignProject_SigningConfig) String() string { return proto.CompactTextString(m) }
+func (*DesignProject_SigningConfig) ProtoMessage()    {}
+func (*DesignProject_SigningConfig) Descriptor() ([]byte, []int) {
+	return fileDescriptor_f430eea6a6b81e0b, []int{0, 2}
+}
+
+func (m *DesignProject_SigningConfig) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_DesignProject_SigningConfig.Unmarshal(m, b)
+}
+func (m *DesignProject_SigningConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_DesignProject_SigningConfig.Marshal(b, m, deterministic)
+}
+func (m *DesignProject_SigningConfig) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_DesignProject_SigningConfig.Merge(m, src)
+}
+func (m *DesignProject_SigningConfig) XXX_Size() int {
+	return xxx_messageInfo_DesignProject_SigningConfig.Size(m)
+}
+func (m *DesignProject_SigningConfig) XXX_DiscardUnknown() {
+	xxx_messageInfo_DesignProject_SigningConfig.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_DesignProject_SigningConfig proto.InternalMessageInfo
+
+func (m *DesignProject_SigningConfig) GetBrandIdToKey() map[string]string {
+	if m != nil {
+		return m.BrandIdToKey
+	}
+	return nil
+}
+
 func init() {
 	proto.RegisterType((*DesignProject)(nil), "prototype.DesignProject")
 	proto.RegisterType((*DesignProject_FirmwareConfig)(nil), "prototype.DesignProject.FirmwareConfig")
 	proto.RegisterType((*DesignProject_FactoryConfig)(nil), "prototype.DesignProject.FactoryConfig")
+	proto.RegisterType((*DesignProject_SigningConfig)(nil), "prototype.DesignProject.SigningConfig")
+	proto.RegisterMapType((map[string]string)(nil), "prototype.DesignProject.SigningConfig.BrandIdToKeyEntry")
 }
 
 func init() { proto.RegisterFile("prototype/design_project.proto", fileDescriptor_f430eea6a6b81e0b) }
 
 var fileDescriptor_f430eea6a6b81e0b = []byte{
-	// 332 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x41, 0x4f, 0xc2, 0x40,
-	0x10, 0x85, 0x83, 0x20, 0xca, 0x10, 0x2a, 0xd9, 0x53, 0x83, 0x89, 0x12, 0x13, 0x85, 0x83, 0x69,
-	0x13, 0x89, 0x07, 0xaf, 0x68, 0xbc, 0x18, 0x12, 0xc2, 0xd1, 0x4b, 0x5d, 0xca, 0xee, 0x76, 0x25,
-	0xed, 0x36, 0xdb, 0x25, 0xa4, 0x3f, 0xd7, 0x7f, 0x62, 0x3a, 0xbb, 0xad, 0xf4, 0xe0, 0x6d, 0xe6,
-	0xbd, 0xaf, 0x6f, 0x66, 0xba, 0x70, 0x93, 0x6b, 0x65, 0x94, 0x29, 0x73, 0x16, 0xee, 0x58, 0x21,
-	0x45, 0x16, 0xe5, 0x5a, 0x7d, 0xb3, 0xd8, 0x04, 0x68, 0x90, 0x41, 0xe3, 0xdf, 0xfd, 0x74, 0x61,
-	0xf4, 0x86, 0xcc, 0xda, 0x22, 0x84, 0x40, 0x2f, 0xa3, 0x29, 0xf3, 0x3b, 0xd3,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82, 0x38, 0xd1, 0x2a, 0x95, 0x87, 0x34, 0x50, 0x5a, 0x84, 0x75, 0xa3, 0x8a, 0x50,
-	0x66, 0x5c, 0xd3, 0x10, 0xaf, 0x0e, 0x85, 0x0a, 0x9b, 0xf3, 0xb7, 0x7d, 0x2c, 0x17, 0xbf, 0x01,
-	0x00, 0x00, 0xff, 0xff, 0x9a, 0x79, 0x10, 0x90, 0x4e, 0x02, 0x00, 0x00,
+	// 432 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4d, 0x8b, 0xd4, 0x30,
+	0x1c, 0xc6, 0xe9, 0xce, 0xce, 0xba, 0xf3, 0x1f, 0x67, 0x76, 0x0c, 0x1e, 0x4a, 0x05, 0x1d, 0x04,
+	0xdd, 0x1e, 0xa4, 0x85, 0x5d, 0x84, 0xd5, 0x8b, 0x30, 0xbe, 0x80, 0x2c, 0x0b, 0xc3, 0xe8, 0xc9,
+	0x4b, 0x4c, 0xdb, 0x34, 0x8d, 0x6b, 0x93, 0x92, 0x66, 0x1c, 0xfa, 0xb1, 0xfc, 0x4e, 0x7e, 0x10,
+	0x49, 0xd2, 0xd6, 0x16, 0x11, 0xf7, 0xf6, 0x7f, 0xf9, 0xe5, 0xc9, 0xf3, 0x34, 0x85, 0xc7, 0x95,
+	0x92, 0x5a, 0xea, 0xa6, 0xa2, 0x71, 0x46, 0x6b, 0xce, 0x04, 0xae, 0x94, 0xfc, 0x46, 0x53, 0x1d,
+	0xd9, 0x05, 0x9a, 0xf5, 0xfb, 0xa7, 0xbf, 0xa6, 0xb0, 0x78, 0x67, 0x99, 0xad, 0x43, 0x10, 0x82,
+	0x63, 0x41, 0x4a, 0xea, 0x7b, 0x6b, 0x2f, 0x9c, 0xed, 0x6c, 0x6d, 0x66, 0x8a, 0x56, 0xd2, 0x3f,
+	0x72, 0x33, 0x53, 0xa3, 0x27, 0x30, 0x4f, 0x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, 0xc1, 0x4f, 0x0f, 0x16, 0x23, 0xf7,
+	0x08, 0xc3, 0x99, 0x91, 0xce, 0x30, 0xcf, 0xb0, 0x96, 0xf6, 0xa8, 0xb7, 0x9e, 0x84, 0xf3, 0x8b,
+	0xab, 0xbb, 0xc5, 0x8f, 0x8c, 0x87, 0xec, 0x63, 0xf6, 0x59, 0x5e, 0xd3, 0xe6, 0xbd, 0xd0, 0xaa,
+	0xd9, 0xdd, 0x4f, 0x06, 0xa3, 0xe0, 0x0d, 0x3c, 0xf8, 0x0b, 0x41, 0x2b, 0x98, 0xb8, 0x9b, 0x8c,
+	0x49, 0x53, 0xa2, 0x87, 0x30, 0xfd, 0x41, 0xbe, 0xef, 0x69, 0x6b, 0xdc, 0x35, 0xaf, 0x8f, 0xae,
+	0xbc, 0xcd, 0xcb, 0x2f, 0x97, 0x4c, 0x46, 0x69, 0xa1, 0x64, 0xc9, 0xf7, 0x65, 0x24, 0x15, 0x8b,
+	0xbb, 0x46, 0xd6, 0x31, 0x17, 0xb9, 0x22, 0xb1, 0xb5, 0x1a, 0x33, 0x19, 0xf7, 0x9e, 0x93, 0x13,
+	0x5b, 0x5e, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x01, 0x80, 0x9b, 0xd8, 0x51, 0x03, 0x00, 0x00,
 }
diff --git a/src/prototype/design_project.proto b/src/prototype/design_project.proto
index f4f5384..534e2fc 100644
--- a/src/prototype/design_project.proto
+++ b/src/prototype/design_project.proto
@@ -29,6 +29,9 @@
   // Define factory build config needed for manufacturing verification.
   FactoryConfig factory_config = 7;
 
+  // Defines signing config unique to the given design project.
+  SigningConfig signing_config = 8;
+
   message FirmwareConfig {
     // Defines the firmware branch that will be maintained for the project.
     string firmware_branch = 1;
@@ -50,4 +53,14 @@
     // project_key should be 'MILKYWAY'. The matching is case-insensitive.
     string hwid_project_key = 2;
   }
+
+  message SigningConfig {
+    // Key names have taken historically followed many different patterns.
+    // To support all of the cases, this defines an explicit mapping between the
+    // supported brands and corresponding keys present in the respective
+    // keysets.
+    // Going forward, this could be standardized, removing the need for the
+    // explict mapping, but this will be required for the foreseeable future.
+    map<string, string> brand_id_to_key = 1;
+  }
 }