summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Matveev <stargrave@stargrave.org>2019-07-09 19:21:01 +0300
committerSergey Matveev <stargrave@stargrave.org>2019-07-09 19:21:01 +0300
commit437523766db1cb260454c4fb4c7be290c3fecaf7 (patch)
tree64fcc6f0f744021ccdb1f65e63635baeea86a7e4
parent025648504c4e9d1e7867f3d52e82ad8d0f359061 (diff)
downloadpygost-437523766db1cb260454c4fb4c7be290c3fecaf7.tar.xz
34.10-2012 test vectors from SESPAKE
-rw-r--r--NEWS4
-rw-r--r--VERSION2
-rw-r--r--news.texi7
-rw-r--r--pygost/test_gost3410.py215
4 files changed, 227 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 92f8f82..12080e4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+3.16:
+ * 34.10-2012 TC26 twisted Edwards curve related parameters.
+ * More test vectors.
+
3.15:
* Licence changed back to GNU GPLv3+.
GNU LGPLv3+ licenced versions are not available anymore
diff --git a/VERSION b/VERSION
index 93a848f..5174c53 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.15
+3.16
diff --git a/news.texi b/news.texi
index 3113f3b..1e9e814 100644
--- a/news.texi
+++ b/news.texi
@@ -3,6 +3,13 @@
@table @strong
+@anchor{Release 3.16}
+@item 3.16
+ @itemize
+ @item 34.10-2012 TC26 twisted Edwards curve related parameters
+ @item More test vectors
+ @end itemize
+
@anchor{Release 3.15}
@item 3.15
@itemize
diff --git a/pygost/test_gost3410.py b/pygost/test_gost3410.py
index 972df82..680d8a2 100644
--- a/pygost/test_gost3410.py
+++ b/pygost/test_gost3410.py
@@ -24,6 +24,7 @@ from pygost.gost3410 import public_key
from pygost.gost3410 import sign
from pygost.gost3410 import verify
from pygost.utils import bytes2long
+from pygost.utils import hexdec
from pygost.utils import long2bytes
@@ -228,3 +229,217 @@ class Test34102012(TestCase):
s = sign(c, prv, digest, mode=2012)
self.assertTrue(verify(c, (pubX, pubY), digest, s, mode=2012))
self.assertNotIn(b"\x00" * 8, s)
+
+
+class Test34102012SESPAKE(TestCase):
+ """Test vectors for multiplication from :rfc:`8133`
+ """
+ def test_curve1(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_CryptoPro_A_ParamSet"])
+ q_ind = (
+ 0xA69D51CAF1A309FA9E9B66187759B0174C274E080356F23CFCBFE84D396AD7BB,
+ 0x5D26F29ECC2E9AC0404DCF7986FA55FE94986362170F54B9616426A659786DAC,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F18127067"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0x59495655D1E7C7424C622485F575CCF121F3122D274101E8AB734CC9C9A9B45E,
+ 0x48D1C311D33C9B701F3B03618562A4A07A044E3AF31E3999E67B487778B53C62,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x1F2538097D5A031FA68BBB43C84D12B3DE47B7061C0D5E24993E0C873CDBA6B3),
+ (
+ 0xBBC77CF42DC1E62D06227935379B4AA4D14FEA4F565DDF4CB4FA4D31579F9676,
+ 0x8E16604A4AFDF28246684D4996274781F6CB80ABBBA1414C1513EC988509DABF,
+ )
+ )
+ self.assertEqual(
+ c.exp(0xDC497D9EF6324912FD367840EE509A2032AEDB1C0A890D133B45F596FCCBD45D),
+ (
+ 0x6097341C1BE388E83E7CA2DF47FAB86E2271FD942E5B7B2EB2409E49F742BC29,
+ 0xC81AA48BDB4CA6FA0EF18B9788AE25FE30857AA681B3942217F9FED151BAB7D0,
+ ),
+ )
+
+ def test_curve2(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_CryptoPro_B_ParamSet"])
+ q_ind = (
+ 0x3D715A874A4B17CB3B517893A9794A2B36C89D2FFC693F01EE4CC27E7F49E399,
+ 0x1C5A641FCF7CE7E87CDF8CEA38F3DB3096EACE2FAD158384B53953365F4FE7FE,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F18127067"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0x6DC2AE26BC691FCA5A73D9C452790D15E34BA5404D92955B914C8D2662ABB985,
+ 0x3B02AAA9DD65AE30C335CED12F3154BBAC059F66B088306747453EDF6E5DB077,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x499D72B90299CAB0DA1F8BE19D9122F622A13B32B730C46BD0664044F2144FAD),
+ (
+ 0x61D6F916DB717222D74877F179F7EBEF7CD4D24D8C1F523C048E34A1DF30F8DD,
+ 0x3EC48863049CFCFE662904082E78503F4973A4E105E2F1B18C69A5E7FB209000,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x0F69FF614957EF83668EDC2D7ED614BE76F7B253DB23C5CC9C52BF7DF8F4669D),
+ (
+ 0x33BC6F7E9C0BA10CFB2B72546C327171295508EA97F8C8BA9F890F2478AB4D6C,
+ 0x75D57B396C396F492F057E9222CCC686437A2AAD464E452EF426FC8EEED1A4A6,
+ ),
+ )
+
+ def test_curve3(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_CryptoPro_C_ParamSet"])
+ q_ind = (
+ 0x1E36383E43BB6CFA2917167D71B7B5DD3D6D462B43D7C64282AE67DFBEC2559D,
+ 0x137478A9F721C73932EA06B45CF72E37EB78A63F29A542E563C614650C8B6399,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F18127067"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0x945821DAF91E158B839939630655A3B21FF3E146D27041E86C05650EB3B46B59,
+ 0x3A0C2816AC97421FA0E879605F17F0C9C3EB734CFF196937F6284438D70BDC48,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x3A54AC3F19AD9D0B1EAC8ACDCEA70E581F1DAC33D13FEAFD81E762378639C1A8),
+ (
+ 0x96B7F09C94D297C257A7DA48364C0076E59E48D221CBA604AE111CA3933B446A,
+ 0x54E4953D86B77ECCEB578500931E822300F7E091F79592CA202A020D762C34A6,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x448781782BF7C0E52A1DD9E6758FD3482D90D3CFCCF42232CF357E59A4D49FD4),
+ (
+ 0x4B9C0AB55A938121F282F48A2CC4396EB16E7E0068B495B0C1DD4667786A3EB7,
+ 0x223460AA8E09383E9DF9844C5A0F2766484738E5B30128A171B69A77D9509B96,
+ ),
+ )
+
+ def test_curve4(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"])
+ q_ind = (
+ 0x2A17F8833A32795327478871B5C5E88AEFB91126C64B4B8327289BEA62559425D18198F133F400874328B220C74497CD240586CB249E158532CB8090776CD61C,
+ 0x728F0C4A73B48DA41CE928358FAD26B47A6E094E9362BAE82559F83CDDC4EC3A4676BD3707EDEAF4CD85E99695C64C241EDC622BE87DC0CF87F51F4367F723C5,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F181270671C6213E3930EFDDA26451792C6208122EE60D200520D695DFD9F5F0FD5ABA702"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0x0C0AB53D0E0A9C607CAD758F558915A0A7DC5DC87B45E9A58FDDF30EC3385960283E030CD322D9E46B070637785FD49D2CD711F46807A24C40AF9A42C8E2D740,
+ 0xDF93A8012B86D3A3D4F8A4D487DA15FC739EB31B20B3B0E8C8C032AAF8072C6337CF7D5B404719E5B4407C41D9A3216A08CA69C271484E9ED72B8AAA52E28B8B,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x3CE54325DB52FE798824AEAD11BB16FA766857D04A4AF7D468672F16D90E7396046A46F815693E85B1CE5464DA9270181F82333B0715057BBE8D61D400505F0E),
+ (
+ 0xB93093EB0FCC463239B7DF276E09E592FCFC9B635504EA4531655D76A0A3078E2B4E51CFE2FA400CC5DE9FBE369DB204B3E8ED7EDD85EE5CCA654C1AED70E396,
+ 0x809770B8D910EA30BD2FA89736E91DC31815D2D9B31128077EEDC371E9F69466F497DC64DD5B1FADC587F860EE256109138C4A9CD96B628E65A8F590520FC882,
+ )
+ )
+ self.assertEqual(
+ c.exp(0xB5C286A79AA8E97EC0E19BC1959A1D15F12F8C97870BA9D68CC12811A56A3BB11440610825796A49D468CDC9C2D02D76598A27973D5960C5F50BCE28D8D345F4),
+ (
+ 0x238B38644E440452A99FA6B93D9FD7DA0CB83C32D3C1E3CFE5DF5C3EB0F9DB91E588DAEDC849EA2FB867AE855A21B4077353C0794716A6480995113D8C20C7AF,
+ 0xB2273D5734C1897F8D15A7008B862938C8C74CA7E877423D95243EB7EBD02FD2C456CF9FC956F078A59AA86F19DD1075E5167E4ED35208718EA93161C530ED14,
+ ),
+ )
+
+ def test_curve5(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetB"])
+ q_ind = (
+ 0x7E1FAE8285E035BEC244BEF2D0E5EBF436633CF50E55231DEA9C9CF21D4C8C33DF85D4305DE92971F0A4B4C07E00D87BDBC720EB66E49079285AAF12E0171149,
+ 0x2CC89998B875D4463805BA0D858A196592DB20AB161558FF2F4EF7A85725D20953967AE621AFDEAE89BB77C83A2528EF6FCE02F68BDA4679D7F2704947DBC408,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F181270671C6213E3930EFDDA26451792C6208122EE60D200520D695DFD9F5F0FD5ABA702"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0x7D03E65B8050D1E12CBB601A17B9273B0E728F5021CD47C8A4DD822E4627BA5F9C696286A2CDDA9A065509866B4DEDEDC4A118409604AD549F87A60AFA621161,
+ 0x16037DAD45421EC50B00D50BDC6AC3B85348BC1D3A2F85DB27C3373580FEF87C2C743B7ED30F22BE22958044E716F93A61CA3213A361A2797A16A3AE62957377,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x715E893FA639BF341296E0623E6D29DADF26B163C278767A7982A989462A3863FE12AEF8BD403D59C4DC4720570D4163DB0805C7C10C4E818F9CB785B04B9997),
+ (
+ 0x10C479EA1C04D3C2C02B0576A9C42D96226FF033C1191436777F66916030D87D02FB93738ED7669D07619FFCE7C1F3C4DB5E5DF49E2186D6FA1E2EB5767602B9,
+ 0x039F6044191404E707F26D59D979136A831CCE43E1C5F0600D1DDF8F39D0CA3D52FBD943BF04DDCED1AA2CE8F5EBD7487ACDEF239C07D015084D796784F35436,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x30FA8C2B4146C2DBBE82BED04D7378877E8C06753BD0A0FF71EBF2BEFE8DA8F3DC0836468E2CE7C5C961281B6505140F8407413F03C2CB1D201EA1286CE30E6D),
+ (
+ 0x34C0149E7BB91AE377B02573FCC48AF7BFB7B16DEB8F9CE870F384688E3241A3A868588CC0EF4364CCA67D17E3260CD82485C202ADC76F895D5DF673B1788E67,
+ 0x608E944929BD643569ED5189DB871453F13333A1EAF82B2FE1BE8100E775F13DD9925BD317B63BFAF05024D4A738852332B64501195C1B2EF789E34F23DDAFC5,
+ ),
+ )
+
+ def test_curve6(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_256_ParamSetA"])
+ q_ind = (
+ 0xB51ADF93A40AB15792164FAD3352F95B66369EB2A4EF5EFAE32829320363350E,
+ 0x74A358CC08593612F5955D249C96AFB7E8B0BB6D8BD2BBE491046650D822BE18,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F18127067"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0xDBF99827078956812FA48C6E695DF589DEF1D18A2D4D35A96D75BF6854237629,
+ 0x9FDDD48BFBC57BEE1DA0CFF282884F284D471B388893C48F5ECB02FC18D67589,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x147B72F6684FB8FD1B418A899F7DBECAF5FCE60B13685BAA95328654A7F0707F),
+ (
+ 0x33FBAC14EAE538275A769417829C431BD9FA622B6F02427EF55BD60EE6BC2888,
+ 0x22F2EBCF960A82E6CDB4042D3DDDA511B2FBA925383C2273D952EA2D406EAE46,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x30D5CFADAA0E31B405E6734C03EC4C5DF0F02F4BA25C9A3B320EE6453567B4CB),
+ (
+ 0x2B2D89FAB735433970564F2F28CFA1B57D640CB902BC6334A538F44155022CB2,
+ 0x10EF6A82EEF1E70F942AA81D6B4CE5DEC0DDB9447512962874870E6F2849A96F,
+ ),
+ )
+
+ def test_curve7(self):
+ c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetC"])
+ q_ind = (
+ 0x489C91784E02E98F19A803ABCA319917F37689E5A18965251CE2FF4E8D8B298F5BA7470F9E0E713487F96F4A8397B3D09A270C9D367EB5E0E6561ADEEB51581D,
+ 0x684EA885ACA64EAF1B3FEE36C0852A3BE3BD8011B0EF18E203FF87028D6EB5DB2C144A0DCC71276542BFD72CA2A43FA4F4939DA66D9A60793C704A8C94E16F18,
+ )
+ self.assertEqual(
+ c.exp(bytes2long(hexdec(
+ "BD04673F7149B18E98155BD1E2724E71D0099AA25174F792D3326C6F181270671C6213E3930EFDDA26451792C6208122EE60D200520D695DFD9F5F0FD5ABA702"
+ )[::-1]), x=q_ind[0], y=q_ind[1]),
+ (
+ 0x0185AE6271A81BB7F236A955F7CAA26FB63849813C0287D96C83A15AE6B6A86467AB13B6D88CE8CD7DC2E5B97FF5F28FAC2C108F2A3CF3DB5515C9E6D7D210E8,
+ 0xED0220F92EF771A71C64ECC77986DB7C03D37B3E2AB3E83F32CE5E074A762EC08253C9E2102B87532661275C4B1D16D2789CDABC58ACFDF7318DE70AB64F09B8,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x332F930421D14CFE260042159F18E49FD5A54167E94108AD80B1DE60B13DE7999A34D611E63F3F870E5110247DF8EC7466E648ACF385E52CCB889ABF491EDFF0),
+ (
+ 0x561655966D52952E805574F4281F1ED3A2D498932B00CBA9DECB42837F09835BFFBFE2D84D6B6B242FE7B57F92E1A6F2413E12DDD6383E4437E13D72693469AD,
+ 0xF6B18328B2715BD7F4178615273A36135BC0BF62F7D8BB9F080164AD36470AD03660F51806C64C6691BADEF30F793720F8E3FEAED631D6A54A4C372DCBF80E82,
+ )
+ )
+ self.assertEqual(
+ c.exp(0x38481771E7D054F96212686B613881880BD8A6C89DDBC656178F014D2C093432A033EE10415F13A160D44C2AD61E6E2E05A7F7EC286BCEA3EA4D4D53F8634FA2),
+ (
+ 0xB7C5818687083433BC1AFF61CB5CA79E38232025E0C1F123B8651E62173CE6873F3E6FFE7281C2E45F4F524F66B0C263616ED08FD210AC4355CA3292B51D71C3,
+ 0x497F14205DBDC89BDDAF50520ED3B1429AD30777310186BE5E68070F016A44E0C766DB08E8AC23FBDFDE6D675AA4DF591EB18BA0D348DF7AA40973A2F1DCFA55,
+ ),
+ )