Add explicit uint truncation casts
This commit adds some explicit downcasts from `size_t` to `uint8_t` in
the RSASSA signature encoding function `rsa_rsassa_pkcs1_v15_encode`.
The truncation is safe as it has been checked beforehand that the
respective values are in the range of a `uint8_t`.
diff --git a/library/rsa.c b/library/rsa.c
index a171fa6..8c0d8c3 100644
--- a/library/rsa.c
+++ b/library/rsa.c
@@ -1628,17 +1628,17 @@
* TAG-OCTET + LEN [ HASH ] ]
*/
*p++ = MBEDTLS_ASN1_SEQUENCE | MBEDTLS_ASN1_CONSTRUCTED;
- *p++ = 0x08 + oid_size + hashlen;
+ *p++ = (unsigned char)( 0x08 + oid_size + hashlen );
*p++ = MBEDTLS_ASN1_SEQUENCE | MBEDTLS_ASN1_CONSTRUCTED;
- *p++ = 0x04 + oid_size;
+ *p++ = (unsigned char)( 0x04 + oid_size );
*p++ = MBEDTLS_ASN1_OID;
- *p++ = oid_size;
+ *p++ = (unsigned char) oid_size;
memcpy( p, oid, oid_size );
p += oid_size;
*p++ = MBEDTLS_ASN1_NULL;
*p++ = 0x00;
*p++ = MBEDTLS_ASN1_OCTET_STRING;
- *p++ = hashlen;
+ *p++ = (unsigned char) hashlen;
memcpy( p, hash, hashlen );
p += hashlen;