-
Notifications
You must be signed in to change notification settings - Fork 90
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
*: migrate to k1 package #1685
*: migrate to k1 package #1685
Conversation
@@ -109,13 +109,13 @@ func Recover(hash []byte, sig []byte) (*k1.PublicKey, error) { | |||
return nil, errors.New("invalid recovery id", z.Any("id", sig[k1RecIdx])) | |||
} | |||
|
|||
if sig[k1RecIdx] == 0 || sig[k1RecIdx] == 1 { | |||
sig[k1RecIdx] += compactSigMagicOffset // Make the last byte 27 or 28 since that is required below. |
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.
this modified the input argument
var sb strings.Builder | ||
_, _ = sb.WriteString("\n") | ||
_, _ = sb.WriteString("***************** Decoded ENR (see https://enr-viewer.com/ for additional fields) **********************\n") | ||
_, _ = sb.WriteString(fmt.Sprintf("secp256k1 pubkey: %#x\n", pubkeyHex(privKey.PublicKey))) |
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.
@xenowits this was a bug, you hexed it twice
func GenerateInsecureK1Key(t *testing.T, random io.Reader) *k1.PrivateKey { | ||
t.Helper() | ||
|
||
k, err := ecdsa.GenerateKey(k1.S256(), random) |
Check failure
Code scanning / CodeQL
Use of insufficient randomness as the key of a cryptographic algorithm
Codecov ReportBase: 54.29% // Head: 54.54% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1685 +/- ##
==========================================
+ Coverage 54.29% 54.54% +0.25%
==========================================
Files 159 159
Lines 20627 20609 -18
==========================================
+ Hits 11199 11241 +42
+ Misses 7929 7872 -57
+ Partials 1499 1496 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
LGTM
Migrates uses of
ecdsa.P*Key
tok1.P*Key
and uses ofgeth/crypto
toapp/k1util
.category: refactor
ticket: #1626