mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-20 22:05:15 +00:00
Merge pull request #3355 from AndrzejKurek/fi_error_codes
Change the default value of status variables to an error
This commit is contained in:
commit
478b05c34c
10 changed files with 48 additions and 46 deletions
|
|
@ -1236,7 +1236,7 @@ int uECC_valid_public_key(const uint8_t *public_key)
|
|||
|
||||
int uECC_compute_public_key(const uint8_t *private_key, uint8_t *public_key)
|
||||
{
|
||||
int ret;
|
||||
int ret = UECC_FAULT_DETECTED;
|
||||
uECC_word_t _private[NUM_ECC_WORDS];
|
||||
uECC_word_t _public[NUM_ECC_WORDS * 2];
|
||||
|
||||
|
|
@ -1264,6 +1264,5 @@ int uECC_compute_public_key(const uint8_t *private_key, uint8_t *public_key)
|
|||
uECC_vli_nativeToBytes(
|
||||
public_key +
|
||||
NUM_ECC_BYTES, NUM_ECC_BYTES, _public + NUM_ECC_WORDS);
|
||||
return UECC_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
int uECC_make_key_with_d(uint8_t *public_key, uint8_t *private_key,
|
||||
unsigned int *d)
|
||||
{
|
||||
int ret;
|
||||
int ret = UECC_FAULT_DETECTED;
|
||||
uECC_word_t _private[NUM_ECC_WORDS];
|
||||
uECC_word_t _public[NUM_ECC_WORDS * 2];
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ exit:
|
|||
|
||||
int uECC_make_key(uint8_t *public_key, uint8_t *private_key)
|
||||
{
|
||||
int ret;
|
||||
int ret = UECC_FAULT_DETECTED;
|
||||
uECC_word_t _random[NUM_ECC_WORDS * 2];
|
||||
uECC_word_t _private[NUM_ECC_WORDS];
|
||||
uECC_word_t _public[NUM_ECC_WORDS * 2];
|
||||
|
|
@ -162,7 +162,7 @@ int uECC_shared_secret(const uint8_t *public_key, const uint8_t *private_key,
|
|||
uECC_word_t _private[NUM_ECC_WORDS];
|
||||
wordcount_t num_words = NUM_ECC_WORDS;
|
||||
wordcount_t num_bytes = NUM_ECC_BYTES;
|
||||
int r;
|
||||
int r = UECC_FAULT_DETECTED;
|
||||
|
||||
/* Converting buffers to correct bit order: */
|
||||
uECC_vli_bytesToNative(_private,
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash,
|
|||
uECC_word_t s[NUM_ECC_WORDS];
|
||||
uECC_word_t p[NUM_ECC_WORDS * 2];
|
||||
wordcount_t num_n_words = BITS_TO_WORDS(NUM_ECC_BITS);
|
||||
int r;
|
||||
int r = UECC_FAILURE;
|
||||
|
||||
|
||||
/* Make sure 0 < k < curve_n */
|
||||
|
|
@ -136,7 +136,7 @@ int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash,
|
|||
}
|
||||
|
||||
uECC_vli_nativeToBytes(signature + NUM_ECC_BYTES, NUM_ECC_BYTES, s);
|
||||
return UECC_SUCCESS;
|
||||
return r;
|
||||
}
|
||||
|
||||
int uECC_sign(const uint8_t *private_key, const uint8_t *message_hash,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue