source: UsbWattMeter/trunk/wolfssl-3.7.0/wolfssl/openssl/bn.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 5.0 KB
Line 
1/* bn.h for openssl */
2
3
4#ifndef WOLFSSL_BN_H_
5#define WOLFSSL_BN_H_
6
7#include <wolfssl/wolfcrypt/settings.h>
8#include <wolfssl/wolfcrypt/integer.h>
9
10#ifdef __cplusplus
11 extern "C" {
12#endif
13
14typedef struct WOLFSSL_BIGNUM {
15 int neg; /* openssh deference */
16 void* internal; /* our big num */
17} WOLFSSL_BIGNUM;
18
19
20#define WOLFSSL_BN_ULONG mp_digit
21
22typedef struct WOLFSSL_BN_CTX WOLFSSL_BN_CTX;
23typedef struct WOLFSSL_BN_GENCB WOLFSSL_BN_GENCB;
24
25WOLFSSL_API WOLFSSL_BN_CTX* wolfSSL_BN_CTX_new(void);
26WOLFSSL_API void wolfSSL_BN_CTX_init(WOLFSSL_BN_CTX*);
27WOLFSSL_API void wolfSSL_BN_CTX_free(WOLFSSL_BN_CTX*);
28
29WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_new(void);
30WOLFSSL_API void wolfSSL_BN_free(WOLFSSL_BIGNUM*);
31WOLFSSL_API void wolfSSL_BN_clear_free(WOLFSSL_BIGNUM*);
32
33
34WOLFSSL_API int wolfSSL_BN_sub(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*,
35 const WOLFSSL_BIGNUM*);
36WOLFSSL_API int wolfSSL_BN_mod(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*,
37 const WOLFSSL_BIGNUM*, const WOLFSSL_BN_CTX*);
38
39WOLFSSL_API const WOLFSSL_BIGNUM* wolfSSL_BN_value_one(void);
40
41
42WOLFSSL_API int wolfSSL_BN_num_bytes(const WOLFSSL_BIGNUM*);
43WOLFSSL_API int wolfSSL_BN_num_bits(const WOLFSSL_BIGNUM*);
44
45WOLFSSL_API int wolfSSL_BN_is_zero(const WOLFSSL_BIGNUM*);
46WOLFSSL_API int wolfSSL_BN_is_one(const WOLFSSL_BIGNUM*);
47WOLFSSL_API int wolfSSL_BN_is_odd(const WOLFSSL_BIGNUM*);
48
49WOLFSSL_API int wolfSSL_BN_cmp(const WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*);
50
51WOLFSSL_API int wolfSSL_BN_bn2bin(const WOLFSSL_BIGNUM*, unsigned char*);
52WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_bin2bn(const unsigned char*, int len,
53 WOLFSSL_BIGNUM* ret);
54
55WOLFSSL_API int wolfSSL_mask_bits(WOLFSSL_BIGNUM*, int n);
56
57WOLFSSL_API int wolfSSL_BN_rand(WOLFSSL_BIGNUM*, int bits, int top, int bottom);
58WOLFSSL_API int wolfSSL_BN_is_bit_set(const WOLFSSL_BIGNUM*, int n);
59WOLFSSL_API int wolfSSL_BN_hex2bn(WOLFSSL_BIGNUM**, const char* str);
60
61WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_dup(const WOLFSSL_BIGNUM*);
62WOLFSSL_API WOLFSSL_BIGNUM* wolfSSL_BN_copy(WOLFSSL_BIGNUM*,
63 const WOLFSSL_BIGNUM*);
64
65WOLFSSL_API int wolfSSL_BN_dec2bn(WOLFSSL_BIGNUM**, const char* str);
66WOLFSSL_API char* wolfSSL_BN_bn2dec(const WOLFSSL_BIGNUM*);
67
68WOLFSSL_API int wolfSSL_BN_lshift(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*, int);
69WOLFSSL_API int wolfSSL_BN_add_word(WOLFSSL_BIGNUM*, WOLFSSL_BN_ULONG);
70WOLFSSL_API int wolfSSL_BN_set_bit(WOLFSSL_BIGNUM*, int);
71WOLFSSL_API int wolfSSL_BN_set_word(WOLFSSL_BIGNUM*, WOLFSSL_BN_ULONG);
72
73WOLFSSL_API int wolfSSL_BN_add(WOLFSSL_BIGNUM*, WOLFSSL_BIGNUM*,
74 WOLFSSL_BIGNUM*);
75WOLFSSL_API char *wolfSSL_BN_bn2hex(const WOLFSSL_BIGNUM*);
76WOLFSSL_API int wolfSSL_BN_is_prime_ex(const WOLFSSL_BIGNUM*, int,
77 WOLFSSL_BN_CTX*, WOLFSSL_BN_GENCB*);
78WOLFSSL_API WOLFSSL_BN_ULONG wolfSSL_BN_mod_word(const WOLFSSL_BIGNUM*,
79 WOLFSSL_BN_ULONG);
80#ifndef NO_FILESYSTEM
81 WOLFSSL_API int wolfSSL_BN_print_fp(XFILE , const WOLFSSL_BIGNUM*);
82#endif
83WOLFSSL_API int wolfSSL_BN_rshift(WOLFSSL_BIGNUM*, const WOLFSSL_BIGNUM*, int);
84WOLFSSL_API WOLFSSL_BIGNUM *wolfSSL_BN_CTX_get(WOLFSSL_BN_CTX *ctx);
85WOLFSSL_API void wolfSSL_BN_CTX_start(WOLFSSL_BN_CTX *ctx);
86
87typedef WOLFSSL_BIGNUM BIGNUM;
88typedef WOLFSSL_BN_CTX BN_CTX;
89typedef WOLFSSL_BN_GENCB BN_GENCB;
90
91#define BN_CTX_new wolfSSL_BN_CTX_new
92#define BN_CTX_init wolfSSL_BN_CTX_init
93#define BN_CTX_free wolfSSL_BN_CTX_free
94
95#define BN_new wolfSSL_BN_new
96#define BN_free wolfSSL_BN_free
97#define BN_clear_free wolfSSL_BN_clear_free
98
99#define BN_num_bytes wolfSSL_BN_num_bytes
100#define BN_num_bits wolfSSL_BN_num_bits
101
102#define BN_is_zero wolfSSL_BN_is_zero
103#define BN_is_one wolfSSL_BN_is_one
104#define BN_is_odd wolfSSL_BN_is_odd
105
106#define BN_cmp wolfSSL_BN_cmp
107
108#define BN_bn2bin wolfSSL_BN_bn2bin
109#define BN_bin2bn wolfSSL_BN_bin2bn
110
111#define BN_mod wolfSSL_BN_mod
112#define BN_sub wolfSSL_BN_sub
113#define BN_value_one wolfSSL_BN_value_one
114
115#define BN_mask_bits wolfSSL_mask_bits
116
117#define BN_rand wolfSSL_BN_rand
118#define BN_is_bit_set wolfSSL_BN_is_bit_set
119#define BN_hex2bn wolfSSL_BN_hex2bn
120
121#define BN_dup wolfSSL_BN_dup
122#define BN_copy wolfSSL_BN_copy
123
124#define BN_set_word wolfSSL_BN_set_word
125
126#define BN_dec2bn wolfSSL_BN_dec2bn
127#define BN_bn2dec wolfSSL_BN_bn2dec
128#define BN_bn2hex wolfSSL_BN_bn2hex
129
130#define BN_lshift wolfSSL_BN_lshift
131#define BN_add_word wolfSSL_BN_add_word
132#define BN_add wolfSSL_BN_add
133#define BN_set_word wolfSSL_BN_set_word
134#define BN_set_bit wolfSSL_BN_set_bit
135
136
137#define BN_is_prime_ex wolfSSL_BN_is_prime_ex
138#define BN_print_fp wolfSSL_BN_print_fp
139#define BN_rshift wolfSSL_BN_rshift
140#define BN_mod_word wolfSSL_BN_mod_word
141
142#define BN_CTX_get wolfSSL_BN_CTX_get
143#define BN_CTX_start wolfSSL_BN_CTX_start
144
145#ifdef __cplusplus
146 } /* extern "C" */
147#endif
148
149
150#endif /* WOLFSSL__H_ */
151
Note: See TracBrowser for help on using the repository browser.