Skip to content

Commit

Permalink
Fix suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
BenDHillier committed Nov 19, 2019
1 parent b0cc69c commit e819fe7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tpm2tools/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tpm2tools

import (
"crypto"
"crypto/rsa"
"fmt"
"io"
"sync"
Expand All @@ -22,12 +23,15 @@ func (signer *tpmSigner) Public() crypto.PublicKey {
return signer.Key.PublicKey()
}

// Sign uses the TPM key to sign the digest.
// Sign uses the TPM key to sign the digest.
// The digest must be hashed from the same hash algorithm as the keys scheme.
// The opts hash function must also match the keys scheme.
// Concurrent use of Sign is thread safe, but it is not safe to access the TPM
// from other sources while Sign is executing.
func (signer *tpmSigner) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error) {
if _, ok := opts.(*rsa.PSSOptions); ok {
return nil, fmt.Errorf("signing with PSS not supported.")
}
if opts.HashFunc() != signer.Hash {
return nil, fmt.Errorf("opts hash: %v does not match the keys signing hash: %v", opts.HashFunc(), signer.Hash)
}
Expand Down

0 comments on commit e819fe7

Please sign in to comment.