Skip to content

Commit

Permalink
Remove internal step package
Browse files Browse the repository at this point in the history
This commit removes the use of the step package and the use of STEPPATH
as the base directory for relative paths  in template files, as well as
the location of the tpmkms storage directory.
  • Loading branch information
maraino committed Jul 26, 2023
1 parent 58f792a commit d019b1c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 210 deletions.
94 changes: 0 additions & 94 deletions internal/step/config.go

This file was deleted.

106 changes: 0 additions & 106 deletions internal/step/config_test.go

This file was deleted.

6 changes: 2 additions & 4 deletions kms/tpmkms/tpmkms.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import (
"errors"
"fmt"
"net/url"
"path/filepath"
"time"

"go.step.sm/crypto/internal/step"
"go.step.sm/crypto/kms/apiv1"
"go.step.sm/crypto/kms/uri"
"go.step.sm/crypto/tpm"
Expand Down Expand Up @@ -93,7 +91,7 @@ var signatureAlgorithmMapping = map[apiv1.SignatureAlgorithm]algorithmAttributes
// })
//
// The default storage location for serialized TPM objects when
// an instance of TPMKMS is created, is $STEPPATH/tpm.
// an instance of TPMKMS is created, is the relative path "tpm".
//
// The system default TPM device will be used when not configured. A
// specific TPM device can be selected by setting the device:
Expand Down Expand Up @@ -146,7 +144,7 @@ func New(ctx context.Context, opts apiv1.Options) (kms *TPMKMS, err error) {
identityEarlyRenewalEnabled: true,
identityRenewalPeriodPercentage: 60, // default to AK certificate renewal at 60% of lifetime
}
storageDirectory := filepath.Join(step.Path(), "tpm") // store TPM objects in $STEPPATH/tpm by default
storageDirectory := "tpm" // store TPM objects in a relative tpm directory by default.
if opts.StorageDirectory != "" {
storageDirectory = opts.StorageDirectory
}
Expand Down
4 changes: 1 addition & 3 deletions sshutil/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/pkg/errors"

"go.step.sm/crypto/internal/step"
"go.step.sm/crypto/internal/templates"
)

Expand Down Expand Up @@ -71,8 +70,7 @@ func WithTemplateBase64(s string, data TemplateData) Option {
// with the given data.
func WithTemplateFile(path string, data TemplateData) Option {
return func(cr CertificateRequest, o *Options) error {
filename := step.Abs(path)
b, err := os.ReadFile(filename)
b, err := os.ReadFile(path)
if err != nil {
return errors.Wrapf(err, "error reading %s", path)
}
Expand Down
4 changes: 1 addition & 3 deletions x509util/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"golang.org/x/crypto/cryptobyte"
"golang.org/x/crypto/cryptobyte/asn1"

"go.step.sm/crypto/internal/step"
"go.step.sm/crypto/internal/templates"
)

Expand Down Expand Up @@ -82,8 +81,7 @@ func WithTemplateBase64(s string, data TemplateData) Option {
// with the given data.
func WithTemplateFile(path string, data TemplateData) Option {
return func(cr *x509.CertificateRequest, o *Options) error {
filename := step.Abs(path)
b, err := os.ReadFile(filename)
b, err := os.ReadFile(path)
if err != nil {
return errors.Wrapf(err, "error reading %s", path)
}
Expand Down

0 comments on commit d019b1c

Please sign in to comment.