virgil-crypto 2.3.0 → 3.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/.gitmodules +0 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +0 -0
  6. data/README.md +113 -9
  7. data/Rakefile +0 -0
  8. data/ext/native/src/.clang-format +37 -0
  9. data/ext/native/src/.gitignore +3 -0
  10. data/ext/native/src/.travis.yml +2 -1
  11. data/ext/native/src/CMakeLists.txt +66 -63
  12. data/ext/native/src/ChangeLog +114 -2
  13. data/ext/native/src/Dockerfile_Golang +29 -8
  14. data/ext/native/src/Jenkinsfile +61 -50
  15. data/ext/native/src/LICENSE +0 -0
  16. data/ext/native/src/README.md +137 -167
  17. data/ext/native/src/VERSION +1 -1
  18. data/ext/native/src/benchmark.md +140 -0
  19. data/ext/native/src/benchmark/CMakeLists.txt +0 -0
  20. data/ext/native/src/benchmark/benchmark_cipher.cxx +0 -0
  21. data/ext/native/src/benchmark/benchmark_hash.cxx +0 -0
  22. data/ext/native/src/benchmark/benchmark_keys.cxx +0 -0
  23. data/ext/native/src/benchmark/benchmark_pythia.cxx +61 -0
  24. data/ext/native/src/benchmark/benchmark_random.cxx +0 -0
  25. data/ext/native/src/benchmark/benchmark_signer.cxx +0 -0
  26. data/ext/native/src/ci/install-dependencies.sh +8 -12
  27. data/ext/native/src/ci/publish-docs.sh +107 -22
  28. data/ext/native/src/ci/travis-deployment-key.enc +0 -0
  29. data/ext/native/src/cmake/TransitiveArgs.cmake +78 -0
  30. data/ext/native/src/cmake/TransitiveToolchainArgs.cmake +105 -0
  31. data/ext/native/src/cmake/add_mono_metadata.cmake +103 -0
  32. data/ext/native/src/cmake/apple.cmake +56 -11
  33. data/ext/native/src/cmake/aux_source_directory_to_file.cmake +0 -0
  34. data/ext/native/src/cmake/check_pointer_size.cmake +0 -0
  35. data/ext/native/src/cmake/copy_all_files.cmake +0 -0
  36. data/ext/native/src/cmake/file_regex_replace.cmake +0 -0
  37. data/ext/native/src/cmake/find_host_utils.cmake +0 -0
  38. data/ext/native/src/cmake/uppercase_first_char.cmake +0 -0
  39. data/ext/native/src/cmake/uppercase_namespaces.cmake +3 -0
  40. data/ext/native/src/cmake/virgil_depends.cmake +0 -0
  41. data/ext/native/src/cmake/virgil_depends_local.cmake +2 -0
  42. data/ext/native/src/docs/.gitignore +0 -0
  43. data/ext/native/src/lib/CMakeLists.txt +59 -1
  44. data/ext/native/src/lib/Doxyfile.in +1 -1
  45. data/ext/native/src/lib/Info.plist.in +0 -0
  46. data/ext/native/src/lib/cmake/config.cmake.in +0 -0
  47. data/ext/native/src/lib/include/virgil/crypto/VirgilByteArrayUtils.h +0 -0
  48. data/ext/native/src/lib/include/virgil/crypto/VirgilChunkCipher.h +0 -0
  49. data/ext/native/src/lib/include/virgil/crypto/VirgilCipherBase.h +0 -0
  50. data/ext/native/src/lib/include/virgil/crypto/VirgilContentInfo.h +0 -0
  51. data/ext/native/src/lib/include/virgil/crypto/VirgilCrypto.h +13 -0
  52. data/ext/native/src/lib/include/virgil/crypto/VirgilCryptoError.h +0 -0
  53. data/ext/native/src/lib/include/virgil/crypto/VirgilCustomParams.h +0 -0
  54. data/ext/native/src/lib/include/virgil/crypto/VirgilKeyPair.h +30 -0
  55. data/ext/native/src/lib/include/virgil/crypto/VirgilSignerBase.h +0 -0
  56. data/ext/native/src/lib/include/virgil/crypto/VirgilStreamCipher.h +0 -0
  57. data/ext/native/src/lib/include/virgil/crypto/VirgilStreamSigner.h +0 -0
  58. data/ext/native/src/lib/include/virgil/crypto/VirgilTinyCipher.h +0 -0
  59. data/ext/native/src/lib/include/virgil/crypto/VirgilVersion.h +0 -0
  60. data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilAsymmetricCipher.h +17 -0
  61. data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilHKDF.h +0 -0
  62. data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilPBKDF.h +0 -0
  63. data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilSystemCryptoError.h +0 -0
  64. data/ext/native/src/lib/include/virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h +0 -0
  65. data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSContent.h +0 -0
  66. data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSContentInfo.h +0 -0
  67. data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSEncryptedContent.h +0 -0
  68. data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSEnvelopedData.h +0 -0
  69. data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSKeyTransRecipient.h +0 -0
  70. data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSPasswordRecipient.h +0 -0
  71. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFS.h +0 -0
  72. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSEncryptedMessage.h +0 -0
  73. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSInitiatorPrivateInfo.h +0 -0
  74. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSInitiatorPublicInfo.h +0 -0
  75. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSPrivateKey.h +0 -0
  76. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSPublicKey.h +0 -0
  77. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSResponderPrivateInfo.h +0 -0
  78. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSResponderPublicInfo.h +0 -0
  79. data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSSession.h +0 -0
  80. data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationCipher.h +0 -0
  81. data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationDH.h +0 -0
  82. data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationHash.h +0 -0
  83. data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationKDF.h +0 -0
  84. data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationRandom.h +0 -0
  85. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythia.h +181 -0
  86. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaBlindResult.h +89 -0
  87. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaContext.h +72 -0
  88. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaError.h +161 -0
  89. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaProveResult.h +89 -0
  90. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaTransformResult.h +91 -0
  91. data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaTransformationKeyPair.h +87 -0
  92. data/ext/native/src/lib/include/virgil/crypto/pythia/virgil_pythia_c.h +203 -0
  93. data/ext/native/src/lib/include/virgil/crypto/stream/VirgilBytesDataSink.h +0 -0
  94. data/ext/native/src/lib/include/virgil/crypto/stream/VirgilBytesDataSource.h +0 -0
  95. data/ext/native/src/lib/mainpage.dox +6 -0
  96. data/ext/native/src/lib/module.modulemap +7 -0
  97. data/ext/native/src/lib/src/VirgilAsn1Alg.cxx +0 -0
  98. data/ext/native/src/lib/src/VirgilAsn1Alg.h +0 -0
  99. data/ext/native/src/lib/src/VirgilAsn1Compatible.cxx +0 -0
  100. data/ext/native/src/lib/src/VirgilAsymmetricCipher.cxx +82 -0
  101. data/ext/native/src/lib/src/VirgilByteArrayUtils.cxx +0 -0
  102. data/ext/native/src/lib/src/VirgilCMSContent.cxx +0 -0
  103. data/ext/native/src/lib/src/VirgilCMSContentInfo.cxx +0 -0
  104. data/ext/native/src/lib/src/VirgilCMSEncryptedContent.cxx +0 -0
  105. data/ext/native/src/lib/src/VirgilCMSEnvelopedData.cxx +0 -0
  106. data/ext/native/src/lib/src/VirgilCMSKeyTransRecipient.cxx +0 -0
  107. data/ext/native/src/lib/src/VirgilCMSPasswordRecipient.cxx +0 -0
  108. data/ext/native/src/lib/src/VirgilChunkCipher.cxx +0 -0
  109. data/ext/native/src/lib/src/VirgilCipherBase.cxx +0 -0
  110. data/ext/native/src/lib/src/VirgilConfig.cxx +51 -0
  111. data/ext/native/src/lib/src/VirgilConfig.h.in +43 -1
  112. data/ext/native/src/lib/src/VirgilContentInfo.cxx +0 -0
  113. data/ext/native/src/lib/src/VirgilCryptoError.cxx +0 -0
  114. data/ext/native/src/lib/src/VirgilCustomParams.cxx +0 -0
  115. data/ext/native/src/lib/src/VirgilDataSink.cxx +0 -0
  116. data/ext/native/src/lib/src/VirgilHKDF.cxx +0 -0
  117. data/ext/native/src/lib/src/VirgilKeyPair.cxx +19 -0
  118. data/ext/native/src/lib/src/VirgilOID.h +0 -0
  119. data/ext/native/src/lib/src/VirgilPBKDF.cxx +0 -0
  120. data/ext/native/src/lib/src/VirgilSignerBase.cxx +0 -0
  121. data/ext/native/src/lib/src/VirgilStreamCipher.cxx +0 -0
  122. data/ext/native/src/lib/src/VirgilStreamSigner.cxx +0 -0
  123. data/ext/native/src/lib/src/VirgilSystemCryptoError.cxx +0 -0
  124. data/ext/native/src/lib/src/VirgilTagFilter.cxx +0 -0
  125. data/ext/native/src/lib/src/VirgilTagFilter.h +0 -0
  126. data/ext/native/src/lib/src/VirgilTinyCipher.cxx +0 -0
  127. data/ext/native/src/lib/src/VirgilVersion.cxx.in +0 -0
  128. data/ext/native/src/lib/src/mbedtls_context.h +0 -0
  129. data/ext/native/src/lib/src/mbedtls_context_policy_spec.h +0 -0
  130. data/ext/native/src/lib/src/mbedtls_type_utils.h +0 -0
  131. data/ext/native/src/lib/src/pfs/VirgilPFS.cxx +0 -0
  132. data/ext/native/src/lib/src/pfs/VirgilPFSEncryptedMessage.cxx +0 -0
  133. data/ext/native/src/lib/src/pfs/VirgilPFSInitiatorPrivateInfo.cxx +0 -0
  134. data/ext/native/src/lib/src/pfs/VirgilPFSInitiatorPublicInfo.cxx +0 -0
  135. data/ext/native/src/lib/src/pfs/VirgilPFSPrivateKey.cxx +0 -0
  136. data/ext/native/src/lib/src/pfs/VirgilPFSPublicKey.cxx +0 -0
  137. data/ext/native/src/lib/src/pfs/VirgilPFSResponderPrivateInfo.cxx +0 -0
  138. data/ext/native/src/lib/src/pfs/VirgilPFSResponderPublicInfo.cxx +0 -0
  139. data/ext/native/src/lib/src/pfs/VirgilPFSSession.cxx +0 -0
  140. data/ext/native/src/lib/src/primitive/VirgilOperationCipher.cxx +0 -0
  141. data/ext/native/src/lib/src/primitive/VirgilOperationDH.cxx +0 -0
  142. data/ext/native/src/lib/src/primitive/VirgilOperationHash.cxx +0 -0
  143. data/ext/native/src/lib/src/primitive/VirgilOperationKDF.cxx +0 -0
  144. data/ext/native/src/lib/src/primitive/VirgilOperationRandom.cxx +0 -0
  145. data/ext/native/src/lib/src/pythia/VirgilPythia.cxx +202 -0
  146. data/ext/native/src/lib/src/pythia/VirgilPythiaContext.cxx +116 -0
  147. data/ext/native/src/lib/src/pythia/VirgilPythiaError.cxx +58 -0
  148. data/ext/native/src/lib/src/pythia/virgil_pythia_c.cxx +129 -0
  149. data/ext/native/src/lib/src/stream/VirgilBytesDataSink.cxx +0 -0
  150. data/ext/native/src/lib/src/stream/VirgilBytesDataSource.cxx +0 -0
  151. data/ext/native/src/lib/src/utils.h +3 -2
  152. data/ext/native/src/libs_ext/mbedtls/configs/config.h +0 -0
  153. data/ext/native/src/libs_ext/mbedtls/configs/config_desktop.h +0 -0
  154. data/ext/native/src/libs_ext/mbedtls/mbedtls.cmake +0 -0
  155. data/ext/native/src/{cmake/cmake_args.cmake → libs_ext/pythia/pythia.cmake} +24 -28
  156. data/ext/native/src/libs_ext/rapidjson/rapidjson.cmake +0 -0
  157. data/ext/native/src/libs_ext/tinyformat/cmake/config.cmake.in +0 -0
  158. data/ext/native/src/libs_ext/tinyformat/tinyformat.cmake +0 -0
  159. data/ext/native/src/migration-2.0.md +0 -0
  160. data/ext/native/src/tests/CMakeLists.txt +0 -0
  161. data/ext/native/src/tests/catch.hpp +0 -0
  162. data/ext/native/src/tests/data/test_data_pfs_with_otc.json +0 -0
  163. data/ext/native/src/tests/data/test_data_pfs_without_otc.json +0 -0
  164. data/ext/native/src/tests/deterministic_keys.h +293 -0
  165. data/ext/native/src/tests/rsa_keys.h +229 -123
  166. data/ext/native/src/tests/test_asn1_writer.cxx +0 -0
  167. data/ext/native/src/tests/test_asymmetric_cipher.cxx +65 -0
  168. data/ext/native/src/tests/test_base64.cxx +0 -0
  169. data/ext/native/src/tests/test_byte_array_utils.cxx +0 -0
  170. data/ext/native/src/tests/test_chunk_cipher.cxx +0 -0
  171. data/ext/native/src/tests/test_cipher.cxx +8 -4
  172. data/ext/native/src/tests/test_cipher_base.cxx +0 -0
  173. data/ext/native/src/tests/test_contract_copy_move.cxx +4 -1
  174. data/ext/native/src/tests/test_data_pfs.h +0 -0
  175. data/ext/native/src/tests/test_hash.cxx +0 -0
  176. data/ext/native/src/tests/test_hkdf.cxx +0 -0
  177. data/ext/native/src/tests/test_key_pair.cxx +65 -3
  178. data/ext/native/src/tests/test_pbe.cxx +0 -0
  179. data/ext/native/src/tests/test_pbkdf.cxx +0 -0
  180. data/ext/native/src/tests/test_pfs.cxx +0 -0
  181. data/ext/native/src/tests/test_pythia.cxx +157 -0
  182. data/ext/native/src/tests/test_random.cxx +0 -0
  183. data/ext/native/src/tests/test_runner.cxx +0 -0
  184. data/ext/native/src/tests/test_signer.cxx +0 -0
  185. data/ext/native/src/tests/test_stream_cipher.cxx +0 -0
  186. data/ext/native/src/tests/test_stream_data_source.cxx +0 -0
  187. data/ext/native/src/tests/test_symmetric_cipher.cxx +0 -0
  188. data/ext/native/src/tests/test_tag_filter.cxx +0 -0
  189. data/ext/native/src/tests/test_tiny_cipher.cxx +0 -0
  190. data/ext/native/src/utils/build.bat +0 -0
  191. data/ext/native/src/utils/build.sh +238 -68
  192. data/ext/native/src/utils/zip.vbs +0 -0
  193. data/ext/native/src/virgil-crypto.sublime-project +15 -0
  194. data/ext/native/src/wrappers/asmjs/CMakeLists.txt +0 -8
  195. data/ext/native/src/wrappers/emsdk/CMakeLists.txt +2 -2
  196. data/ext/native/src/wrappers/emsdk/error.js +0 -0
  197. data/ext/native/src/wrappers/emsdk/example.html +152 -31
  198. data/ext/native/src/wrappers/emsdk/helpers.js +140 -135
  199. data/ext/native/src/wrappers/emsdk/patch_embind.pl +0 -0
  200. data/ext/native/src/wrappers/emsdk/wrapper.cxx +55 -0
  201. data/ext/native/src/wrappers/go/CMakeLists.txt +6 -5
  202. data/ext/native/src/wrappers/java/CMakeLists.txt +27 -4
  203. data/ext/native/src/wrappers/java/src/JniLoader.java +167 -0
  204. data/ext/native/src/wrappers/java/src/VirgilStreamDataSink.java +0 -0
  205. data/ext/native/src/wrappers/java/src/VirgilStreamDataSource.java +0 -0
  206. data/ext/native/src/wrappers/net/CMakeLists.txt +41 -8
  207. data/ext/native/src/wrappers/net/cmake/UseCSharp.cmake +5 -5
  208. data/ext/native/src/wrappers/net/src/VirgilStreamDataSink.cs +0 -0
  209. data/ext/native/src/wrappers/net/src/VirgilStreamDataSource.cs +0 -0
  210. data/ext/native/src/wrappers/nodejs/checksum.txt +66 -0
  211. data/ext/native/src/wrappers/php/CMakeLists.txt +2 -5
  212. data/ext/native/src/wrappers/php/tests/CMakeLists.txt +6 -0
  213. data/ext/native/src/wrappers/php/tests/VirgilChunkCipher_Test.php.in +0 -0
  214. data/ext/native/src/wrappers/php/tests/VirgilCustomParams_Test.php.in +0 -0
  215. data/ext/native/src/wrappers/php/tests/VirgilKDF_Test.php.in +0 -0
  216. data/ext/native/src/wrappers/php/tests/VirgilPBE_Test.php.in +0 -0
  217. data/ext/native/src/wrappers/php/tests/VirgilPBKDF_Test.php.in +0 -0
  218. data/ext/native/src/wrappers/php/tests/VirgilPythia_Test.php.in +87 -0
  219. data/ext/native/src/wrappers/php/tests/VirgilStreamCipher_Test.php.in +0 -0
  220. data/ext/native/src/wrappers/php/tests/VirgilStreamSigner_Test.php.in +0 -0
  221. data/ext/native/src/wrappers/php/tests/VirgilVersion_Test.php.in +0 -0
  222. data/ext/native/src/wrappers/python/CMakeLists.txt +4 -1
  223. data/ext/native/src/wrappers/ruby/CMakeLists.txt +4 -1
  224. data/ext/native/src/wrappers/swig/common.i +0 -0
  225. data/ext/native/src/wrappers/swig/csharp/FixedArray.i +0 -0
  226. data/ext/native/src/wrappers/swig/csharp/VirgilByteArray.i +0 -0
  227. data/ext/native/src/wrappers/swig/csharp/common.i +0 -0
  228. data/ext/native/src/wrappers/swig/csharp/csharphead.swg.in +0 -0
  229. data/ext/native/src/wrappers/swig/go/common.i.in +7 -0
  230. data/ext/native/src/wrappers/swig/java/VirgilByteArray.i +0 -0
  231. data/ext/native/src/wrappers/swig/java/common.i +6 -0
  232. data/ext/native/src/wrappers/swig/php/common.i +0 -0
  233. data/ext/native/src/wrappers/swig/php/php7/VirgilByteArray.i +0 -0
  234. data/ext/native/src/wrappers/swig/util.i +0 -0
  235. data/ext/native/src/wrappers/swig/wrapper.i.in +18 -7
  236. data/ext/native/src/wrappers/webasm/CMakeLists.txt +0 -8
  237. data/ext/rakefile.rb +77 -56
  238. data/lib/virgil/crypto.rb +53 -9
  239. data/lib/virgil/crypto/access_token_signer.rb +79 -0
  240. data/lib/virgil/crypto/bytes.rb +81 -17
  241. data/lib/virgil/crypto/card_crypto.rb +115 -0
  242. data/lib/virgil/crypto/crypto_exception.rb +40 -0
  243. data/lib/virgil/crypto/hash_algorithm.rb +82 -0
  244. data/lib/virgil/crypto/key_pair.rb +41 -0
  245. data/lib/virgil/crypto/key_pair_type.rb +98 -0
  246. data/lib/virgil/crypto/private_key.rb +40 -0
  247. data/lib/virgil/crypto/private_key_exporter.rb +67 -0
  248. data/lib/virgil/crypto/public_key.rb +40 -0
  249. data/lib/virgil/crypto/{virgil_stream_data_sink.rb → stream_data_sink.rb} +12 -12
  250. data/lib/virgil/crypto/{virgil_stream_data_source.rb → stream_data_source.rb} +12 -12
  251. data/lib/virgil/crypto/validation.rb +59 -0
  252. data/lib/virgil/crypto/version.rb +35 -1
  253. data/lib/virgil/crypto/virgil_crypto.rb +595 -0
  254. data/lib/virgil/native_crypto.rb +80 -60
  255. data/lib/virgil/os.rb +40 -6
  256. data/secrets.tar.enc +0 -0
  257. data/virgil-crypto.gemspec +6 -7
  258. metadata +62 -12
  259. data/ext/native/src/cmake/android.toolchain.cmake +0 -1697
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.4.5
@@ -0,0 +1,140 @@
1
+ # Benchmark tests
2
+
3
+ This file contain benchmark of the Virgil Crypto library:
4
+
5
+ ## Environment for tests
6
+
7
+ These tests were made on MacBook Pro with the next specifications:
8
+
9
+ | Property | Specifications |
10
+ |---------------|-------------------------------------------|
11
+ | Model | MacBook Pro (Retina, 13-inch, Early 2015) |
12
+ | Processor | 3.1 GHz Intel Core i7 |
13
+ | Memory | 16 GB 1867 MHz DDR3 |
14
+ | MacOS version | High Sierra (version 10.13.3) |
15
+
16
+ ## Tests
17
+
18
+ ### Hashing
19
+
20
+ | algorithm | samples | ns/op |
21
+ |-----------|---------|-------|
22
+ | MD5 | 100000 | 19314 |
23
+ | SHA-256 | 50000 | 38695 |
24
+ | SHA-384 | 50000 | 25606 |
25
+ | SHA-512 | 50000 | 25438 |
26
+
27
+ ### Key pair generation
28
+
29
+ | algorithm | samples | ns/op |
30
+ |--------------------------|---------|------------|
31
+ | RSA 2048 | 5 | 202676085 |
32
+ | RSA 3072 | 5 | 761719258 |
33
+ | RSA 4096 | 1 | 4606853434 |
34
+ | curve25519 | 50000 | 20493 |
35
+ | ed25519 | 100000 | 16226 |
36
+ | 224-bits NIST curve | 1000 | 1344291 |
37
+ | 256-bits NIST curve | 1000 | 1911181 |
38
+ | 384-bits NIST curve | 500 | 2565290 |
39
+ | 521-bits NIST curve | 500 | 3758969 |
40
+ | 256-bits Brainpool curve | 100 | 13363189 |
41
+ | 384-bits Brainpool curve | 50 | 24520962 |
42
+ | 512-bits Brainpool curve | 50 | 45844118 |
43
+ | 192-bits Koblitz curve | 1000 | 1601368 |
44
+ | 224-bits Koblitz curve | 1000 | 1935883 |
45
+ | 256-bits Koblitz curve | 500 | 2119124 |
46
+
47
+ ### Key Export
48
+
49
+ | operation | samples | ns/op |
50
+ |----------------------------------------|---------|----------|
51
+ | Public Key to DER | 2000000 | 577 |
52
+ | Public Key to PEM | 1000000 | 1560 |
53
+ | Private Key to DER (no password) | 5000000 | 336 |
54
+ | Private Key to PEM (no password) | 2000000 | 879 |
55
+ | Private Key to DER (with password) | 100 | 14168461 |
56
+ | Private Key to PEM (with password) | 100 | 13862879 |
57
+ | Public Key DER to PEM | 500 | 4426590 |
58
+ | Public Key PEM to DER | 500 | 4461710 |
59
+ | Private Key PEM to DER (no password) | 500 | 4451291 |
60
+ | Private Key DER to PEM (no password) | 500 | 4408890 |
61
+ | Private Key DER to PEM (with password) | 50 | 25451292 |
62
+ | Private Key PEM to DER (with password) | 50 | 29305614 |
63
+
64
+ ### Encryption
65
+
66
+ | algorithm | samples | ns/op |
67
+ |--------------------------|---------|-------|
68
+ | RSA 2048 | 200000 | 9458 |
69
+ | RSA 3072 | 100000 | 10776 |
70
+ | RSA 4096 | 100000 | 11220 |
71
+ | Curve25519 curve | 200000 | 9672 |
72
+ | Ed25519 curve | 100000 | 11692 |
73
+ | 224-bits NIST curve | 100000 | 10114 |
74
+ | 256-bits NIST curve | 100000 | 11664 |
75
+ | 384-bits NIST curve | 100000 | 13421 |
76
+ | 521-bits NIST curve | 100000 | 10327 |
77
+ | 256-bits Brainpool curve | 100000 | 10152 |
78
+ | 384-bits Brainpool curve | 100000 | 10485 |
79
+ | 512-bits Brainpool curve | 100000 | 11166 |
80
+ | 192-bits Koblitz curve | 100000 | 11069 |
81
+ | 224-bits Koblitz curve | 200000 | 9631 |
82
+ | 256-bits Koblitz curve | 200000 | 9740 |
83
+
84
+ ### Decryption
85
+
86
+ | algorithm | samples | ns/op |
87
+ |--------------------------|---------|----------|
88
+ | RSA 2048 | 200 | 8709333 |
89
+ | RSA 3072 | 100 | 14597898 |
90
+ | RSA 4096 | 50 | 24189009 |
91
+ | curve25519 | 500 | 4603996 |
92
+ | ed25519 | 500 | 4545415 |
93
+ | 224-bits NIST curve | 200 | 6140846 |
94
+ | 256-bits NIST curve | 200 | 7106018 |
95
+ | 384-bits NIST curve | 200 | 7754033 |
96
+ | 521-bits NIST curve | 200 | 9074803 |
97
+ | 256-bits Brainpool curve | 100 | 19708554 |
98
+ | 384-bits Brainpool curve | 50 | 32892030 |
99
+ | 512-bits Brainpool curve | 20 | 57748835 |
100
+ | 192-bits Koblitz curve | 200 | 6485849 |
101
+ | 224-bits Koblitz curve | 200 | 6944859 |
102
+ | 256-bits Koblitz curve | 200 | 7362125 |
103
+
104
+ ### Sign
105
+
106
+ | algorithm | samples | ns/op |
107
+ |--------------------------|---------|----------|
108
+ | RSA 2048 | 500 | 4061518 |
109
+ | RSA 3072 | 200 | 9937662 |
110
+ | RSA 4096 | 100 | 19593122 |
111
+ | 224-bits NIST curve | 1000 | 1397832 |
112
+ | 256-bits NIST curve | 500 | 2040942 |
113
+ | 384-bits NIST curve | 500 | 2732660 |
114
+ | 521-bits NIST curve | 500 | 3897379 |
115
+ | 256-bits Brainpool curve | 100 | 13377896 |
116
+ | 384-bits Brainpool curve | 50 | 25024584 |
117
+ | 512-bits Brainpool curve | 50 | 47017466 |
118
+ | 192-bits Koblitz curve | 1000 | 1708163 |
119
+ | 224-bits Koblitz curve | 500 | 2083555 |
120
+ | 256-bits Koblitz curve | 500 | 2247125 |
121
+ | Ed25519 curve | 20000 | 52751 |
122
+
123
+ ### Verify
124
+
125
+ | algorithm | samples | ns/op |
126
+ |--------------------------|---------|----------|
127
+ | RSA 2048 | 20000 | 94365 |
128
+ | RSA 3072 | 10000 | 186789 |
129
+ | RSA 4096 | 5000 | 298092 |
130
+ | 224-bits NIST curve | 500 | 2694377 |
131
+ | 256-bits NIST curve | 500 | 3983349 |
132
+ | 384-bits NIST curve | 200 | 5237961 |
133
+ | 521-bits NIST curve | 200 | 7485531 |
134
+ | 256-bits Brainpool curve | 50 | 26543606 |
135
+ | 384-bits Brainpool curve | 50 | 48791525 |
136
+ | 512-bits Brainpool curve | 20 | 91268881 |
137
+ | 192-bits Koblitz curve | 500 | 3233918 |
138
+ | 224-bits Koblitz curve | 500 | 4083664 |
139
+ | 256-bits Koblitz curve | 500 | 4345015 |
140
+ | Ed25519 curve | 20000 | 59837 |
File without changes
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright (C) 2015-2018 Virgil Security Inc.
3
+ *
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * (1) Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ *
13
+ * (2) Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following disclaimer in
15
+ * the documentation and/or other materials provided with the
16
+ * distribution.
17
+ *
18
+ * (3) Neither the name of the copyright holder nor the names of its
19
+ * contributors may be used to endorse or promote products derived from
20
+ * this software without specific prior written permission.
21
+ *
22
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
23
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
31
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
+ * POSSIBILITY OF SUCH DAMAGE.
33
+ *
34
+ * Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
35
+ */
36
+
37
+ #define BENCHPRESS_CONFIG_MAIN
38
+
39
+ #include "benchpress.hpp"
40
+
41
+
42
+ #if VIRGIL_CRYPTO_FEATURE_PYTHIA
43
+
44
+
45
+ #include <virgil/crypto/VirgilByteArrayUtils.h>
46
+ #include <virgil/crypto/pythia/VirgilPythia.h>
47
+
48
+ using virgil::crypto::VirgilByteArrayUtils;
49
+ using virgil::crypto::pythia::VirgilPythia;
50
+
51
+ BENCHMARK("pythia init", [](benchpress::context* ctx) {
52
+
53
+ ctx->run_parallel([](benchpress::parallel_context* pctx) {
54
+ while (pctx->next()) {
55
+ VirgilPythia pythia;
56
+ auto result = pythia.blind(VirgilByteArrayUtils::stringToBytes("password"));
57
+ }
58
+ });
59
+ })
60
+
61
+ #endif /* VIRGIL_CRYPTO_FEATURE_PYTHIA */
@@ -50,6 +50,9 @@ travis_retry sudo apt-get -qq update
50
50
  ######################################## Utils
