diff options
author | Rob Austein <sra@hactrn.net> | 2015-06-11 10:53:26 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2015-06-11 10:53:26 -0400 |
commit | 5f152f558e7bc8fc8d93ae250bdc61cd60ab5acd (patch) | |
tree | 097104aa649411d3bf3bec5b14963365016fed04 /cryptech.h | |
parent | 5d21abbc8a727b7a586a91d0fc5c704deb1a69a4 (diff) |
First cut at RSA decryption/signature using the Chinese Remainder
Theorem. Not yet tested, and given the number of moving parts I would
be astonished if this version actually worked, but it does compile.
Added some timing code to tests/test-rsa.c so we can see whether this
is doing anything useful once it does work.
Diffstat (limited to 'cryptech.h')
-rw-r--r-- | cryptech.h | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -442,6 +442,10 @@ DEFINE_HAL_ERROR(HAL_ERROR_KEYWRAP_BAD_MAGIC, "Bad magic number while unwrapping key") \ DEFINE_HAL_ERROR(HAL_ERROR_KEYWRAP_BAD_LENGTH, "Length out of range while unwrapping key") \ DEFINE_HAL_ERROR(HAL_ERROR_KEYWRAP_BAD_PADDING, "Non-zero padding detected unwrapping key") \ + DEFINE_HAL_ERROR(HAL_ERROR_CRT_FAILED, "CRT calculation failed") \ + DEFINE_HAL_ERROR(HAL_ERROR_ALLOCATION_FAILURE, "Memory allocation failed") \ + DEFINE_HAL_ERROR(HAL_ERROR_UNKNOWN_TFM_FAILURE, "Unknown libtfm failure") \ + DEFINE_HAL_ERROR(HAL_ERROR_RESULT_TOO_LONG, "Result too long for buffer") \ END_OF_HAL_ERROR_LIST /* Marker to forestall silly line continuation errors */ @@ -595,6 +599,22 @@ extern hal_error_t hal_modexp(const uint8_t * const msg, const size_t msg_len, / uint8_t * result, const size_t result_len); +/* + * RSA. This is not the real API (yet), just test functions for debugging. + */ + +extern void hal_rsa_set_debug(const int onoff); + +extern hal_error_t hal_rsa_crt(const uint8_t * const m, const size_t m_len, + const uint8_t * const n, const size_t n_len, + const uint8_t * const e, const size_t e_len, + const uint8_t * const d, const size_t d_len, + const uint8_t * const p, const size_t p_len, + const uint8_t * const q, const size_t q_len, + const uint8_t * const u, const size_t u_len, + uint8_t * result, const size_t result_len); + + #endif /* _CRYPTECH_H_ */ |