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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.gitmodules +0 -0
- data/.travis.yml +13 -0
- data/Gemfile +0 -0
- data/README.md +113 -9
- data/Rakefile +0 -0
- data/ext/native/src/.clang-format +37 -0
- data/ext/native/src/.gitignore +3 -0
- data/ext/native/src/.travis.yml +2 -1
- data/ext/native/src/CMakeLists.txt +66 -63
- data/ext/native/src/ChangeLog +114 -2
- data/ext/native/src/Dockerfile_Golang +29 -8
- data/ext/native/src/Jenkinsfile +61 -50
- data/ext/native/src/LICENSE +0 -0
- data/ext/native/src/README.md +137 -167
- data/ext/native/src/VERSION +1 -1
- data/ext/native/src/benchmark.md +140 -0
- data/ext/native/src/benchmark/CMakeLists.txt +0 -0
- data/ext/native/src/benchmark/benchmark_cipher.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_hash.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_keys.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_pythia.cxx +61 -0
- data/ext/native/src/benchmark/benchmark_random.cxx +0 -0
- data/ext/native/src/benchmark/benchmark_signer.cxx +0 -0
- data/ext/native/src/ci/install-dependencies.sh +8 -12
- data/ext/native/src/ci/publish-docs.sh +107 -22
- data/ext/native/src/ci/travis-deployment-key.enc +0 -0
- data/ext/native/src/cmake/TransitiveArgs.cmake +78 -0
- data/ext/native/src/cmake/TransitiveToolchainArgs.cmake +105 -0
- data/ext/native/src/cmake/add_mono_metadata.cmake +103 -0
- data/ext/native/src/cmake/apple.cmake +56 -11
- data/ext/native/src/cmake/aux_source_directory_to_file.cmake +0 -0
- data/ext/native/src/cmake/check_pointer_size.cmake +0 -0
- data/ext/native/src/cmake/copy_all_files.cmake +0 -0
- data/ext/native/src/cmake/file_regex_replace.cmake +0 -0
- data/ext/native/src/cmake/find_host_utils.cmake +0 -0
- data/ext/native/src/cmake/uppercase_first_char.cmake +0 -0
- data/ext/native/src/cmake/uppercase_namespaces.cmake +3 -0
- data/ext/native/src/cmake/virgil_depends.cmake +0 -0
- data/ext/native/src/cmake/virgil_depends_local.cmake +2 -0
- data/ext/native/src/docs/.gitignore +0 -0
- data/ext/native/src/lib/CMakeLists.txt +59 -1
- data/ext/native/src/lib/Doxyfile.in +1 -1
- data/ext/native/src/lib/Info.plist.in +0 -0
- data/ext/native/src/lib/cmake/config.cmake.in +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilByteArrayUtils.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilChunkCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCipherBase.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilContentInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCrypto.h +13 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCryptoError.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilCustomParams.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilKeyPair.h +30 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilSignerBase.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilStreamCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilStreamSigner.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilTinyCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/VirgilVersion.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilAsymmetricCipher.h +17 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilHKDF.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilPBKDF.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilSystemCryptoError.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/asn1/VirgilAsn1Compatible.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSContent.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSContentInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSEncryptedContent.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSEnvelopedData.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSKeyTransRecipient.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/foundation/cms/VirgilCMSPasswordRecipient.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFS.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSEncryptedMessage.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSInitiatorPrivateInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSInitiatorPublicInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSPrivateKey.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSPublicKey.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSResponderPrivateInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSResponderPublicInfo.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pfs/VirgilPFSSession.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationCipher.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationDH.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationHash.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationKDF.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/primitive/VirgilOperationRandom.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythia.h +181 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaBlindResult.h +89 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaContext.h +72 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaError.h +161 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaProveResult.h +89 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaTransformResult.h +91 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/VirgilPythiaTransformationKeyPair.h +87 -0
- data/ext/native/src/lib/include/virgil/crypto/pythia/virgil_pythia_c.h +203 -0
- data/ext/native/src/lib/include/virgil/crypto/stream/VirgilBytesDataSink.h +0 -0
- data/ext/native/src/lib/include/virgil/crypto/stream/VirgilBytesDataSource.h +0 -0
- data/ext/native/src/lib/mainpage.dox +6 -0
- data/ext/native/src/lib/module.modulemap +7 -0
- data/ext/native/src/lib/src/VirgilAsn1Alg.cxx +0 -0
- data/ext/native/src/lib/src/VirgilAsn1Alg.h +0 -0
- data/ext/native/src/lib/src/VirgilAsn1Compatible.cxx +0 -0
- data/ext/native/src/lib/src/VirgilAsymmetricCipher.cxx +82 -0
- data/ext/native/src/lib/src/VirgilByteArrayUtils.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSContent.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSContentInfo.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSEncryptedContent.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSEnvelopedData.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSKeyTransRecipient.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCMSPasswordRecipient.cxx +0 -0
- data/ext/native/src/lib/src/VirgilChunkCipher.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCipherBase.cxx +0 -0
- data/ext/native/src/lib/src/VirgilConfig.cxx +51 -0
- data/ext/native/src/lib/src/VirgilConfig.h.in +43 -1
- data/ext/native/src/lib/src/VirgilContentInfo.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCryptoError.cxx +0 -0
- data/ext/native/src/lib/src/VirgilCustomParams.cxx +0 -0
- data/ext/native/src/lib/src/VirgilDataSink.cxx +0 -0
- data/ext/native/src/lib/src/VirgilHKDF.cxx +0 -0
- data/ext/native/src/lib/src/VirgilKeyPair.cxx +19 -0
- data/ext/native/src/lib/src/VirgilOID.h +0 -0
- data/ext/native/src/lib/src/VirgilPBKDF.cxx +0 -0
- data/ext/native/src/lib/src/VirgilSignerBase.cxx +0 -0
- data/ext/native/src/lib/src/VirgilStreamCipher.cxx +0 -0
- data/ext/native/src/lib/src/VirgilStreamSigner.cxx +0 -0
- data/ext/native/src/lib/src/VirgilSystemCryptoError.cxx +0 -0
- data/ext/native/src/lib/src/VirgilTagFilter.cxx +0 -0
- data/ext/native/src/lib/src/VirgilTagFilter.h +0 -0
- data/ext/native/src/lib/src/VirgilTinyCipher.cxx +0 -0
- data/ext/native/src/lib/src/VirgilVersion.cxx.in +0 -0
- data/ext/native/src/lib/src/mbedtls_context.h +0 -0
- data/ext/native/src/lib/src/mbedtls_context_policy_spec.h +0 -0
- data/ext/native/src/lib/src/mbedtls_type_utils.h +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFS.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSEncryptedMessage.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSInitiatorPrivateInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSInitiatorPublicInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSPrivateKey.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSPublicKey.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSResponderPrivateInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSResponderPublicInfo.cxx +0 -0
- data/ext/native/src/lib/src/pfs/VirgilPFSSession.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationCipher.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationDH.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationHash.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationKDF.cxx +0 -0
- data/ext/native/src/lib/src/primitive/VirgilOperationRandom.cxx +0 -0
- data/ext/native/src/lib/src/pythia/VirgilPythia.cxx +202 -0
- data/ext/native/src/lib/src/pythia/VirgilPythiaContext.cxx +116 -0
- data/ext/native/src/lib/src/pythia/VirgilPythiaError.cxx +58 -0
- data/ext/native/src/lib/src/pythia/virgil_pythia_c.cxx +129 -0
- data/ext/native/src/lib/src/stream/VirgilBytesDataSink.cxx +0 -0
- data/ext/native/src/lib/src/stream/VirgilBytesDataSource.cxx +0 -0
- data/ext/native/src/lib/src/utils.h +3 -2
- data/ext/native/src/libs_ext/mbedtls/configs/config.h +0 -0
- data/ext/native/src/libs_ext/mbedtls/configs/config_desktop.h +0 -0
- data/ext/native/src/libs_ext/mbedtls/mbedtls.cmake +0 -0
- data/ext/native/src/{cmake/cmake_args.cmake → libs_ext/pythia/pythia.cmake} +24 -28
- data/ext/native/src/libs_ext/rapidjson/rapidjson.cmake +0 -0
- data/ext/native/src/libs_ext/tinyformat/cmake/config.cmake.in +0 -0
- data/ext/native/src/libs_ext/tinyformat/tinyformat.cmake +0 -0
- data/ext/native/src/migration-2.0.md +0 -0
- data/ext/native/src/tests/CMakeLists.txt +0 -0
- data/ext/native/src/tests/catch.hpp +0 -0
- data/ext/native/src/tests/data/test_data_pfs_with_otc.json +0 -0
- data/ext/native/src/tests/data/test_data_pfs_without_otc.json +0 -0
- data/ext/native/src/tests/deterministic_keys.h +293 -0
- data/ext/native/src/tests/rsa_keys.h +229 -123
- data/ext/native/src/tests/test_asn1_writer.cxx +0 -0
- data/ext/native/src/tests/test_asymmetric_cipher.cxx +65 -0
- data/ext/native/src/tests/test_base64.cxx +0 -0
- data/ext/native/src/tests/test_byte_array_utils.cxx +0 -0
- data/ext/native/src/tests/test_chunk_cipher.cxx +0 -0
- data/ext/native/src/tests/test_cipher.cxx +8 -4
- data/ext/native/src/tests/test_cipher_base.cxx +0 -0
- data/ext/native/src/tests/test_contract_copy_move.cxx +4 -1
- data/ext/native/src/tests/test_data_pfs.h +0 -0
- data/ext/native/src/tests/test_hash.cxx +0 -0
- data/ext/native/src/tests/test_hkdf.cxx +0 -0
- data/ext/native/src/tests/test_key_pair.cxx +65 -3
- data/ext/native/src/tests/test_pbe.cxx +0 -0
- data/ext/native/src/tests/test_pbkdf.cxx +0 -0
- data/ext/native/src/tests/test_pfs.cxx +0 -0
- data/ext/native/src/tests/test_pythia.cxx +157 -0
- data/ext/native/src/tests/test_random.cxx +0 -0
- data/ext/native/src/tests/test_runner.cxx +0 -0
- data/ext/native/src/tests/test_signer.cxx +0 -0
- data/ext/native/src/tests/test_stream_cipher.cxx +0 -0
- data/ext/native/src/tests/test_stream_data_source.cxx +0 -0
- data/ext/native/src/tests/test_symmetric_cipher.cxx +0 -0
- data/ext/native/src/tests/test_tag_filter.cxx +0 -0
- data/ext/native/src/tests/test_tiny_cipher.cxx +0 -0
- data/ext/native/src/utils/build.bat +0 -0
- data/ext/native/src/utils/build.sh +238 -68
- data/ext/native/src/utils/zip.vbs +0 -0
- data/ext/native/src/virgil-crypto.sublime-project +15 -0
- data/ext/native/src/wrappers/asmjs/CMakeLists.txt +0 -8
- data/ext/native/src/wrappers/emsdk/CMakeLists.txt +2 -2
- data/ext/native/src/wrappers/emsdk/error.js +0 -0
- data/ext/native/src/wrappers/emsdk/example.html +152 -31
- data/ext/native/src/wrappers/emsdk/helpers.js +140 -135
- data/ext/native/src/wrappers/emsdk/patch_embind.pl +0 -0
- data/ext/native/src/wrappers/emsdk/wrapper.cxx +55 -0
- data/ext/native/src/wrappers/go/CMakeLists.txt +6 -5
- data/ext/native/src/wrappers/java/CMakeLists.txt +27 -4
- data/ext/native/src/wrappers/java/src/JniLoader.java +167 -0
- data/ext/native/src/wrappers/java/src/VirgilStreamDataSink.java +0 -0
- data/ext/native/src/wrappers/java/src/VirgilStreamDataSource.java +0 -0
- data/ext/native/src/wrappers/net/CMakeLists.txt +41 -8
- data/ext/native/src/wrappers/net/cmake/UseCSharp.cmake +5 -5
- data/ext/native/src/wrappers/net/src/VirgilStreamDataSink.cs +0 -0
- data/ext/native/src/wrappers/net/src/VirgilStreamDataSource.cs +0 -0
- data/ext/native/src/wrappers/nodejs/checksum.txt +66 -0
- data/ext/native/src/wrappers/php/CMakeLists.txt +2 -5
- data/ext/native/src/wrappers/php/tests/CMakeLists.txt +6 -0
- data/ext/native/src/wrappers/php/tests/VirgilChunkCipher_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilCustomParams_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilKDF_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilPBE_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilPBKDF_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilPythia_Test.php.in +87 -0
- data/ext/native/src/wrappers/php/tests/VirgilStreamCipher_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilStreamSigner_Test.php.in +0 -0
- data/ext/native/src/wrappers/php/tests/VirgilVersion_Test.php.in +0 -0
- data/ext/native/src/wrappers/python/CMakeLists.txt +4 -1
- data/ext/native/src/wrappers/ruby/CMakeLists.txt +4 -1
- data/ext/native/src/wrappers/swig/common.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/FixedArray.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/VirgilByteArray.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/common.i +0 -0
- data/ext/native/src/wrappers/swig/csharp/csharphead.swg.in +0 -0
- data/ext/native/src/wrappers/swig/go/common.i.in +7 -0
- data/ext/native/src/wrappers/swig/java/VirgilByteArray.i +0 -0
- data/ext/native/src/wrappers/swig/java/common.i +6 -0
- data/ext/native/src/wrappers/swig/php/common.i +0 -0
- data/ext/native/src/wrappers/swig/php/php7/VirgilByteArray.i +0 -0
- data/ext/native/src/wrappers/swig/util.i +0 -0
- data/ext/native/src/wrappers/swig/wrapper.i.in +18 -7
- data/ext/native/src/wrappers/webasm/CMakeLists.txt +0 -8
- data/ext/rakefile.rb +77 -56
- data/lib/virgil/crypto.rb +53 -9
- data/lib/virgil/crypto/access_token_signer.rb +79 -0
- data/lib/virgil/crypto/bytes.rb +81 -17
- data/lib/virgil/crypto/card_crypto.rb +115 -0
- data/lib/virgil/crypto/crypto_exception.rb +40 -0
- data/lib/virgil/crypto/hash_algorithm.rb +82 -0
- data/lib/virgil/crypto/key_pair.rb +41 -0
- data/lib/virgil/crypto/key_pair_type.rb +98 -0
- data/lib/virgil/crypto/private_key.rb +40 -0
- data/lib/virgil/crypto/private_key_exporter.rb +67 -0
- data/lib/virgil/crypto/public_key.rb +40 -0
- data/lib/virgil/crypto/{virgil_stream_data_sink.rb → stream_data_sink.rb} +12 -12
- data/lib/virgil/crypto/{virgil_stream_data_source.rb → stream_data_source.rb} +12 -12
- data/lib/virgil/crypto/validation.rb +59 -0
- data/lib/virgil/crypto/version.rb +35 -1
- data/lib/virgil/crypto/virgil_crypto.rb +595 -0
- data/lib/virgil/native_crypto.rb +80 -60
- data/lib/virgil/os.rb +40 -6
- data/secrets.tar.enc +0 -0
- data/virgil-crypto.gemspec +6 -7
- metadata +62 -12
- data/ext/native/src/cmake/android.toolchain.cmake +0 -1697
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7a8803e30898c0762202fa39472acf941058fa017999654de2134a280945974
|
4
|
+
data.tar.gz: 3b831be8eb3704a6506109aeb3100d015ccdb658b440eaa482db13034ca526c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5969d567e6f7beccdaf7f455f897f1586572917049a066abcdb604548ec2d076806a42f1bc0ff93cc656f8b87925aa344d5070d45b139f4da60540fa745dc720
|
7
|
+
data.tar.gz: 3d3ef03d4ab7b3e21e9cd04f3dcffa2aea1bbc6af8daa5ea28001aacc26cd7f55453b068f1997c06a53d9e1f0973bdf1b8ae6b5f8e7657d1547e6106bdd81d2b
|
data/.gitignore
CHANGED
File without changes
|
data/.gitmodules
CHANGED
File without changes
|
data/.travis.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
language: ruby
|
2
|
+
branches:
|
3
|
+
only:
|
4
|
+
- master
|
5
|
+
before_install:
|
6
|
+
- openssl aes-256-cbc -K $encrypted_a30fbaed9b64_key -iv $encrypted_a30fbaed9b64_iv -in secrets.tar.enc -out secrets.tar -d
|
7
|
+
- tar xvf secrets.tar
|
8
|
+
- rvm install 2.4.1
|
9
|
+
|
10
|
+
rvm:
|
11
|
+
- 2.4.1
|
12
|
+
script:
|
13
|
+
- rake
|
data/Gemfile
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,24 +1,128 @@
|
|
1
|
-
# Virgil Crypto Library
|
1
|
+
# Virgil Security Ruby Crypto Library
|
2
|
+
[![Build Status](https://travis-ci.org/VirgilSecurity/virgil-crypto-ruby.svg?branch=master)](https://travis-ci.org/VirgilSecurity/virgil-crypto-ruby)
|
3
|
+
[![Gem](https://img.shields.io/gem/v/virgil-crypto.svg)](https://rubygems.org/gems/virgil-crypto)
|
4
|
+
[![GitHub license](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](https://github.com/VirgilSecurity/virgil/blob/master/LICENSE)
|
5
|
+
[![Documentation YARD](https://img.shields.io/badge/docs-yard-blue.svg)](https://virgilsecurity.github.io/virgil-crypto-ruby)
|
2
6
|
|
3
|
-
|
4
|
-
# Installation and usage
|
5
|
-
To install the latest gem version run:
|
7
|
+
### [Introduction](#introduction) | [Library purposes](#library-purposes) | [Usage examples](#usage-examples) | [Installation](#installation) | [Docs](#docs) | [License](#license) | [Contacts](#support)
|
6
8
|
|
9
|
+
## Introduction
|
10
|
+
VirgilCrypto is a stack of security libraries (ECIES with Crypto Agility wrapped in Virgil Cryptogram) and an open-source high-level [cryptographic library](https://github.com/VirgilSecurity/virgil-crypto) that allows you to perform all necessary operations for securely storing and transferring data in your digital solutions. Crypto Library is written in C++ and is suitable for mobile and server platforms.
|
11
|
+
|
12
|
+
Virgil Security, Inc., guides software developers into the forthcoming security world in which everything will be encrypted (and passwords will be eliminated). In this world, the days of developers having to raise millions of dollars to build a secure chat, secure email, secure file-sharing, or a secure anything have come to an end. Now developers can instead focus on building features that give them a competitive market advantage while end-users can enjoy the privacy and security they increasingly demand.
|
13
|
+
|
14
|
+
## Library purposes
|
15
|
+
* Asymmetric Key Generation
|
16
|
+
* Encryption/Decryption of data and streams
|
17
|
+
* Generation/Verification of digital signatures
|
18
|
+
* PFS (Perfect Forward Secrecy)
|
19
|
+
|
20
|
+
## Usage examples
|
21
|
+
|
22
|
+
#### Generate a key pair
|
23
|
+
|
24
|
+
Generate a Private Key with the default algorithm (EC_X25519):
|
25
|
+
```ruby
|
26
|
+
require 'virgil/crypto'
|
27
|
+
include Virgil::Crypto
|
28
|
+
|
29
|
+
crypto = VirgilCrypto.new
|
30
|
+
key_pair = crypto.generate_keys
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Generate and verify a signature
|
34
|
+
|
35
|
+
Generate signature and sign data with a private key:
|
36
|
+
```ruby
|
37
|
+
require 'virgil/crypto'
|
38
|
+
include Virgil::Crypto
|
39
|
+
|
40
|
+
crypto = VirgilCrypto.new
|
41
|
+
|
42
|
+
# prepare a message
|
43
|
+
message_to_sign = 'Hello, Bob!'
|
44
|
+
data_to_sign = Bytes.from_string(message_to_sign)
|
45
|
+
|
46
|
+
# generate a signature
|
47
|
+
signature = crypto.generate_signature(data_to_sign, sender_private_key)
|
7
48
|
```
|
8
|
-
|
49
|
+
|
50
|
+
Verify a signature with a public key:
|
51
|
+
```ruby
|
52
|
+
require 'virgil/crypto'
|
53
|
+
include Virgil::Crypto
|
54
|
+
|
55
|
+
crypto = VirgilCrypto.new
|
56
|
+
|
57
|
+
# verify a signature
|
58
|
+
verified = crypto.verify_signature(signature, data_to_sign, sender_public_key)
|
9
59
|
```
|
10
60
|
|
11
|
-
|
61
|
+
#### Encrypt and decrypt data
|
62
|
+
|
63
|
+
Encrypt Data on a Public Key:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
require 'virgil/crypto'
|
67
|
+
include Virgil::Crypto
|
68
|
+
|
69
|
+
crypto = VirgilCrypto.new
|
12
70
|
|
71
|
+
# prepare a message
|
72
|
+
message_to_encrypt = 'Hello, Bob!'
|
73
|
+
data_to_encrypt = Bytes.from_string(message_to_encrypt)
|
74
|
+
|
75
|
+
# encrypt the message
|
76
|
+
encrypted_data = crypto.encrypt(data_to_encrypt, receiver_public_key)
|
13
77
|
```
|
14
|
-
|
78
|
+
|
79
|
+
Decrypt the encrypted data with a Private Key:
|
80
|
+
```ruby
|
81
|
+
require 'virgil/crypto'
|
82
|
+
include Virgil::Crypto
|
83
|
+
|
84
|
+
crypto = VirgilCrypto.new
|
85
|
+
|
86
|
+
# prepare data to be decrypted
|
87
|
+
decrypted_data = crypto.decrypt(encrypted_data, receiver_private_key)
|
88
|
+
|
89
|
+
# decrypt the encrypted data using a private key
|
90
|
+
decrypted_message = Bytes.new(decrypted_data).to_s
|
15
91
|
```
|
92
|
+
|
93
|
+
Need more examples? Visit our [developer documentation](https://developer.virgilsecurity.com/docs/how-to#cryptography).
|
16
94
|
|
95
|
+
## Installation
|
96
|
+
|
97
|
+
TThe Virgil Crypto is provided as a [gem](https://rubygems.org/) named [*virgil-crypto*](https://rubygems.org/gems/virgil-crypto) and available for Ruby 2.1 and newer. The package is distributed via *bundler* package manager.
|
98
|
+
|
99
|
+
To install the package use the command below:
|
100
|
+
|
101
|
+
```
|
102
|
+
gem install virgil-crypto
|
103
|
+
```
|
104
|
+
|
105
|
+
or add the following line to your Gemfile:
|
106
|
+
|
107
|
+
```
|
108
|
+
gem 'virgil-crypto', '~> 3.6.2'
|
109
|
+
```
|
17
110
|
and then run
|
18
111
|
|
19
112
|
```
|
20
113
|
bundle
|
21
114
|
```
|
115
|
+
## Docs
|
116
|
+
- [Crypto Core Library](https://github.com/VirgilSecurity/virgil-crypto)
|
117
|
+
- [More usage examples](https://developer.virgilsecurity.com/docs/how-to#cryptography)
|
118
|
+
|
119
|
+
## License
|
120
|
+
|
121
|
+
This library is released under the [3-clause BSD License](https://github.com/VirgilSecurity/virgil-sdk-javascript/blob/master/LICENSE).
|
122
|
+
|
123
|
+
## Support
|
124
|
+
Our developer support team is here to help you. Find out more information on our [Help Center](https://help.virgilsecurity.com/).
|
125
|
+
|
126
|
+
You can find us on [Twitter](https://twitter.com/VirgilSecurity) or send us email support@VirgilSecurity.com.
|
22
127
|
|
23
|
-
|
24
|
-
Use this crypto with [Virgil SDK](https://github.com/VirgilSecurity/virgil-sdk-ruby) that will provide you to create an secure application using Virgil Security services.
|
128
|
+
Also, get extra help from our support team on [Slack](https://virgilsecurity.com/join-community).
|
data/Rakefile
CHANGED
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
Language: Cpp
|
3
|
+
BasedOnStyle: LLVM
|
4
|
+
Standard: Cpp11
|
5
|
+
TabWidth: 4
|
6
|
+
UseTab: Never
|
7
|
+
ColumnLimit: 120
|
8
|
+
IndentWidth: 4
|
9
|
+
ConstructorInitializerIndentWidth: 8
|
10
|
+
ContinuationIndentWidth: 8
|
11
|
+
AllowShortFunctionsOnASingleLine : false
|
12
|
+
DerivePointerAlignment: false
|
13
|
+
PointerAlignment: Left
|
14
|
+
AlignAfterOpenBracket: AlwaysBreak
|
15
|
+
AccessModifierOffset: -4
|
16
|
+
AllowAllParametersOfDeclarationOnNextLine: true
|
17
|
+
BinPackArguments: true
|
18
|
+
BinPackParameters: true
|
19
|
+
AlwaysBreakBeforeMultilineStrings: true
|
20
|
+
MaxEmptyLinesToKeep: 2
|
21
|
+
BraceWrapping:
|
22
|
+
AfterClass: false
|
23
|
+
AfterControlStatement: false
|
24
|
+
AfterEnum: false
|
25
|
+
AfterFunction: false
|
26
|
+
AfterNamespace: false
|
27
|
+
AfterObjCDeclaration: false
|
28
|
+
AfterStruct: false
|
29
|
+
AfterUnion: false
|
30
|
+
AfterExternBlock: false
|
31
|
+
BeforeCatch: false
|
32
|
+
BeforeElse: false
|
33
|
+
IndentBraces: false
|
34
|
+
SplitEmptyFunction: true
|
35
|
+
SplitEmptyRecord: true
|
36
|
+
SplitEmptyNamespace: true
|
37
|
+
...
|
data/ext/native/src/.gitignore
CHANGED
data/ext/native/src/.travis.yml
CHANGED
@@ -39,10 +39,10 @@ matrix:
|
|
39
39
|
env:
|
40
40
|
global:
|
41
41
|
- VIRGIL_CRYPTO_FEATURE_LOW_LEVEL_WRAP=ON
|
42
|
+
- VIRGIL_CRYPTO_FEATURE_PYTHIA=ON
|
42
43
|
- PROJECT_ROOT=${TRAVIS_BUILD_DIR}
|
43
44
|
- CMAKE_VERSION=3.10.2
|
44
45
|
- SWIG_VERSION=3.0.12
|
45
|
-
- DOXYGEN_VERSION=1.8.13
|
46
46
|
cache:
|
47
47
|
directories:
|
48
48
|
- cmake-${CMAKE_VERSION}
|
@@ -67,6 +67,7 @@ install:
|
|
67
67
|
before_script:
|
68
68
|
- CMAKE_ARGS="-DLANG=${LANG} -DPLATFORM_ARCH=`uname -m`"
|
69
69
|
- CMAKE_ARGS+=" -DVIRGIL_CRYPTO_FEATURE_LOW_LEVEL_WRAP=${VIRGIL_CRYPTO_FEATURE_LOW_LEVEL_WRAP}"
|
70
|
+
- CMAKE_ARGS+=" -DVIRGIL_CRYPTO_FEATURE_PYTHIA=${VIRGIL_CRYPTO_FEATURE_PYTHIA}"
|
70
71
|
- CMAKE_ARGS+=" -DCMAKE_INSTALL_PREFIX=${PROJECT_ROOT}/install"
|
71
72
|
- CMAKE_ARGS+=" -DLANG_VERSION=${LANG_VERSION}"
|
72
73
|
- if [ "${LANG}" = "cpp" ]; then CMAKE_ARGS+=" -DVIRGIL_CRYPTO_FEATURE_STREAM_IMPL=ON"; fi
|
@@ -41,7 +41,6 @@
|
|
41
41
|
# - PLATFORM - name of target platform (optional).
|
42
42
|
# - PLATFORM_VERSION - minimum supported version of the target platform (optional).
|
43
43
|
# - PLATFORM_ARCH - target platform processor architecture (optional).
|
44
|
-
# - ADD_COMPILER_INFO - define whether to add compiler info to the library full name (optional).
|
45
44
|
# - LIB_STATIC_RUNTIME - сauses library to use the static version of the run-time library.
|
46
45
|
#
|
47
46
|
# - BUILD_LIBRARY_FRAMEWORK - build library as Apple Framework.
|
@@ -72,18 +71,25 @@
|
|
72
71
|
# boolean value that defines whether to compile module that is
|
73
72
|
# depends on a C++ streams or not.
|
74
73
|
#
|
74
|
+
# - VIRGIL_CRYPTO_FEATURE_PYTHIA -
|
75
|
+
# boolean value that defines whether to enable module Pythia or not.
|
76
|
+
#
|
77
|
+
# - VIRGIL_CRYPTO_FEATURE_PYTHIA_MT -
|
78
|
+
# boolean value that defines whether to build module Pythia in a multi-threading mode.
|
79
|
+
#
|
75
80
|
# Define variables:
|
76
81
|
# - VIRGIL_VERSION - library full version.
|
77
82
|
# - VIRGIL_VERSION_MAJOR - library major version number.
|
78
83
|
# - VIRGIL_VERSION_MINOR - library minor version number.
|
79
84
|
# - VIRGIL_VERSION_PATCH - library patch number.
|
80
85
|
# - VIRGIL_SOVERSION - library ABI version.
|
81
|
-
# -
|
86
|
+
# - VIRGIL_VERSION_TAG - library version tag, i.e. rc1, or coolfeature, etc.
|
82
87
|
# - VIRGIL_VERSION_FULL_NAME - library version full name, i.e. 1.3.4-rc1
|
83
88
|
#
|
84
|
-
# -
|
89
|
+
# - VIRGIL_PACKAGE_NAME_FEATURES - add available features to the library package name.
|
90
|
+
# - VIRGIL_PACKAGE_NAME_COMPILER - add compiler info to the library package name.
|
85
91
|
#
|
86
|
-
# -
|
92
|
+
# - POINTER_SIZE - compiler pointer size.
|
87
93
|
#
|
88
94
|
# Optimizations:
|
89
95
|
# - ED25519_AMD64_OPTIMIZATION - boolean value that defines whether to enable AMD64 optimization
|
@@ -105,17 +111,17 @@ project (VirgilSecurity)
|
|
105
111
|
|
106
112
|
# Set library version
|
107
113
|
set (VIRGIL_VERSION_MAJOR 2)
|
108
|
-
set (VIRGIL_VERSION_MINOR
|
109
|
-
set (VIRGIL_VERSION_PATCH
|
110
|
-
set (
|
114
|
+
set (VIRGIL_VERSION_MINOR 4)
|
115
|
+
set (VIRGIL_VERSION_PATCH 5)
|
116
|
+
set (VIRGIL_VERSION_TAG)
|
111
117
|
set (VIRGIL_VERSION ${VIRGIL_VERSION_MAJOR}.${VIRGIL_VERSION_MINOR}.${VIRGIL_VERSION_PATCH})
|
112
118
|
set (VIRGIL_SOVERSION 2)
|
113
119
|
|
114
|
-
if (
|
115
|
-
set (VIRGIL_VERSION_FULL_NAME ${VIRGIL_VERSION}-${
|
116
|
-
else (
|
120
|
+
if (VIRGIL_VERSION_TAG)
|
121
|
+
set (VIRGIL_VERSION_FULL_NAME ${VIRGIL_VERSION}-${VIRGIL_VERSION_TAG})
|
122
|
+
else (VIRGIL_VERSION_TAG)
|
117
123
|
set (VIRGIL_VERSION_FULL_NAME ${VIRGIL_VERSION})
|
118
|
-
endif (
|
124
|
+
endif (VIRGIL_VERSION_TAG)
|
119
125
|
|
120
126
|
message (STATUS "Virgil version: " ${VIRGIL_VERSION_FULL_NAME})
|
121
127
|
message (STATUS "Virgil soversion: " ${VIRGIL_SOVERSION})
|
@@ -123,6 +129,9 @@ message (STATUS "Virgil soversion: " ${VIRGIL_SOVERSION})
|
|
123
129
|
# Configure path to custom modules
|
124
130
|
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
125
131
|
|
132
|
+
# Define known toolchain arguments to be passed downstream.
|
133
|
+
include (TransitiveToolchainArgs)
|
134
|
+
|
126
135
|
# Build shared library if defined
|
127
136
|
set (BUILD_SHARED_LIBS OFF CACHE BOOL "Force to create shared libraries")
|
128
137
|
|
@@ -133,8 +142,9 @@ else ()
|
|
133
142
|
set (LIB_STATIC_RUNTIME OFF CACHE BOOL "Causes library to use the static version of the run-time library.")
|
134
143
|
endif ()
|
135
144
|
|
136
|
-
#
|
137
|
-
set (
|
145
|
+
# Define package name options
|
146
|
+
set (VIRGIL_PACKAGE_NAME_FEATURES OFF CACHE BOOL "Add available features to the library package name.")
|
147
|
+
set (VIRGIL_PACKAGE_NAME_COMPILER OFF CACHE BOOL "Add compiler info to the library package name.")
|
138
148
|
|
139
149
|
# Define COMPILER
|
140
150
|
string (TOLOWER "${CMAKE_CXX_COMPILER_ID}" COMPILER_ID)
|
@@ -157,38 +167,8 @@ endif ()
|
|
157
167
|
# Add find_host_* utilities
|
158
168
|
include (find_host_utils)
|
159
169
|
|
160
|
-
# Define possible cmake_args
|
161
|
-
include (cmake_args)
|
162
|
-
|
163
|
-
if (ANDROID)
|
164
|
-
append_cmake_arg (CMAKE_ARGS NAME PLATFORM_VERSION TYPE STRING)
|
165
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_NDK TYPE PATH)
|
166
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_ABI TYPE STRING)
|
167
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_NATIVE_API_LEVEL TYPE STRING)
|
168
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_TOOLCHAIN_NAME TYPE STRING)
|
169
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_FORCE_ARM_BUILD TYPE BOOL)
|
170
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_NO_UNDEFINED TYPE BOOL)
|
171
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_SO_UNDEFINED TYPE BOOL)
|
172
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_STL TYPE STRING)
|
173
|
-
append_cmake_arg (CMAKE_ARGS NAME ANDROID_STL_FORCE_FEATURES TYPE BOOL)
|
174
|
-
endif (ANDROID)
|
175
|
-
|
176
|
-
if (CMAKE_TOOLCHAIN_FILE AND APPLE)
|
177
|
-
append_cmake_arg (CMAKE_ARGS NAME APPLE_PLATFORM TYPE STRING)
|
178
|
-
append_cmake_arg (CMAKE_ARGS NAME APPLE_BITCODE TYPE BOOL)
|
179
|
-
append_cmake_arg (CMAKE_ARGS NAME APPLE_EXTENSION TYPE BOOL)
|
180
|
-
append_cmake_arg (CMAKE_ARGS NAME IOS_DEVICE_FAMILY TYPE STRING)
|
181
|
-
append_cmake_arg (CMAKE_ARGS NAME IOS_DEPLOYMENT_TARGET TYPE STRING)
|
182
|
-
append_cmake_arg (CMAKE_ARGS NAME WATCHOS_DEPLOYMENT_TARGET TYPE STRING)
|
183
|
-
append_cmake_arg (CMAKE_ARGS NAME WATCHOS_DEVICE_FAMILY TYPE STRING)
|
184
|
-
append_cmake_arg (CMAKE_ARGS NAME TVOS_DEPLOYMENT_TARGET TYPE STRING)
|
185
|
-
append_cmake_arg (CMAKE_ARGS NAME TVOS_DEVICE_FAMILY TYPE STRING)
|
186
|
-
append_cmake_arg (CMAKE_ARGS NAME MACOS_DEPLOYMENT_TARGET TYPE STRING)
|
187
|
-
append_cmake_arg (CMAKE_ARGS NAME CMAKE_APPLE_PLATFORM_DEVELOPER_ROOT TYPE PATH)
|
188
|
-
append_cmake_arg (CMAKE_ARGS NAME CMAKE_APPLE_SDK_ROOT TYPE PATH)
|
189
|
-
endif ()
|
190
|
-
|
191
170
|
# Define additional compiler flags
|
171
|
+
# TODO: Review. Maybe redundant, because of option POSITION_INDEPENDENT_CODE=ON
|
192
172
|
if (NOT CMAKE_CROSSCOMPILING)
|
193
173
|
include (CheckCCompilerFlag)
|
194
174
|
check_c_compiler_flag (-fPIC COMPILER_SUPPORT_PIC)
|
@@ -212,10 +192,19 @@ if (LIB_STATIC_RUNTIME)
|
|
212
192
|
endforeach ()
|
213
193
|
endif (LIB_STATIC_RUNTIME)
|
214
194
|
|
215
|
-
#
|
216
|
-
set (
|
195
|
+
# Configure features
|
196
|
+
set (VIRGIL_CRYPTO_FEATURE_LOW_LEVEL_WRAP OFF CACHE BOOL
|
197
|
+
"Defines whether to wrap low-level API or not")
|
198
|
+
|
199
|
+
set (VIRGIL_CRYPTO_FEATURE_STREAM_IMPL ON CACHE BOOL
|
200
|
+
"Defines whether to compile module that is depends on a C++ stream or not")
|
201
|
+
|
202
|
+
set (VIRGIL_CRYPTO_FEATURE_PYTHIA OFF CACHE BOOL "Defines whether to enable module Pythia or not")
|
203
|
+
set (VIRGIL_CRYPTO_FEATURE_PYTHIA_MT ON CACHE BOOL "Defines whether to build module Pythia in a multi-threading mode")
|
217
204
|
|
218
205
|
# Configure optimizations
|
206
|
+
set (ED25519_AMD64_OPTIMIZATION ON CACHE BOOL "Defines whether to enable AMD64 optimization for Ed25519 algorithms")
|
207
|
+
|
219
208
|
set (MBEDTLS_CMAKE_ARGS "")
|
220
209
|
if (NOT CMAKE_CROSSCOMPILING AND ED25519_AMD64_OPTIMIZATION AND UNIX)
|
221
210
|
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES OR
|
@@ -233,24 +222,31 @@ include (virgil_depends)
|
|
233
222
|
virgil_depends (
|
234
223
|
PACKAGE_NAME "MbedTLS"
|
235
224
|
CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs_ext/mbedtls"
|
236
|
-
CMAKE_ARGS "${
|
225
|
+
CMAKE_ARGS "${MBEDTLS_CMAKE_ARGS}"
|
237
226
|
)
|
238
227
|
virgil_find_package (MbedTLS 2.4)
|
239
228
|
|
240
229
|
virgil_depends (
|
241
230
|
PACKAGE_NAME "RapidJSON"
|
242
231
|
CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs_ext/rapidjson"
|
243
|
-
CMAKE_ARGS "${CMAKE_ARGS}"
|
244
232
|
)
|
245
233
|
virgil_find_package (RapidJSON 1.1)
|
246
234
|
|
247
235
|
virgil_depends (
|
248
236
|
PACKAGE_NAME "tinyformat"
|
249
237
|
CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs_ext/tinyformat"
|
250
|
-
CMAKE_ARGS "${CMAKE_ARGS}"
|
251
238
|
)
|
252
239
|
virgil_find_package (tinyformat 2.0.1)
|
253
240
|
|
241
|
+
if (VIRGIL_CRYPTO_FEATURE_PYTHIA)
|
242
|
+
virgil_depends (
|
243
|
+
PACKAGE_NAME "pythia"
|
244
|
+
CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs_ext/pythia"
|
245
|
+
)
|
246
|
+
virgil_find_package (pythia 0.0.1)
|
247
|
+
virgil_find_package (relic 0.4.0)
|
248
|
+
endif ()
|
249
|
+
|
254
250
|
# Define enviroment parameters
|
255
251
|
if (NOT DEFINED POINTER_SIZE)
|
256
252
|
include (check_pointer_size)
|
@@ -276,19 +272,12 @@ set_property (CACHE LANG PROPERTY STRINGS
|
|
276
272
|
"ruby"
|
277
273
|
)
|
278
274
|
|
279
|
-
# Configure features
|
280
|
-
set (VIRGIL_CRYPTO_FEATURE_LOW_LEVEL_WRAP OFF CACHE BOOL
|
281
|
-
"Defines whether to wrap low-level API or not")
|
282
|
-
|
283
|
-
set (VIRGIL_CRYPTO_FEATURE_STREAM_IMPL ON CACHE BOOL
|
284
|
-
"Defines whether to compile module that is depends on a C++ stream or not")
|
285
|
-
|
286
275
|
# Configure crosscompiling
|
287
276
|
set (UCLIBC OFF CACHE BOOL "Enable pathches if library is build with uClibc++")
|
288
277
|
|
289
278
|
if (CMAKE_CROSSCOMPILING AND APPLE)
|
290
279
|
string (TOLOWER "${APPLE_PLATFORM}" PLATFORM)
|
291
|
-
string (REPLACE "_sim" "" PLATFORM "${PLATFORM}")
|
280
|
+
string (REGEX REPLACE "_sim(32|64)?" "" PLATFORM "${PLATFORM}")
|
292
281
|
|
293
282
|
set (PLATFORM ${PLATFORM} CACHE STRING "Target platform")
|
294
283
|
set (PLATFORM_VERSION ${APPLE_DEPLOYMENT_TARGET} CACHE STRING "Minimum version of the platform")
|
@@ -302,16 +291,23 @@ if (CMAKE_CROSSCOMPILING AND APPLE)
|
|
302
291
|
endif ()
|
303
292
|
endif ()
|
304
293
|
|
294
|
+
if (CMAKE_CROSSCOMPILING AND ANDROID)
|
295
|
+
set (PLATFORM_VERSION ${ANDROID_NATIVE_API_LEVEL} CACHE STRING "Android native API level")
|
296
|
+
set (PLATFORM_ARCH ${ANDROID_ABI} CACHE STRING "Target processor architecture")
|
297
|
+
set (PLATFORM_EMBEDDED YES CACHE BOOL "Mark target platform as embedded")
|
298
|
+
endif ()
|
299
|
+
|
305
300
|
# Configure testing
|
306
301
|
set (ENABLE_TESTING ON CACHE BOOL "Defines whether include unit testing or not.")
|
307
302
|
set (ENABLE_BENCHMARK OFF CACHE BOOL "Defines whether include benchmark or not.")
|
308
303
|
|
309
304
|
# Configure path variables
|
310
|
-
|
305
|
+
include(GNUInstallDirs)
|
306
|
+
set (INSTALL_INC_DIR_NAME ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "Installation directory name for includes")
|
311
307
|
set (INSTALL_LIB_DIR_NAME lib CACHE STRING "Installation directory name for libraries")
|
312
|
-
set (INSTALL_BIN_DIR_NAME
|
313
|
-
set (INSTALL_MAN_DIR_NAME
|
314
|
-
set (INSTALL_DOC_DIR_NAME "
|
308
|
+
set (INSTALL_BIN_DIR_NAME ${CMAKE_INSTALL_BINDIR} CACHE STRING "Installation directory name for executables")
|
309
|
+
set (INSTALL_MAN_DIR_NAME ${CMAKE_INSTALL_MANDIR} CACHE STRING "Installation directory name for man pages")
|
310
|
+
set (INSTALL_DOC_DIR_NAME "${CMAKE_INSTALL_DATAROOTDIR}/doc" CACHE STRING "Installation directory name for doc pages")
|
315
311
|
set (INSTALL_API_DIR_NAME api CACHE STRING "Installation directory name for interface files")
|
316
312
|
|
317
313
|
# Configure platform specific path variables
|
@@ -406,11 +402,18 @@ if (PLATFORM_ARCH)
|
|
406
402
|
set (LIB_NAME_FULL "${LIB_NAME_FULL}-${PLATFORM_ARCH}")
|
407
403
|
endif (PLATFORM_ARCH)
|
408
404
|
|
409
|
-
|
405
|
+
|
406
|
+
if (VIRGIL_PACKAGE_NAME_FEATURES)
|
407
|
+
if (VIRGIL_CRYPTO_FEATURE_PYTHIA)
|
408
|
+
set (LIB_NAME_FULL "${LIB_NAME_FULL}-pythia")
|
409
|
+
endif ()
|
410
|
+
endif ()
|
411
|
+
|
412
|
+
if (VIRGIL_PACKAGE_NAME_COMPILER)
|
410
413
|
if (COMPILER AND COMPILER_VERSION)
|
411
414
|
set (LIB_NAME_FULL "${LIB_NAME_FULL}-${COMPILER}-${COMPILER_VERSION}")
|
412
415
|
else ()
|
413
|
-
message (FATAL_ERROR "
|
416
|
+
message (FATAL_ERROR "VIRGIL_PACKAGE_NAME_COMPILER defined, but can not deduce compiler version.")
|
414
417
|
endif ()
|
415
418
|
endif ()
|
416
419
|
|