From 47b069ce54f15512b82ef4f114457dd3a0f4dc7b Mon Sep 17 00:00:00 2001 From: eve Date: Thu, 28 Sep 2023 13:25:12 -0500 Subject: [PATCH] fixed bug from last commit Signed-off-by: Felipe Ventura --- oqsprov/oqs_encode_key2any.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/oqsprov/oqs_encode_key2any.c b/oqsprov/oqs_encode_key2any.c index 2f0b9cc2..58b53c4e 100644 --- a/oqsprov/oqs_encode_key2any.c +++ b/oqsprov/oqs_encode_key2any.c @@ -712,10 +712,11 @@ static int oqsx_pki_priv_to_der(const void *vxkey, unsigned char **pder) buflen = oqsxkey->privkeylen_cmp[i] + oqsxkey->pubkeylen_cmp[i]; buf = OPENSSL_malloc(buflen); - - if(get_oqsname_fromtls(name) != 0)//include pubkey in privkey for PQC + memcpy(buf, oqsxkey->comp_privkey[i], buflen); + if(get_oqsname_fromtls(name) != 0){//include pubkey in privkey for PQC + memcpy(buf, oqsxkey->comp_privkey[i], oqsxkey->privkeylen_cmp[i]); memcpy(buf + oqsxkey->privkeylen_cmp[i], oqsxkey->comp_pubkey[i], oqsxkey->pubkeylen_cmp[i]); - else + }else memcpy(buf, oqsxkey->comp_privkey[i], buflen); ASN1_STRING_set0(tempOct, buf, buflen);