bcrypt-ruby 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bcrypt-ruby might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -35,3 +35,6 @@
35
35
 
36
36
  2.1.1 Aug 14 2009
37
37
  - JVM 1.4/1.5 compatibility [Hongli Lai]
38
+
39
+ 2.1.2 Sep 16 2009
40
+ - Fixed support for Solaris, OpenSolaris.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/rdoctask'
7
7
  require "benchmark"
8
8
 
9
9
  PKG_NAME = "bcrypt-ruby"
10
- PKG_VERSION = "2.1.1"
10
+ PKG_VERSION = "2.1.2"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  PKG_FILES = FileList[
13
13
  '[A-Z]*',
@@ -1,6 +1,10 @@
1
1
  /* $OpenBSD: bcrypt.c,v 1.22 2007/02/20 01:44:16 ray Exp $ */
2
2
 
3
- /*
3
+ /*
4
+ * Modified by <coda.hale@gmail.com> on 2009-09-16:
5
+ *
6
+ * - Standardized on stdint.h's numerical types and removed some debug cruft.
7
+ *
4
8
  * Modified by <hongli@phusion.nl> on 2009-08-05:
5
9
  *
6
10
  * - Got rid of the global variables; they're not thread-safe.
@@ -58,13 +62,8 @@
58
62
  *
59
63
  */
60
64
 
61
- #if 0
62
- #include <stdio.h>
63
- #endif
64
-
65
65
  #include <stdio.h>
66
66
  #include <stdlib.h>
67
- #include <sys/types.h>
68
67
  #include <string.h>
69
68
  #include "blf.h"
70
69
  #include "bcrypt.h"
@@ -74,14 +73,14 @@
74
73
  * time to come.
75
74
  */
76
75
 
77
- static void encode_salt(char *, u_int8_t *, u_int16_t, u_int8_t);
78
- static void encode_base64(u_int8_t *, u_int8_t *, u_int16_t);
79
- static void decode_base64(u_int8_t *, u_int16_t, u_int8_t *);
76
+ static void encode_salt(char *, uint8_t *, uint16_t, uint8_t);
77
+ static void encode_base64(uint8_t *, uint8_t *, uint16_t);
78
+ static void decode_base64(uint8_t *, uint16_t, uint8_t *);
80
79
 
81
- const static u_int8_t Base64Code[] =
80
+ const static uint8_t Base64Code[] =
82
81
  "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
83
82
 
84
- const static u_int8_t index_64[128] = {
83
+ const static uint8_t index_64[128] = {
85
84
  255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
86
85
  255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
87
86
  255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
@@ -99,11 +98,11 @@ const static u_int8_t index_64[128] = {
99
98
  #define CHAR64(c) ( (c) > 127 ? 255 : index_64[(c)])
100
99
 
101
100
  static void
102
- decode_base64(u_int8_t *buffer, u_int16_t len, u_int8_t *data)
101
+ decode_base64(uint8_t *buffer, uint16_t len, uint8_t *data)
103
102
  {
104
- u_int8_t *bp = buffer;
105
- u_int8_t *p = data;
106
- u_int8_t c1, c2, c3, c4;
103
+ uint8_t *bp = buffer;
104
+ uint8_t *p = data;
105
+ uint8_t c1, c2, c3, c4;
107
106
  while (bp < buffer + len) {
108
107
  c1 = CHAR64(*p);
109
108
  c2 = CHAR64(*(p + 1));
@@ -134,7 +133,7 @@ decode_base64(u_int8_t *buffer, u_int16_t len, u_int8_t *data)
134
133
  }
135
134
 
136
135
  static void
137
- encode_salt(char *salt, u_int8_t *csalt, u_int16_t clen, u_int8_t logr)
136
+ encode_salt(char *salt, uint8_t *csalt, uint16_t clen, uint8_t logr)
138
137
  {
139
138
  salt[0] = '$';
140
139
  salt[1] = BCRYPT_VERSION;
@@ -143,7 +142,7 @@ encode_salt(char *salt, u_int8_t *csalt, u_int16_t clen, u_int8_t logr)
143
142
 
144
143
  snprintf(salt + 4, 4, "%2.2u$", logr);
145
144
 
146
- encode_base64((u_int8_t *) salt + 7, csalt, clen);
145
+ encode_base64((uint8_t *) salt + 7, csalt, clen);
147
146
  }
148
147
  /* Generates a salt for this version of crypt.
149
148
  Since versions may change. Keeping this here
@@ -151,7 +150,7 @@ encode_salt(char *salt, u_int8_t *csalt, u_int16_t clen, u_int8_t logr)
151
150
  */
152
151
 
153
152
  char *
154
- bcrypt_gensalt(char *output, u_int8_t log_rounds, u_int8_t *rseed)
153
+ bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed)
155
154
  {
156
155
  if (log_rounds < 4)
157
156
  log_rounds = 4;
@@ -168,12 +167,12 @@ char *
168
167
  bcrypt(char *output, const char *key, const char *salt)
169
168
  {
170
169
  blf_ctx state;
171
- u_int32_t rounds, i, k;
172
- u_int16_t j;
173
- u_int8_t key_len, salt_len, logr, minor;
174
- u_int8_t ciphertext[4 * BCRYPT_BLOCKS] = "OrpheanBeholderScryDoubt";
175
- u_int8_t csalt[BCRYPT_MAXSALT];
176
- u_int32_t cdata[BCRYPT_BLOCKS];
170
+ uint32_t rounds, i, k;
171
+ uint16_t j;
172
+ uint8_t key_len, salt_len, logr, minor;
173
+ uint8_t ciphertext[4 * BCRYPT_BLOCKS] = "OrpheanBeholderScryDoubt";
174
+ uint8_t csalt[BCRYPT_MAXSALT];
175
+ uint32_t cdata[BCRYPT_BLOCKS];
177
176
  int n;
178
177
 
179
178
  /* Discard "$" identifier */
@@ -208,8 +207,8 @@ bcrypt(char *output, const char *key, const char *salt)
208
207
  n = atoi(salt);
209
208
  if (n > 31 || n < 0)
210
209
  return NULL;
211
- logr = (u_int8_t)n;
212
- if ((rounds = (u_int32_t) 1 << logr) < BCRYPT_MINROUNDS)
210
+ logr = (uint8_t)n;
211
+ if ((rounds = (uint32_t) 1 << logr) < BCRYPT_MINROUNDS)
213
212
  return NULL;
214
213
 
215
214
  /* Discard num rounds + "$" identifier */
@@ -219,16 +218,16 @@ bcrypt(char *output, const char *key, const char *salt)
219
218
  return NULL;
220
219
 
221
220
  /* We dont want the base64 salt but the raw data */
222
- decode_base64(csalt, BCRYPT_MAXSALT, (u_int8_t *) salt);
221
+ decode_base64(csalt, BCRYPT_MAXSALT, (uint8_t *) salt);
223
222
  salt_len = BCRYPT_MAXSALT;
224
223
  key_len = strlen(key) + (minor >= 'a' ? 1 : 0);
225
224
 
226
225
  /* Setting up S-Boxes and Subkeys */
227
226
  Blowfish_initstate(&state);
228
227
  Blowfish_expandstate(&state, csalt, salt_len,
229
- (u_int8_t *) key, key_len);
228
+ (uint8_t *) key, key_len);
230
229
  for (k = 0; k < rounds; k++) {
231
- Blowfish_expand0state(&state, (u_int8_t *) key, key_len);
230
+ Blowfish_expand0state(&state, (uint8_t *) key, key_len);
232
231
  Blowfish_expand0state(&state, csalt, salt_len);
233
232
  }
234
233
 
@@ -261,18 +260,18 @@ bcrypt(char *output, const char *key, const char *salt)
261
260
 
262
261
  snprintf(output + i, 4, "%2.2u$", logr);
263
262
 
264
- encode_base64((u_int8_t *) output + i + 3, csalt, BCRYPT_MAXSALT);
265
- encode_base64((u_int8_t *) output + strlen(output), ciphertext,
263
+ encode_base64((uint8_t *) output + i + 3, csalt, BCRYPT_MAXSALT);
264
+ encode_base64((uint8_t *) output + strlen(output), ciphertext,
266
265
  4 * BCRYPT_BLOCKS - 1);
267
266
  return output;
268
267
  }
269
268
 
270
269
  static void
271
- encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len)
270
+ encode_base64(uint8_t *buffer, uint8_t *data, uint16_t len)
272
271
  {
273
- u_int8_t *bp = buffer;
274
- u_int8_t *p = data;
275
- u_int8_t c1, c2;
272
+ uint8_t *bp = buffer;
273
+ uint8_t *p = data;
274
+ uint8_t c1, c2;
276
275
  while (p < data + len) {
277
276
  c1 = *p++;
278
277
  *bp++ = Base64Code[(c1 >> 2)];
@@ -296,33 +295,3 @@ encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len)
296
295
  }
297
296
  *bp = '\0';
298
297
  }
299
- #if 0
300
- void
301
- main()
302
- {
303
- char blubber[73];
304
- char salt[100];
305
- char *p;
306
- salt[0] = '$';
307
- salt[1] = BCRYPT_VERSION;
308
- salt[2] = '$';
309
-
310
- snprintf(salt + 3, 4, "%2.2u$", 5);
311
-
312
- printf("24 bytes of salt: ");
313
- fgets(salt + 6, sizeof(salt) - 6, stdin);
314
- salt[99] = 0;
315
- printf("72 bytes of password: ");
316
- fpurge(stdin);
317
- fgets(blubber, sizeof(blubber), stdin);
318
- blubber[72] = 0;
319
-
320
- p = crypt(blubber, salt);
321
- printf("Passwd entry: %s\n\n", p);
322
-
323
- p = bcrypt_gensalt(5);
324
- printf("Generated salt: %s\n", p);
325
- p = crypt(blubber, p);
326
- printf("Passwd entry: %s\n", p);
327
- }
328
- #endif
@@ -31,6 +31,8 @@
31
31
  #ifndef _BCRYPT_H_
32
32
  #define _BCRYPT_H_
33
33
 
34
+ #include <stdint.h>
35
+
34
36
  #define BCRYPT_VERSION '2'
35
37
  #define BCRYPT_MAXSALT 16 /* Precomputation is just so nice */
36
38
  #define BCRYPT_BLOCKS 6 /* Ciphertext blocks */
@@ -49,7 +51,7 @@
49
51
  * cryptographically secure random source.
50
52
  * Returns: output
51
53
  */
52
- char *bcrypt_gensalt(char *output, u_int8_t log_rounds, u_int8_t *rseed);
54
+ char *bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed);
53
55
 
54
56
  /*
55
57
  * Given a secret and a salt, generates a salted hash (which you can then store safely).
@@ -41,7 +41,7 @@ static VALUE bc_salt(VALUE self, VALUE cost, VALUE seed) {
41
41
  int icost = NUM2INT(cost);
42
42
  char salt[BCRYPT_SALT_OUTPUT_SIZE];
43
43
 
44
- bcrypt_gensalt(salt, icost, (u_int8_t *)RSTRING_PTR(seed));
44
+ bcrypt_gensalt(salt, icost, (uint8_t *)RSTRING_PTR(seed));
45
45
  return rb_str_new2(salt);
46
46
  }
47
47
 
@@ -31,18 +31,11 @@
31
31
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
32
  */
33
33
 
34
- /* Add this type so we'll compile nicely on Solaris.
35
- Thanks to Jeremy LaTrasse and the Twitter crew. */
36
- #ifdef __sun
37
- #define u_int8_t uint8_t
38
- #define u_int16_t uint16_t
39
- #define u_int32_t uint32_t
40
- #define u_int64_t uint64_t
41
- #endif
42
-
43
34
  #ifndef _BLF_H_
44
35
  #define _BLF_H_
45
36
 
37
+ #include <stdint.h>
38
+
46
39
  // Imported from pwd.h. <coda.hale@gmail.com>
47
40
  #define _PASSWORD_LEN 128 /* max length, not counting NUL */
48
41
 
@@ -58,8 +51,8 @@
58
51
 
59
52
  /* Blowfish context */
60
53
  typedef struct BlowfishContext {
61
- u_int32_t S[4][256]; /* S-Boxes */
62
- u_int32_t P[BLF_N + 2]; /* Subkeys */
54
+ uint32_t S[4][256]; /* S-Boxes */
55
+ uint32_t P[BLF_N + 2]; /* Subkeys */
63
56
  } blf_ctx;
64
57
 
65
58
  /* Raw access to customized Blowfish
@@ -68,26 +61,26 @@ typedef struct BlowfishContext {
68
61
  * Blowfish_expand0state( state, key, keylen )
69
62
  */
70
63
 
71
- void Blowfish_encipher(blf_ctx *, u_int32_t *, u_int32_t *);
72
- void Blowfish_decipher(blf_ctx *, u_int32_t *, u_int32_t *);
64
+ void Blowfish_encipher(blf_ctx *, uint32_t *, uint32_t *);
65
+ void Blowfish_decipher(blf_ctx *, uint32_t *, uint32_t *);
73
66
  void Blowfish_initstate(blf_ctx *);
74
- void Blowfish_expand0state(blf_ctx *, const u_int8_t *, u_int16_t);
67
+ void Blowfish_expand0state(blf_ctx *, const uint8_t *, uint16_t);
75
68
  void Blowfish_expandstate
76
- (blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t);
69
+ (blf_ctx *, const uint8_t *, uint16_t, const uint8_t *, uint16_t);
77
70
 
78
71
  /* Standard Blowfish */
79
72
 
80
- void blf_key(blf_ctx *, const u_int8_t *, u_int16_t);
81
- void blf_enc(blf_ctx *, u_int32_t *, u_int16_t);
82
- void blf_dec(blf_ctx *, u_int32_t *, u_int16_t);
73
+ void blf_key(blf_ctx *, const uint8_t *, uint16_t);
74
+ void blf_enc(blf_ctx *, uint32_t *, uint16_t);
75
+ void blf_dec(blf_ctx *, uint32_t *, uint16_t);
83
76
 
84
- void blf_ecb_encrypt(blf_ctx *, u_int8_t *, u_int32_t);
85
- void blf_ecb_decrypt(blf_ctx *, u_int8_t *, u_int32_t);
77
+ void blf_ecb_encrypt(blf_ctx *, uint8_t *, uint32_t);
78
+ void blf_ecb_decrypt(blf_ctx *, uint8_t *, uint32_t);
86
79
 
87
- void blf_cbc_encrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t);
88
- void blf_cbc_decrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t);
80
+ void blf_cbc_encrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t);
81
+ void blf_cbc_decrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t);
89
82
 
