Merge pull request #4542 from SparkiDev/dh_enc_fix

DH encoding: use correct length for inner sequence
This commit is contained in:
David Garske
2021-11-05 08:50:43 -07:00
committed by GitHub

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;