51
51
  travis_retry sudo apt-get install -y -qq software-properties-common
52
52
 
53
+ ######################################## Doxygen
54
+ travis_retry sudo apt-get install -y --force-yes -qq doxygen
55
+
53
56
  ######################################## Compilers
54
57
  if [[ "${CC}" == "gcc-5" ]]; then
55
58
  travis_retry sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
@@ -75,10 +78,10 @@ else
75
78
  tar xvfz cmake-${CMAKE_VERSION}.tar.gz
76
79
  cd cmake-${CMAKE_VERSION}
77
80
  ./bootstrap
78
- make -j4
81
+ make -j8 >/dev/null
79
82
  fi
80
83
 
81
- sudo make install
84
+ sudo make install >/dev/null
82
85
 
83
86
  cd -
84
87
 
@@ -91,21 +94,14 @@ else
91
94
  travis_retry wget http://downloads.sourceforge.net/swig/swig-${SWIG_VERSION}.tar.gz
92
95
  tar -xzf swig-${SWIG_VERSION}.tar.gz
93
96
  cd swig-${SWIG_VERSION}
94
- ./configure
95
- make -j4
97
+ ./configure >/dev/null
98
+ make -j8 >/dev/null
96
99
  fi
97
100
 
98
- sudo make install
101
+ sudo make install >/dev/null
99
102
 