90
- /* Converts u_int8_t to u_int32_t */
91
- u_int32_t Blowfish_stream2word(const u_int8_t *, u_int16_t , u_int16_t *);
83
+ /* Converts uint8_t to uint32_t */
84
+ uint32_t Blowfish_stream2word(const uint8_t *, uint16_t , uint16_t *);
92
85
 
93
86
  #endif
@@ -39,12 +39,6 @@
39
39
  * Bruce Schneier.
40
40
  */
41
41
 
42
- #if 0
43
- #include <stdio.h> /* used for debugging */
44
- #include <string.h>
45
- #endif
46
-
47
- #include <sys/types.h>
48
42
  #include "blf.h"
49
43
 
50
44
  #undef inline
@@ -64,12 +58,12 @@
64
58
  #define BLFRND(s,p,i,j,n) (i ^= F(s,j) ^ (p)[n])
65
59
 
66
60
  void
67
- Blowfish_encipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr)
61
+ Blowfish_encipher(blf_ctx *c, uint32_t *xl, uint32_t *xr)
68
62
  {
69
- u_int32_t Xl;
70
- u_int32_t Xr;
71
- u_int32_t *s = c->S[0];
72
- u_int32_t *p = c->P;
63
+ uint32_t Xl;
64
+ uint32_t Xr;
65
+ uint32_t *s = c->S[0];
66
+ uint32_t *p = c->P;
73
67
 
74
68
  Xl = *xl;
75
69
  Xr = *xr;
@@ -89,12 +83,12 @@ Blowfish_encipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr)
89
83
  }
