7 #include <cyassl/ctaocrypt/settings.h>
13 typedef struct CYASSL_BIGNUM {
14 int neg; /* openssh deference */
15 void* internal; /* our big num */
19 typedef struct CYASSL_BN_CTX CYASSL_BN_CTX;
22 CYASSL_API CYASSL_BN_CTX* CyaSSL_BN_CTX_new(void);
23 CYASSL_API void CyaSSL_BN_CTX_init(CYASSL_BN_CTX*);
24 CYASSL_API void CyaSSL_BN_CTX_free(CYASSL_BN_CTX*);
26 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_new(void);
27 CYASSL_API void CyaSSL_BN_free(CYASSL_BIGNUM*);
28 CYASSL_API void CyaSSL_BN_clear_free(CYASSL_BIGNUM*);
31 CYASSL_API int CyaSSL_BN_sub(CYASSL_BIGNUM*, const CYASSL_BIGNUM*,
32 const CYASSL_BIGNUM*);
33 CYASSL_API int CyaSSL_BN_mod(CYASSL_BIGNUM*, const CYASSL_BIGNUM*,
34 const CYASSL_BIGNUM*, const CYASSL_BN_CTX*);
36 CYASSL_API const CYASSL_BIGNUM* CyaSSL_BN_value_one(void);
39 CYASSL_API int CyaSSL_BN_num_bytes(const CYASSL_BIGNUM*);
40 CYASSL_API int CyaSSL_BN_num_bits(const CYASSL_BIGNUM*);
42 CYASSL_API int CyaSSL_BN_is_zero(const CYASSL_BIGNUM*);
43 CYASSL_API int CyaSSL_BN_is_one(const CYASSL_BIGNUM*);
44 CYASSL_API int CyaSSL_BN_is_odd(const CYASSL_BIGNUM*);
46 CYASSL_API int CyaSSL_BN_cmp(const CYASSL_BIGNUM*, const CYASSL_BIGNUM*);
48 CYASSL_API int CyaSSL_BN_bn2bin(const CYASSL_BIGNUM*, unsigned char*);
49 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_bin2bn(const unsigned char*, int len,
52 CYASSL_API int CyaSSL_mask_bits(CYASSL_BIGNUM*, int n);
54 CYASSL_API int CyaSSL_BN_rand(CYASSL_BIGNUM*, int bits, int top, int bottom);
55 CYASSL_API int CyaSSL_BN_is_bit_set(const CYASSL_BIGNUM*, int n);
56 CYASSL_API int CyaSSL_BN_hex2bn(CYASSL_BIGNUM**, const char* str);
58 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_dup(const CYASSL_BIGNUM*);
59 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_copy(CYASSL_BIGNUM*, const CYASSL_BIGNUM*);
61 CYASSL_API int CyaSSL_BN_set_word(CYASSL_BIGNUM*, unsigned long w);
63 CYASSL_API int CyaSSL_BN_dec2bn(CYASSL_BIGNUM**, const char* str);
64 CYASSL_API char* CyaSSL_BN_bn2dec(const CYASSL_BIGNUM*);
67 typedef CYASSL_BIGNUM BIGNUM;
68 typedef CYASSL_BN_CTX BN_CTX;
70 #define BN_CTX_new CyaSSL_BN_CTX_new
71 #define BN_CTX_init CyaSSL_BN_CTX_init
72 #define BN_CTX_free CyaSSL_BN_CTX_free
74 #define BN_new CyaSSL_BN_new
75 #define BN_free CyaSSL_BN_free
76 #define BN_clear_free CyaSSL_BN_clear_free
78 #define BN_num_bytes CyaSSL_BN_num_bytes
79 #define BN_num_bits CyaSSL_BN_num_bits
81 #define BN_is_zero CyaSSL_BN_is_zero
82 #define BN_is_one CyaSSL_BN_is_one
83 #define BN_is_odd CyaSSL_BN_is_odd
85 #define BN_cmp CyaSSL_BN_cmp
87 #define BN_bn2bin CyaSSL_BN_bn2bin
88 #define BN_bin2bn CyaSSL_BN_bin2bn
90 #define BN_mod CyaSSL_BN_mod
91 #define BN_sub CyaSSL_BN_sub
92 #define BN_value_one CyaSSL_BN_value_one
94 #define BN_mask_bits CyaSSL_mask_bits
96 #define BN_rand CyaSSL_BN_rand
97 #define BN_is_bit_set CyaSSL_BN_is_bit_set
98 #define BN_hex2bn CyaSSL_BN_hex2bn
100 #define BN_dup CyaSSL_BN_dup
101 #define BN_copy CyaSSL_BN_copy
103 #define BN_set_word CyaSSL_BN_set_word
105 #define BN_dec2bn CyaSSL_BN_dec2bn
106 #define BN_bn2dec CyaSSL_BN_bn2dec
114 #endif /* CYASSL__H_ */