From 62e6ea2c22244953b0f86a84378fd4fbd75f2280 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Fri, 18 Mar 2022 15:39:44 +0100 Subject: [PATCH] Avoid spurious write to *olen in PSA version of rsa_encrypt_wrap() Signed-off-by: Neil Armstrong --- library/pk_wrap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 73005cfda..8f9b5e56e 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -249,9 +249,7 @@ static int rsa_encrypt_wrap( void *ctx, return( MBEDTLS_ERR_RSA_INVALID_PADDING ); #endif - *olen = mbedtls_rsa_get_len( rsa ); - - if( *olen > osize ) + if( mbedtls_rsa_get_len( rsa ) > osize ) return( MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE ); /* mbedtls_pk_write_pubkey_der() expects a full PK context;