summaryrefslogtreecommitdiff
path: root/lib/rsa
diff options
context:
space:
mode:
authorSESA644425 <giojahermann@gmail.com>2022-03-09 01:27:15 -0800
committerTom Rini <trini@konsulko.com>2022-04-11 11:39:19 -0400
commitc755aa8a1dc2f2b819ce36148248ebe93bbc7f86 (patch)
treea66f046d74706b2ac4b2b04cf58cc4df969da89f /lib/rsa
parent7262ff7e564c8b7d81f940af242c20f832ee7511 (diff)
lib: rsa: Fix const-correctness of rsassa_pss functions
Prior to introduction of modifications in rsassa_pss functions related to padding verification, doing a pass to update const-correctness in targeted functions to comply with coding-rules and avoid const-cast Signed-off-by: SESA644425 <gioja.hermann@non.se.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/rsa')
-rw-r--r--lib/rsa/rsa-verify.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index 112664059c..c2c7248f90 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -73,7 +73,7 @@ static int rsa_verify_padding(const uint8_t *msg, const int pad_len,
}
int padding_pkcs_15_verify(struct image_sign_info *info,
- uint8_t *msg, int msg_len,
+ const uint8_t *msg, int msg_len,
const uint8_t *hash, int hash_len)
{
struct checksum_algo *checksum = info->checksum;
@@ -125,7 +125,7 @@ static void u32_i2osp(uint32_t val, uint8_t *buf)
* Return: 0 if the octet string was correctly generated, others on error
*/
static int mask_generation_function1(struct checksum_algo *checksum,
- uint8_t *seed, int seed_len,
+ const uint8_t *seed, int seed_len,
uint8_t *output, int output_len)
{
struct image_region region[2];
@@ -176,9 +176,9 @@ out:
}
static int compute_hash_prime(struct checksum_algo *checksum,
- uint8_t *pad, int pad_len,
- uint8_t *hash, int hash_len,
- uint8_t *salt, int salt_len,
+ const uint8_t *pad, int pad_len,
+ const uint8_t *hash, int hash_len,
+ const uint8_t *salt, int salt_len,
uint8_t *hprime)
{
struct image_region region[3];
@@ -215,7 +215,7 @@ out:
* @hash_len: Length of the hash
*/
int padding_pss_verify(struct image_sign_info *info,
- uint8_t *msg, int msg_len,
+ const uint8_t *msg, int msg_len,
const uint8_t *hash, int hash_len)
{
uint8_t *masked_db = NULL;
@@ -287,7 +287,7 @@ int padding_pss_verify(struct image_sign_info *info,
/* step 12 & 13 */
compute_hash_prime(checksum, pad_zero, 8,
- (uint8_t *)hash, hash_len,
+ hash, hash_len,
salt, salt_len, hprime);
/* step 14 */