This is a port of cyaSSL 2.7.0.

Dependents:   CyaSSL_DTLS_Cellular CyaSSL_DTLS_Ethernet

Committer:
ashleymills
Date:
Thu Sep 05 15:55:50 2013 +0000
Revision:
1:c0ce1562443a
Parent:
0:714293de3836
Nothing;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:714293de3836 1 /* bn.h for openssl */
ashleymills 0:714293de3836 2
ashleymills 0:714293de3836 3
ashleymills 0:714293de3836 4 #ifndef CYASSL_BN_H_
ashleymills 0:714293de3836 5 #define CYASSL_BN_H_
ashleymills 0:714293de3836 6
ashleymills 0:714293de3836 7 #include <cyassl/ctaocrypt/settings.h>
ashleymills 0:714293de3836 8
ashleymills 0:714293de3836 9 #ifdef __cplusplus
ashleymills 0:714293de3836 10 extern "C" {
ashleymills 0:714293de3836 11 #endif
ashleymills 0:714293de3836 12
ashleymills 0:714293de3836 13 typedef struct CYASSL_BIGNUM {
ashleymills 0:714293de3836 14 int neg; /* openssh deference */
ashleymills 0:714293de3836 15 void* internal; /* our big num */
ashleymills 0:714293de3836 16 } CYASSL_BIGNUM;
ashleymills 0:714293de3836 17
ashleymills 0:714293de3836 18
ashleymills 0:714293de3836 19 typedef struct CYASSL_BN_CTX CYASSL_BN_CTX;
ashleymills 0:714293de3836 20
ashleymills 0:714293de3836 21
ashleymills 0:714293de3836 22 CYASSL_API CYASSL_BN_CTX* CyaSSL_BN_CTX_new(void);
ashleymills 0:714293de3836 23 CYASSL_API void CyaSSL_BN_CTX_init(CYASSL_BN_CTX*);
ashleymills 0:714293de3836 24 CYASSL_API void CyaSSL_BN_CTX_free(CYASSL_BN_CTX*);
ashleymills 0:714293de3836 25
ashleymills 0:714293de3836 26 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_new(void);
ashleymills 0:714293de3836 27 CYASSL_API void CyaSSL_BN_free(CYASSL_BIGNUM*);
ashleymills 0:714293de3836 28 CYASSL_API void CyaSSL_BN_clear_free(CYASSL_BIGNUM*);
ashleymills 0:714293de3836 29
ashleymills 0:714293de3836 30
ashleymills 0:714293de3836 31 CYASSL_API int CyaSSL_BN_sub(CYASSL_BIGNUM*, const CYASSL_BIGNUM*,
ashleymills 0:714293de3836 32 const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 33 CYASSL_API int CyaSSL_BN_mod(CYASSL_BIGNUM*, const CYASSL_BIGNUM*,
ashleymills 0:714293de3836 34 const CYASSL_BIGNUM*, const CYASSL_BN_CTX*);
ashleymills 0:714293de3836 35
ashleymills 0:714293de3836 36 CYASSL_API const CYASSL_BIGNUM* CyaSSL_BN_value_one(void);
ashleymills 0:714293de3836 37
ashleymills 0:714293de3836 38
ashleymills 0:714293de3836 39 CYASSL_API int CyaSSL_BN_num_bytes(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 40 CYASSL_API int CyaSSL_BN_num_bits(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 41
ashleymills 0:714293de3836 42 CYASSL_API int CyaSSL_BN_is_zero(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 43 CYASSL_API int CyaSSL_BN_is_one(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 44 CYASSL_API int CyaSSL_BN_is_odd(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 45
ashleymills 0:714293de3836 46 CYASSL_API int CyaSSL_BN_cmp(const CYASSL_BIGNUM*, const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 47
ashleymills 0:714293de3836 48 CYASSL_API int CyaSSL_BN_bn2bin(const CYASSL_BIGNUM*, unsigned char*);
ashleymills 0:714293de3836 49 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_bin2bn(const unsigned char*, int len,
ashleymills 0:714293de3836 50 CYASSL_BIGNUM* ret);
ashleymills 0:714293de3836 51
ashleymills 0:714293de3836 52 CYASSL_API int CyaSSL_mask_bits(CYASSL_BIGNUM*, int n);
ashleymills 0:714293de3836 53
ashleymills 0:714293de3836 54 CYASSL_API int CyaSSL_BN_rand(CYASSL_BIGNUM*, int bits, int top, int bottom);
ashleymills 0:714293de3836 55 CYASSL_API int CyaSSL_BN_is_bit_set(const CYASSL_BIGNUM*, int n);
ashleymills 0:714293de3836 56 CYASSL_API int CyaSSL_BN_hex2bn(CYASSL_BIGNUM**, const char* str);
ashleymills 0:714293de3836 57
ashleymills 0:714293de3836 58 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_dup(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 59 CYASSL_API CYASSL_BIGNUM* CyaSSL_BN_copy(CYASSL_BIGNUM*, const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 60
ashleymills 0:714293de3836 61 CYASSL_API int CyaSSL_BN_set_word(CYASSL_BIGNUM*, unsigned long w);
ashleymills 0:714293de3836 62
ashleymills 0:714293de3836 63 CYASSL_API int CyaSSL_BN_dec2bn(CYASSL_BIGNUM**, const char* str);
ashleymills 0:714293de3836 64 CYASSL_API char* CyaSSL_BN_bn2dec(const CYASSL_BIGNUM*);
ashleymills 0:714293de3836 65
ashleymills 0:714293de3836 66
ashleymills 0:714293de3836 67 typedef CYASSL_BIGNUM BIGNUM;
ashleymills 0:714293de3836 68 typedef CYASSL_BN_CTX BN_CTX;
ashleymills 0:714293de3836 69
ashleymills 0:714293de3836 70 #define BN_CTX_new CyaSSL_BN_CTX_new
ashleymills 0:714293de3836 71 #define BN_CTX_init CyaSSL_BN_CTX_init
ashleymills 0:714293de3836 72 #define BN_CTX_free CyaSSL_BN_CTX_free
ashleymills 0:714293de3836 73
ashleymills 0:714293de3836 74 #define BN_new CyaSSL_BN_new
ashleymills 0:714293de3836 75 #define BN_free CyaSSL_BN_free
ashleymills 0:714293de3836 76 #define BN_clear_free CyaSSL_BN_clear_free
ashleymills 0:714293de3836 77
ashleymills 0:714293de3836 78 #define BN_num_bytes CyaSSL_BN_num_bytes
ashleymills 0:714293de3836 79 #define BN_num_bits CyaSSL_BN_num_bits
ashleymills 0:714293de3836 80
ashleymills 0:714293de3836 81 #define BN_is_zero CyaSSL_BN_is_zero
ashleymills 0:714293de3836 82 #define BN_is_one CyaSSL_BN_is_one
ashleymills 0:714293de3836 83 #define BN_is_odd CyaSSL_BN_is_odd
ashleymills 0:714293de3836 84
ashleymills 0:714293de3836 85 #define BN_cmp CyaSSL_BN_cmp
ashleymills 0:714293de3836 86
ashleymills 0:714293de3836 87 #define BN_bn2bin CyaSSL_BN_bn2bin
ashleymills 0:714293de3836 88 #define BN_bin2bn CyaSSL_BN_bin2bn
ashleymills 0:714293de3836 89
ashleymills 0:714293de3836 90 #define BN_mod CyaSSL_BN_mod
ashleymills 0:714293de3836 91 #define BN_sub CyaSSL_BN_sub
ashleymills 0:714293de3836 92 #define BN_value_one CyaSSL_BN_value_one
ashleymills 0:714293de3836 93
ashleymills 0:714293de3836 94 #define BN_mask_bits CyaSSL_mask_bits
ashleymills 0:714293de3836 95
ashleymills 0:714293de3836 96 #define BN_rand CyaSSL_BN_rand
ashleymills 0:714293de3836 97 #define BN_is_bit_set CyaSSL_BN_is_bit_set
ashleymills 0:714293de3836 98 #define BN_hex2bn CyaSSL_BN_hex2bn
ashleymills 0:714293de3836 99
ashleymills 0:714293de3836 100 #define BN_dup CyaSSL_BN_dup
ashleymills 0:714293de3836 101 #define BN_copy CyaSSL_BN_copy
ashleymills 0:714293de3836 102
ashleymills 0:714293de3836 103 #define BN_set_word CyaSSL_BN_set_word
ashleymills 0:714293de3836 104
ashleymills 0:714293de3836 105 #define BN_dec2bn CyaSSL_BN_dec2bn
ashleymills 0:714293de3836 106 #define BN_bn2dec CyaSSL_BN_bn2dec
ashleymills 0:714293de3836 107
ashleymills 0:714293de3836 108
ashleymills 0:714293de3836 109 #ifdef __cplusplus
ashleymills 0:714293de3836 110 } /* extern "C" */
ashleymills 0:714293de3836 111 #endif
ashleymills 0:714293de3836 112
ashleymills 0:714293de3836 113
ashleymills 0:714293de3836 114 #endif /* CYASSL__H_ */
ashleymills 0:714293de3836 115