DH encoding: use correct length for inner sequence

Only affect small DH keys (like 512 bits).
This commit is contained in:
Sean Parkinson
2021-11-05 15:02:14 +10:00
parent ae84a2a326
commit d01f0d7a4c

View File

@ -8342,8 +8342,8 @@ int wc_DhKeyToDer(DhKey* key, byte* output, word32* outSz, int exportPriv)
/* object dhKeyAgreement 1.2.840.113549.1.3.1 */
idx += SetObjectId(sizeof(keyDhOid), NULL);
idx += sizeof(keyDhOid);
/* sequence */
idx += SetSequence(idx, NULL);
/* sequence - all but pub/priv */
idx += SetSequence(idx - keySz, NULL);
if (exportPriv) {
/* version: 0 (ASN_INTEGER, 0x01, 0x00) */
idx += 3;