-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskey.h
307 lines (269 loc) · 4.17 KB
/
skey.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/*
* header file for skey
*
* Version 0.0
*/
/*
*--------------------
*
* included header files
*
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "skey_definitions.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* --------------------
*
* ptr structure
*
*/
typedef struct skey_ptr
{
char *ptr;
struct skey_ptr *next;
struct skey_ptr *last;
} skey_ptr_t;
/*
* --------------------
*
* mem structure
*
*/
typedef struct skey_mem
{
skey_ptr_t *start;
skey_ptr_t *ptr;
unsigned int size;
} skey_mem_t;
/*
* --------------------
*
* skey addbin structure
*
*/
typedef struct skey_addbin
{
skey_mem_t mem;
char overflow;
char *first;
char *second;
char *result;
unsigned int *first_size;
unsigned int *second_size;
unsigned int offset;
unsigned int size;
}skey_addbin_t;
/*
* --------------------
*
* skey structure skey_clearmem
*
*/
typedef struct skey_clearmem
{
skey_mem_t mem;
}skey_clearmem_t;
/*
* --------------------
*
* skey structure skey_compare
*
*/
typedef struct skey_compare
{
skey_mem_t mem;
unsigned int offset;
unsigned first_offset;
unsigned second_offset;
}skey_compare_t;
/*
* --------------------
*
* skey structure skey_convert
*
*/
typedef struct skey_convert
{
skey_mem_t mem;
unsigned int offset;
unsigned int offset2;
unsigned int size;
}skey_convert_t;
/*
* --------------------
*
* skey structure skey_crypt
*
*/
typedef struct skey_crypt
{
skey_mem_t mem;
char *in;
unsigned int offset;
unsigned int offset2;
unsigned int size;
}skey_crypt_t;
/*
* --------------------
*
* skey structure skey_divbin
*
*/
typedef struct skey_divbin
{
skey_mem_t mem;
char *free_ptr;
char *first;
char **first_ptr;
char *divident;
char *divisor;
unsigned int first_size;
unsigned int divisor_size;
unsigned int divident_size;
unsigned int offset;
unsigned int qoffset;
int done;
}skey_divbin_t;
/*
* --------------------
*
* skey structure getmem
*
*/
typedef struct skey_getmem
{
skey_ptr_t *start;
skey_ptr_t *ptr;
}skey_getmem_t;
/*
* --------------------
*
* skey structure skey_mulbin
*
*/
typedef struct skey_mulbin
{
skey_mem_t mem;
char *multiplicand;
char *multiplier;
char *one;
char *product;
char *ptr;
char *realloc;
char *result;
unsigned int k;
unsigned int multiplicand_size;
unsigned int multiplier_size;
unsigned int product_size;
unsigned int ptr_size;
unsigned int result_size;
unsigned int offset;
unsigned int size;
}skey_mulbin_t;
/*
* --------------------
*
* skey structure skey_subbin
*
*/
typedef struct skey_subbin
{
skey_mem_t mem;
char one;
char *minuend;
char *subtrahend;
char *new_subtrahend;
unsigned int minuend_size;
unsigned int offset;
unsigned int size;
}skey_subbin_t;
/*
* --------------------
*
* skey structure skey_read
*
*/
typedef struct skey_read
{
skey_mem_t mem;
unsigned int size;
unsigned int offset;
unsigned int offset2;
}skey_read_t;
/*
* --------------------
*
* skey structure skey_mod
*
*/
typedef struct skey_mod
{
skey_mem_t mem;
char *divident;
char *out;
char *out_offset;
char *quotient;
char *remainder;
char *result;
unsigned int divident_size;
unsigned int one_size;
unsigned int offset;
unsigned int out_size;
unsigned int quotient_size;
unsigned int remainder_size;
unsigned int result_size;
char one;
}skey_mod_t;
/*
* --------------------
*
* skey structure skey_unmod
*
*/
typedef struct skey_unmod
{
skey_mem_t mem;
char *base;
char *in;
char **in_ptr;
char *in2;
char *multiplier;
char **mult_ptr;
char *out;
char *position;
char *product;
char *ptr;
char *result;
char *sum;
unsigned int base_size;
unsigned int in2_size;
int multiplier_size;
unsigned int offset;
unsigned int offset2;
unsigned int out_size;
unsigned int product_size;
unsigned int position_size;
unsigned int sum_size;
char one;
char zero;
}skey_unmod_t;
/*
* --------------------
*
* skey structure skey_dest
*
*/
typedef struct skey_dest
{
skey_ptr_t *start;
}skey_dest_t;
/* -------------------- */
#ifdef __cplusplus
}
#endif
#include "skey_proto.h"