CVSROOT:        /cvs
Module name:    src
Changes by:     t...@cvs.openbsd.org    2024/10/28 12:15:53

Modified files:
        lib/libcrypto/ec: ec_asn1.c 

Log message:
Fix private key encoding in i2d_ECPrivateKey()

The private key is a random integer between 1 and order - 1. As such it
requires at most as many bytes as the order to encode. SEC 1, Section C.4
is very explicit about padding it to this length:

The component privateKey is the private key defined to be the octet
string of length [ceil(log_2 n/8)] (where n is the order of the curve)
obtained from the unsigned integer via the encoding of Section 2.3.7.

Fix this by generalizing a similar fix for field elements.

ok jsing

Reply via email to