cryptopp 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/.gitignore +8 -0
  2. data/MIT-LICENSE +22 -0
  3. data/README +7 -0
  4. data/Rakefile +42 -0
  5. data/cryptopp.gemspec +199 -0
  6. data/ext/.gitignore +5 -0
  7. data/ext/Rakefile +16 -0
  8. data/ext/ciphers.cpp +1402 -0
  9. data/ext/cryptopp.cpp +285 -0
  10. data/ext/cryptopp_ruby_api.h +139 -0
  11. data/ext/defs/block_modes.def +10 -0
  12. data/ext/defs/checksums.def +10 -0
  13. data/ext/defs/ciphers.def +136 -0
  14. data/ext/defs/hashes.def +78 -0
  15. data/ext/defs/hmacs.def +54 -0
  16. data/ext/defs/paddings.def +9 -0
  17. data/ext/defs/rngs.def +7 -0
  18. data/ext/digests.cpp +1120 -0
  19. data/ext/extconf.rb +39 -0
  20. data/ext/j3way.cpp +22 -0
  21. data/ext/j3way.h +29 -0
  22. data/ext/jadler32.h +32 -0
  23. data/ext/jaes.cpp +22 -0
  24. data/ext/jaes.h +31 -0
  25. data/ext/jarc4.cpp +22 -0
  26. data/ext/jarc4.h +37 -0
  27. data/ext/jbase.cpp +172 -0
  28. data/ext/jbase.h +92 -0
  29. data/ext/jbasiccipherinfo.h +74 -0
  30. data/ext/jblowfish.cpp +22 -0
  31. data/ext/jblowfish.h +29 -0
  32. data/ext/jcamellia.cpp +24 -0
  33. data/ext/jcamellia.h +33 -0
  34. data/ext/jcast128.cpp +22 -0
  35. data/ext/jcast128.h +31 -0
  36. data/ext/jcast256.cpp +22 -0
  37. data/ext/jcast256.h +31 -0
  38. data/ext/jcipher.cpp +112 -0
  39. data/ext/jcipher.h +42 -0
  40. data/ext/jcipher_t.h +469 -0
  41. data/ext/jconfig.h +127 -0
  42. data/ext/jconstants.h +189 -0
  43. data/ext/jcrc32.h +32 -0
  44. data/ext/jdes.cpp +22 -0
  45. data/ext/jdes.h +31 -0
  46. data/ext/jdes_ede2.cpp +22 -0
  47. data/ext/jdes_ede2.h +31 -0
  48. data/ext/jdes_ede3.cpp +22 -0
  49. data/ext/jdes_ede3.h +31 -0
  50. data/ext/jdes_xex3.cpp +22 -0
  51. data/ext/jdes_xex3.h +31 -0
  52. data/ext/jdiamond2.cpp +22 -0
  53. data/ext/jdiamond2.h +31 -0
  54. data/ext/jdiamond2lite.cpp +22 -0
  55. data/ext/jdiamond2lite.h +31 -0
  56. data/ext/jexception.h +20 -0
  57. data/ext/jgost.cpp +22 -0
  58. data/ext/jgost.h +31 -0
  59. data/ext/jhash.cpp +92 -0
  60. data/ext/jhash.h +54 -0
  61. data/ext/jhash_t.h +121 -0
  62. data/ext/jhaval.h +64 -0
  63. data/ext/jhelpers.cpp +90 -0
  64. data/ext/jhelpers.h +38 -0
  65. data/ext/jhmac.cpp +44 -0
  66. data/ext/jhmac.h +34 -0
  67. data/ext/jhmac_t.h +125 -0
  68. data/ext/jidea.cpp +22 -0
  69. data/ext/jidea.h +31 -0
  70. data/ext/jmarc4.cpp +22 -0
  71. data/ext/jmarc4.h +37 -0
  72. data/ext/jmars.cpp +22 -0
  73. data/ext/jmars.h +31 -0
  74. data/ext/jmd2.h +56 -0
  75. data/ext/jmd4.h +56 -0
  76. data/ext/jmd5.h +56 -0
  77. data/ext/jpanamacipher.cpp +32 -0
  78. data/ext/jpanamacipher.h +46 -0
  79. data/ext/jpanamahash.h +44 -0
  80. data/ext/jrc2.cpp +44 -0
  81. data/ext/jrc2.h +39 -0
  82. data/ext/jrc5.cpp +22 -0
  83. data/ext/jrc5.h +31 -0
  84. data/ext/jrc6.cpp +22 -0
  85. data/ext/jrc6.h +31 -0
  86. data/ext/jripemd160.h +113 -0
  87. data/ext/jsafer.cpp +32 -0
  88. data/ext/jsafer.h +42 -0
  89. data/ext/jseal.cpp +32 -0
  90. data/ext/jseal.h +42 -0
  91. data/ext/jserpent.cpp +22 -0
  92. data/ext/jserpent.h +31 -0
  93. data/ext/jsha.h +122 -0
  94. data/ext/jshacal2.cpp +22 -0
  95. data/ext/jshacal2.h +31 -0
  96. data/ext/jshark.cpp +24 -0
  97. data/ext/jshark.h +33 -0
  98. data/ext/jsink.cpp +90 -0
  99. data/ext/jsink.h +154 -0
  100. data/ext/jskipjack.cpp +22 -0
  101. data/ext/jskipjack.h +31 -0
  102. data/ext/jsquare.cpp +22 -0
  103. data/ext/jsquare.h +31 -0
  104. data/ext/jstream.cpp +8 -0
  105. data/ext/jstream.h +20 -0
  106. data/ext/jstream_t.h +175 -0
  107. data/ext/jtea.cpp +22 -0
  108. data/ext/jtea.h +31 -0
  109. data/ext/jtiger.h +52 -0
  110. data/ext/jtwofish.cpp +22 -0
  111. data/ext/jtwofish.h +31 -0
  112. data/ext/jwhirlpool.h +52 -0
  113. data/ext/utils.cpp +8 -0
  114. data/extras/parser_c.rb +114 -0
  115. data/test/ciphers_test.rb +37 -0
  116. data/test/data/ciphers/3desval.dat +7 -0
  117. data/test/data/ciphers/3wayval.dat +6 -0
  118. data/test/data/ciphers/arc4.dat +8 -0
  119. data/test/data/ciphers/blowfish.dat +5 -0
  120. data/test/data/ciphers/camellia.dat +7 -0
  121. data/test/data/ciphers/cast128v.dat +5 -0
  122. data/test/data/ciphers/cast256v.dat +5 -0
  123. data/test/data/ciphers/descert.dat +198 -0
  124. data/test/data/ciphers/diamond.dat +9 -0
  125. data/test/data/ciphers/gostval.dat +10 -0
  126. data/test/data/ciphers/ideaval.dat +13 -0
  127. data/test/data/ciphers/marsval.dat +11 -0
  128. data/test/data/ciphers/panamac.dat +7 -0
  129. data/test/data/ciphers/rc2val.dat +10 -0
  130. data/test/data/ciphers/rc5val.dat +7 -0
  131. data/test/data/ciphers/rc6val.dat +8 -0
  132. data/test/data/ciphers/rijndael.dat +11 -0
  133. data/test/data/ciphers/saferval.dat +27 -0
  134. data/test/data/ciphers/seal.dat +3 -0
  135. data/test/data/ciphers/serpentv.dat +11 -0
  136. data/test/data/ciphers/shacal2.dat +7 -0
  137. data/test/data/ciphers/sharkval.dat +9 -0
  138. data/test/data/ciphers/skipjack.dat +3 -0
  139. data/test/data/ciphers/squareva.dat +10 -0
  140. data/test/data/ciphers/twofishv.dat +11 -0
  141. data/test/data/digests/adler32.dat +8 -0
  142. data/test/data/digests/crc32.dat +10 -0
  143. data/test/data/digests/haval.dat +4 -0
  144. data/test/data/digests/havalcer.dat +23 -0
  145. data/test/data/digests/md2.dat +9 -0
  146. data/test/data/digests/md4.dat +9 -0
  147. data/test/data/digests/md5.dat +9 -0
  148. data/test/data/digests/panamah.dat +8 -0
  149. data/test/data/digests/ripemd.dat +43 -0
  150. data/test/data/digests/sha.dat +19 -0
  151. data/test/data/digests/tiger.dat +11 -0
  152. data/test/data/digests/whirlpool.dat +13 -0
  153. data/test/data/hmacs/hmac.dat +6 -0
  154. data/test/digests_test.rb +29 -0
  155. data/test/hmacs_test.rb +38 -0
  156. data/test/test_helper.rb +42 -0
  157. metadata +220 -0