100
103
  cd -
101
104
 
102
- ######################################## Doxygen
103
- echo "Download Doxygen version ${DOXYGEN_VERSION} ..."
104
- travis_retry wget http://ftp.stack.nl/pub/users/dimitri/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
105
- tar -xzf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
106
- sudo mv doxygen-${DOXYGEN_VERSION}/bin/doxygen /usr/bin/doxygen
107
- cd -
108
-
109
105
  ####################################### PHP & PHPUnit
110
106
  if [[ "${LANG}" == "php" ]]; then
111
107
  PHP_VERSION=${LANG_VERSION_MAJOR}.${LANG_VERSION_MINOR}
@@ -35,42 +35,60 @@
35
35
  # Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
36
36
  #
37
37
 
38
- set -ev
38
+ set -e
39
39
 
40
- if [[ "${PUBLISH_DOCS}" == "ON" ]] && [[ "${TRAVIS_BRANCH}" == "master" ]]; then
40
+ # Build documentation from the known tags pattern
41
+ if [ "${PUBLISH_DOCS}" == "ON" ] && [ -n "${TRAVIS_TAG}" ]; then
41
42
  # Settings
42
43
  REPO_PATH=git@github.com:VirgilSecurity/virgil-crypto.git
43
44
  HTML_PATH_DST="${PROJECT_ROOT}/build/docs/html"
