Skip to content

Commit

Permalink
Rename mgf_digest_size to mgf_size to fix checkpatch warnings
Browse files Browse the repository at this point in the history
Reformatting these function calls will always result in checkpatch
warnings unless the variable names are shorter or the calls is
refactored to a separate function. Shortening the name is simpler.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
  • Loading branch information
samitolvanen committed Apr 5, 2024
1 parent 14fc4f1 commit d66d728
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/drivers/crypto/caam/acipher/caam_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ static TEE_Result do_oaep_decoding(struct drvcrypt_rsa_ed *rsa_data)
* Note: Use same buffer for seed and seedMask
*/
mgf_data.hash_algo = rsa_data->mgf_algo;
mgf_data.digest_size = rsa_data->mgf_digest_size;
mgf_data.digest_size = rsa_data->mgf_size;
mgf_data.seed.data = maskedDB.data;
mgf_data.seed.length = maskedDB.length;
mgf_data.mask.data = seed.data;
Expand Down Expand Up @@ -1124,7 +1124,7 @@ static TEE_Result do_oaep_encoding(struct drvcrypt_rsa_ed *rsa_data)
* dbMask = MGF(seed, k - hLen - 1)
*/
mgf_data.hash_algo = rsa_data->mgf_algo;
mgf_data.digest_size = rsa_data->mgf_digest_size;
mgf_data.digest_size = rsa_data->mgf_size;
mgf_data.seed.data = seed.data;
mgf_data.seed.length = seed.length;
mgf_data.mask.data = dbMask.data;
Expand Down
10 changes: 4 additions & 6 deletions core/drivers/crypto/crypto_api/acipher/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,8 @@ TEE_Result crypto_acipher_rsaes_decrypt(uint32_t algo, struct rsa_keypair *key,
return ret;

rsa_data.mgf_algo = mgf_algo;
ret = tee_alg_get_digest_size(
rsa_data.mgf_algo,
&rsa_data.mgf_digest_size);
ret = tee_alg_get_digest_size(rsa_data.mgf_algo,
&rsa_data.mgf_size);
if (ret != TEE_SUCCESS)
return ret;

Expand Down Expand Up @@ -332,9 +331,8 @@ TEE_Result crypto_acipher_rsaes_encrypt(uint32_t algo,
return TEE_ERROR_BAD_PARAMETERS;

rsa_data.mgf_algo = mgf_algo;
ret = tee_alg_get_digest_size(
rsa_data.mgf_algo,
&rsa_data.mgf_digest_size);
ret = tee_alg_get_digest_size(rsa_data.mgf_algo,
&rsa_data.mgf_size);
if (ret != TEE_SUCCESS)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion core/drivers/crypto/crypto_api/include/drvcrypt_acipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct drvcrypt_rsa_ed {
struct drvcrypt_buf cipher; /* Cipher encrypted or to decrypt */
struct drvcrypt_buf label; /* Additional Label (RSAES) */
uint32_t mgf_algo; /* MGF1 hash algorithm (RSAES) */
size_t mgf_digest_size; /* MGF1 hash digest size (RSAES) */
size_t mgf_size; /* MGF1 hash digest size (RSAES) */

/* RSA Mask Generation function */
TEE_Result (*mgf)(struct drvcrypt_rsa_mgf *mgf_data);
Expand Down

0 comments on commit d66d728

Please sign in to comment.