GmSSL icon indicating copy to clipboard operation
GmSSL copied to clipboard

编译gmssl,运行sm2test的错误结果反馈

Open willalways opened this issue 9 years ago • 3 comments

下面是我编译执行sm2test的结果,最后几行显示如下 error: test/sm2test.c 452 140533278427968:error:10067066:elliptic curve routines:ec_GFp_simple_oct2point:invalid encoding:crypto/ec/ecp_oct.c:317: 140533278427968:error:1011A0BC:elliptic curve routines:SM2_CIPHERTEXT_VALUE_decode:oct2point failed:crypto/sm2/sm2_enc.c:265: 140533278427968:error:101230AE:elliptic curve routines:SM2_decrypt:error:crypto/sm2/sm2_enc.c:571: sm2 enc p256 failed

完整的执行结果如下: `root@host:~/Desktop/GmSSL-master/test# ./sm2test Private-Key: (256 bit) priv: 12:8b:2f:a8:bd:43:3c:6c:06:8c:8d:80:3d:ff:79: 79:2a:51:9a:55:17:1b:1b:65:0c:23:66:1d:15:89: 72:63 pub: 04:0a:e4:c7:79:8a:a0:f1:19:47:1b:ee:11:82:5b: e4:62:02:bb:79:e2:a5:84:44:95:e9:7c:04:ff:4d: f2:54:8a:7c:02:40:f8:8f:1c:d4:e1:63:52:a7:3c: 17:b7:f1:6f:07:35:3e:53:a1:76:d6:84:a9:fe:0c: 6b:b7:98:e8:57 Field Type: prime-field Prime: 00:85:42:d6:9e:4c:04:4f:18:e8:b9:24:35:bf:6f: f7:de:45:72:83:91:5c:45:51:7d:72:2e:db:8b:08: f1:df:c3 A:
78:79:68:b4:fa:32:c3:fd:24:17:84:2e:73:bb:fe: ff:2f:3c:84:8b:68:31:d7:e0:ec:65:22:8b:39:37: e4:98 B:
63:e4:c6:d3:b2:3b:0c:84:9c:f8:42:41:48:4b:fe: 48:f6:1d:59:a5:b1:6b:a0:6e:6e:12:d1:da:27:c5: 24:9a Generator (uncompressed): 04:42:1d:eb:d6:1b:62:ea:b6:74:64:34:eb:c3:cc: 31:5e:32:22:0b:3b:ad:d5:0b:dc:4c:4e:6c:14:7f: ed:d4:3d:06:80:51:2b:cb:b4:2c:07:d4:73:49:d2: 15:3b:70:c4:e5:d7:fd:fc:bf:a3:6e:a1:a8:58:41: b9:e4:6e:09:a2 Order: 00:85:42:d6:9e:4c:04:4f:18:e8:b9:24:35:bf:6f: f7:dd:29:77:20:63:04:85:62:8d:5a:e7:4e:e7:c3: 2e:79:b7 Cofactor: 1 (0x1) [email protected] zid(xx):f4a38489e32b45b6f876e3ac2168ca392362dc8f23459c1d1146fc3dbfb7bc9a -> 389 sm2 sign p256 passed Private-Key: (255 bit) priv: 77:1e:f3:db:ff:5f:1c:dc:32:b9:c5:72:93:04:76: 19:19:98:b2:bf:7c:b9:81:d7:f5:b3:92:02:64:5f: 09:31 pub: 04:01:65:96:16:45:28:1a:86:26:60:7b:91:7f:65: 7d:7e:93:82:f1:ea:5c:d9:31:f4:0f:66:27:f3:57: 54:26:53:b2:01:68:65:22:13:0d:59:0f:b8:de:63: 5d:8f:ca:71:5c:c6:bf:3d:05:be:f3:f7:5d:a5:d5: 43:45:44:48:16:66:12 Field Type: characteristic-two-field Basis Type: tpBasis Polynomial: 02:00:00:00:00:00:00:00:00:00:00:00:00:00:00: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00: 00:10:01 A: 0 B:
00:e7:8b:cd:09:74:6c:20:23:78:a7:e7:2b:12:bc: e0:02:66:b9:62:7e:cb:0b:5a:25:36:7a:d1:ad:4c: c6:24:2b Generator (uncompressed): 04:00:cd:b9:ca:7f:1e:6b:04:41:f6:58:34:3f:4b: 10:29:7c:0e:f9:b6:49:10:82:40:0a:62:e7:a7:48: 57:35:fa:dd:01:3d:e7:4d:a6:59:51:c4:d7:6d:c8: 92:20:d5:f7:77:7a:61:1b:1c:38:ba:e2:60:b1:75: 95:1d:c8:06:0c:2b:3e Order: 7f:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: ff:bc:97:2c:f7:e6:b6:f9:00:94:5b:3c:6a:0c:f6: 16:1d Cofactor: 4 (0x4) [email protected] zid(xx):26352af82ec19f207bbc6f9474e11e90ce0f7ddace03b27f801817e897a81fd5 -> 389 sm2 sign b257 passed error: test/sm2test.c 452 140533278427968:error:10067066:elliptic curve routines:ec_GFp_simple_oct2point:invalid encoding:crypto/ec/ecp_oct.c:317: 140533278427968:error:1011A0BC:elliptic curve routines:SM2_CIPHERTEXT_VALUE_decode:oct2point failed:crypto/sm2/sm2_enc.c:265: 140533278427968:error:101230AE:elliptic curve routines:SM2_decrypt:error:crypto/sm2/sm2_enc.c:571: sm2 enc p256 failed

SM2 test failed `