90
84
 
91
85
  void
92
- Blowfish_decipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr)
86
+ Blowfish_decipher(blf_ctx *c, uint32_t *xl, uint32_t *xr)
93
87
  {
94
- u_int32_t Xl;
95
- u_int32_t Xr;
96
- u_int32_t *s = c->S[0];
97
- u_int32_t *p = c->P;
88
+ uint32_t Xl;
89
+ uint32_t Xr;
90
+ uint32_t *s = c->S[0];
91
+ uint32_t *p = c->P;
98
92
 
99
93
  Xl = *xl;
100
94
  Xr = *xr;
@@ -392,13 +386,13 @@ Blowfish_initstate(blf_ctx *c)
392
386
  *c = initstate;
393
387
  }
394
388
 
395
- u_int32_t
396
- Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes,
397
- u_int16_t *current)
389
+ uint32_t
390
+ Blowfish_stream2word(const uint8_t *data, uint16_t databytes,
391
+ uint16_t *current)
398
392
  {
399
- u_int8_t i;
400
- u_int16_t j;
401
- u_int32_t temp;
393
+ uint8_t i;
394
+ uint16_t j;
395
+ uint32_t temp;
402
396
 
403
397
  temp = 0x00000000;
404
398
  j = *current;
@@ -414,14 +408,14 @@ Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes,
414
408
  }
