camellia-rb 1.1 → 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.
@@ -16,3 +16,16 @@ Changes from version 1.0
16
16
  * the directory name of extended library is changed to 'ext'
17
17
 
18
18
  * unused file/directory is deleted from the package
19
+
20
+ == 1.2 2009-01-20
21
+ Changes from version 1.1
22
+
23
+ * It corresponded to ruby-1.9.1-rc1.
24
+
25
+ * 'RSTRING()->len' is changed to 'RSTRING_LEN()'.
26
+
27
+ * 'RSTRING()->ptr' is changed to 'RSTRING_PTR()'.
28
+
29
+ * This version is tested in ruby 1.8.5, 1.8.7 and 1.9.1 rc1 environment.
30
+
31
+ * In the version before ruby 1.8.5 that can not use RSTRING_LEN/RSTRING_PTR, then they are automatically defined using RSTRING internally.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008
1
+ Copyright (c) 2008-2009
2
2
  NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.txt CHANGED
@@ -76,7 +76,7 @@ Sample program(camellia-example.rb)
76
76
 
77
77
  ############################################################
78
78
 
79
- * Copyright (c) 2008
79
+ * Copyright (c) 2008-2009
80
80
  * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
81
81
 
82
- ############################################################
82
+ ############################################################
@@ -1,6 +1,6 @@
1
1
  #* camellia-example.rb
2
2
  #*
3
- #* Copyright (c) 2008
3
+ #* Copyright (c) 2008-2009
4
4
  #* NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
5
5
  #*
6
6
  #* Redistribution and use in source and binary forms, with or without
@@ -1,6 +1,6 @@
1
1
  /* camellia-rb.c
2
2
  *
3
- * Copyright (c) 2008
3
+ * Copyright (c) 2008-2009
4
4
  * NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,14 @@
28
28
  #include "camellia.h"
29
29
  #include <stdio.h>
30
30
 
31
+ // for version before Ruby 1.8.5
32
+ #ifndef RSTRING_PTR
33
+ # define RSTRING_PTR(s) (RSTRING(s)->ptr)
34
+ #endif
35
+ #ifndef RSTRING_LEN
36
+ # define RSTRING_LEN(s) (RSTRING(s)->len)
37
+ #endif
38
+
31
39
  typedef unsigned char u1byte;
32
40
 
33
41
  // error class
@@ -52,6 +60,7 @@ typedef struct {
52
60
  */
53
61
  static VALUE s_new(VALUE self)
