From dd482bfd6a5194b6a5d83e1f9159053b971cc35f Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Wed, 16 Mar 2022 11:43:22 +0100 Subject: [PATCH] Modify own_pubkey_max_len calculation Signed-off-by: Przemek Stekiel --- library/ssl_srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 87e6b64bde..dc5b8a550e 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -3166,8 +3166,9 @@ curve_matching_done: * Make one byte space for the length. */ unsigned char *own_pubkey = p + data_length_size; + size_t own_pubkey_max_len = (size_t)( MBEDTLS_SSL_OUT_CONTENT_LEN - - ssl->out_msglen - header_size ); + - ( own_pubkey - ssl->out_msg ) ); status = psa_export_public_key( handshake->ecdh_psa_privkey, own_pubkey, own_pubkey_max_len,