415
409
 
416
410
  void
417
- Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
411
+ Blowfish_expand0state(blf_ctx *c, const uint8_t *key, uint16_t keybytes)
418
412
  {
419
- u_int16_t i;
420
- u_int16_t j;
421
- u_int16_t k;
422
- u_int32_t temp;
423
- u_int32_t datal;
424
- u_int32_t datar;
413
+ uint16_t i;
414
+ uint16_t j;
415
+ uint16_t k;
416
+ uint32_t temp;
417
+ uint32_t datal;
418
+ uint32_t datar;
425
419
 
426
420
  j = 0;
427
421
  for (i = 0; i < BLF_N + 2; i++) {
@@ -452,15 +446,15 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
452
446
 
453
447
 
454
448
  void
455
- Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
456
- const u_int8_t *key, u_int16_t keybytes)
449
+ Blowfish_expandstate(blf_ctx *c, const uint8_t *data, uint16_t databytes,
450
+ const uint8_t *key, uint16_t keybytes)
457
451
  {
458
- u_int16_t i;
459
- u_int16_t j;
460
- u_int16_t k;
461
- u_int32_t temp;
462
- u_int32_t datal;
463
- u_int32_t datar;
452
+ uint16_t i;
453
+ uint16_t j;
454
+ uint16_t k;
455
+ uint32_t temp;
456
+ uint32_t datal;
457
+ uint32_t datar;
464
458
 
465
459
  j = 0;
466
460
  for (i = 0; i < BLF_N + 2; i++) {
@@ -495,7 +489,7 @@ Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
495
489
  }
496
490
 
497
491
  void
498
- blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len)
492
+ blf_key(blf_ctx *c, const uint8_t *k, uint16_t len)
499
493
  {
500
494
  /* Initialize S-boxes and subkeys with Pi */
501
495
  Blowfish_initstate(c);
@@ -505,10 +499,10 @@ blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len)
505
499
  }
