-
Notifications
You must be signed in to change notification settings - Fork 381
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
Unexport HashLogRoot. Verify with VerifySignedLogRoot. #1042
Conversation
a8c86f7
to
2b97bd8
Compare
Codecov Report
@@ Coverage Diff @@
## master #1042 +/- ##
==========================================
- Coverage 62.6% 62.56% -0.05%
==========================================
Files 100 101 +1
Lines 8324 8379 +55
==========================================
+ Hits 5211 5242 +31
- Misses 2593 2610 +17
- Partials 520 527 +7
Continue to review full report at Codecov.
|
SignLogRoot should produce a *trillian.SignedLogRoot VerifyLogRoot should verify a *trillian.SignedLogRoot This prevents clients from needing to parse the SignedLogRoot object themslves. It also provides a single API point to maintain. VerifySignedLogRoot will produce a *trillian.SignedLogRoot. The idea is the force clients to only use data that has been returned from a successful verification.
2b97bd8
to
cc99c97
Compare
crypto/signer.go
Outdated
// signature. Hashing is performed by github.com/benlaurie/objecthash. | ||
func (s *Signer) SignLogRoot(root *trillian.SignedLogRoot) (*sigpb.DigitallySigned, error) { | ||
hash, err := HashLogRoot(*root) | ||
// SignLogRoot hashes and signs the supplied (to-be) SignedLogRoot and returns a SignedLogRoot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "returns a complete SignedLogRoot (including signature)".
(also nit) Trailing full stop in comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
crypto/signer_test.go
Outdated
@@ -115,23 +115,17 @@ func TestSignLogRoot(t *testing.T) { | |||
t.Errorf("Failed to sign log root: %v", err) | |||
continue | |||
} | |||
if got := len(sig.Signature); got == 0 { | |||
if got := len(sig.Signature.Signature); got == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sig
is now a bit misleading - maybe rename to slr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Reduce the API surface of the crypto package: unexport
HashLogRoot
Signing and verifying
SignedLogRoot
s should only go throughSignLogRoot
andVerifySignedLogRoot
functions. This simplifies future work to adjust the signature formats.#958