bgn_export.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #ifndef _BIGNUM_EXPORT_H
  2. #define _BIGNUM_EXPORT_H
  3. typedef struct {
  4. int s;
  5. int n;
  6. unsigned long *p;
  7. } bgn;
  8. /**************************************************************************
  9. * EXPORT FUNCTIONS
  10. **************************************************************************/
  11. int bgn_read_bin(bgn *X, const unsigned char *buf, int buflen);
  12. int bgn_write_bin(const bgn *X, unsigned char *buf, int buflen);
  13. int bgn_read_str(bgn *X, int radix, const char *s, int length);
  14. int bgn_exp_mod(bgn *X, const bgn *E, const bgn *N, bgn *_RR);
  15. /**************************************************************************
  16. * ERROR CODE
  17. **************************************************************************/
  18. #define E_BGN_FILE_IOEOR 0x0001
  19. #define E_BGN_BAD_INPUT_DATA 0x0002
  20. #define E_BGN_INVALID_CHARACTER 0x0003
  21. #define E_BGN_BUFFER_TOO_SMALL 0x0004
  22. #define E_BGN_NEGATIVE_VALUE 0x0005
  23. #define E_BGN_DIVISION_BY_ZERO 0x0006
  24. #define E_BGN_NOT_ACCEPTABLE 0x0007
  25. #endif /* bgn.h */