506
500
 
507
501
  void
508
- blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks)
502
+ blf_enc(blf_ctx *c, uint32_t *data, uint16_t blocks)
509
503
  {
510
- u_int32_t *d;
511
- u_int16_t i;
504
+ uint32_t *d;
505
+ uint16_t i;
512
506
 
513
507
  d = data;
514
508
  for (i = 0; i < blocks; i++) {
@@ -518,10 +512,10 @@ blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks)
518
512
  }
519
513
 
520
514
  void
521
- blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks)
515
+ blf_dec(blf_ctx *c, uint32_t *data, uint16_t blocks)
522
516
  {
523
- u_int32_t *d;
524
- u_int16_t i;
517
+ uint32_t *d;
518
+ uint16_t i;
525
519
 
526
520
  d = data;
527
521
  for (i = 0; i < blocks; i++) {
@@ -531,10 +525,10 @@ blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks)
531
525
  }
532
526
 
533
527
  void
534
- blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
528
+ blf_ecb_encrypt(blf_ctx *c, uint8_t *data, uint32_t len)
535
529
  {
536
- u_int32_t l, r;
537
- u_int32_t i;
530
+ uint32_t l, r;
531
+ uint32_t i;
538
532
 
539
533
  for (i = 0; i < len; i += 8) {
540
534
  l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
@@ -553,10 +547,10 @@ blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
553
547
  }
554
548
 
555
549
  void
556
- blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
550
+ blf_ecb_decrypt(blf_ctx *c, uint8_t *data, uint32_t len)
557
551
  {
558
- u_int32_t l, r;
559
- u_int32_t i;
552
+ uint32_t l, r;
553
+ uint32_t i;
560
554
 
561
555
  for (i = 0; i < len; i += 8) {
562
556
  l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
@@ -575,10 +569,10 @@ blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
575
569
  }
576
570
 
577
571
  void
578
- blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len)
572
+ blf_cbc_encrypt(blf_ctx *c, uint8_t *iv, uint8_t *data, uint32_t len)
579
573
  {
580
- u_int32_t l, r;
581
- u_int32_t i, j;
574
+ uint32_t l, r;
575
+ uint32_t i, j;
582
576
 
583
577
  for (i = 0; i < len; i += 8) {
584
578
  for (j = 0; j < 8; j++)
@@ -600,11 +594,11 @@ blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len)
600
594
  }
601
595
 
602
596
  void
603
- blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len)
597
+ blf_cbc_decrypt(blf_ctx *c, uint8_t *iva, uint8_t *data, uint32_t len)
604
598
  {
605
- u_int32_t l, r;
606
- u_int8_t *iv;
607
- u_int32_t i, j;
599
+ uint32_t l, r;
600
+ uint8_t *iv;
601
+ uint32_t i, j;
608
602
 
609
603
  iv = data + len - 16;
610
604
  data = data + len - 8;
@@ -639,47 +633,3 @@ blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len)
639
633
  for (j = 0; j < 8; j++)