@@ -0,0 +1,285 @@
1
+
2
+ /*
3
+ * Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
4
+ * Crypto++ copyright (c) 1995-2010 Wei Dai
5
+ * See COPYING for the extact license
6
+ */
7
+
8
+ #include "ruby.h"
9
+
10
+ #ifdef HAVE_CONFIG_H
11
+ #include "config.h"
12
+ #endif
13
+
14
+ #include "jbase.h"
15
+ #include "jhash.h"
16
+ #include "jconfig.h"
17
+
18
+ #include "cryptopp_ruby_api.h"
19
+
20
+ using namespace std;
21
+
22
+ VALUE rb_mCryptoPP;
23
+ VALUE rb_eCryptoPP_Error;
24
+ VALUE rb_cCryptoPP_Cipher;
25
+ VALUE rb_cCryptoPP_Digest;
26
+ VALUE rb_cCryptoPP_Digest_HMAC;
27
+
28
+ #define CIPHER_ALGORITHM_X(klass, r, c, s) \
29
+ VALUE rb_cCryptoPP_Cipher_ ## r ;
30
+ #include "defs/ciphers.def"
31
+
32
+ #define CHECKSUM_ALGORITHM_X(klass, r, c, s) \
33
+ VALUE rb_cCryptoPP_Digest_ ## r ;
34
+ #include "defs/checksums.def"
35
+
36
+ #define HASH_ALGORITHM_X(klass, r, c, s) \
37
+ VALUE rb_cCryptoPP_Digest_ ## r ;
38
+ #include "defs/hashes.def"
39
+
40
+ #define HMAC_ALGORITHM_X(klass, r, c, s) \
41
+ VALUE rb_cCryptoPP_Digest_HMAC_ ## r ;
42
+ #include "defs/hmacs.def"
43
+
44
+ /* Marking function for garbage collector. */
45
+ void cipher_mark(JBase *c)
46
+ {
47
+ }
48
+
49
+ /* Free up memory. */
50
+ void cipher_free(JBase *c)
51
+ {
52
+ delete c;
53
+ }
54
+
55
+ /* Marking function for garbage collector. */
56
+ void hash_mark (JHash *c)
57
+ {
58
+ }
59
+
60
+ /* Free up memory. */
61
+ void hash_free (JHash *c)
62
+ {
63
+ delete c;
64
+ }
65
+
66
+
67
+ #define CRYPTOPP_VALUE_FUNC(f) \
68
+ RUBY_METHOD_FUNC(f)
69
+ #define CRYPTOPP_DEFINE_CONST(klass, n, c) \
70
+ rb_define_const(klass, n, INT2NUM(c));
71
+ #define CRYPTOPP_MODULE_METHOD(m, n, f, a) \
72
+ rb_define_module_function(m, n, CRYPTOPP_VALUE_FUNC(f), a);
73
+ #define CRYPTOPP_CLASS_METHOD(c, n, f, a) \
74
+ rb_define_method(rb_cCryptoPP_ ## c, n, CRYPTOPP_VALUE_FUNC(f), a);
75
+ #define CRYPTOPP_MODULE_METHOD_ALIAS(m, n, o) \
76
+ rb_define_alias(rb_singleton_class(m), n, o);
77
+ #define CRYPTOPP_CLASS_METHOD_ALIAS(c, n, o) \
78
+ rb_define_alias(rb_cCryptoPP_ ## c, n, o);
79
+
80
+ /* The extension initialization function. */
81
+ extern "C" void Init_cryptopp()
82
+ {
83
+ /**
84
+ * This is the main CryptoPP module. All of the various Cipher, Digest
85
+ * and HMAC classes are found here.
86
+ *
87
+ * The CryptoPP module contains a handful of module methods that can be
88
+ * used to create new ciphers, digests and HMACs and provide information
89
+ * on the environment and configuration CryptoPP is running with.
90
+ */
91
+ rb_mCryptoPP = rb_define_module("CryptoPP");
92
+
93
+ /**
94
+ * Exception class.
95
+ */
96
+ rb_eCryptoPP_Error = rb_define_class_under(rb_mCryptoPP, "CryptoPPError", rb_eStandardError);
97
+
98
+ /**
99
+ * The base cipher class. This class is not meant to be used directly. It
100
+ * merely serves as the base class for all CryptoPP ciphers.
101
+ *
102
+ * Ciphers can be created either by using the
103
+ * <tt>CryptoPP#cipher_factory</tt> factory method or by instantiating
104
+ * the classes directly. For instance, the following are equivalent:
105
+ *
106
+ * cipher = CryptoPP.cipher_factory(:aes)
107
+ * cipher = CryptoPP::AES.new
108
+ *
109
+ * Options include:
110
+ *
111
+ * * <tt>:plaintext</tt> and <tt>:plaintext_hex</tt> - set the plaintext. You
112
+ * can only use one at a time.
113
+ * * <tt>:ciphertext</tt> and <tt>:ciphertext_hex</tt> - set the ciphertext.
114
+ * You can only use one at a time.
115
+ * * <tt>:key</tt> and <tt>:key_hex</tt> - set the key. You can only use one
116
+ * at a time.
117
+ * * <tt>:key_length</tt> - set the length of the key. Normally this is done
118
+ * automatically, but you can force a different key length if necessary.
119
+ * * <tt>:effective_key_length</tt> - sets the effective key length on RC2
120
+ * ciphers.
121
+ * * <tt>:rounds</tt> - sets the number of rounds a cipher performs on
122
+ * block ciphers that support them.
123
+ * * <tt>:rng</tt> - sets the random number generator to be used for things
124
+ * like creating initialization vectors and such. Not all operating
125
+ * systems and environments will support all RNGs. You can check which
126
+ * ones are supported with <tt>CryptoPP#rng_available?</tt>. Possible
127
+ * values are :blocking, :non_blocking and :rand.
128
+ *
129
+ * All of these options have their equivalent setter and getter methods
130
+ * if you need to modify them after initialization.
131
+ */
132
+ rb_cCryptoPP_Cipher = rb_define_class_under(rb_mCryptoPP, "Cipher", rb_cObject);
133
+
134
+ /**
135
+ * The base Digest class. This class is not meant to be used directly. It
136
+ * merely serves as the base class for all CryptoPP Digests and HMACs.
137
+ */
138
+ rb_cCryptoPP_Digest = rb_define_class_under(rb_mCryptoPP, "Digest", rb_cObject);
139
+
140
+ /**
141
+ * The base HMAC class. This class is not meant to be used directly. It
142
+ * merely serves as the base class for all CryptoPP HMACs.
143
+ */
144
+ rb_cCryptoPP_Digest_HMAC = rb_define_class_under(rb_mCryptoPP, "HMAC", rb_cCryptoPP_Digest);
145
+
146
+ rb_undef_alloc_func(rb_cCryptoPP_Cipher);
147
+ rb_undef_alloc_func(rb_cCryptoPP_Digest);
148
+ rb_undef_alloc_func(rb_cCryptoPP_Digest_HMAC);
149
+
150
+ rb_define_const(rb_mCryptoPP, "VERSION", rb_str_new2("0.0.2"));
151
+ rb_define_const(rb_mCryptoPP, "CRYPTOPP_VERSION", INT2NUM(CRYPTOPP_VERSION));
152
+
153
+ # define CIPHER_ALGORITHM_X(klass, r, c, s) \
154
+ rb_cCryptoPP_Cipher_ ## r = rb_define_class_under(rb_mCryptoPP, # klass, rb_cCryptoPP_Cipher); \
155
+ rb_define_singleton_method((rb_cCryptoPP_Cipher_ ## r), "new", CRYPTOPP_VALUE_FUNC(rb_cipher_ ## r ##_new), -1);
156
+ # include "defs/ciphers.def"
157
+
158
+ # define CHECKSUM_ALGORITHM_X(klass, r, c, s) \
159
+ rb_cCryptoPP_Digest_ ## r = rb_define_class_under(rb_mCryptoPP, # klass, rb_cCryptoPP_Digest); \
160
+ rb_define_singleton_method((rb_cCryptoPP_Digest_ ## r), "new", CRYPTOPP_VALUE_FUNC(rb_digest_ ## r ##_new), -1);
161
+ # include "defs/checksums.def"
162
+
163
+ # define HASH_ALGORITHM_X(klass, r, c, s) \
164
+ rb_cCryptoPP_Digest_ ## r = rb_define_class_under(rb_mCryptoPP, # klass, rb_cCryptoPP_Digest); \
165
+ rb_define_singleton_method((rb_cCryptoPP_Digest_ ## r), "new", CRYPTOPP_VALUE_FUNC(rb_digest_ ## r ##_new), -1);
166
+ # include "defs/hashes.def"
167
+
168
+ # define HMAC_ALGORITHM_X(klass, r, c, s) \
169
+ rb_cCryptoPP_Digest_HMAC_ ## r = rb_define_class_under(rb_mCryptoPP, # klass, rb_cCryptoPP_Digest_HMAC); \
170
+ rb_define_singleton_method((rb_cCryptoPP_Digest_HMAC_ ## r), "new", CRYPTOPP_VALUE_FUNC(rb_digest_hmac_ ## r ##_new), -1);
171
+ # include "defs/hmacs.def"
172
+
173
+ rb_define_module_function(rb_mCryptoPP, "cipher_list", RUBY_METHOD_FUNC(rb_module_cipher_list), 0); /* in ciphers.cpp */
174
+ rb_define_module_function(rb_mCryptoPP, "cipher_name", RUBY_METHOD_FUNC(rb_module_cipher_name), 1); /* in ciphers.cpp */
175
+ rb_define_module_function(rb_mCryptoPP, "block_mode_name", RUBY_METHOD_FUNC(rb_module_block_mode_name), 1); /* in ciphers.cpp */
176
+ rb_define_module_function(rb_mCryptoPP, "padding_name", RUBY_METHOD_FUNC(rb_module_padding_name), 1); /* in ciphers.cpp */
177
+ rb_define_module_function(rb_mCryptoPP, "rng_name", RUBY_METHOD_FUNC(rb_module_rng_name), 1); /* in ciphers.cpp */
178
+ rb_define_module_function(rb_mCryptoPP, "cipher_enabled?", RUBY_METHOD_FUNC(rb_module_cipher_enabled), 1); /* in ciphers.cpp */
179
+ rb_define_module_function(rb_mCryptoPP, "rng_available?", RUBY_METHOD_FUNC(rb_module_rng_available), 1); /* in ciphers.cpp */
180
+
181
+ rb_define_module_function(rb_mCryptoPP, "cipher_factory", RUBY_METHOD_FUNC(rb_module_cipher_factory), -1); /* in ciphers.cpp */
182
+ rb_define_module_function(rb_mCryptoPP, "digest_factory", RUBY_METHOD_FUNC(rb_module_digest_factory), -1); /* in digests.cpp */
183
+ rb_define_module_function(rb_mCryptoPP, "hmac_factory", RUBY_METHOD_FUNC(rb_module_hmac_factory), -1); /* in digests.cpp */
184
+
185
+ rb_define_module_function(rb_mCryptoPP, "digest_enabled?", RUBY_METHOD_FUNC(rb_module_digest_enabled), 1); /* in digests.cpp */
186
+ rb_define_module_function(rb_mCryptoPP, "digest_name", RUBY_METHOD_FUNC(rb_module_digest_name), 1); /* in digests.cpp */
187
+ rb_define_module_function(rb_mCryptoPP, "digest_list", RUBY_METHOD_FUNC(rb_module_digest_list), 0); /* in digests.cpp */
188
+
189
+ rb_define_alias(rb_singleton_class(rb_mCryptoPP), "hash_enabled?", "digest_enabled?");
190
+ rb_define_alias(rb_singleton_class(rb_mCryptoPP), "hash_name", "digest_name");
191
+ rb_define_alias(rb_singleton_class(rb_mCryptoPP), "hash_list", "digest_list");
192
+
193
+ rb_define_module_function(rb_mCryptoPP, "digest", RUBY_METHOD_FUNC(rb_module_digest), -1); /* in digests.cpp */
194
+ rb_define_module_function(rb_mCryptoPP, "digest_hex", RUBY_METHOD_FUNC(rb_module_digest_hex), -1); /* in digests.cpp */
195
+
196
+ rb_define_alias(rb_singleton_class(rb_mCryptoPP), "hexdigest", "digest_hex");
197
+
198
+ rb_define_module_function(rb_mCryptoPP, "digest_io", RUBY_METHOD_FUNC(rb_module_digest_io), -1); /* in digests.cpp */
199
+ rb_define_module_function(rb_mCryptoPP, "digest_io_hex", RUBY_METHOD_FUNC(rb_module_digest_io_hex), -1); /* in digests.cpp */
200
+
201
+ rb_define_module_function(rb_mCryptoPP, "digest_hmac", RUBY_METHOD_FUNC(rb_module_hmac_digest), -1); /* in digests.cpp */
202
+ rb_define_module_function(rb_mCryptoPP, "digest_hmac_hex", RUBY_METHOD_FUNC(rb_module_hmac_digest_hex), -1); /* in digests.cpp */
203
+ rb_define_module_function(rb_mCryptoPP, "hmac_list", RUBY_METHOD_FUNC(rb_module_hmac_list), 0); /* in digests.cpp */
204
+
205
+ rb_define_method(rb_cCryptoPP_Cipher, "rand_iv", RUBY_METHOD_FUNC(rb_cipher_rand_iv), 1); /* in ciphers.cpp */
206
+ rb_define_method(rb_cCryptoPP_Cipher, "iv=", RUBY_METHOD_FUNC(rb_cipher_iv_eq), 1); /* in ciphers.cpp */
207
+ rb_define_method(rb_cCryptoPP_Cipher, "iv_hex=", RUBY_METHOD_FUNC(rb_cipher_iv_hex_eq), 1); /* in ciphers.cpp */
208
+ rb_define_method(rb_cCryptoPP_Cipher, "iv", RUBY_METHOD_FUNC(rb_cipher_iv), 0); /* in ciphers.cpp */
209
+ rb_define_method(rb_cCryptoPP_Cipher, "iv_hex", RUBY_METHOD_FUNC(rb_cipher_iv_hex), 0); /* in ciphers.cpp */
210
+ rb_define_method(rb_cCryptoPP_Cipher, "block_mode=", RUBY_METHOD_FUNC(rb_cipher_block_mode_eq), 1); /* in ciphers.cpp */
211
+ rb_define_method(rb_cCryptoPP_Cipher, "block_mode", RUBY_METHOD_FUNC(rb_cipher_block_mode), 0); /* in ciphers.cpp */
212
+ rb_define_method(rb_cCryptoPP_Cipher, "padding=", RUBY_METHOD_FUNC(rb_cipher_padding_eq), 1); /* in ciphers.cpp */
213
+ rb_define_method(rb_cCryptoPP_Cipher, "padding", RUBY_METHOD_FUNC(rb_cipher_padding), 0); /* in ciphers.cpp */
214
+ rb_define_method(rb_cCryptoPP_Cipher, "rng=", RUBY_METHOD_FUNC(rb_cipher_rng_eq), 1); /* in ciphers.cpp */
215
+ rb_define_method(rb_cCryptoPP_Cipher, "rng", RUBY_METHOD_FUNC(rb_cipher_rng), 0); /* in ciphers.cpp */
216
+ rb_define_method(rb_cCryptoPP_Cipher, "plaintext=", RUBY_METHOD_FUNC(rb_cipher_plaintext_eq), 1); /* in ciphers.cpp */
217
+ rb_define_method(rb_cCryptoPP_Cipher, "plaintext_hex=", RUBY_METHOD_FUNC(rb_cipher_plaintext_hex_eq), 1); /* in ciphers.cpp */
218
+ rb_define_method(rb_cCryptoPP_Cipher, "plaintext", RUBY_METHOD_FUNC(rb_cipher_plaintext), 0); /* in ciphers.cpp */
219
+ rb_define_method(rb_cCryptoPP_Cipher, "plaintext_hex", RUBY_METHOD_FUNC(rb_cipher_plaintext_hex), 0); /* in ciphers.cpp */
220
+ rb_define_method(rb_cCryptoPP_Cipher, "ciphertext=", RUBY_METHOD_FUNC(rb_cipher_ciphertext_eq), 1); /* in ciphers.cpp */
221
+ rb_define_method(rb_cCryptoPP_Cipher, "ciphertext_hex=", RUBY_METHOD_FUNC(rb_cipher_ciphertext_hex_eq), 1); /* in ciphers.cpp */
222
+ rb_define_method(rb_cCryptoPP_Cipher, "ciphertext", RUBY_METHOD_FUNC(rb_cipher_ciphertext), 0); /* in ciphers.cpp */
223
+ rb_define_method(rb_cCryptoPP_Cipher, "ciphertext_hex", RUBY_METHOD_FUNC(rb_cipher_ciphertext_hex), 0); /* in ciphers.cpp */
224
+ rb_define_method(rb_cCryptoPP_Cipher, "key=", RUBY_METHOD_FUNC(rb_cipher_key_eq), 1); /* in ciphers.cpp */
225
+ rb_define_method(rb_cCryptoPP_Cipher, "key_hex=", RUBY_METHOD_FUNC(rb_cipher_key_hex_eq), 1); /* in ciphers.cpp */
226
+ rb_define_method(rb_cCryptoPP_Cipher, "key", RUBY_METHOD_FUNC(rb_cipher_key), 0); /* in ciphers.cpp */
227
+ rb_define_method(rb_cCryptoPP_Cipher, "key_hex", RUBY_METHOD_FUNC(rb_cipher_key_hex), 0); /* in ciphers.cpp */
228
+ rb_define_method(rb_cCryptoPP_Cipher, "key_length=", RUBY_METHOD_FUNC(rb_cipher_key_length_eq), 1); /* in ciphers.cpp */
229
+ rb_define_method(rb_cCryptoPP_Cipher, "key_length", RUBY_METHOD_FUNC(rb_cipher_key_length), 0); /* in ciphers.cpp */
230
+ rb_define_method(rb_cCryptoPP_Cipher, "default_key_length", RUBY_METHOD_FUNC(rb_cipher_default_key_length), 0); /* in ciphers.cpp */
231
+ rb_define_method(rb_cCryptoPP_Cipher, "max_key_length", RUBY_METHOD_FUNC(rb_cipher_max_key_length), 0); /* in ciphers.cpp */
232
+ rb_define_method(rb_cCryptoPP_Cipher, "min_key_length", RUBY_METHOD_FUNC(rb_cipher_min_key_length), 0); /* in ciphers.cpp */
233
+ rb_define_method(rb_cCryptoPP_Cipher, "mult_key_length", RUBY_METHOD_FUNC(rb_cipher_mult_key_length), 0); /* in ciphers.cpp */
234
+ rb_define_method(rb_cCryptoPP_Cipher, "valid_key_length", RUBY_METHOD_FUNC(rb_cipher_valid_key_length), 1); /* in ciphers.cpp */
235
+ # if ENABLED_RC2_CIPHER
236
+ rb_define_method(rb_cCryptoPP_Cipher_RC2, "effective_key_length=", RUBY_METHOD_FUNC(rb_cipher_effective_key_length_eq), 1); /* in ciphers.cpp */
237
+ rb_define_method(rb_cCryptoPP_Cipher_RC2, "effective_key_length", RUBY_METHOD_FUNC(rb_cipher_effective_key_length), 0); /* in ciphers.cpp */
238
+ # endif
239
+ rb_define_method(rb_cCryptoPP_Cipher, "block_size", RUBY_METHOD_FUNC(rb_cipher_block_size), 1); /* in ciphers.cpp */
240
+ rb_define_method(rb_cCryptoPP_Cipher, "rounds=", RUBY_METHOD_FUNC(rb_cipher_rounds_eq), 1); /* in ciphers.cpp */
241
+ rb_define_method(rb_cCryptoPP_Cipher, "rounds", RUBY_METHOD_FUNC(rb_cipher_rounds), 0); /* in ciphers.cpp */
242
+ rb_define_method(rb_cCryptoPP_Cipher, "algorithm_name", RUBY_METHOD_FUNC(rb_cipher_algorithm_name), 0); /* in ciphers.cpp */
243
+ rb_define_method(rb_cCryptoPP_Cipher, "block_mode_name", RUBY_METHOD_FUNC(rb_cipher_block_mode_name), 0); /* in ciphers.cpp */
244
+ rb_define_method(rb_cCryptoPP_Cipher, "padding_name", RUBY_METHOD_FUNC(rb_cipher_padding_name), 0); /* in ciphers.cpp */
245
+ rb_define_method(rb_cCryptoPP_Cipher, "rng_name", RUBY_METHOD_FUNC(rb_cipher_rng_name), 0); /* in ciphers.cpp */
246
+ rb_define_method(rb_cCryptoPP_Cipher, "cipher_type", RUBY_METHOD_FUNC(rb_cipher_cipher_type), 0); /* in ciphers.cpp */
247
+ rb_define_method(rb_cCryptoPP_Cipher, "encrypt", RUBY_METHOD_FUNC(rb_cipher_encrypt), 0); /* in ciphers.cpp */
248
+ rb_define_method(rb_cCryptoPP_Cipher, "encrypt_hex", RUBY_METHOD_FUNC(rb_cipher_encrypt_hex), 0); /* in ciphers.cpp */
249
+ rb_define_method(rb_cCryptoPP_Cipher, "decrypt", RUBY_METHOD_FUNC(rb_cipher_decrypt), 0); /* in ciphers.cpp */
250
+ rb_define_method(rb_cCryptoPP_Cipher, "decrypt_hex", RUBY_METHOD_FUNC(rb_cipher_decrypt_hex), 0); /* in ciphers.cpp */
251
+ rb_define_method(rb_cCryptoPP_Cipher, "encrypt_io", RUBY_METHOD_FUNC(rb_cipher_encrypt_io), 2); /* in ciphers.cpp */
252
+ rb_define_method(rb_cCryptoPP_Cipher, "decrypt_io", RUBY_METHOD_FUNC(rb_cipher_decrypt_io), 2); /* in ciphers.cpp */
253
+
254
+ rb_define_method(rb_cCryptoPP_Digest, "digest", RUBY_METHOD_FUNC(rb_digest_digest), 0); /* in digests.cpp */
255
+ rb_define_method(rb_cCryptoPP_Digest, "digest_hex", RUBY_METHOD_FUNC(rb_digest_digest_hex), 0); /* in digests.cpp */
256
+ rb_define_method(rb_cCryptoPP_Digest, "digest=", RUBY_METHOD_FUNC(rb_digest_digest_eq), 1); /* in digests.cpp */
257
+ rb_define_method(rb_cCryptoPP_Digest, "digest_hex=", RUBY_METHOD_FUNC(rb_digest_digest_hex_eq), 1); /* in digests.cpp */
258
+ rb_define_method(rb_cCryptoPP_Digest, "plaintext", RUBY_METHOD_FUNC(rb_digest_plaintext), 0); /* in digests.cpp */
259
+ rb_define_method(rb_cCryptoPP_Digest, "plaintext=", RUBY_METHOD_FUNC(rb_digest_plaintext_eq), 1); /* in digests.cpp */
260
+ rb_define_method(rb_cCryptoPP_Digest, "plaintext_hex", RUBY_METHOD_FUNC(rb_digest_plaintext_hex), 0); /* in digests.cpp */
261
+ rb_define_method(rb_cCryptoPP_Digest, "plaintext_hex=", RUBY_METHOD_FUNC(rb_digest_plaintext_hex_eq), 1); /* in digests.cpp */
262
+ rb_define_method(rb_cCryptoPP_Digest, "calculate", RUBY_METHOD_FUNC(rb_digest_calculate), 0); /* in digests.cpp */
263
+ rb_define_method(rb_cCryptoPP_Digest, "calculate_hex", RUBY_METHOD_FUNC(rb_digest_calculate_hex), 0); /* in digests.cpp */
264
+ rb_define_method(rb_cCryptoPP_Digest, "digest_io", RUBY_METHOD_FUNC(rb_digest_digest_io), 1); /* in digests.cpp */
265
+ rb_define_method(rb_cCryptoPP_Digest, "digest_io_hex", RUBY_METHOD_FUNC(rb_digest_digest_io_hex), 1); /* in digests.cpp */
266
+ rb_define_method(rb_cCryptoPP_Digest, "update", RUBY_METHOD_FUNC(rb_digest_update), 1); /* in digests.cpp */
267
+ rb_define_method(rb_cCryptoPP_Digest, "to_s", RUBY_METHOD_FUNC(rb_digest_digest_hex), 0); /* in digests.cpp */
268
+ rb_define_method(rb_cCryptoPP_Digest, "inspect", RUBY_METHOD_FUNC(rb_digest_inspect), 0); /* in digests.cpp */
269
+ rb_define_method(rb_cCryptoPP_Digest, "==", RUBY_METHOD_FUNC(rb_digest_equals), 1); /* in digests.cpp */
270
+ rb_define_method(rb_cCryptoPP_Digest, "algorithm_name", RUBY_METHOD_FUNC(rb_digest_algorithm_name), 0); /* in digests.cpp */
271
+ rb_define_method(rb_cCryptoPP_Digest, "clear", RUBY_METHOD_FUNC(rb_digest_clear), 0); /* in digests.cpp */
272
+ rb_define_method(rb_cCryptoPP_Digest, "validate", RUBY_METHOD_FUNC(rb_digest_validate), 0); /* in digests.cpp */
273
+
274
+ rb_define_alias(rb_cCryptoPP_Digest, "hexdigest", "digest_hex");
275
+ rb_define_alias(rb_cCryptoPP_Digest, "hexdigest=", "digest_hex=");
276
+ rb_define_alias(rb_cCryptoPP_Digest, "<<", "update");
277
+ rb_define_alias(rb_cCryptoPP_Digest, "valid?", "validate");
278
+
279
+ rb_define_method(rb_cCryptoPP_Digest_HMAC, "key=", RUBY_METHOD_FUNC(rb_digest_hmac_key_eq), 1); /* in digests.cpp */
280
+ rb_define_method(rb_cCryptoPP_Digest_HMAC, "key_hex=", RUBY_METHOD_FUNC(rb_digest_hmac_key_hex_eq), 1); /* in digests.cpp */
281
+ rb_define_method(rb_cCryptoPP_Digest_HMAC, "key", RUBY_METHOD_FUNC(rb_digest_hmac_key), 0); /* in digests.cpp */
282
+ rb_define_method(rb_cCryptoPP_Digest_HMAC, "key_hex", RUBY_METHOD_FUNC(rb_digest_hmac_key_hex), 0); /* in digests.cpp */
283
+ rb_define_method(rb_cCryptoPP_Digest_HMAC, "key_length=", RUBY_METHOD_FUNC(rb_digest_hmac_key_length_eq), 1); /* in digests.cpp */
284
+ rb_define_method(rb_cCryptoPP_Digest_HMAC, "key_length", RUBY_METHOD_FUNC(rb_digest_hmac_key_length), 0); /* in digests.cpp */
285
+ }
@@ -0,0 +1,139 @@
1
+
2
+ /*
3
+ * Copyright (c) 2002-2010 J Smith <dark.panda@gmail.com>
4
+ * Crypto++ copyright (c) 1995-2010 Wei Dai
5
+ * See COPYING for the extact license
6
+ */
7
+
8
+ #ifndef __CRYPTOPP_RUBY_API_H__
9
+ #define __CRYPTOPP_RUBY_API_H__
10
+
11
+ #include "ruby.h"
12
+
13
+ extern VALUE rb_mCryptoPP;
14
+ extern VALUE rb_eCryptoPP_Error;
15
+ extern VALUE rb_cCryptoPP_Cipher;
16
+ extern VALUE rb_cCryptoPP_Digest;
17
+ extern VALUE rb_cCryptoPP_Digest_HMAC;
18
+
19
+ #define CIPHER_ALGORITHM_X(klass, r, c, s) \
20
+ extern VALUE rb_cCryptoPP_Cipher_ ## r ;
21
+ #include "defs/ciphers.def"
22
+
23
+ #define CHECKSUM_ALGORITHM_X(klass, r, c, s) \
24
+ extern VALUE rb_cCryptoPP_Digest_ ## r ;
25
+ #include "defs/checksums.def"
26
+
27
+ #define HASH_ALGORITHM_X(klass, r, c, s) \
28
+ extern VALUE rb_cCryptoPP_Digest_ ## r ;
29
+ #include "defs/hashes.def"
30
+
31
+ #define HMAC_ALGORITHM_X(klass, r, c, s) \
32
+ extern VALUE rb_cCryptoPP_Digest_HMAC_ ## r ;
33
+ #include "defs/hmacs.def"
34
+
35
+ VALUE rb_module_cipher_factory(int argc, VALUE *argv, VALUE self);
36
+ #define CIPHER_ALGORITHM_X(klass, r, n, s) \
37
+ VALUE rb_cipher_ ## r ##_new(int argc, VALUE *argv, VALUE self);
38
+ #include "defs/ciphers.def"
39
+ VALUE rb_cipher_rand_iv(VALUE self, VALUE l);
40
+ VALUE rb_cipher_iv_eq(VALUE self, VALUE iv);
41
+ VALUE rb_cipher_iv_hex_eq(VALUE self, VALUE iv);
42
+ VALUE rb_cipher_iv(VALUE self);
43
+ VALUE rb_cipher_iv_hex(VALUE self);
44
+ VALUE rb_cipher_block_mode_eq(VALUE self, VALUE m);
45
+ VALUE rb_cipher_block_mode(VALUE self);
46
+ VALUE rb_cipher_padding_eq(VALUE self, VALUE p);
47
+ VALUE rb_cipher_padding(VALUE self);
48
+ VALUE rb_cipher_rng_eq(VALUE self, VALUE r);
49
+ VALUE rb_cipher_rng(VALUE self);
50
+ VALUE rb_cipher_plaintext_eq(VALUE self, VALUE plaintext);
51
+ VALUE rb_cipher_plaintext_hex_eq(VALUE self, VALUE plaintext);
52
+ VALUE rb_cipher_plaintext(VALUE self);
53
+ VALUE rb_cipher_plaintext_hex(VALUE self);
54
+ VALUE rb_cipher_ciphertext_eq(VALUE self, VALUE ciphertext);
55
+ VALUE rb_cipher_ciphertext_hex_eq(VALUE self, VALUE ciphertext);
56
+ VALUE rb_cipher_ciphertext(VALUE self);
57
+ VALUE rb_cipher_ciphertext_hex(VALUE self);
58
+ VALUE rb_cipher_key_eq(VALUE self, VALUE key);
59
+ VALUE rb_cipher_key_hex_eq(VALUE self, VALUE key);
60
+ VALUE rb_cipher_key(VALUE self);
61
+ VALUE rb_cipher_key_hex(VALUE self);
62
+ VALUE rb_cipher_key_length_eq(VALUE self, VALUE l);
63
+ VALUE rb_cipher_key_length(VALUE self);
64
+ VALUE rb_cipher_default_key_length(VALUE self);
65
+ VALUE rb_cipher_min_key_length(VALUE self);
66
+ VALUE rb_cipher_max_key_length(VALUE self);
67
+ VALUE rb_cipher_mult_key_length(VALUE self);
68
+ VALUE rb_cipher_valid_key_length(VALUE self, VALUE l);
69
+ VALUE rb_cipher_effective_key_length_eq(VALUE self, VALUE l);
70
+ VALUE rb_cipher_effective_key_length(VALUE self);
71
+ VALUE rb_cipher_block_size(VALUE self);
72
+ VALUE rb_cipher_rounds_eq(VALUE self, VALUE r);
73
+ VALUE rb_cipher_rounds(VALUE self);
74
+ VALUE rb_cipher_encrypt(VALUE self);
75
+ VALUE rb_cipher_encrypt_hex(VALUE self);
76
+ VALUE rb_cipher_decrypt(VALUE self);
77
+ VALUE rb_cipher_decrypt_hex(VALUE self);
78
+ VALUE rb_cipher_encrypt_io(VALUE self, VALUE in, VALUE out);
79
+ VALUE rb_cipher_decrypt_io(VALUE self, VALUE in, VALUE out);
80
+ VALUE rb_module_cipher_name(VALUE self, VALUE c);
81
+ VALUE rb_cipher_algorithm_name(VALUE self);
82
+ VALUE rb_module_block_mode_name(VALUE self, VALUE m);
83
+ VALUE rb_cipher_block_mode_name(VALUE self);
84
+ VALUE rb_module_padding_name(VALUE self, VALUE p);
85
+ VALUE rb_cipher_padding_name(VALUE self);
86
+ VALUE rb_module_rng_name(VALUE self, VALUE r);
87
+ VALUE rb_cipher_rng_name(VALUE self);
88
+ VALUE rb_cipher_cipher_type(VALUE self);
89
+ VALUE rb_module_cipher_enabled(VALUE self, VALUE c);
90
+ VALUE rb_module_rng_available(VALUE self, VALUE r);
91
+ VALUE rb_module_cipher_list(VALUE self);
92
+ VALUE rb_module_digest_factory(int argc, VALUE *argv, VALUE self);
93
+ #define CHECKSUM_ALGORITHM_X(klass, r, n, s) \
94
+ VALUE rb_digest_ ## r ##_new(int argc, VALUE *argv, VALUE self);
95
+ #include "defs/checksums.def"
96
+
97
+ #define HASH_ALGORITHM_X(klass, r, n, s) \
98
+ VALUE rb_digest_ ## r ##_new(int argc, VALUE *argv, VALUE self);
99
+ #include "defs/hashes.def"
100
+ VALUE rb_digest_update(VALUE self, VALUE plaintext);
101
+ VALUE rb_digest_digest(VALUE self);
102
+ VALUE rb_digest_digest_hex(VALUE self);
103
+ VALUE rb_digest_plaintext(VALUE self);
104
+ VALUE rb_digest_plaintext_hex(VALUE self);
105
+ VALUE rb_digest_plaintext_eq(VALUE self, VALUE plaintext);
106
+ VALUE rb_digest_plaintext_hex_eq(VALUE self, VALUE plaintext);
107
+ VALUE rb_digest_calculate(VALUE self);
108
+ VALUE rb_digest_calculate_hex(VALUE self);
109
+ VALUE rb_digest_digest_eq(VALUE self, VALUE digest);
110
+ VALUE rb_digest_digest_hex_eq(VALUE self, VALUE digest);
111
+ VALUE rb_digest_inspect(VALUE self);
112
+ VALUE rb_digest_equals(VALUE self, VALUE compare);
113
+ VALUE rb_module_digest(int argc, VALUE *argv, VALUE self);
114
+ VALUE rb_module_digest_hex(int argc, VALUE *argv, VALUE self);
115
+ VALUE rb_module_digest_io(int argc, VALUE *argv, VALUE self);
116
+ VALUE rb_module_digest_io_hex(int argc, VALUE *argv, VALUE self);
117
+ VALUE rb_module_digest_enabled(VALUE self, VALUE d);
118
+ VALUE rb_module_digest_name(VALUE self, VALUE h);
119
+ VALUE rb_digest_algorithm_name(VALUE self);
120
+ VALUE rb_digest_clear(VALUE self);
121
+ VALUE rb_digest_validate(VALUE self);
122
+ VALUE rb_digest_digest_io(VALUE self, VALUE io);
123
+ VALUE rb_digest_digest_io_hex(VALUE self, VALUE io);
124
+ VALUE rb_module_digest_list(VALUE self);
125
+ VALUE rb_module_hmac_factory(int argc, VALUE *argv, VALUE self);
126
+ #define HMAC_ALGORITHM_X(klass, r, n, s) \
127
+ VALUE rb_digest_hmac_ ## r ##_new(int argc, VALUE *argv, VALUE self);
128
+ #include "defs/hmacs.def"
129
+ VALUE rb_digest_hmac_key_eq(VALUE self, VALUE key);
130
+ VALUE rb_digest_hmac_key_hex_eq(VALUE self, VALUE key);
131
+ VALUE rb_digest_hmac_key(VALUE self);
132
+ VALUE rb_digest_hmac_key_hex(VALUE self);
133
+ VALUE rb_digest_hmac_key_length_eq(VALUE self, VALUE l);
134
+ VALUE rb_digest_hmac_key_length(VALUE self);
135
+ VALUE rb_module_hmac_digest(int argc, VALUE *argv, VALUE self);
136
+ VALUE rb_module_hmac_digest_hex(int argc, VALUE *argv, VALUE self);
137
+ VALUE rb_module_hmac_list(VALUE self);
138
+
139
+ #endif
@@ -0,0 +1,10 @@
1
+
2
+ // C++ constant, Ruby Symbol
3
+ BLOCK_MODE_X(ECB, ecb)
4
+ BLOCK_MODE_X(CBC, cbc)
5
+ BLOCK_MODE_X(CBC_CTS, cbc_cts)
6
+ BLOCK_MODE_X(CFB, cfb)
7
+ BLOCK_MODE_X(CTR, ctr)
8
+ BLOCK_MODE_X(OFB, ofb)
9
+
10
+ #undef BLOCK_MODE_X
@@ -0,0 +1,10 @@
1
+ #if ENABLED_ADLER32_CHECKSUM || defined(CHECKSUM_ALGORITHM_X_FORCE)
2
+ CHECKSUM_ALGORITHM_X(Adler32, ADLER32, JAdler32, adler32)
3
+ #endif
4
+
5
+ #if ENABLED_CRC32_CHECKSUM || defined(CHECKSUM_ALGORITHM_X_FORCE)
6
+ CHECKSUM_ALGORITHM_X(CRC32, CRC32, JCRC32, crc32)
7
+ #endif
8
+
9
+ #undef CHECKSUM_ALGORITHM_X
10
+ #undef CHECKSUM_ALGORITHM_X_FORCE
@@ -0,0 +1,136 @@
1
+
2
+ // Ruby class name, constant, C++ class name, a Symbol
3
+ #if ENABLED_ARC4_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
4
+ CIPHER_ALGORITHM_X(ARC4, ARC4, JARC4, arc4)
5
+ #endif
6
+
7
+ #if ENABLED_PANAMA_LITTLE_ENDIAN_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
8
+ CIPHER_ALGORITHM_X(PanamaCipherLE, PANAMA_LITTLE_ENDIAN, JPanamaCipherLE, panama_le)
9
+ #endif
10
+
11
+ #if ENABLED_PANAMA_BIG_ENDIAN_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
12
+ CIPHER_ALGORITHM_X(PanamaCipherBE, PANAMA_BIG_ENDIAN, JPanamaCipherBE, panama_be)
13
+ #endif
14
+
15
+ #if ENABLED_MARC4_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
16
+ CIPHER_ALGORITHM_X(MARC4, MARC4, JMARC4, marc4)
17
+ #endif
18
+
19
+ #if ENABLED_SEAL_LITTLE_ENDIAN_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
20
+ CIPHER_ALGORITHM_X(SEAL_BE, SEAL_LITTLE_ENDIAN, JSEAL_LE, seal_le)
21
+ #endif
22
+
23
+ #if ENABLED_SEAL_BIG_ENDIAN_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
24
+ CIPHER_ALGORITHM_X(SEAL_LE, SEAL_BIG_ENDIAN, JSEAL_BE, seal_be)
25
+ #endif
26
+
27
+ #if ENABLED_THREEWAY_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
28
+ CIPHER_ALGORITHM_X(Threeway, THREEWAY, J3Way, threeway)
29
+ #endif
30
+
31
+ #if ENABLED_AES_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
32
+ CIPHER_ALGORITHM_X(AES, AES, JAES, aes)
33
+ #endif
34
+
35
+ #if ENABLED_BLOWFISH_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
36
+ CIPHER_ALGORITHM_X(Blowfish, BLOWFISH, JBlowfish, blowfish)
37
+ #endif
38
+
39
+ #if ENABLED_CAMELLIA_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
40
+ CIPHER_ALGORITHM_X(Camellia, CAMELLIA, JCamellia, camellia)
41
+ #endif
42
+
43
+ #if ENABLED_CAST128_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
44
+ CIPHER_ALGORITHM_X(CAST128, CAST128, JCAST128, cast128)
45
+ #endif
46
+
47
+ #if ENABLED_CAST256_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
48
+ CIPHER_ALGORITHM_X(CAST256, CAST256, JCAST256, cast256)
49
+ #endif
50
+
51
+ #if ENABLED_DES_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
52
+ CIPHER_ALGORITHM_X(DES, DES, JDES, des)
53
+ #endif
54
+
55
+ #if ENABLED_DES_EDE2_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
56
+ CIPHER_ALGORITHM_X(DES_EDE2, DES_EDE2, JDES_EDE2, des_ede2)
57
+ #endif
58
+
59
+ #if ENABLED_DES_EDE3_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
60
+ CIPHER_ALGORITHM_X(DES_EDE3, DES_EDE3, JDES_EDE3, des_ede3)
61
+ #endif
62
+
63
+ #if ENABLED_DES_XEX3_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
64
+ CIPHER_ALGORITHM_X(DES_XEX3, DES_XEX3, JDES_XEX3, des_xex3)
65
+ #endif
66
+
67
+ #if ENABLED_DIAMOND2_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
68
+ CIPHER_ALGORITHM_X(Diamond2, DIAMOND2, JDiamond2, diamond2)
69
+ #endif
70
+
71
+ #if ENABLED_DIAMOND2_LITE_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
72
+ CIPHER_ALGORITHM_X(Diamond2Lite, DIAMOND2_LITE, JDiamond2Lite, diamond2lite)
73
+ #endif
74
+
75
+ #if ENABLED_GOST_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
76
+ CIPHER_ALGORITHM_X(GOST, GOST, JGOST, gost)
77
+ #endif
78
+
79
+ #if ENABLED_IDEA_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
80
+ CIPHER_ALGORITHM_X(IDEA, IDEA, JIDEA, idea)
81
+ #endif
82
+
83
+ #if ENABLED_MARS_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
84
+ CIPHER_ALGORITHM_X(MARS, MARS, JMARS, mars)
85
+ #endif
86
+
87
+ #if ENABLED_RC2_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
88
+ CIPHER_ALGORITHM_X(RC2, RC2, JRC2, rc2)
89
+ #endif
90
+
91
+ #if ENABLED_RC5_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
92
+ CIPHER_ALGORITHM_X(RC5, RC5, JRC5, rc5)
93
+ #endif
94
+
95
+ #if ENABLED_RC6_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
96
+ CIPHER_ALGORITHM_X(RC6, RC6, JRC6, rc6)
97
+ #endif
98
+
99
+ #if ENABLED_SAFER_K_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
100
+ CIPHER_ALGORITHM_X(SAFER_K, SAFER_K, JSAFER_K, safer_k)
101
+ #endif
102
+
103
+ #if ENABLED_SAFER_SK_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
104
+ CIPHER_ALGORITHM_X(SAFER_SK, SAFER_SK, JSAFER_SK, safer_sk)
105
+ #endif
106
+
107
+ #if ENABLED_SERPENT_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
108
+ CIPHER_ALGORITHM_X(Serpent, SERPENT, JSerpent, serpent)
109
+ #endif
110
+
111
+ #if ENABLED_SHACAL2_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
112
+ CIPHER_ALGORITHM_X(SHACAL2, SHACAL2, JSHACAL2, shacal2)
113
+ #endif
114
+
115
+ #if ENABLED_SHARK_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
116
+ CIPHER_ALGORITHM_X(SHARK, SHARK, JSHARK, shark)
117
+ #endif
118
+
119
+ #if ENABLED_SKIPJACK_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
120
+ CIPHER_ALGORITHM_X(SKIPJACK, SKIPJACK, JSKIPJACK, skipjack)
121
+ #endif
122
+
123
+ #if ENABLED_SQUARE_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
124
+ CIPHER_ALGORITHM_X(Square, SQUARE, JSquare, square)
125
+ #endif
126
+
127
+ #if ENABLED_TEA_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
128
+ CIPHER_ALGORITHM_X(TEA, TEA, JTEA, tea)
129
+ #endif
130
+
131
+ #if ENABLED_TWOFISH_CIPHER || defined(CIPHER_ALGORITHM_X_FORCE)
132
+ CIPHER_ALGORITHM_X(Twofish, TWOFISH, JTwofish, twofish)
133
+ #endif
134
+
135
+ #undef CIPHER_ALGORITHM_X
136
+ #undef CIPHER_ALGORITHM_X_FORCE