From ac4cd362973e9cf57c3aaf0857260950757af461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 14 Aug 2013 20:20:41 +0200 Subject: [PATCH] PK rsa_verify: check signature length --- library/pk_wrap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/pk_wrap.c b/library/pk_wrap.c index e2c9bb126..8f6150025 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -62,7 +62,8 @@ static int rsa_verify_wrap( void *ctx, const unsigned char *hash, const md_info_t *md_info, const unsigned char *sig, size_t sig_len ) { - ((void) sig_len); + if( sig_len != ((rsa_context *) ctx)->len ) + return( POLARSSL_ERR_RSA_VERIFY_FAILED ); return( rsa_pkcs1_verify( (rsa_context *) ctx, RSA_PUBLIC, md_info->type, 0, hash, sig ) );