Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests,pa,spm] add/fix configurations to enable running integration tests #26

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions config/dev/spm/sku_auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

skuAuthCfgList:
"tpm_1":
# bcrypt hash of "test_password" (used by .../pa/loadtest.go)
skuAuth: "$2a$10$7ZjR5zTQpig.aomnunzte.Ve1eW4GT2ACx1iy4fxtfzysprfrNMfG"
methods: ["password"]
1 change: 0 additions & 1 deletion config/dev/spm/sku_tpm_1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ keyWrapConfig:
name: 1
hash: 2
rootCAPath: certs/NuvotonTPMRootCA0200.cer

2 changes: 1 addition & 1 deletion src/pa/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
testSKUName = "tpm_1"

// testSKUAuth contains the test SKU authentication string.
testSKUAuth = "TODO: SET_SKU_AUTH"
testSKUAuth = "test_password"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion src/pa/pa_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
var (
port = flag.Int("port", 0, "the port to bind the server on; required")
spmAddress = flag.String("spm_address", "", "the SPM server address to connect to; required")
enableRegBuff = flag.Bool("enable_rb", true, "Enable connectivity to the RegistryBuffer server; optional")
enableRegBuff = flag.Bool("enable_rb", false, "Enable connectivity to the RegistryBuffer server; optional")
rbAddress = flag.String("rb_address", "", "the RegistryBuffer server address to connect to; required")
enableTLS = flag.Bool("enable_tls", false, "Enable mTLS secure channel; optional")
serviceKey = flag.String("service_key", "", "File path to the PEM encoding of the server's private key")
Expand Down
2 changes: 1 addition & 1 deletion src/pa/proto/pa.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ message InitSessionResponse {
// PA endpoint. The client should select connections to this client to issue
// any provisioning calls (e.g. CreateKeyAndCertRequest).
string pa_endpoint = 2;
// list of authenticate methods
// List of authenticate methods. Required.
repeated string auth_methods = 3;
}

Expand Down
2 changes: 1 addition & 1 deletion src/spm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

load("@io_bazel_rules_go//go:def.bzl", "go_binary")
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

package(default_visibility = ["//visibility:public"])

Expand Down
1 change: 1 addition & 0 deletions src/spm/services/se.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type SE interface {
// Derives the transport secret for a device with the given ID, and wraps
// it with the device class's global secret.
DeriveAndWrapTransportSecret(deviceId []byte) ([]byte, error)

// Generates and signs certificates with the given parent corresponding to the
// arguments in certs.
//
Expand Down
4 changes: 2 additions & 2 deletions src/spm/services/spm.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func NewSpmServer(opts Options) (pbs.SpmServiceServer, error) {
return nil, fmt.Errorf("config directory does not exist: %q, error: %v", opts.SPMConfigDir, err)
}

// TODO: make this runtime configurable
filename := "sku_auth.yml"
var config AuthConfig
err := utils.LoadConfig(opts.SPMConfigDir, filename, &config)
Expand All @@ -171,7 +172,6 @@ func NewSpmServer(opts Options) (pbs.SpmServiceServer, error) {
func (s *server) initSku(sku string) (string, error) {
token, err := generateSessionToken(TokenSize)
if err != nil {

log.Printf("failed to generate session token: %v", err)
return "", status.Errorf(codes.NotFound, "failed to generate session token: %v", err)
}
Expand All @@ -188,7 +188,7 @@ func (s *server) initSku(sku string) (string, error) {
}

// findSkuAuth returns an empty sku auth config, if nor sku or a family sku can be found
// in the map config, otherwize the relavent sku auth config will be return.
// in the map config, otherwise the relavent sku auth config will be return.
func (s *server) findSkuAuth(sku string) (SkuAuthConfig, bool) {
skuAuthConfig := SkuAuthConfig{}
if skuAuthConfig, found := s.authCfg.SkuAuthCfgList[sku]; found {
Expand Down
Loading