Hi Janos,
ret = -53212 is what I am getting. When ret is treated as integer.
Regards,
Arun Lal K M
From: Tom Cosgrove <Tom.Cosgrove@arm.com>
Sent: Friday, June 7, 2024 5:30 PM
To: Janos Follath <Janos.Follath@arm.com>; mbed-tls@lists.trustedfirmware.org; Lal, Arun <arun.lal@intel.com>
Subject: Re: [mbed-tls] Re: How to read ecp private key
What error code are you getting?
Note that you need to capture the returned value (not just set it to 0), as the output is written to the end of the buffer, and the
return value gives the number of bytes of data written.
From: Lal, Arun via mbed-tls <mbed-tls@lists.trustedfirmware.org>
Sent: 07 June 2024 12:49
To: Janos Follath <Janos.Follath@arm.com>;
mbed-tls@lists.trustedfirmware.org <mbed-tls@lists.trustedfirmware.org>
Subject: [mbed-tls] Re: How to read ecp private key
Hi Janos,
I added the following code.
unsigned
char output_buf[16000];
memset(output_buf, 0, 16000);
ret = mbedtls_pk_write_key_der(pk, output_buf, 16000);
if(ret < 0)
{
goto exit;
}
else
{
ret = 0;
}
But it returned failure.
Any idea if I am missing something here?
Regards,
Arun Lal K M
From: Janos Follath <Janos.Follath@arm.com>
Sent: Friday, June 7, 2024 3:41 PM
To: Lal, Arun <arun.lal@intel.com>;
mbed-tls@lists.trustedfirmware.org
Subject: Re: [mbed-tls] How to read ecp private key
Hi Arun,
You can write it into a buffer with the `mbedtls_pk_write_key_der()` function.
Regards,
Janos