-
Notifications
You must be signed in to change notification settings - Fork 331
Add support for small curves #223
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
Changes from all commits
e0d1c05
36e2e92
de82152
e74f8e6
f3607fd
57b3f7b
2879582
3bda7d7
95aa83f
bae6ddc
4bd1d1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,6 +294,74 @@ def point_is_valid(generator, x, y): | |
return True | ||
|
||
|
||
# secp112r1 curve | ||
_p = int(remove_whitespace("DB7C 2ABF62E3 5E668076 BEAD208B"), 16) | ||
# s = 00F50B02 8E4D696E 67687561 51752904 72783FB1 | ||
_a = int(remove_whitespace("DB7C 2ABF62E3 5E668076 BEAD2088"), 16) | ||
_b = int(remove_whitespace("659E F8BA0439 16EEDE89 11702B22"), 16) | ||
_Gx = int(remove_whitespace("09487239 995A5EE7 6B55F9C2 F098"), 16) | ||
_Gy = int(remove_whitespace("A89C E5AF8724 C0A23E0E 0FF77500"), 16) | ||
_r = int(remove_whitespace("DB7C 2ABF62E3 5E7628DF AC6561C5"), 16) | ||
_h = 1 | ||
curve_112r1 = ellipticcurve.CurveFp(_p, _a, _b, _h) | ||
generator_112r1 = ellipticcurve.PointJacobi( | ||
curve_112r1, _Gx, _Gy, 1, _r, generator=True | ||
) | ||
|
||
|
||
# secp112r2 curve | ||
_p = int(remove_whitespace("DB7C 2ABF62E3 5E668076 BEAD208B"), 16) | ||
# s = 022757A1 114D69E 67687561 51755316 C05E0BD4 | ||
_a = int(remove_whitespace("6127 C24C05F3 8A0AAAF6 5C0EF02C"), 16) | ||
_b = int(remove_whitespace("51DE F1815DB5 ED74FCC3 4C85D709"), 16) | ||
_Gx = int(remove_whitespace("4BA30AB5 E892B4E1 649DD092 8643"), 16) | ||
_Gy = int(remove_whitespace("ADCD 46F5882E 3747DEF3 6E956E97"), 16) | ||
_r = int(remove_whitespace("36DF 0AAFD8B8 D7597CA1 0520D04B"), 16) | ||
_h = 4 | ||
curve_112r2 = ellipticcurve.CurveFp(_p, _a, _b, _h) | ||
generator_112r2 = ellipticcurve.PointJacobi( | ||
curve_112r2, _Gx, _Gy, 1, _r, generator=True | ||
) | ||
|
||
|
||
# secp128r1 curve | ||
_p = int(remove_whitespace("FFFFFFFD FFFFFFFF FFFFFFFF FFFFFFFF"), 16) | ||
# S = 000E0D4D 69E6768 75615175 0CC03A44 73D03679 | ||
# a and b are mod p, so a is equal to p-3, or simply -3 | ||
# _a = -3 | ||
_b = int(remove_whitespace("E87579C1 1079F43D D824993C 2CEE5ED3"), 16) | ||
_Gx = int(remove_whitespace("161FF752 8B899B2D 0C28607C A52C5B86"), 16) | ||
_Gy = int(remove_whitespace("CF5AC839 5BAFEB13 C02DA292 DDED7A83"), 16) | ||
_r = int(remove_whitespace("FFFFFFFE 00000000 75A30D1B 9038A115"), 16) | ||
_h = 1 | ||
curve_128r1 = ellipticcurve.CurveFp(_p, -3, _b, _h) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it's |
||
generator_128r1 = ellipticcurve.PointJacobi( | ||
curve_128r1, _Gx, _Gy, 1, _r, generator=True | ||
) | ||
|
||
|
||
# secp160r1 | ||
_p = int(remove_whitespace("FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 7FFFFFFF"), 16) | ||
# S = 1053CDE4 2C14D696 E6768756 1517533B F3F83345 | ||
# a and b are mod p, so a is equal to p-3, or simply -3 | ||
# _a = -3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here -- the specifications mention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, the -3 curves are special: https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html we just don't use this property in the implementation (at least not now) |
||
_b = int(remove_whitespace("1C97BEFC 54BD7A8B 65ACF89F 81D4D4AD C565FA45"), 16) | ||
_Gx = int( | ||
remove_whitespace("4A96B568 8EF57328 46646989 68C38BB9 13CBFC82"), 16, | ||
) | ||
_Gy = int( | ||
remove_whitespace("23A62855 3168947D 59DCC912 04235137 7AC5FB32"), 16, | ||
) | ||
_r = int( | ||
remove_whitespace("01 00000000 00000000 0001F4C8 F927AED3 CA752257"), 16, | ||
) | ||
_h = 1 | ||
curve_160r1 = ellipticcurve.CurveFp(_p, -3, _b, _h) | ||
generator_160r1 = ellipticcurve.PointJacobi( | ||
curve_160r1, _Gx, _Gy, 1, _r, generator=True | ||
) | ||
|
||
|
||
# NIST Curve P-192: | ||
_p = 6277101735386680763835789423207666416083908700390324961279 | ||
_r = 6277101735386680763835789423176059013767194773182842284081 | ||
|
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 does not do anything in current travis (see the "View config" -> "Config validation" in the travis build)
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.
yes, "sudo: true" is supposed to not do anything, but it breaks when i don't use it... so I keep it
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.
weird. Can you be more specific what breaks? I think I removed all these from OpenSC and all works fine.
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.
I wasn't getting the distribution versions and thus python versions I expected from configuration, that being said I tried it some time ago...
Something to try when travis build queue isn't measured in hours...