Skip to content

Commit

Permalink
remove const modifiers to rsa operations
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed Oct 10, 2023
1 parent 9dd712b commit 75192fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/rsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int rsa_generate_key(rsa_key_t *key, uint16_t nbits);
*
* @return 0 on success.
*/
int rsa_get_public_key(const rsa_key_t *key, uint8_t *n);
int rsa_get_public_key(rsa_key_t *key, uint8_t *n);

/**
* Compute private key operation, used in sign or decrypt.
Expand All @@ -49,7 +49,7 @@ int rsa_get_public_key(const rsa_key_t *key, uint8_t *n);
*
* @return 0 on success.
*/
int rsa_private(const rsa_key_t *key, const uint8_t *input, uint8_t *output);
int rsa_private(rsa_key_t *key, const uint8_t *input, uint8_t *output);

int rsa_sign_pkcs_v15(const rsa_key_t *key, const uint8_t *data, size_t len, uint8_t *sig);

Expand Down
6 changes: 4 additions & 2 deletions src/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ __attribute__((weak)) int rsa_generate_key(rsa_key_t *key, uint16_t nbits) {
mbedtls_rsa_free(&rsa);
#else
(void)key;
(void)nbits;
#endif
return ret;
}

__attribute__((weak)) int rsa_get_public_key(const rsa_key_t *key, uint8_t *n) {
__attribute__((weak)) int rsa_get_public_key(rsa_key_t *key, uint8_t *n) {
int ret = 0;
#ifdef USE_MBEDCRYPTO
mbedtls_rsa_context rsa;
Expand All @@ -74,11 +75,12 @@ __attribute__((weak)) int rsa_get_public_key(const rsa_key_t *key, uint8_t *n) {
mbedtls_rsa_free(&rsa);
#else
(void)key;
(void)n;
#endif
return ret;
}

__attribute__((weak)) int rsa_private(const rsa_key_t *key, const uint8_t *input, uint8_t *output) {
__attribute__((weak)) int rsa_private(rsa_key_t *key, const uint8_t *input, uint8_t *output) {
int ret = 0;
#ifdef USE_MBEDCRYPTO
mbedtls_rsa_context rsa;
Expand Down

0 comments on commit 75192fd

Please sign in to comment.