Skip to content

Commit

Permalink
FIX: curve names
Browse files Browse the repository at this point in the history
  • Loading branch information
go-compile committed Jun 12, 2022
1 parent 49aa338 commit 249ee22
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
8 changes: 8 additions & 0 deletions brainpool/bcurves/curves.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func initP160t1() {
p160t1.Gx, _ = new(big.Int).SetString("B199B13B9B34EFC1397E64BAEB05ACC265FF2378", 16)
p160t1.Gy, _ = new(big.Int).SetString("ADD6718B7C7C1961F0991B842443772152C9E0AD", 16)
p160t1.BitSize = 160
p160t1.Name = "P160t1"
}

func initP192t1() {
Expand All @@ -65,6 +66,7 @@ func initP192t1() {
p192t1.Gx, _ = new(big.Int).SetString("3AE9E58C82F63C30282E1FE7BBF43FA72C446AF6F4618129", 16)
p192t1.Gy, _ = new(big.Int).SetString("97E2C5667C2223A902AB5CA449D0084B7E5B3DE7CCC01C9", 16)
p192t1.BitSize = 192
p192t1.Name = "P192t1"
}

func initP224t1() {
Expand All @@ -74,6 +76,7 @@ func initP224t1() {
p224t1.Gx, _ = new(big.Int).SetString("6AB1E344CE25FF3896424E7FFE14762ECB49F8928AC0C76029B4D580", 16)
p224t1.Gy, _ = new(big.Int).SetString("374E9F5143E568CD23F3F4D7C0D4B1E41C8CC0D1C6ABD5F1A46DB4C", 16)
p224t1.BitSize = 224
p224t1.Name = "P224t1"
}

func initP256t1() {
Expand All @@ -83,6 +86,7 @@ func initP256t1() {
p256t1.Gx, _ = new(big.Int).SetString("A3E8EB3CC1CFE7B7732213B23A656149AFA142C47AAFBC2B79A191562E1305F4", 16)
p256t1.Gy, _ = new(big.Int).SetString("2D996C823439C56D7F7B22E14644417E69BCB6DE39D027001DABE8F35B25C9BE", 16)
p256t1.BitSize = 256
p256t1.Name = "P256t1"
}

func initP320t1() {
Expand All @@ -92,6 +96,8 @@ func initP320t1() {
p320t1.Gx, _ = new(big.Int).SetString("925BE9FB01AFC6FB4D3E7D4990010F813408AB106C4F09CB7EE07868CC136FFF3357F624A21BED52", 16)
p320t1.Gy, _ = new(big.Int).SetString("63BA3A7A27483EBF6671DBEF7ABB30EBEE084E58A0B077AD42A5A0989D1EE71B1B9BC0455FB0D2C3", 16)
p320t1.BitSize = 320
p320t1.Name = "P320t1"

}

func initP384t1() {
Expand All @@ -101,6 +107,7 @@ func initP384t1() {
p384t1.Gx, _ = new(big.Int).SetString("18DE98B02DB9A306F2AFCD7235F72A819B80AB12EBD653172476FECD462AABFFC4FF191B946A5F54D8D0AA2F418808CC", 16)
p384t1.Gy, _ = new(big.Int).SetString("25AB056962D30651A114AFD2755AD336747F93475B7A1FCA3B88F2B6A208CCFE469408584DC2B2912675BF5B9E582928", 16)
p384t1.BitSize = 384
p384t1.Name = "P384t1"
}

func initP512t1() {
Expand All @@ -110,6 +117,7 @@ func initP512t1() {
p512t1.Gx, _ = new(big.Int).SetString("640ECE5C12788717B9C1BA06CBC2A6FEBA85842458C56DDE9DB1758D39C0313D82BA51735CDB3EA499AA77A7D6943A64F7A3F25FE26F06B51BAA2696FA9035DA", 16)
p512t1.Gy, _ = new(big.Int).SetString("5B534BD595F5AF0FA2C892376C84ACE1BB4E3019B71634C01131159CAE03CEE9D9932184BEEF216BD71DF2DADF86A627306ECFF96DBB8BACE198B61E00F8B332", 16)
p512t1.BitSize = 512
p512t1.Name = "P512t1"
}

func initP160r1() {
Expand Down
4 changes: 4 additions & 0 deletions brainpool/bcurves/rcurve.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func newrcurve(twisted elliptic.Curve, gx, gy, z *big.Int) *rcurve {
curve.zinv2 = new(big.Int).Exp(curve.zinv, two, curve.params.P)
curve.zinv3 = new(big.Int).Exp(curve.zinv, three, curve.params.P)

// auto rename twisted curves to r1 from t1
name := curve.params.Name
curve.params.Name = name[:len(name)-2] + "r1"

return &curve
}

Expand Down
28 changes: 0 additions & 28 deletions brainpool/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ func GenerateP160r() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP160r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -32,8 +30,6 @@ func GenerateP160t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP160t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -48,8 +44,6 @@ func GenerateP192r1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP192r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -64,8 +58,6 @@ func GenerateP192t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP192t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -80,8 +72,6 @@ func GenerateP224r1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP224r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -96,8 +86,6 @@ func GenerateP224t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP224t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -112,8 +100,6 @@ func GenerateP256r1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP256r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -128,8 +114,6 @@ func GenerateP256t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP256t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -144,8 +128,6 @@ func GenerateP320r1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP320r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -160,8 +142,6 @@ func GenerateP320t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP320t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -176,8 +156,6 @@ func GenerateP384r1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP384r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -192,8 +170,6 @@ func GenerateP384t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP384t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -208,8 +184,6 @@ func GenerateP512r1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP512r1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand All @@ -224,8 +198,6 @@ func GenerateP512t1() (*rome.ECKey, error) {
return nil, err
}

k.Curve.Params().Name = "brainpoolP512t1"

// ecdsa curves share a common interface.
// Go's elliptic.Curve only comes with Nist curves thus the package nist
// is where all the code for interfacing with such curves are.
Expand Down

0 comments on commit 249ee22

Please sign in to comment.