virgil-crypto 2.1.2 → 2.1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/native/src/CMakeLists.txt +3 -3
- data/ext/native/src/ChangeLog +58 -0
- data/ext/native/src/Dockerfile_Golang +41 -0
- data/ext/native/src/Jenkinsfile +12 -1
- data/ext/native/src/VERSION +1 -1
- data/ext/native/src/cmake/find_host_utils.cmake +6 -0
- data/ext/native/src/cmake/virgil_depends_local.cmake +1 -1
- data/ext/native/src/lib/include/CMakeLists.txt +0 -2
- data/ext/native/src/lib/include/virgil/crypto/VirgilCipherBase.h +0 -6
- data/ext/native/src/lib/include/virgil/crypto/VirgilCryptoError.h +6 -6
- data/ext/native/src/lib/include/virgil/crypto/VirgilCryptoException.h +1 -1
- data/ext/native/src/lib/include/virgil/crypto/VirgilKeyPair.h +4 -2
- data/ext/native/src/lib/include/virgil/crypto/VirgilStreamCipher.h +0 -1
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilHash.h +10 -13
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilKDF.h +3 -6
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilPBE.h +1 -1
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilPBKDF.h +1 -4
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilRandom.h +0 -2
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilSymmetricCipher.h +4 -2
- data/ext/native/src/lib/include/virgil/crypto/foundation/VirgilSystemCryptoError.h +6 -6
- data/ext/native/src/lib/include/virgil/crypto/foundation/asn1/VirgilAsn1Writer.h +2 -2
- data/ext/native/src/lib/mainpage.dox +4 -4
- data/ext/native/src/lib/src/VirgilAsymmetricCipher.cxx +1 -1
- data/ext/native/src/lib/src/VirgilSymmetricCipher.cxx +4 -0
- data/ext/native/src/lib/src/VirgilTinyCipher.cxx +4 -4
- data/ext/native/src/libs_ext/mbedtls/mbedtls.cmake +2 -2
- data/ext/native/src/tests/test_asymmetric_cipher.cxx +42 -1
- data/ext/native/src/tests/test_symmetric_cipher.cxx +20 -2
- data/ext/native/src/utils/build.sh +10 -0
- data/ext/native/src/wrappers/ruby/CMakeLists.txt +30 -1
- data/lib/virgil/crypto/version.rb +1 -1
- data/lib/virgil/crypto/virgil_stream_data_sink.rb +1 -1
- data/lib/virgil/crypto/virgil_stream_data_source.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a182cddff92e3dc3bca871c4be88be1e0f002177
|
|
4
|
+
data.tar.gz: c29d49a12780c7b9ff509b5037876e19fc8ccef2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c10d7298396093557b605a604787cd4baf636f68f8a4dc3e77a9a41b88fac55a7e932c0c391db8ddbb002518560a2b58f1ffc9ca036fbee6b7674b81f37ba55
|
|
7
|
+
data.tar.gz: 3807971910e5519f6f87d17282c61e821e4b09a022c77f61c91b33ba9e2768ff6de583b5d241a03f2b2d3123d3932da36654fb3a203c41b9e196e1a89309a90d
|
|
@@ -98,8 +98,8 @@ project (VirgilSecurity)
|
|
|
98
98
|
# Set library version
|
|
99
99
|
set (VIRGIL_VERSION_MAJOR 2)
|
|
100
100
|
set (VIRGIL_VERSION_MINOR 1)
|
|
101
|
-
set (VIRGIL_VERSION_PATCH
|
|
102
|
-
set (VIRGIL_VERSION_FEATURE
|
|
101
|
+
set (VIRGIL_VERSION_PATCH 2)
|
|
102
|
+
set (VIRGIL_VERSION_FEATURE)
|
|
103
103
|
set (VIRGIL_VERSION ${VIRGIL_VERSION_MAJOR}.${VIRGIL_VERSION_MINOR}.${VIRGIL_VERSION_PATCH})
|
|
104
104
|
set (VIRGIL_SOVERSION 2)
|
|
105
105
|
|
|
@@ -109,7 +109,7 @@ else (VIRGIL_VERSION_FEATURE)
|
|
|
109
109
|
set (VIRGIL_VERSION_FULL_NAME ${VIRGIL_VERSION})
|
|
110
110
|
endif (VIRGIL_VERSION_FEATURE)
|
|
111
111
|
|
|
112
|
-
message (STATUS "Virgil version: " ${
|
|
112
|
+
message (STATUS "Virgil version: " ${VIRGIL_VERSION_FULL_NAME})
|
|
113
113
|
message (STATUS "Virgil soversion: " ${VIRGIL_SOVERSION})
|
|
114
114
|
|
|
115
115
|
# Configure path to custom modules
|
data/ext/native/src/ChangeLog
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
virgil ChangeLog (Sorted per date)
|
|
2
2
|
|
|
3
|
+
= Version 2.1.2 released 2017-03-22
|
|
4
|
+
|
|
5
|
+
## Bugfix
|
|
6
|
+
|
|
7
|
+
[Build] Fix MSVC build by updating underlying MbedTLS library to the version: mbedtls-2.4.2-virgil-2.0.3
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
= Version 2.1.1 released 2017-03-22
|
|
11
|
+
|
|
12
|
+
## Bugfix
|
|
13
|
+
|
|
14
|
+
[Lib] Fix: Got unexpected error when process encrypted private key and omit password
|
|
15
|
+
[Lib] Update to mbed TLS version 2.4.2
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
= Version 2.1.0 released 2017-03-16
|
|
19
|
+
|
|
20
|
+
## Bugfix
|
|
21
|
+
|
|
22
|
+
[OSX] Add minimum required OSX version (Yosemite)
|
|
23
|
+
[Lib] Fix extra compiler warnings and documentation warnings
|
|
24
|
+
|
|
25
|
+
## Changes
|
|
26
|
+
|
|
27
|
+
[OSX] Add minimum required OSX version (Yosemite)
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
[CI] Add Dockerfile with Golang environment
|
|
32
|
+
[Lib] Expose low level API for targets that use C/C++ headers
|
|
33
|
+
[Lib] Add AES-128 to the symmetric cipher
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
= Version 2.0.7 released 2017-03-06
|
|
37
|
+
|
|
38
|
+
## Bugfix
|
|
39
|
+
|
|
40
|
+
* [Doc] Fix doxygen warnings
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
= Version 2.0.6 released 2017-02-24
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
* [Ruby] Add support for ruby versions: 2.2, 2.3, 2.4
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
= Version 2.0.5 released 2017-02-20
|
|
51
|
+
|
|
52
|
+
## Bugfix
|
|
53
|
+
|
|
54
|
+
* [Ruby] Fix linkage issue - link Ruby wrapper to the native Ruby ruby library
|
|
55
|
+
|
|
56
|
+
## Changes
|
|
57
|
+
|
|
58
|
+
* [Ruby] Add flag '-autorename' for Ruby Swig wrapper, which apply Ruby naming conventions
|
|
59
|
+
|
|
60
|
+
|
|
3
61
|
= Version 2.0.4 released 2017-01-10
|
|
4
62
|
|
|
5
63
|
## Bugfix
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
FROM ubuntu:16.04
|
|
2
|
+
|
|
3
|
+
# gcc for cgo
|
|
4
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
5
|
+
g++ \
|
|
6
|
+
gcc \
|
|
7
|
+
libc6-dev \
|
|
8
|
+
make \
|
|
9
|
+
pkg-config \
|
|
10
|
+
cmake \
|
|
11
|
+
swig \
|
|
12
|
+
doxygen \
|
|
13
|
+
curl \
|
|
14
|
+
ca-certificates \
|
|
15
|
+
git \
|
|
16
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
17
|
+
|
|
18
|
+
# install golang
|
|
19
|
+
ENV GOLANG_VERSION 1.7.5
|
|
20
|
+
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
|
|
21
|
+
ENV GOLANG_DOWNLOAD_SHA256 2e4dd6c44f0693bef4e7b46cc701513d74c3cc44f2419bf519d7868b12931ac3
|
|
22
|
+
|
|
23
|
+
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
|
|
24
|
+
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
|
|
25
|
+
&& tar -C /usr/local -xzf golang.tar.gz \
|
|
26
|
+
&& rm golang.tar.gz
|
|
27
|
+
|
|
28
|
+
ENV GOPATH /go
|
|
29
|
+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
|
30
|
+
|
|
31
|
+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
|
|
32
|
+
WORKDIR $GOPATH
|
|
33
|
+
|
|
34
|
+
# build virgil-crypto-go
|
|
35
|
+
ADD . virgil-crypto
|
|
36
|
+
RUN cd virgil-crypto \
|
|
37
|
+
&& cmake -H. -B_build -DCMAKE_INSTALL_PREFIX=_install -DLANG=go -DINSTALL_CORE_LIBS=ON \
|
|
38
|
+
&& cmake --build _build --target install \
|
|
39
|
+
&& go get -d gopkg.in/virgilsecurity/virgil-crypto-go.v4 \
|
|
40
|
+
&& cp -r _install/* $GOPATH/src/gopkg.in/virgilsecurity/virgil-crypto-go.v4 \
|
|
41
|
+
&& cd - && rm -rf virgil-crypto
|
data/ext/native/src/Jenkinsfile
CHANGED
|
@@ -41,7 +41,18 @@ def createNativeUnixBuild(slave) {
|
|
|
41
41
|
// C++
|
|
42
42
|
sh './utils/build.sh cpp'
|
|
43
43
|
// Ruby
|
|
44
|
-
|
|
44
|
+
withEnv(["PATH=${env.HOME}/.rbenv/bin:${env.PATH}"]){
|
|
45
|
+
writeFile file: './utils/env.sh', text: ['eval "$(rbenv init -)"'].join("\n")
|
|
46
|
+
writeFile file: '.ruby-version', text: ['2.0.0-p648'].join("\n")
|
|
47
|
+
sh './utils/build.sh ruby-2.0'
|
|
48
|
+
writeFile file: '.ruby-version', text: ['2.2.6'].join("\n")
|
|
49
|
+
sh './utils/build.sh ruby-2.2'
|
|
50
|
+
writeFile file: '.ruby-version', text: ['2.3.3'].join("\n")
|
|
51
|
+
sh './utils/build.sh ruby-2.3'
|
|
52
|
+
writeFile file: '.ruby-version', text: ['2.4.0'].join("\n")
|
|
53
|
+
sh './utils/build.sh ruby-2.4'
|
|
54
|
+
}
|
|
55
|
+
organizeFilesUnix('install/ruby')
|
|
45
56
|
// Python
|
|
46
57
|
if (slave.contains('centos7')) {
|
|
47
58
|
sh './utils/build.sh python-2.7'
|
data/ext/native/src/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.1.
|
|
1
|
+
2.1.2
|
|
@@ -128,7 +128,7 @@ function (virgil_depends_create_cache_file cache_path)
|
|
|
128
128
|
# Pass compiler flags if not toolchain case
|
|
129
129
|
if (NOT CMAKE_CROSSCOMPILING)
|
|
130
130
|
string (TOUPPER "${CMAKE_BUILD_TYPE}" configuration)
|
|
131
|
-
foreach (lang C CXX)
|
|
131
|
+
foreach (lang ASM C CXX)
|
|
132
132
|
virgil_depends_write_cache_var ("${cache_path}" "CMAKE_${lang}_COMPILER")
|
|
133
133
|
virgil_depends_write_cache_var ("${cache_path}" "CMAKE_${lang}_FLAGS")
|
|
134
134
|
virgil_depends_write_cache_var ("${cache_path}" "CMAKE_${lang}_FLAGS_${configuration}")
|
|
@@ -53,11 +53,9 @@ else ()
|
|
|
53
53
|
PATTERN "*.h"
|
|
54
54
|
PATTERN "cms" EXCLUDE
|
|
55
55
|
PATTERN "internal" EXCLUDE
|
|
56
|
-
PATTERN "VirgilOID.h" EXCLUDE
|
|
57
56
|
PATTERN "VirgilAsn1Reader.h" EXCLUDE
|
|
58
57
|
PATTERN "VirgilAsn1Writer.h" EXCLUDE
|
|
59
58
|
PATTERN "VirgilKDF.h" EXCLUDE
|
|
60
|
-
PATTERN "PolarsslException.h" EXCLUDE
|
|
61
59
|
PATTERN "VirgilKeyPairGenerator.h" EXCLUDE
|
|
62
60
|
PATTERN "VirgilSymmetricCipher.h" EXCLUDE
|
|
63
61
|
PATTERN "VirgilAsymmetricCipher.h" EXCLUDE
|
|
@@ -136,9 +136,6 @@ public:
|
|
|
136
136
|
* for future decription in secure form.
|
|
137
137
|
*/
|
|
138
138
|
///@{
|
|
139
|
-
/**
|
|
140
|
-
* @brief Returns encrypted data info.
|
|
141
|
-
*/
|
|
142
139
|
/**
|
|
143
140
|
* @brief Return content info.
|
|
144
141
|
*
|
|
@@ -225,9 +222,6 @@ protected:
|
|
|
225
222
|
* @note cipher's input vector is randomly generated.
|
|
226
223
|
*/
|
|
227
224
|
virgil::crypto::foundation::VirgilSymmetricCipher& initEncryption();
|
|
228
|
-
/**
|
|
229
|
-
* @brief Configures symmetric cipher for encryption.
|
|
230
|
-
*/
|
|
231
225
|
/**
|
|
232
226
|
* @brief Configures symmetric cipher for decryption.
|
|
233
227
|
* @param encryptedDataInfo - serialized encrypted data info.
|
|
@@ -46,7 +46,7 @@ namespace virgil { namespace crypto {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* @brief Specific error codes for the crypto library.
|
|
49
|
-
* @ingroup
|
|
49
|
+
* @ingroup error
|
|
50
50
|
*/
|
|
51
51
|
enum class VirgilCryptoError {
|
|
52
52
|
Reserved = 0, ///< Should not be used.
|
|
@@ -71,7 +71,7 @@ enum class VirgilCryptoError {
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @brief This is specific error category that contains information about crypto library errors.
|
|
74
|
-
* @ingroup
|
|
74
|
+
* @ingroup error
|
|
75
75
|
*/
|
|
76
76
|
class VirgilCryptoErrorCategory : public std::error_category {
|
|
77
77
|
public:
|
|
@@ -92,7 +92,7 @@ public:
|
|
|
92
92
|
/**
|
|
93
93
|
* @brief Return singleton instance of the crypto error category.
|
|
94
94
|
* @return Instance of the crypto error categoty.
|
|
95
|
-
* @ingroup
|
|
95
|
+
* @ingroup error
|
|
96
96
|
*/
|
|
97
97
|
const VirgilCryptoErrorCategory& crypto_category() noexcept;
|
|
98
98
|
|
|
@@ -101,7 +101,7 @@ const VirgilCryptoErrorCategory& crypto_category() noexcept;
|
|
|
101
101
|
* @param ev Error value.
|
|
102
102
|
* @return Exception with given error value and corresond error category.
|
|
103
103
|
* @see VirgilCryptoError for specific error values.
|
|
104
|
-
* @ingroup
|
|
104
|
+
* @ingroup error
|
|
105
105
|
*/
|
|
106
106
|
inline VirgilCryptoException make_error(VirgilCryptoError ev) {
|
|
107
107
|
return VirgilCryptoException(static_cast<int>(ev), crypto_category());
|
|
@@ -113,7 +113,7 @@ inline VirgilCryptoException make_error(VirgilCryptoError ev) {
|
|
|
113
113
|
* @param what Additional error description.
|
|
114
114
|
* @return Exception with given error value and corresond error category.
|
|
115
115
|
* @see VirgilCryptoError for specific error values.
|
|
116
|
-
* @ingroup
|
|
116
|
+
* @ingroup error
|
|
117
117
|
*/
|
|
118
118
|
inline VirgilCryptoException make_error(VirgilCryptoError ev, const std::string& what) {
|
|
119
119
|
return VirgilCryptoException(static_cast<int>(ev), crypto_category(), what);
|
|
@@ -125,7 +125,7 @@ inline VirgilCryptoException make_error(VirgilCryptoError ev, const std::string&
|
|
|
125
125
|
* @param what Additional error description.
|
|
126
126
|
* @return Exception with given error value and corresond error category.
|
|
127
127
|
* @see VirgilCryptoError for specific error values.
|
|
128
|
-
* @ingroup
|
|
128
|
+
* @ingroup error
|
|
129
129
|
*/
|
|
130
130
|
inline VirgilCryptoException make_error(VirgilCryptoError ev, const char* what) {
|
|
131
131
|
return VirgilCryptoException(static_cast<int>(ev), crypto_category(), what);
|
|
@@ -49,7 +49,7 @@ namespace virgil { namespace crypto {
|
|
|
49
49
|
* To determine the real exception reason, error codes with conjuction with error category are used.
|
|
50
50
|
* Error codes can be found in the enumeration @link VirgilCryptoError @endlink.
|
|
51
51
|
*
|
|
52
|
-
* @ingroup
|
|
52
|
+
* @ingroup error
|
|
53
53
|
*/
|
|
54
54
|
class VirgilCryptoException : public std::exception {
|
|
55
55
|
public:
|
|
@@ -228,7 +228,8 @@ public:
|
|
|
228
228
|
/**
|
|
229
229
|
* @brief Convert given private key to the PEM format.
|
|
230
230
|
*
|
|
231
|
-
* @param
|
|
231
|
+
* @param privateKey - Private Key to be converted.
|
|
232
|
+
* @param privateKeyPassword - password for the Private Key.
|
|
232
233
|
* @return Private Key in the PEM fromat.
|
|
233
234
|
* @throw VirgilCryptoException, with VirgilCryptoError::InvalidPrivateKeyPassword if password is wrong.
|
|
234
235
|
* @throw VirgilCryptoException, with VirgilCryptoError::InvalidFormat if key has invalid format.
|
|
@@ -239,7 +240,8 @@ public:
|
|
|
239
240
|
/**
|
|
240
241
|
* @brief Convert given private key to the DER format.
|
|
241
242
|
*
|
|
242
|
-
* @param
|
|
243
|
+
* @param privateKey - Private Key to be converted.
|
|
244
|
+
* @param privateKeyPassword - password for the Private Key.
|
|
243
245
|
* @return Private Key in the DER fromat.
|
|
244
246
|
* @throw VirgilCryptoException, with VirgilCryptoError::InvalidPrivateKeyPassword if password is wrong.
|
|
245
247
|
* @throw VirgilCryptoException, with VirgilCryptoError::InvalidFormat if key has invalid format.
|
|
@@ -57,7 +57,6 @@ public:
|
|
|
57
57
|
* @param embedContentInfo - determines whether to embed content info the the encrypted data, or not.
|
|
58
58
|
* @note Store content info to use it for decription process, if embedContentInfo parameter is false.
|
|
59
59
|
* @see getContentInfo()
|
|
60
|
-
* @return encrypted data.
|
|
61
60
|
*/
|
|
62
61
|
void encrypt(VirgilDataSource& source, VirgilDataSink& sink, bool embedContentInfo = true);
|
|
63
62
|
|
|
@@ -47,7 +47,7 @@ namespace virgil { namespace crypto { namespace foundation {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* @brief Provides hashing (message digest) algorithms.
|
|
50
|
-
* @ingroup
|
|
50
|
+
* @ingroup hash
|
|
51
51
|
*/
|
|
52
52
|
class VirgilHash : public virgil::crypto::foundation::asn1::VirgilAsn1Compatible {
|
|
53
53
|
public:
|
|
@@ -91,12 +91,9 @@ public:
|
|
|
91
91
|
*/
|
|
92
92
|
explicit VirgilHash(const char* name);
|
|
93
93
|
///@}
|
|
94
|
-
/**
|
|
95
|
-
* @brief
|
|
96
|
-
*/
|
|
97
94
|
/**
|
|
98
95
|
* @name Info
|
|
99
|
-
*
|
|
96
|
+
* Provide detail information about object.
|
|
100
97
|
*/
|
|
101
98
|
///@{
|
|
102
99
|
/**
|
|
@@ -114,7 +111,7 @@ public:
|
|
|
114
111
|
|
|
115
112
|
/**
|
|
116
113
|
* @name Immediate Hashing
|
|
117
|
-
*
|
|
114
|
+
* This methods can be used to get the message hash immediately.
|
|
118
115
|
*/
|
|
119
116
|
///@{
|
|
120
117
|
/**
|
|
@@ -131,7 +128,7 @@ public:
|
|
|
131
128
|
/**
|
|
132
129
|
* @name Chain Hashing
|
|
133
130
|
*
|
|
134
|
-
*
|
|
131
|
+
* This methods provide mechanism to hash long message,
|
|
135
132
|
* that can be splitted to a shorter chunks and be processed separately.
|
|
136
133
|
*/
|
|
137
134
|
///@{
|
|
@@ -147,22 +144,22 @@ public:
|
|
|
147
144
|
* This method MAY be called multiple times to process long message splitted to a shorter chunks.
|
|
148
145
|
*
|
|
149
146
|
* @param data - message to be hashed.
|
|
150
|
-
* @see
|
|
147
|
+
* @see start()
|
|
151
148
|
*/
|
|
152
149
|
void update(const virgil::crypto::VirgilByteArray& data);
|
|
153
150
|
|
|
154
151
|
/**
|
|
155
152
|
* @brief Return final message hash.
|
|
156
153
|
* @return Message hash processed by series of @link update() @endlink method.
|
|
157
|
-
* @see
|
|
158
|
-
* @see
|
|
154
|
+
* @see start()
|
|
155
|
+
* @see update()
|
|
159
156
|
*/
|
|
160
157
|
virgil::crypto::VirgilByteArray finish();
|
|
161
158
|
///@}
|
|
162
159
|
|
|
163
160
|
/**
|
|
164
161
|
* @name HMAC Immediate Hashing
|
|
165
|
-
*
|
|
162
|
+
* This methods can be used to get the message HMAC hash immediately.
|
|
166
163
|
*/
|
|
167
164
|
///@{
|
|
168
165
|
/**
|
|
@@ -182,7 +179,7 @@ public:
|
|
|
182
179
|
/**
|
|
183
180
|
* @name HMAC Chain Hashing
|
|
184
181
|
*
|
|
185
|
-
*
|
|
182
|
+
* This methods provide mechanism to get HMAC hash of the long message,
|
|
186
183
|
* that can be splitted to a shorter chunks and be processed separately.
|
|
187
184
|
*/
|
|
188
185
|
///@{
|
|
@@ -253,7 +250,7 @@ namespace std {
|
|
|
253
250
|
/**
|
|
254
251
|
* @brief Returns string representation of the Hash algorithm.
|
|
255
252
|
* @return Hash algorithm as string.
|
|
256
|
-
* @ingroup
|
|
253
|
+
* @ingroup hash
|
|
257
254
|
*/
|
|
258
255
|
string to_string(virgil::crypto::foundation::VirgilHash::Algorithm alg);
|
|
259
256
|
}
|
|
@@ -47,7 +47,7 @@ namespace virgil { namespace crypto { namespace foundation {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* @brief Provides key derivation function algorithms.
|
|
50
|
-
* @ingroup
|
|
50
|
+
* @ingroup kdf
|
|
51
51
|
*/
|
|
52
52
|
class VirgilKDF : public asn1::VirgilAsn1Compatible {
|
|
53
53
|
public:
|
|
@@ -86,12 +86,9 @@ public:
|
|
|
86
86
|
*/
|
|
87
87
|
explicit VirgilKDF(const char* name);
|
|
88
88
|
///@}
|
|
89
|
-
/**
|
|
90
|
-
* @brief
|
|
91
|
-
*/
|
|
92
89
|
/**
|
|
93
90
|
* @name Info
|
|
94
|
-
*
|
|
91
|
+
* Provide detail information about object.
|
|
95
92
|
*/
|
|
96
93
|
///@{
|
|
97
94
|
/**
|
|
@@ -167,7 +164,7 @@ namespace std {
|
|
|
167
164
|
/**
|
|
168
165
|
* @brief Returns string representation of the KDF algorithm.
|
|
169
166
|
* @return KDF algorithm as string.
|
|
170
|
-
* @ingroup
|
|
167
|
+
* @ingroup kdf
|
|
171
168
|
*/
|
|
172
169
|
string to_string(virgil::crypto::foundation::VirgilKDF::Algorithm alg);
|
|
173
170
|
}
|
|
@@ -47,7 +47,7 @@ namespace virgil { namespace crypto { namespace foundation {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* @brief Provides Password-Based Cryptography. Now PKCS#5 and PKCS#12 are partially supported.
|
|
50
|
-
* @ingroup
|
|
50
|
+
* @ingroup cipher
|
|
51
51
|
*/
|
|
52
52
|
class VirgilPBE : public asn1::VirgilAsn1Compatible {
|
|
53
53
|
public:
|
|
@@ -82,12 +82,9 @@ public:
|
|
|
82
82
|
*/
|
|
83
83
|
VirgilPBKDF(const virgil::crypto::VirgilByteArray& salt, unsigned int iterationCount = kIterationCount_Default);
|
|
84
84
|
///@}
|
|
85
|
-
/**
|
|
86
|
-
* @brief
|
|
87
|
-
*/
|
|
88
85
|
/**
|
|
89
86
|
* @name Configuration / Info
|
|
90
|
-
*
|
|
87
|
+
* Provide methods that allow precise algorithm configuration and get information about it.
|
|
91
88
|
*/
|
|
92
89
|
///@{
|
|
93
90
|
/**
|
|
@@ -57,14 +57,12 @@ public:
|
|
|
57
57
|
* @brief Initialize randomization module with personalization data.
|
|
58
58
|
*
|
|
59
59
|
* @param personalInfo (@see section 8.7.1 of NIST Special Publication 800-90A).
|
|
60
|
-
* @return Random bytes.
|
|
61
60
|
*/
|
|
62
61
|
explicit VirgilRandom(const virgil::crypto::VirgilByteArray& personalInfo);
|
|
63
62
|
/**
|
|
64
63
|
* @brief Initialize randomization module with personalization data.
|
|
65
64
|
*
|
|
66
65
|
* @param personalInfo (@see section 8.7.1 of NIST Special Publication 800-90A).
|
|
67
|
-
* @return Random bytes.
|
|
68
66
|
*/
|
|
69
67
|
explicit VirgilRandom(const std::string& personalInfo);
|
|
70
68
|
///@}
|
|
@@ -47,7 +47,7 @@ namespace virgil { namespace crypto { namespace foundation {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* @brief Provides symmetric ciphers algorithms.
|
|
50
|
-
* @ingroup
|
|
50
|
+
* @ingroup cipher
|
|
51
51
|
*/
|
|
52
52
|
class VirgilSymmetricCipher : public virgil::crypto::foundation::asn1::VirgilAsn1Compatible {
|
|
53
53
|
public:
|
|
@@ -70,6 +70,8 @@ public:
|
|
|
70
70
|
* Enumerates possible Symmetric Cipher algorithms.
|
|
71
71
|
*/
|
|
72
72
|
enum class Algorithm {
|
|
73
|
+
AES_128_CBC, ///< Cipher algorithm: AES-128, mode: CBC
|
|
74
|
+
AES_128_GCM, ///< Cipher algorithm: AES-128, mode: GCM
|
|
73
75
|
AES_256_CBC, ///< Cipher algorithm: AES-256, mode: CBC
|
|
74
76
|
AES_256_GCM ///< Cipher algorithm: AES-256, mode: GCM
|
|
75
77
|
};
|
|
@@ -297,7 +299,7 @@ namespace std {
|
|
|
297
299
|
/**
|
|
298
300
|
* @brief Returns string representation of the Hash algorithm.
|
|
299
301
|
* @return Symmetric cipher algorithm as string.
|
|
300
|
-
* @ingroup
|
|
302
|
+
* @ingroup cipher
|
|
301
303
|
*/
|
|
302
304
|
string to_string(virgil::crypto::foundation::VirgilSymmetricCipher::Algorithm alg);
|
|
303
305
|
}
|
|
@@ -45,7 +45,7 @@ namespace virgil { namespace crypto { namespace foundation {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* @brief Error category that handles error codes from the system crypto library.
|
|
48
|
-
* @ingroup
|
|
48
|
+
* @ingroup error
|
|
49
49
|
*/
|
|
50
50
|
class VirgilSystemCryptoErrorCategory : public std::error_category {
|
|
51
51
|
public:
|
|
@@ -66,7 +66,7 @@ public:
|
|
|
66
66
|
/**
|
|
67
67
|
* @brief Return singleton instance of the system crypto error category.
|
|
68
68
|
* @return Instance of the syste, crypto error categoty.
|
|
69
|
-
* @ingroup
|
|
69
|
+
* @ingroup error
|
|
70
70
|
*/
|
|
71
71
|
const VirgilSystemCryptoErrorCategory& system_crypto_category() noexcept;
|
|
72
72
|
|
|
@@ -79,7 +79,7 @@ const VirgilSystemCryptoErrorCategory& system_crypto_category() noexcept;
|
|
|
79
79
|
* @param result Value returned by system crypto library.
|
|
80
80
|
* @return Value if it's not an error.
|
|
81
81
|
* @throw VirgilCryptoException with given error code and correspond category, if given value represents an error.
|
|
82
|
-
* @ingroup
|
|
82
|
+
* @ingroup error
|
|
83
83
|
*/
|
|
84
84
|
inline int system_crypto_handler_get_result(int result) {
|
|
85
85
|
if (result >= 0) { return result; }
|
|
@@ -94,7 +94,7 @@ inline int system_crypto_handler_get_result(int result) {
|
|
|
94
94
|
*
|
|
95
95
|
* @param result Value returned by system crypto library.
|
|
96
96
|
* @throw VirgilCryptoException with given error code and correspond category, if given value represents an error.
|
|
97
|
-
* @ingroup
|
|
97
|
+
* @ingroup error
|
|
98
98
|
*/
|
|
99
99
|
inline void system_crypto_handler(int result) {
|
|
100
100
|
(void) system_crypto_handler_get_result(result);
|
|
@@ -113,7 +113,7 @@ inline void system_crypto_handler(int result) {
|
|
|
113
113
|
* @param catch_handler Function that can handle the error in a different way.
|
|
114
114
|
*
|
|
115
115
|
* @return Value if it's not an error.
|
|
116
|
-
* @ingroup
|
|
116
|
+
* @ingroup error
|
|
117
117
|
*/
|
|
118
118
|
template<typename CatchHandler>
|
|
119
119
|
inline int system_crypto_handler_get_result(int result, CatchHandler catch_handler) {
|
|
@@ -137,7 +137,7 @@ inline int system_crypto_handler_get_result(int result, CatchHandler catch_handl
|
|
|
137
137
|
*
|
|
138
138
|
* @param result Value returned by system crypto library.
|
|
139
139
|
* @param catch_handler Function that can handle the error in a different way.
|
|
140
|
-
* @ingroup
|
|
140
|
+
* @ingroup error
|
|
141
141
|
*/
|
|
142
142
|
template<typename CatchHandler>
|
|
143
143
|
inline void system_crypto_handler(int result, CatchHandler catch_handler) {
|
|
@@ -55,14 +55,14 @@ class VirgilAsn1Writer {
|
|
|
55
55
|
public:
|
|
56
56
|
/**
|
|
57
57
|
* @brief Initialize internal state for the first use.
|
|
58
|
-
* @see
|
|
58
|
+
* @see reset() method for reusing this class to create new ASN.1 stucture.
|
|
59
59
|
*/
|
|
60
60
|
VirgilAsn1Writer();
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* @brief Initialize internal state for the first use.
|
|
64
64
|
* @param capacity - expected ASN.1 final size
|
|
65
|
-
* @see
|
|
65
|
+
* @see reset() method for reusing this class to create new ASN.1 stucture.
|
|
66
66
|
*/
|
|
67
67
|
VirgilAsn1Writer(size_t capacity);
|
|
68
68
|
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* @defgroup Error
|
|
39
|
+
* @defgroup error Error
|
|
40
40
|
*
|
|
41
41
|
* @brief This group contains interfaces for error handling mechanism that is used in the library.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* @defgroup Hash
|
|
45
|
+
* @defgroup hash Hash
|
|
46
46
|
*
|
|
47
47
|
* @brief This group contains interfaces for producing cryptographic hashes.
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* @defgroup KDF
|
|
51
|
+
* @defgroup kdf KDF
|
|
52
52
|
*
|
|
53
53
|
* @brief This group contains interfaces to Key Derivation Function algorithms.
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* @defgroup Cipher
|
|
57
|
+
* @defgroup cipher Cipher
|
|
58
58
|
*
|
|
59
59
|
* @brief This group contains interfaces to encryption and to decryption algorithms.
|
|
60
60
|
*/
|
|
@@ -226,7 +226,7 @@ static VirgilByteArray fixKey(const VirgilByteArray& key) {
|
|
|
226
226
|
if (std::search(key.begin(), key.end(), pemHeaderBegin.begin(), pemHeaderBegin.end()) != key.end()) {
|
|
227
227
|
VirgilByteArray fixedKey(key.begin(), key.end());
|
|
228
228
|
fixedKey.push_back(0);
|
|
229
|
-
return
|
|
229
|
+
return fixedKey;
|
|
230
230
|
}
|
|
231
231
|
return key;
|
|
232
232
|
}
|
|
@@ -342,6 +342,10 @@ void VirgilSymmetricCipher::asn1Read(VirgilAsn1Reader& asn1Reader) {
|
|
|
342
342
|
|
|
343
343
|
std::string std::to_string(virgil::crypto::foundation::VirgilSymmetricCipher::Algorithm alg) {
|
|
344
344
|
switch (alg) {
|
|
345
|
+
case VirgilSymmetricCipher::Algorithm::AES_128_CBC:
|
|
346
|
+
return "AES-128-CBC";
|
|
347
|
+
case VirgilSymmetricCipher::Algorithm::AES_128_GCM:
|
|
348
|
+
return "AES-128-GCM";
|
|
345
349
|
case VirgilSymmetricCipher::Algorithm::AES_256_CBC:
|
|
346
350
|
return "AES-256-CBC";
|
|
347
351
|
case VirgilSymmetricCipher::Algorithm::AES_256_GCM:
|
|
@@ -178,7 +178,7 @@ static size_t calc_master_package_payload_size(size_t packageSize, size_t public
|
|
|
178
178
|
/**
|
|
179
179
|
* @brief Produce additional authenticated data for AEAD cipher.
|
|
180
180
|
*
|
|
181
|
-
* @param packageCount- package count
|
|
181
|
+
* @param packageCount - package count
|
|
182
182
|
* @param ephemeralContext - asymmetric cipher context that handles ephemeral public key
|
|
183
183
|
* @param isSigned - defines that package is signed
|
|
184
184
|
*/
|
|
@@ -188,7 +188,7 @@ static VirgilByteArray
|
|
|
188
188
|
/**
|
|
189
189
|
* @brief Read header from the package and parse it.
|
|
190
190
|
*
|
|
191
|
-
* @param[
|
|
191
|
+
* @param[in,out] packageIt - current parse position in the package
|
|
192
192
|
* @param[in] end - end of the package
|
|
193
193
|
* @param[out] isMaster - defines that package is master
|
|
194
194
|
* @param[out] isSigned - defines that package is signed
|
|
@@ -412,9 +412,9 @@ void VirgilTinyCipher::encryptAndSign(
|
|
|
412
412
|
throw make_error(VirgilCryptoError::InvalidState, "Package size overflow.");
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
const
|
|
415
|
+
const std::ptrdiff_t spaceLeft = impl_->packageSize - package.size();
|
|
416
416
|
const std::ptrdiff_t payloadAvailable = encryptedData.end() - payloadIt;
|
|
417
|
-
const
|
|
417
|
+
const std::ptrdiff_t payloadSize = spaceLeft > payloadAvailable ? payloadAvailable : spaceLeft;
|
|
418
418
|
package.insert(package.end(), payloadIt, payloadIt + payloadSize);
|
|
419
419
|
payloadIt += payloadSize;
|
|
420
420
|
|
|
@@ -89,8 +89,8 @@ endif ()
|
|
|
89
89
|
|
|
90
90
|
ExternalProject_Add (${PROJECT_NAME}
|
|
91
91
|
DOWNLOAD_DIR "@VIRGIL_DEPENDS_PACKAGE_DOWNLOAD_DIR@"
|
|
92
|
-
URL "https://github.com/VirgilSecurity/mbedtls/archive/mbedtls-2.4.
|
|
93
|
-
URL_HASH SHA1=
|
|
92
|
+
URL "https://github.com/VirgilSecurity/mbedtls/archive/mbedtls-2.4.2-virgil-2.0.3.tar.gz"
|
|
93
|
+
URL_HASH SHA1=98a836e2030b6e00c9f0dab7b0e81ee37e395e57
|
|
94
94
|
PREFIX "@VIRGIL_DEPENDS_PACKAGE_BUILD_DIR@"
|
|
95
95
|
CMAKE_ARGS "@VIRGIL_DEPENDS_CMAKE_ARGS@" "${MBEDTLS_CMAKE_ARGS}"
|
|
96
96
|
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
@@ -68,6 +68,22 @@ static const char* const kPrivateKey1 =
|
|
|
68
68
|
"qS/jikzHqj7JwTOgmgSMhVzzOsJhXTD5Tp4M1gbz\n"
|
|
69
69
|
"-----END EC PRIVATE KEY-----\n";
|
|
70
70
|
|
|
71
|
+
static const char* const kPrivateKey1DER =
|
|
72
|
+
"3081DB0201010441009E17CF991D24E4"
|
|
73
|
+
"BE392799B659A12341C679AE66C93CB7"
|
|
74
|
+
"2BB61DD7E7DA0BD9B27D3D9B3E659EC5"
|
|
75
|
+
"0B499270E967CEFB1E6F8AE0D8FDA4DE"
|
|
76
|
+
"8F7777E7CD09CBBCE0A00B06092B2403"
|
|
77
|
+
"03020801010DA1818503818200045955"
|
|
78
|
+
"E0E67649AC5A689924B3B9913CBCDB3F"
|
|
79
|
+
"DCFB2B4196932AE070E9D3DDCA0F0D64"
|
|
80
|
+
"C5034E36A1C66E783F5E2F396E82C3A3"
|
|
81
|
+
"EDAD7D1AE774D9A904C2D2011046964F"
|
|
82
|
+
"C77EFCAD956632792CC18FA72DC62B5D"
|
|
83
|
+
"F0467661EC11B8257A20CC89216224CA"
|
|
84
|
+
"A92FE38A4CC7AA3EC9C133A09A048C85"
|
|
85
|
+
"5CF33AC2615D30F94E9E0CD606F3";
|
|
86
|
+
|
|
71
87
|
static const char* const kMalformedPrivateKey1 =
|
|
72
88
|
"-----BEGIN EC PRIVATE KEY-----\n"
|
|
73
89
|
"MIHbAgEBBEEAnhfPmR0k5L45J5m2WaEjQcZ5rmbJPLcrth3X59oL2bJ9PZs+ZZ7F\n"
|
|
@@ -96,6 +112,27 @@ static const char* const kPrivateKey2 =
|
|
|
96
112
|
"sMaFiu8OBbyVfjhr9g==\n"
|
|
97
113
|
"-----END ENCRYPTED PRIVATE KEY-----\n";
|
|
98
114
|
|
|
115
|
+
static const char* const kPrivateKey2DER =
|
|
116
|
+
"308201293034060A2A864886F70D010C"
|
|
117
|
+
"0103302604209D8267D5C3EFDB1EE2C5"
|
|
118
|
+
"8EF33681F28A0A91FD4847F7329A6A31"
|
|
119
|
+
"347D297B6CC2020220000481F073EA64"
|
|
120
|
+
"D31E8DDCE3B0F78B26B2E3D525DD112F"
|
|
121
|
+
"053948160DB22114B9BFE86DE5782362"
|
|
122
|
+
"FFBB1C8083B0A2893F7F9A842F7C9D1E"
|
|
123
|
+
"86D7718AEBE4BB65AF9A3906C48110B0"
|
|
124
|
+
"4024AA1429C5A6BBC02E6F4DEFFF021E"
|
|
125
|
+
"4CDB1587103FE269F9920B3A070269E7"
|
|
126
|
+
"DA0E0EFD18AA944016C310B1725A5E37"
|
|
127
|
+
"8F556A4A2EC0C0A284FC59AD2CE5C7CF"
|
|
128
|
+
"B5444DCD45101BB08E6A43783C5D3531"
|
|
129
|
+
"7807604B2F73FCA05C8FD05072013F00"
|
|
130
|
+
"5557B6F1DE5215D710F2E5608D8017DD"
|
|
131
|
+
"10477C96E4DA233775E58EDA868A0003"
|
|
132
|
+
"D2B55833C486DAB4825F231B9BD26D9F"
|
|
133
|
+
"8109A30D778DFE1A4B27A3873DA01919"
|
|
134
|
+
"B0C6858AEF0E05BC957E386BF6";
|
|
135
|
+
|
|
99
136
|
static const char* const kMalformedPrivateKey2 =
|
|
100
137
|
"-----BEGIN ENC PRIVATE KEY-----\n"
|
|
101
138
|
"MIIBKTA0BgoqhkiG9w0BDAEDMCYEIJ2CZ9XD79se4sWO8zaB8ooKkf1IR/cymmox\n"
|
|
@@ -127,10 +164,14 @@ TEST_CASE("Asymmetric Cipher - Keys Validation", "[asymmetric-cipher]") {
|
|
|
127
164
|
REQUIRE_FALSE(VirgilAsymmetricCipher::checkPrivateKeyPassword(
|
|
128
165
|
str2bytes(kPrivateKey2), str2bytes(kWrongPwdPrivateKey2)));
|
|
129
166
|
}
|
|
130
|
-
SECTION("check if private key is encrypted") {
|
|
167
|
+
SECTION("check if private key is encrypted (PEM)") {
|
|
131
168
|
REQUIRE(VirgilAsymmetricCipher::isPrivateKeyEncrypted(str2bytes(kPrivateKey2)));
|
|
132
169
|
REQUIRE_FALSE(VirgilAsymmetricCipher::isPrivateKeyEncrypted(str2bytes(kPrivateKey1)));
|
|
133
170
|
}
|
|
171
|
+
SECTION("check if private key is encrypted (DER)") {
|
|
172
|
+
REQUIRE(VirgilAsymmetricCipher::isPrivateKeyEncrypted(hex2bytes(kPrivateKey2DER)));
|
|
173
|
+
REQUIRE_FALSE(VirgilAsymmetricCipher::isPrivateKeyEncrypted(hex2bytes(kPrivateKey1DER)));
|
|
174
|
+
}
|
|
134
175
|
SECTION("check malformed private key throws") {
|
|
135
176
|
REQUIRE_THROWS(VirgilAsymmetricCipher::checkPrivateKeyPassword(str2bytes(kMalformedPrivateKey2),
|
|
136
177
|
str2bytes(kPwdPrivateKey2)));
|
|
@@ -53,10 +53,11 @@ using virgil::crypto::VirgilByteArray;
|
|
|
53
53
|
using virgil::crypto::foundation::VirgilSymmetricCipher;
|
|
54
54
|
using virgil::crypto::foundation::VirgilRandom;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
VirgilSymmetricCipher cipher(VirgilSymmetricCipher::Algorithm::AES_256_GCM);
|
|
56
|
+
static void test_symmetric_cipher(VirgilSymmetricCipher::Algorithm algorithm) {
|
|
58
57
|
VirgilByteArray plainData = str2bytes("data to be encrypted with symmetric cipher");
|
|
59
58
|
|
|
59
|
+
VirgilSymmetricCipher cipher(algorithm);
|
|
60
|
+
|
|
60
61
|
SECTION("with known KEY and IV") {
|
|
61
62
|
// Init keys
|
|
62
63
|
VirgilByteArray key = hex2bytes("194122b1bee2f8c25ea5e0f02b1a3376d3a3dd1252365a2acefabead3cf6ab4c");
|
|
@@ -103,3 +104,20 @@ TEST_CASE("Symmetric Cipher", "[symmetric-cipher]") {
|
|
|
103
104
|
REQUIRE(bytes2str(plainData) == bytes2str(decryptedData));
|
|
104
105
|
}
|
|
105
106
|
}
|
|
107
|
+
|
|
108
|
+
TEST_CASE("Symmetric Cipher", "[symmetric-cipher]") {
|
|
109
|
+
|
|
110
|
+
SECTION("AES-128-CBC") {
|
|
111
|
+
test_symmetric_cipher(VirgilSymmetricCipher::Algorithm::AES_128_CBC);
|
|
112
|
+
}
|
|
113
|
+
SECTION("AES-256-CBC") {
|
|
114
|
+
test_symmetric_cipher(VirgilSymmetricCipher::Algorithm::AES_256_CBC);
|
|
115
|
+
}
|
|
116
|
+
SECTION("AES-128-GCM") {
|
|
117
|
+
test_symmetric_cipher(VirgilSymmetricCipher::Algorithm::AES_128_GCM);
|
|
118
|
+
}
|
|
119
|
+
SECTION("AES-256-GCM") {
|
|
120
|
+
test_symmetric_cipher(VirgilSymmetricCipher::Algorithm::AES_256_GCM);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
}
|
|
@@ -239,6 +239,11 @@ show_info "<install_dir>: ${INSTALL_DIR}"
|
|
|
239
239
|
# Define common build parameters
|
|
240
240
|
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release"
|
|
241
241
|
|
|
242
|
+
if [[ ${TARGET_NAME} =~ ^(cpp|osx|ios|appletvos|applewatchos)$ ]]; then
|
|
243
|
+
# Expose low level API for targets that use C/C++ headers
|
|
244
|
+
CMAKE_ARGS+=" -DLIB_LOW_LEVEL_API=ON"
|
|
245
|
+
fi
|
|
246
|
+
|
|
242
247
|
if [[ ${TARGET_NAME} =~ ^(cpp|osx|java|net|php|python|ruby|nodejs|go)$ ]]; then
|
|
243
248
|
CMAKE_ARGS+=" -DPLATFORM_ARCH=$(uname -m)"
|
|
244
249
|
fi
|
|
@@ -266,6 +271,11 @@ if [[ ${TARGET_NAME} =~ ^(cpp|java|net|php|python|ruby|nodejs|go)$ ]]; then
|
|
|
266
271
|
fi
|
|
267
272
|
|
|
268
273
|
if [ "${TARGET_NAME}" == "osx" ]; then
|
|
274
|
+
# Add minimim OSX version flag
|
|
275
|
+
osx_version_min="10.10" # Yosemite
|
|
276
|
+
CMAKE_ARGS+=" -DCMAKE_ASM_FLAGS=-mmacosx-version-min=${osx_version_min}"
|
|
277
|
+
CMAKE_ARGS+=" -DCMAKE_C_FLAGS=-mmacosx-version-min=${osx_version_min}"
|
|
278
|
+
CMAKE_ARGS+=" -DCMAKE_CXX_FLAGS=-mmacosx-version-min=${osx_version_min}"
|
|
269
279
|
# Build
|
|
270
280
|
cmake ${CMAKE_ARGS} -DLANG=cpp -DPLATFORM=${TARGET_NAME} -DPLATFORM_VERSION=${SYSTEM_KERNEL_RELEASE_VERSION} "${SRC_DIR}"
|
|
271
281
|
make -j4 install
|
|
@@ -42,7 +42,36 @@ set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
|
|
42
42
|
set (RUBY_MODULE_NAME ${PROJECT_NAME})
|
|
43
43
|
set (SWIG_MODULE_NAME ${RUBY_MODULE_NAME})
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
# Find Ruby package
|
|
46
|
+
if (LANG_VERSION)
|
|
47
|
+
find_host_package (Ruby "${LANG_VERSION}" EXACT REQUIRED)
|
|
48
|
+
else ()
|
|
49
|
+
find_host_package (Ruby REQUIRED)
|
|
50
|
+
endif (LANG_VERSION)
|
|
51
|
+
|
|
52
|
+
# Find Ruby headers in given path - not system
|
|
53
|
+
find_host_path (RUBY_INCLUDE_DIR_LOCAL
|
|
54
|
+
NAMES ruby.h
|
|
55
|
+
HINTS
|
|
56
|
+
${RUBY_HDR_DIR}
|
|
57
|
+
${RUBY_ARCH_DIR}
|
|
58
|
+
NO_DEFAULT_PATH
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
find_host_path (RUBY_CONFIG_INCLUDE_DIR_LOCAL
|
|
62
|
+
NAMES ruby/config.h config.h
|
|
63
|
+
HINTS
|
|
64
|
+
${RUBY_HDR_DIR}/${RUBY_ARCH}
|
|
65
|
+
${RUBY_ARCH_DIR}
|
|
66
|
+
${RUBY_ARCHHDR_DIR}
|
|
67
|
+
NO_DEFAULT_PATH
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Replace system ruby include dirs with found within RbConfig
|
|
71
|
+
set (RUBY_INCLUDE_DIRS
|
|
72
|
+
"${RUBY_INCLUDE_DIR_LOCAL}" "${RUBY_CONFIG_INCLUDE_DIR_LOCAL}"
|
|
73
|
+
CACHE STRING "Ruby include directories" FORCE
|
|
74
|
+
)
|
|
46
75
|
include_directories (SYSTEM ${RUBY_INCLUDE_DIRS})
|
|
47
76
|
|
|
48
77
|
if (RUBY_VERSION)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: virgil-crypto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.2
|
|
4
|
+
version: 2.1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitriy Dudkin
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-
|
|
12
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -87,6 +87,7 @@ files:
|
|
|
87
87
|
- ext/native/src/.travis.yml
|
|
88
88
|
- ext/native/src/CMakeLists.txt
|
|
89
89
|
- ext/native/src/ChangeLog
|
|
90
|
+
- ext/native/src/Dockerfile_Golang
|
|
90
91
|
- ext/native/src/Jenkinsfile
|
|
91
92
|
- ext/native/src/LICENSE
|
|
92
93
|
- ext/native/src/README.md
|
|
@@ -978,7 +979,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
978
979
|
version: '0'
|
|
979
980
|
requirements: []
|
|
980
981
|
rubyforge_project:
|
|
981
|
-
rubygems_version: 2.
|
|
982
|
+
rubygems_version: 2.5.2
|
|
982
983
|
signing_key:
|
|
983
984
|
specification_version: 4
|
|
984
985
|
summary: Virgil Crypto library wrapper
|