Skip to content

Commit

Permalink
sw_crypto: add register_hash for encrypt_data RSA_OAEP
Browse files Browse the repository at this point in the history
  • Loading branch information
jnippula committed Jan 14, 2025
1 parent a3f22cd commit 0d4bdb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/drivers/sw_crypto/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ bool crypto_encrypt_data(crypto_session_handle_t handle,
initialize_tomcrypt();

if (public_key && rsa_import(public_key, key_sz, &key) == CRYPT_OK) {
// Register hash algorithm.
const struct ltc_hash_descriptor *hash_desc = &sha256_desc;
const int hash_idx = register_hash(hash_desc);
if (outlen >= ltc_mp.unsigned_size(key.N)
&& pkcs_1_oaep_encode(message,
message_size,
Expand All @@ -465,7 +468,7 @@ bool crypto_encrypt_data(crypto_session_handle_t handle,
ltc_mp.count_bits(key.N),
NULL,
0,
0,
hash_idx,
cipher,
&outlen)
== CRYPT_OK
Expand Down

0 comments on commit 0d4bdb3

Please sign in to comment.