willalways avatar Mar 01 '17 09:03 willalways

@willalways GDB调一下或者其他的调试工具,刚调通了

bochs9 avatar Mar 03 '17 02:03 bochs9

你能描述一下你修改了哪个地方才调通的吗? 我对sm2的流程并不熟悉,其中最疑惑的地方是 我的另个问题 sm3test有个错误 0090414C494345313233405941484F4F2E434F4D00000000000000000000000000000000000000000000000000000000000000000000E78BCD09746C202378A7E72B12BCE00266B9627ECB0B5A25367AD1AD4CC6242B00CDB9CA7F1E6B0441F658343F4B10297C0EF9B6491082400A62E7A7485735FADD013DE74DA65951C4D76DC89220D5F7777A611B1C38BAE260B175951DC8060C2B3E008E3BDB2E11F9193388F1F901CCC857BF49CFC065FB38B9069CAAE6D5AFC3592F004555122AAC0075F42E0A8BBD2C0665C789120DF19D77B4E3EE4712F598040415 got 329c2f6030cc7e0ca3af6c97b76243ca250338ad3d3dc3a8b322d1cfdf98c2b7 instead of ECF0080215977B2E5D6D61B98A99442F03E8803DC39E349F8DCA5621A9ACDF2B

杂凑值Z A =H 256 (ENT L A ∥ ID A ∥ a ∥ b ∥ x G ∥ y G ∥ x A ∥ y A )。 Z A : ECF00802 15977B2E 5D6D61B9 8A99442F 03E8803D C39E349F 8DCA5621 A9ACDF2B 11杂凑值Z B =H 256 (ENT L B ∥ ID B ∥ a ∥ b ∥ x G ∥ y G ∥ x B ∥ y B )。 Z B : 557BAD30 E183559A EEC3B225 6E1C7C11 F870D22B 165D015A CF9465B0 9B87B527

奇怪的地方是Za的结果是错的, Zb却是对的, 我反复对比ENT L A ∥ ID A ∥ a ∥ b ∥ x G ∥ y G ∥ x A ∥ y A 可以确认没有问题, 你能不能帮我确认一下以下字符串的md3值

218个字符 "\x00\x90\x41\x4C\x49\x43\x45\x31\x32\x33\x40\x59\x41\x48\x4F\x4F\x2E\x43\x4F\x4D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xE7\x8B\xCD\x09\x74\x6C\x20\x23\x78\xA7\xE7\x2B\x12\xBC\xE0\x02\x66\xB9\x62\x7E\xCB\x0B\x5A\x25\x36\x7A\xD1\xAD\x4C\xC6\x24\x2B\x00\xCD\xB9\xCA\x7F\x1E\x6B\x04\x41\xF6\x58\x34\x3F\x4B\x10\x29\x7C\x0E\xF9\xB6\x49\x10\x82\x40\x0A\x62\xE7\xA7\x48\x57\x35\xFA\xDD\x01\x3D\xE7\x4D\xA6\x59\x51\xC4\xD7\x6D\xC8\x92\x20\xD5\xF7\x77\x7A\x61\x1B\x1C\x38\xBA\xE2\x60\xB1\x75\x95\x1D\xC8\x06\x0C\x2B\x3E\x00\x8E\x3B\xDB\x2E\x11\xF9\x19\x33\x88\xF1\xF9\x01\xCC\xC8\x57\xBF\x49\xCF\xC0\x65\xFB\x38\xB9\x06\x9C\xAA\xE6\xD5\xAF\xC3\x59\x2F\x00\x45\x55\x12\x2A\xAC\x00\x75\xF4\x2E\x0A\x8B\xBD\x2C\x06\x65\xC7\x89\x12\x0D\xF1\x9D\x77\xB4\xE3\xEE\x47\x12\xF5\x98\x04\x04\x15"

也就是sm3test的第6组数据 /* 6 p.75 ZA */ "0090" "414C494345313233405941484F4F2E434F4D" "000000000000000000000000000000000000000000000000000000000000000000" "00E78BCD09746C202378A7E72B12BCE00266B9627ECB0B5A25367AD1AD4CC6242B" "00CDB9CA7F1E6B0441F658343F4B10297C0EF9B6491082400A62E7A7485735FADD" "013DE74DA65951C4D76DC89220D5F7777A611B1C38BAE260B175951DC8060C2B3E" "008E3BDB2E11F9193388F1F901CCC857BF49CFC065FB38B9069CAAE6D5AFC3592F" "004555122AAC0075F42E0A8BBD2C0665C789120DF19D77B4E3EE4712F598040415",

willalways avatar Mar 04 '17 07:03 willalways

Marked as stale issue. Will be closed later if no activity for a while.

github-actions[bot] avatar Oct 11 '20 01:10 github-actions[bot]