bigint.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. ROM functions for hardware bigint support.
  3. It is not recommended to use these functions directly,
  4. use the wrapper functions in hwcrypto/mpi.h instead.
  5. */
  6. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  7. //
  8. // Licensed under the Apache License, Version 2.0 (the "License");
  9. // you may not use this file except in compliance with the License.
  10. // You may obtain a copy of the License at
  11. // http://www.apache.org/licenses/LICENSE-2.0
  12. //
  13. // Unless required by applicable law or agreed to in writing, software
  14. // distributed under the License is distributed on an "AS IS" BASIS,
  15. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. // See the License for the specific language governing permissions and
  17. // limitations under the License.
  18. #ifndef _ROM_BIGINT_H_
  19. #define _ROM_BIGINT_H_
  20. #include <stdint.h>
  21. #include <stdbool.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. //TODO: add comment here
  26. void ets_bigint_enable(void);
  27. void ets_bigint_disable(void);
  28. void ets_bigint_wait_finish(void);
  29. bool ets_bigint_mod_power_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
  30. uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
  31. bool ets_bigint_mod_power_getz(uint32_t *z, uint32_t len);
  32. bool ets_bigint_mult_prepare(uint32_t *x, uint32_t *y, uint32_t len);
  33. bool ets_bigint_mult_getz(uint32_t *z, uint32_t len);
  34. bool ets_bigint_montgomery_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
  35. uint32_t m_dash, uint32_t len, bool again);
  36. bool ets_bigint_montgomery_mult_getz(uint32_t *z, uint32_t len);
  37. bool ets_bigint_mod_mult_prepare(uint32_t *x, uint32_t *y, uint32_t *m,
  38. uint32_t m_dash, uint32_t *rb, uint32_t len, bool again);
  39. bool ets_bigint_mod_mult_getz(uint32_t *m, uint32_t *z, uint32_t len);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /* _ROM_BIGINT_H_ */