44
45
  COMMIT_USER="Travis CI documentation builder."
45
46
  COMMIT_EMAIL="sergey.seroshtan@gmail.com"
46
47
  CHANGESET=$(git rev-parse --verify HEAD)
48
+ HOST_PLATFORM=$(uname -s)
47
49
 
48
- # Get a clean version of the HTML documentation repo.
50
+ echo "Get a clean version of the HTML documentation repo..."
49
51
  rm -rf ${HTML_PATH_DST}
50
52
  mkdir -p ${HTML_PATH_DST}
51
53
  git clone -b gh-pages "${REPO_PATH}" --single-branch ${HTML_PATH_DST}
52
54
 
53
- # Define SDK versions
54
- VIRGIL_CRYPTO_VERSION=`cat ${PROJECT_ROOT}/VERSION | awk -F"." '{ printf "v%d.%d",$1,$2 }'`
55
+ echo "Define library version..."
56
+ if [[ ${TRAVIS_TAG} == *-* ]]; then
57
+ # Featured tag
58
+ VIRGIL_CRYPTO_VERSION=${TRAVIS_TAG}
59
+ else
60
+ VIRGIL_CRYPTO_VERSION=$(echo ${TRAVIS_TAG#v} | awk -F"." '{ printf "v%d.%d",$1,$2 }')
61
+ fi
62
+ echo "Library tag : ${TRAVIS_TAG}"
63
+ echo "Library version: ${VIRGIL_CRYPTO_VERSION}"
64
+
55
65
  VIRGIL_CRYPTO_HTML_PATH_DST="${HTML_PATH_DST}/${VIRGIL_CRYPTO_VERSION}"
56
66
 
57
- # Prepare destination folders
67
+ echo "Prepare destination folder: ${VIRGIL_CRYPTO_HTML_PATH_DST}..."
58
68
  rm -fr "${VIRGIL_CRYPTO_HTML_PATH_DST}" && mkdir -p "${VIRGIL_CRYPTO_HTML_PATH_DST}"
59
69
 
60
- # Generate the HTML documentation.
70
+ echo "Generate the HTML documentation..."
61
71
  cmake --build "${PROJECT_ROOT}/build" --target doc
62
72
 
63
- # Copy new documentation
73
+ echo "Copy new documentation..."
74
+ echo " From: ${PROJECT_ROOT}/docs/html"
75
+ echo " To: ${VIRGIL_CRYPTO_HTML_PATH_DST}"
64
76
  cp -af "${PROJECT_ROOT}/docs/html/." "${VIRGIL_CRYPTO_HTML_PATH_DST}"
65
77
 
66
- # Fix source file names
78
+ echo "Fix source file names..."
67
79
  function fix_html_source_file_names {
68
80
  cd "${1}"
69
81
  for f in _*.html; do
70
82
  old_name=$f
71
83
  new_name=${f/${f:0:1}/}
84
+ echo " Rename"
85
+ echo " from: ${old_name}"
86
+ echo " to : ${new_name}"
72
87
  mv $old_name $new_name
73
- if [ "$(uname -s)" == "Darwin" ]; then
88
+
89
+ echo " change file name in references..."
90
+ echo ""
91
+ if [ "${HOST_PLATFORM}" == "Darwin" ]; then
74
92
  sed -i "" -e "s/[[:<:]]$old_name[[:>:]]/$new_name/g" *.html
75
93
  else
76
94
  sed -i"" "s/\b$old_name\b/$new_name/g" *.html
@@ -78,19 +96,83 @@ if [[ "${PUBLISH_DOCS}" == "ON" ]] && [[ "${TRAVIS_BRANCH}" == "master" ]]; then
78
96
  done
79
97
  cd -
80
98
  }
81
-
82
99
  fix_html_source_file_names "${VIRGIL_CRYPTO_HTML_PATH_DST}"
83
100
 
84
- # Generate root HTML file
85
- function get_dir_names {
86
- local DIRS=`find "$1" -maxdepth 1 -type d -name "$2"`
87
- local DIR_NAMES=()
88
- for dir in ${DIRS}; do
89
- DIR_NAMES+=("${dir#${1}/}")
101
+ echo "Get version directories list..."
102
+ function define_VERSION_DIRS {
103
+ VERSION_DIRS=()
104
+ for dir in `find "${HTML_PATH_DST}" -maxdepth 1 -type d -name "v*" | sort -r`; do
105
+ VERSION_DIRS+=("${dir##*/}")
106
+ done
107
+ }
108
+
109
+ echo "---"
110
+ echo "Initial versions:"
111
+ define_VERSION_DIRS
112
+ for dir in ${VERSION_DIRS[*]}; do
113
+ echo " - ${dir}"
114
+ done
115
+
116
+ echo "---"
117
+ echo "Cleanup versions..."
118
+ function find_feature_of_version {
119
+ local feature=${1}
120
+ local short_version=${2}
121
+
122
+ local found_versions=()
123
+ for available_version in ${@:3}; do
124
+ if [[ "${available_version}" = *"${short_version}-${feature}"* ]]; then
125
+ found_versions+=("${available_version}")
126
+ fi
127
+ done
128
+
129
+ echo "${found_versions[@]}"
130
+ }
131
+
132
+ function remove_stale_docs_if_relevant_exists {
133
+ local feature_to_reduce=${1}
134
+ local features_up_to_date=("${@:2}")
135
+ echo " ---"
136
+ echo " - Attempt to reduce docs for feature: ${feature_to_reduce} ..."
137
+ echo " - By using docs from features : ${features_up_to_date[*]} ..."
138
+
139
+ for version_dir in ${VERSION_DIRS[*]}; do
140
+ if [[ ${version_dir} = *"${feature_to_reduce}"* ]]; then
141
+ local version="${version_dir}"
142
+ local short_version="${version/%-*/}"
143
+ local release_version=$(echo ${version#v} | awk -F"." '{ printf "v%d.%d",$1,$2 }')
144
+ echo ""
145
+ echo " - Processing version: ${version} ..."
146
+
147
+ if [[ " ${VERSION_DIRS[@]} " =~ " ${release_version} " ]]; then
148
+ echo " - Remove docs because production version found: ${release_version} ..."
149
+ rm -fr -- "${HTML_PATH_DST}/${version_dir}"
150
+ continue
151
+ fi
152
+
153
+ for replacement_feature in ${features_up_to_date[@]}; do
154
+ local replacement_feature_versions=$(find_feature_of_version "${replacement_feature}" "${short_version}" "${VERSION_DIRS[@]}")
155
+
156
+ if [ ! -z "${replacement_feature_versions}" ]; then
157
+ echo " - Remove docs because more relevant version(s) are found: ${replacement_feature_versions} ..."
158
+ rm -fr -- "${HTML_PATH_DST}/${version_dir}"
159
+ fi
160
+ done
161
+ fi
90
162
  done
91
- echo ${DIR_NAMES[*]}
92
163
  }
164
+ remove_stale_docs_if_relevant_exists "beta" "rc"
165
+ remove_stale_docs_if_relevant_exists "rc"
93
166
 
167
+ echo "---"
168
+ echo "Reduced versions:"
169
+ define_VERSION_DIRS
170
+ for dir in ${VERSION_DIRS[*]}; do
171
+ echo " - ${dir}"
172
+ done
173
+
174
+
175
+ echo "Generate root HTML file..."
94
176
  cat >"${HTML_PATH_DST}/index.html" <<EOL
95
177
  <!DOCTYPE HTML>
96
178
  <html>
@@ -103,7 +185,7 @@ if [[ "${PUBLISH_DOCS}" == "ON" ]] && [[ "${TRAVIS_BRANCH}" == "master" ]]; then
103
185
  <ul>
104
186
  EOL
105
187
 
106
- for dir in `get_dir_names "${VIRGIL_CRYPTO_HTML_PATH_DST}/.." "v*"`; do
188
+ for dir in ${VERSION_DIRS[*]}; do
107
189
  echo " <li><p><a href=\"${dir}/index.html\">${dir}</a></p></li>" >> "${HTML_PATH_DST}/index.html"
108
190
  done
109
191
 
@@ -113,15 +195,18 @@ EOL
113
195
  </html>
114
196
  EOL
115
197
 
116
- # Create and commit the documentation repo.
198
+ cat "${HTML_PATH_DST}/index.html"
199
+ cd ${HTML_PATH_DST}
200
+
117
201
  git update-index -q --refresh
118
202
  if ! git diff-index --quiet HEAD --; then
119
- cd ${HTML_PATH_DST}
203
+ echo "Commit documentation to the repo..."
120
204
  git add .
121
205
  git config user.name "${COMMIT_USER}"
122
206
  git config user.email "${COMMIT_EMAIL}"
123
207
  git commit -m "Automated documentation build for changeset ${CHANGESET}."
124
208
  git push origin gh-pages
125
- cd -
126
209
  fi
210
+
211
+ cd -
127
212
  fi