iodine 0.4.8 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of iodine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +26 -0
- data/README.md +18 -12
- data/SPEC-Websocket-Draft.md +9 -5
- data/bin/ws-echo +3 -0
- data/examples/config.ru +0 -1
- data/examples/echo.ru +3 -1
- data/examples/redis.ru +0 -1
- data/ext/iodine/base64.c +97 -105
- data/ext/iodine/defer.c +16 -1
- data/ext/iodine/defer.h +10 -0
- data/ext/iodine/evio.c +35 -13
- data/ext/iodine/extconf.rb +1 -1
- data/ext/iodine/facil.c +12 -1
- data/ext/iodine/facil.h +3 -1
- data/ext/iodine/fio2resp.c +71 -0
- data/ext/iodine/fio2resp.h +50 -0
- data/ext/iodine/fio_cli_helper.c +404 -0
- data/ext/iodine/fio_cli_helper.h +152 -0
- data/ext/iodine/fiobj.h +631 -0
- data/ext/iodine/fiobj_alloc.c +81 -0
- data/ext/iodine/fiobj_ary.c +290 -0
- data/ext/iodine/fiobj_generic.c +260 -0
- data/ext/iodine/fiobj_hash.c +447 -0
- data/ext/iodine/fiobj_io.c +58 -0
- data/ext/iodine/fiobj_json.c +779 -0
- data/ext/iodine/fiobj_misc.c +213 -0
- data/ext/iodine/fiobj_numbers.c +113 -0
- data/ext/iodine/fiobj_primitives.c +98 -0
- data/ext/iodine/fiobj_str.c +261 -0
- data/ext/iodine/fiobj_sym.c +213 -0
- data/ext/iodine/fiobj_tests.c +474 -0
- data/ext/iodine/fiobj_types.h +290 -0
- data/ext/iodine/http1.c +54 -36
- data/ext/iodine/http1_parser.c +143 -35
- data/ext/iodine/http1_parser.h +6 -3
- data/ext/iodine/http1_response.c +0 -1
- data/ext/iodine/http_response.c +1 -1
- data/ext/iodine/iodine.c +20 -4
- data/ext/iodine/iodine_protocol.c +5 -4
- data/ext/iodine/iodine_pubsub.c +1 -1
- data/ext/iodine/random.c +5 -5
- data/ext/iodine/sha1.c +5 -8
- data/ext/iodine/sha2.c +8 -11
- data/ext/iodine/sha2.h +3 -3
- data/ext/iodine/sock.c +29 -31
- data/ext/iodine/websocket_parser.h +428 -0
- data/ext/iodine/websockets.c +112 -377
- data/ext/iodine/xor-crypt.c +16 -12
- data/lib/iodine/version.rb +1 -1
- metadata +21 -3
- data/ext/iodine/empty.h +0 -26
data/ext/iodine/xor-crypt.c
CHANGED
@@ -103,14 +103,17 @@ int bscrypt_xor_crypt(xor_key_s *key, void *target, const void *source,
|
|
103
103
|
while (length > i) {
|
104
104
|
while ((key->length - key->position >= 8) // we have 8 bytes for key.
|
105
105
|
&& ((i + 8) <= length) // we have 8 bytes for stream.
|
106
|
-
&& (((uintptr_t)(target + i)) & 7) ==
|
107
|
-
|
106
|
+
&& (((uintptr_t)((uintptr_t)target + i)) & 7) ==
|
107
|
+
0 // target memory is aligned.
|
108
|
+
&& (((uintptr_t)((uintptr_t)source + i)) & 7) ==
|
109
|
+
0 // source memory is aligned.
|
108
110
|
&& ((uintptr_t)(key->key + key->position) & 7) == 0 // key aligned.
|
109
111
|
) {
|
110
112
|
// fprintf(stderr, "XOR optimization used i= %lu, key pos = %lu.\n", i,
|
111
113
|
// key->position);
|
112
|
-
*((uint64_t *)(target + i)) =
|
113
|
-
|
114
|
+
*((uint64_t *)((uintptr_t)target + i)) =
|
115
|
+
*((uint64_t *)((uintptr_t)source + i)) ^
|
116
|
+
*((uint64_t *)(key->key + key->position));
|
114
117
|
key->position += 8;
|
115
118
|
i += 8;
|
116
119
|
if (key->position < key->length)
|
@@ -122,8 +125,9 @@ int bscrypt_xor_crypt(xor_key_s *key, void *target, const void *source,
|
|
122
125
|
|
123
126
|
if (i < length) {
|
124
127
|
// fprintf(stderr, "XOR single byte.\n");
|
125
|
-
*((uint8_t *)(target + i)) =
|
126
|
-
*((uint8_t *)(source + i)) ^
|
128
|
+
*((uint8_t *)((uintptr_t)target + i)) =
|
129
|
+
*((uint8_t *)((uintptr_t)source + i)) ^
|
130
|
+
*((uint8_t *)(key->key + key->position));
|
127
131
|
++i;
|
128
132
|
++key->position;
|
129
133
|
if (key->position == key->length) {
|
@@ -145,8 +149,8 @@ int bscrypt_xor128_crypt(uint64_t *key, void *target, const void *source,
|
|
145
149
|
uint8_t pos = 0;
|
146
150
|
for (size_t i = 0; i < (length >> 3); i++) {
|
147
151
|
((uint64_t *)target)[0] = ((uint64_t *)source)[0] ^ key[pos++];
|
148
|
-
target
|
149
|
-
source
|
152
|
+
target = (void *)((uintptr_t)target + 8);
|
153
|
+
source = (void *)((uintptr_t)source + 8);
|
150
154
|
if (pos < 2)
|
151
155
|
continue;
|
152
156
|
if (on_cycle && on_cycle(key))
|
@@ -169,8 +173,8 @@ int bscrypt_xor256_crypt(uint64_t *key, void *target, const void *source,
|
|
169
173
|
((uint64_t *)target)[1] = ((uint64_t *)source)[1] ^ key[1];
|
170
174
|
((uint64_t *)target)[2] = ((uint64_t *)source)[2] ^ key[2];
|
171
175
|
((uint64_t *)target)[3] = ((uint64_t *)source)[3] ^ key[3];
|
172
|
-
target
|
173
|
-
source
|
176
|
+
target = (void *)((uintptr_t)target + 32);
|
177
|
+
source = (void *)((uintptr_t)source + 32);
|
174
178
|
if (on_cycle && on_cycle(key))
|
175
179
|
return -1;
|
176
180
|
}
|
@@ -178,8 +182,8 @@ int bscrypt_xor256_crypt(uint64_t *key, void *target, const void *source,
|
|
178
182
|
uint8_t pos = 0;
|
179
183
|
for (size_t i = 0; i < (length >> 3); i++) {
|
180
184
|
((uint64_t *)target)[0] = ((uint64_t *)source)[0] ^ key[pos++];
|
181
|
-
target
|
182
|
-
source
|
185
|
+
target = (void *)((uintptr_t)target + 8);
|
186
|
+
source = (void *)((uintptr_t)source + 8);
|
183
187
|
}
|
184
188
|
length = length & 7;
|
185
189
|
for (size_t i = 0; i < length; i++) {
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -132,16 +132,33 @@ files:
|
|
132
132
|
- ext/iodine/bscrypt.h
|
133
133
|
- ext/iodine/defer.c
|
134
134
|
- ext/iodine/defer.h
|
135
|
-
- ext/iodine/empty.h
|
136
135
|
- ext/iodine/evio.c
|
137
136
|
- ext/iodine/evio.h
|
138
137
|
- ext/iodine/extconf.rb
|
139
138
|
- ext/iodine/facil.c
|
140
139
|
- ext/iodine/facil.h
|
140
|
+
- ext/iodine/fio2resp.c
|
141
|
+
- ext/iodine/fio2resp.h
|
142
|
+
- ext/iodine/fio_cli_helper.c
|
143
|
+
- ext/iodine/fio_cli_helper.h
|
141
144
|
- ext/iodine/fio_dict.c
|
142
145
|
- ext/iodine/fio_dict.h
|
143
146
|
- ext/iodine/fio_hash_table.h
|
144
147
|
- ext/iodine/fio_list.h
|
148
|
+
- ext/iodine/fiobj.h
|
149
|
+
- ext/iodine/fiobj_alloc.c
|
150
|
+
- ext/iodine/fiobj_ary.c
|
151
|
+
- ext/iodine/fiobj_generic.c
|
152
|
+
- ext/iodine/fiobj_hash.c
|
153
|
+
- ext/iodine/fiobj_io.c
|
154
|
+
- ext/iodine/fiobj_json.c
|
155
|
+
- ext/iodine/fiobj_misc.c
|
156
|
+
- ext/iodine/fiobj_numbers.c
|
157
|
+
- ext/iodine/fiobj_primitives.c
|
158
|
+
- ext/iodine/fiobj_str.c
|
159
|
+
- ext/iodine/fiobj_sym.c
|
160
|
+
- ext/iodine/fiobj_tests.c
|
161
|
+
- ext/iodine/fiobj_types.h
|
145
162
|
- ext/iodine/hex.c
|
146
163
|
- ext/iodine/hex.h
|
147
164
|
- ext/iodine/http.c
|
@@ -198,6 +215,7 @@ files:
|
|
198
215
|
- ext/iodine/sock.c
|
199
216
|
- ext/iodine/sock.h
|
200
217
|
- ext/iodine/spnlock.inc
|
218
|
+
- ext/iodine/websocket_parser.h
|
201
219
|
- ext/iodine/websockets.c
|
202
220
|
- ext/iodine/websockets.h
|
203
221
|
- ext/iodine/xor-crypt.c
|
data/ext/iodine/empty.h
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright: Boaz segev, 2016-2017
|
3
|
-
License: MIT except for any non-public-domain algorithms (none that I'm aware
|
4
|
-
of), which might be subject to their own licenses.
|
5
|
-
|
6
|
-
Feel free to copy, use and enjoy in accordance with to the license(s).
|
7
|
-
*/
|
8
|
-
#ifndef BSCRYPT_EMPTY_H
|
9
|
-
#define BSCRYPT_EMPTY_H
|
10
|
-
#include "bscrypt-common.h"
|
11
|
-
/* *****************************************************************************
|
12
|
-
C++ extern
|
13
|
-
*/
|
14
|
-
#if defined(__cplusplus)
|
15
|
-
extern "C" {
|
16
|
-
#endif
|
17
|
-
|
18
|
-
/* *****************************************************************************
|
19
|
-
C++ extern finish
|
20
|
-
*/
|
21
|
-
#if defined(__cplusplus)
|
22
|
-
}
|
23
|
-
#endif
|
24
|
-
|
25
|
-
/* ****************************************************************************/
|
26
|
-
#endif /* include guard */
|