54
62
  {
63
+
55
64
  camelliaObject *camellia;
56
65
  VALUE camellia_data;
57
66
 
@@ -80,8 +89,8 @@ static VALUE set_key(VALUE self, VALUE key)
80
89
  Data_Get_Struct(self, camelliaObject, camellia);
81
90
 
82
91
  Check_Type(key, T_STRING);
83
- skey_len = RSTRING(key)->len;
84
- skey = (unsigned char *)RSTRING(key)->ptr;
92
+ skey_len = RSTRING_LEN(key);
93
+ skey = (unsigned char *)RSTRING_PTR(key);
85
94
 
86
95
  // check key length
87
96
  if (skey_len != 16 && skey_len != 24 && skey_len != 32)
@@ -110,8 +119,8 @@ static VALUE encrypt(VALUE self, VALUE args)
110
119
  u1byte out_blk[16];
111
120
 
112
121
  Check_Type(args, T_STRING);
113
- data_len = RSTRING(args)->len;
114
- data = (unsigned char *)RSTRING(args)->ptr;
122
+ data_len = RSTRING_LEN(args);
123
+ data = (unsigned char *)RSTRING_PTR(args);
115
124
 
116
125
  Data_Get_Struct(self, camelliaObject, camellia);
117
126
 
@@ -146,8 +155,8 @@ static VALUE decrypt(VALUE self,VALUE args)
146
155
  u1byte out_blk[16];
147
156
 
148
157
  Check_Type(args, T_STRING);
149
- data_len = RSTRING(args)->len;
150
- data = (unsigned char *)RSTRING(args)->ptr;
158
+ data_len = RSTRING_LEN(args);
159
+ data = (unsigned char *)RSTRING_PTR(args);
151
160
 
152
161
  // check data length
153
162
  if (data_len != 16)
@@ -183,8 +192,8 @@ static VALUE cfb_salt(VALUE self, VALUE args)
183
192
  int i;
184
193
 
185
194
  Check_Type(args,T_STRING);
186
- src = (unsigned char *)RSTRING(args)->ptr;
187
- src_len = RSTRING(args)->len;
195
+ src = (unsigned char *)RSTRING_PTR(args);
196
+ src_len = RSTRING_LEN(args);
188
197
 
189
198
  // check IV length
190
199
  if (src_len != 16)
@@ -219,8 +228,8 @@ static VALUE cfb_encrypt(VALUE self,VALUE args)
219
228
  VALUE retvalue;
220
229
 
221
230
  Check_Type(args,T_STRING);
222
- src = (unsigned char *)RSTRING(args)->ptr;
223
- srclen = RSTRING(args)->len;
231
+ src = (unsigned char *)RSTRING_PTR(args);
232
+ srclen = RSTRING_LEN(args);
224
233
 
225
234
  Data_Get_Struct(self,camelliaObject,camellia);
226
235
 
@@ -272,8 +281,8 @@ static VALUE cfb_decrypt(VALUE *self, VALUE args)
272
281
  VALUE retvalue;
273
282
 
274
283
  Check_Type(args, T_STRING);
275
- srclen = RSTRING(args)->len;
276
- src = (unsigned char *)RSTRING(args)->ptr;
284
+ srclen = RSTRING_LEN(args);
285
+ src = (unsigned char *)RSTRING_PTR(args);
277
286
 
278
287
  Data_Get_Struct(self,camelliaObject, camellia);
279
288
 
@@ -323,8 +332,8 @@ static VALUE cbc_salt(VALUE self, VALUE args)
323
332
  int i;
324
333
 
325
334
  Check_Type(args,T_STRING);
326
- src = (unsigned char *)RSTRING(args)->ptr;
327
- src_len = RSTRING(args)->len;
335
+ src = (unsigned char *)RSTRING_PTR(args);
336
+ src_len = RSTRING_LEN(args);
328
337
 
329
338
  // check IV length
330
339
  if (src_len != 16)
@@ -358,8 +367,8 @@ static VALUE cbc_pchar(VALUE self, VALUE args)
358
367
  int src_len;
359
368
 
360
369
  Check_Type(args,T_STRING);
361
- src = (unsigned char *)RSTRING(args)->ptr;
362
- src_len = RSTRING(args)->len;
370
+ src = (unsigned char *)RSTRING_PTR(args);
371
+ src_len = RSTRING_LEN(args);
363
372
 
364
373
  // check pcharlength
365
374
  if (src_len != 1)
@@ -389,8 +398,8 @@ static VALUE cbc_encrypt(VALUE self,VALUE args)
389
398
  VALUE retvalue;
390
399
 
391
400
  Check_Type(args,T_STRING);
392
- src = (unsigned char *)RSTRING(args)->ptr;
393
- srclen = RSTRING(args)->len;
401
+ src = (unsigned char *)RSTRING_PTR(args);
402
+ srclen = RSTRING_LEN(args);
394
403
 
395
404
  Data_Get_Struct(self,camelliaObject,camellia);
396
405
 
@@ -467,9 +476,9 @@ static VALUE cbc_decrypt(VALUE *self, VALUE args)
467
476
  VALUE retvalue;
468
477
 
469
478
  Check_Type(args, T_STRING);
470
- srclen = RSTRING(args)->len;
471
- src = (unsigned char *)RSTRING(args)->ptr;
472
-
479
+ srclen = RSTRING_LEN(args);
480
+ src = (unsigned char *)RSTRING_PTR(args);
481
+
473
482
  Data_Get_Struct(self,camelliaObject, camellia);
474
483
 
475
484
  // check if key is initialized
@@ -1,6 +1,6 @@
1
1
  #* extconf.rb
2
2
  #*
3
- #* Copyright (c) 2008
3
+ #* Copyright (c) 2008-2009
4
4
  #* NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
5
5
  #*
6
6
  #* Redistribution and use in source and binary forms, with or without
@@ -1,7 +1,7 @@
1
1
  module Camellia #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR].join('.')
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camellia-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.1"
4
+ version: "1.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - FIXME full name
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-09 00:00:00 +09:00
12
+ date: 2009-01-26 00:00:00 +09:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.0
24
+ version:
16
25
  description: description of gem
17
26
  email:
18
27
  - FIXME email
@@ -79,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
88
  requirements: []
80
89
 
81
90
  rubyforge_project: camellia-rb
82
- rubygems_version: 1.0.1
91
+ rubygems_version: 1.3.1
83
92
  signing_key:
84
93
  specification_version: 2
85
94
  summary: description of gem