Fix RSA sigs for mbed TLS 2.7.0
In https://github.com/ARMmbed/mbedtls/commit/2f8f06aa25e9d5ee4fc9fe217543c872b39e4d05
commit 2f8f06aa25e9d5ee4fc9fe217543c872b39e4d05
Author: Hanno Becker <hanno.becker@arm.com>
Date: Fri Sep 29 11:47:26 2017 +0100
Don't always recompute context length in mbedtls_rsa_get_len
mbed TLS begins assuming that the 'len' field of the context has been
set properly. Previously, we relied on this not being true, and various
tests fail for all keys without setting this.
The fix is to simply set the length based on the value we read.
fixes #235.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/boot/bootutil/src/image_rsa.c b/boot/bootutil/src/image_rsa.c
index d437add..79eb61b 100644
--- a/boot/bootutil/src/image_rsa.c
+++ b/boot/bootutil/src/image_rsa.c
@@ -85,6 +85,8 @@
return -3;
}
+ ctx->len = mbedtls_mpi_size(&ctx->N);
+
if (*p != end) {
return -4;
}