forked from paixaop/node-sodium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sodium_runtime.cc
95 lines (85 loc) · 2.54 KB
/
sodium_runtime.cc
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
/**
* Node Native Module for Lib Sodium
*
* @Author Pedro Paixao
* @email paixaop at gmail dot com
* @License MIT
*/
#include "node_sodium.h"
// int sodium_runtime_has_aesni(void);
NAN_METHOD(bind_sodium_runtime_has_aesni) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_aesni())
);
}
//int sodium_runtime_has_neon(void);
NAN_METHOD(bind_sodium_runtime_has_neon) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_neon())
);
}
//int sodium_runtime_has_sse2(void);
NAN_METHOD(bind_sodium_runtime_has_sse2) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_sse2())
);
}
//int sodium_runtime_has_sse3(void);
NAN_METHOD(bind_sodium_runtime_has_sse3) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_sse3())
);
}
//int sodium_runtime_has_ssse3(void);
NAN_METHOD(bind_sodium_runtime_has_ssse3) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_ssse3())
);
}
//int sodium_runtime_has_sse41(void);
NAN_METHOD(bind_sodium_runtime_has_sse41) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_sse41())
);
}
//int sodium_runtime_has_avx(void);
NAN_METHOD(bind_sodium_runtime_has_avx) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_avx())
);
}
//int sodium_runtime_has_avx2(void);
NAN_METHOD(bind_sodium_runtime_has_avx2) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_avx2())
);
}
//int sodium_runtime_has_pclmul(void);
NAN_METHOD(bind_sodium_runtime_has_pclmul) {
Nan::EscapableHandleScope scope;
return info.GetReturnValue().Set(
Nan::New<Integer>(sodium_runtime_has_pclmul())
);
}
/**
* Register function calls in node binding
*/
void register_runtime(Handle<Object> target) {
NEW_METHOD(sodium_runtime_has_aesni);
NEW_METHOD(sodium_runtime_has_avx);
NEW_METHOD(sodium_runtime_has_avx2);
NEW_METHOD(sodium_runtime_has_neon);
NEW_METHOD(sodium_runtime_has_pclmul);
NEW_METHOD(sodium_runtime_has_sse2);
NEW_METHOD(sodium_runtime_has_sse3);
NEW_METHOD(sodium_runtime_has_sse41);
NEW_METHOD(sodium_runtime_has_ssse3);
}