Fix explicit EC curve encoding.
authorDavid Benjamin <davidben@google.com>
Sun, 20 May 2018 18:33:49 +0000 (14:33 -0400)
committerDavid Benjamin <davidben@google.com>
Wed, 23 May 2018 21:32:41 +0000 (17:32 -0400)
commitfc6f579a9e625caa0c8b93d9716ddbc558e21a29
tree47edcb0975f86359e47916ce1b8df269fba5ec15
parent55a6250f1e7336e8a7d89fb609eb23398715ff6f
Fix explicit EC curve encoding.

Per SEC 1, the curve coefficients must be padded up to size. See C.2's
definition of Curve, C.1's definition of FieldElement, and 2.3.5's definition
of how to encode the field elements in http://www.secg.org/sec1-v2.pdf.

This comes up for P-521, where b needs a leading zero.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6314)
crypto/ec/ec_asn1.c
test/ectest.c