640
634
  data[j] ^= iva[j];
641
635
  }
642
-
643
- #if 0
644
- void
645
- report(u_int32_t data[], u_int16_t len)
646
- {
647
- u_int16_t i;
648
- for (i = 0; i < len; i += 2)
649
- printf("Block %0hd: %08lx %08lx.\n",
650
- i / 2, data[i], data[i + 1]);
651
- }
652
- void
653
- main(void)
654
- {
655
-
656
- blf_ctx c;
657
- char key[] = "AAAAA";
658
- char key2[] = "abcdefghijklmnopqrstuvwxyz";
659
-
660
- u_int32_t data[10];
661
- u_int32_t data2[] =
662
- {0x424c4f57l, 0x46495348l};
663
-
664
- u_int16_t i;
665
-
666
- /* First test */
667
- for (i = 0; i < 10; i++)
668
- data[i] = i;
669
-
670
- blf_key(&c, (u_int8_t *) key, 5);
671
- blf_enc(&c, data, 5);
672
- blf_dec(&c, data, 1);
673
- blf_dec(&c, data + 2, 4);
674
- printf("Should read as 0 - 9.\n");
675
- report(data, 10);
676
-
677
- /* Second test */
678
- blf_key(&c, (u_int8_t *) key2, strlen(key2));
679
- blf_enc(&c, data2, 1);
680
- printf("\nShould read as: 0x324ed0fe 0xf413a203.\n");
681
- report(data2, 2);
682
- blf_dec(&c, data2, 1);
683
- report(data2, 2);
684
- }
685
- #endif
@@ -12,7 +12,6 @@ if RUBY_PLATFORM == "java"
12
12
  else
13
13
  require "mkmf"
14
14
  dir_config("bcrypt_ext")
15
- # enable this when we're feeling nitpicky
16
- # CONFIG['CC'] << " -Wall "
15
+ CONFIG['CC'] << " -Wall "
17
16
  create_makefile("bcrypt_ext")
18
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coda Hale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-14 00:00:00 -07:00
12
+ date: 2009-09-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15