diff --git a/CMakeLists.txt b/CMakeLists.txt index 740a39532..52b41e933 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) -project(virgil_crypto VERSION 0.17.0 LANGUAGES C) +project(virgil_crypto VERSION 0.17.1 LANGUAGES C) # --------------------------------------------------------------------------- diff --git a/ChangeLog.md b/ChangeLog.md index e6da5b1a3..14daee534 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,14 +1,21 @@ # virgil-crypto-c ChangeLog (Sorted by date) -## Version 0.17.0 released 2023-08-09 +## Version 0.17.1 released 2023-08-13 + +### Changes +- Ext: Fix relic version 0.4.0 +- Lib/Pythia: Restore backward compatibility by using fixed relic version 0.4.1 + + +## Version 0.17.0 released 2023-08-09 ### Changes - Apple: Remove support for Apple BITCODE - Apple: Bump min supported macOS version to 10.13 - Ext: Upgrade Relic to the version 0.6.0 - - This version is **incompatible** with 0.5 + - This version is **incompatible** with 0.4 - Lib/Pythia: Adopt to incompatible Relic version - Now `blind()` produce different value, so stored blinded values can not be `deblinded()` - Apple: Move support of CocoaPods and SPM from https://github.com/VirgilSecurity/virgil-cryptowrapper-x to this repo diff --git a/Package.swift b/Package.swift index 6f77499f2..e8eff6cd2 100644 --- a/Package.swift +++ b/Package.swift @@ -2,14 +2,14 @@ import PackageDescription -let version = "0.17.0" +let version = "0.17.1" let useLocalBinaries = false let vscCommonBinaryTarget = { if (useLocalBinaries) { return Target.binaryTarget(name: "VSCCommon", path: "binaries//VSCCommon.xcframework.zip") } else { - let vscCommonChecksum = "bb476008c212720ee878efdb5c8fb8b763a8573ca4dd0531edb3a62a4f812ca5" + let vscCommonChecksum = "99193a9c8a71cebcaadf282ac2f4d5d398f1dee8567799d6a0cdd3e3d63ba1a3" return Target.binaryTarget( name: "VSCCommon", url: "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v\(version)/VSCCommon.xcframework.zip", @@ -22,7 +22,7 @@ let vscFoundationBinaryTarget = { if (useLocalBinaries) { return Target.binaryTarget(name: "VSCFoundation", path: "binaries//VSCFoundation.xcframework.zip") } else { - let vscFoundationChecksum = "fe21fa73c6098f22d7451a5504adc45be575c6e781fea91616c27ec00c4c0a0a" + let vscFoundationChecksum = "b38a85c73b033dc62b55e1d7c7e4988504176b451fd2e87eaad86b616921276a" return Target.binaryTarget( name: "VSCFoundation", url: "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v\(version)/VSCFoundation.xcframework.zip", @@ -35,7 +35,7 @@ let vscPythiaBinaryTarget = { if (useLocalBinaries) { return Target.binaryTarget(name: "VSCPythia", path: "binaries//VSCPythia.xcframework.zip") } else { - let vscPythiaChecksum = "30e61166b400aaccc46c016c1d2e6db490311fbf07dfde081406ca2f69a53560" + let vscPythiaChecksum = "6d5fde11d0ff1c531a7943006a4b1816e37135ea5692f60f47497b9049a649b5" return Target.binaryTarget( name: "VSCPythia", url: "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v\(version)/VSCPythia.xcframework.zip", @@ -48,7 +48,7 @@ let vscRatchetBinaryTarget = { if (useLocalBinaries) { return Target.binaryTarget(name: "VSCRatchet", path: "binaries//VSCRatchet.xcframework.zip") } else { - let vscRatchetChecksum = "632f5ea5f696870c0433fdb0d39f921d495057988ad28c9b65ec8170007eefc6" + let vscRatchetChecksum = "31e8e7ed15c7596262546b53ec36622876f2025f855799e22346d3bf13c0291a" return Target.binaryTarget( name: "VSCRatchet", url: "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v\(version)/VSCRatchet.xcframework.zip", diff --git a/VERSION b/VERSION index c5523bd09..7cca7711a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.17.0 +0.17.1 diff --git a/VSCCrypto.podspec b/VSCCrypto.podspec index 482d832ef..1bd84d044 100644 --- a/VSCCrypto.podspec +++ b/VSCCrypto.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "VSCCrypto" - s.version = "0.17.0" + s.version = "0.17.1" s.license = { :type => "BSD", :file => "VSCCrypto-XCFrameworks/LICENSE" } s.summary = "Contains basic c functions classes for creating key pairs, encrypting/decrypting data, signing data and verifying signatures." s.homepage = "https://github.com/VirgilSecurity/virgil-crypto-c" diff --git a/VirgilCryptoFoundation.podspec b/VirgilCryptoFoundation.podspec index 3e00f0fd0..846f9307a 100644 --- a/VirgilCryptoFoundation.podspec +++ b/VirgilCryptoFoundation.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "VirgilCryptoFoundation" - s.version = "0.17.0" + s.version = "0.17.1" s.swift_version = "5.0" s.license = { :type => "BSD", :file => "LICENSE" } s.summary = "Contains basic swift classes for creating key pairs, encrypting/decrypting data, signing data and verifying signatures." @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.watchos.deployment_target = "4.0" s.public_header_files = "wrappers/swift/VirgilCrypto/VirgilCryptoFoundation/VirgilCryptoFoundation.h" s.source_files = "wrappers/swift/VirgilCrypto/VirgilCryptoFoundation/**/*.{h,mm,swift}" - s.dependency "VSCCrypto/Common", "= 0.17.0" - s.dependency "VSCCrypto/Foundation", "= 0.17.0" + s.dependency "VSCCrypto/Common", "= 0.17.1" + s.dependency "VSCCrypto/Foundation", "= 0.17.1" end diff --git a/VirgilCryptoPythia.podspec b/VirgilCryptoPythia.podspec index 37e0f80f3..bf1893ec4 100644 --- a/VirgilCryptoPythia.podspec +++ b/VirgilCryptoPythia.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "VirgilCryptoPythia" - s.version = "0.17.0" + s.version = "0.17.1" s.swift_version = "5.0" s.license = { :type => "BSD", :file => "LICENSE" } s.summary = "Contains swift classes working with Pythia crypto." @@ -13,8 +13,8 @@ Pod::Spec.new do |s| s.watchos.deployment_target = "4.0" s.public_header_files = "wrappers/swift/VirgilCrypto/VirgilCryptoPythia/VirgilCryptoPythia.h" s.source_files = "wrappers/swift/VirgilCrypto/VirgilCryptoPythia/**/*.{h,mm,swift}" - s.dependency "VirgilCryptoFoundation", "= 0.17.0" - s.dependency "VSCCrypto/Common", "= 0.17.0" - s.dependency "VSCCrypto/Foundation", "= 0.17.0" - s.dependency "VSCCrypto/Pythia", "= 0.17.0" + s.dependency "VirgilCryptoFoundation", "= 0.17.1" + s.dependency "VSCCrypto/Common", "= 0.17.1" + s.dependency "VSCCrypto/Foundation", "= 0.17.1" + s.dependency "VSCCrypto/Pythia", "= 0.17.1" end diff --git a/VirgilCryptoRatchet.podspec b/VirgilCryptoRatchet.podspec index ccfd32c04..e185a9d6d 100644 --- a/VirgilCryptoRatchet.podspec +++ b/VirgilCryptoRatchet.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "VirgilCryptoRatchet" - s.version = "0.17.0" + s.version = "0.17.1" s.swift_version = "5.0" s.license = { :type => "BSD", :file => "LICENSE" } s.summary = "Contains swift for double ratchet crypto operations." @@ -13,8 +13,8 @@ Pod::Spec.new do |s| s.watchos.deployment_target = "4.0" s.public_header_files = "wrappers/swift/VirgilCrypto/VirgilCryptoRatchet/VirgilCryptoRatchet.h" s.source_files = "wrappers/swift/VirgilCrypto/VirgilCryptoRatchet/**/*.{h,mm,swift}" - s.dependency "VirgilCryptoFoundation", "= 0.17.0" - s.dependency "VSCCrypto/Common", "= 0.17.0" - s.dependency "VSCCrypto/Foundation", "= 0.17.0" - s.dependency "VSCCrypto/Ratchet", "= 0.17.0" + s.dependency "VirgilCryptoFoundation", "= 0.17.1" + s.dependency "VSCCrypto/Common", "= 0.17.1" + s.dependency "VSCCrypto/Foundation", "= 0.17.1" + s.dependency "VSCCrypto/Ratchet", "= 0.17.1" end diff --git a/binaries/VSCCommon.xcframework.zip b/binaries/VSCCommon.xcframework.zip index 6c5d7825f..271b4c923 100644 Binary files a/binaries/VSCCommon.xcframework.zip and b/binaries/VSCCommon.xcframework.zip differ diff --git a/binaries/VSCCommon.xcframework.zip.sha256sum b/binaries/VSCCommon.xcframework.zip.sha256sum index c4fbc685f..e2bd081fe 100644 --- a/binaries/VSCCommon.xcframework.zip.sha256sum +++ b/binaries/VSCCommon.xcframework.zip.sha256sum @@ -1 +1 @@ -bb476008c212720ee878efdb5c8fb8b763a8573ca4dd0531edb3a62a4f812ca5 +99193a9c8a71cebcaadf282ac2f4d5d398f1dee8567799d6a0cdd3e3d63ba1a3 diff --git a/binaries/VSCCrypto.xcframework.zip b/binaries/VSCCrypto.xcframework.zip index 1bc443808..d5c745d3c 100644 Binary files a/binaries/VSCCrypto.xcframework.zip and b/binaries/VSCCrypto.xcframework.zip differ diff --git a/binaries/VSCCrypto.xcframework.zip.sha256sum b/binaries/VSCCrypto.xcframework.zip.sha256sum index a05b1102e..eeba24fe0 100644 --- a/binaries/VSCCrypto.xcframework.zip.sha256sum +++ b/binaries/VSCCrypto.xcframework.zip.sha256sum @@ -1 +1 @@ -47fde4ca8cfb7dfb2a19bf9b671846a3dd3caa53b2d76ba269c33a1ec665f36b +3ba14650471da2dd64f04746c5f5c37ecd6394342c4a8a07f188558a61c39e01 diff --git a/binaries/VSCFoundation.xcframework.zip b/binaries/VSCFoundation.xcframework.zip index ecd8cb083..6d56b5e51 100644 Binary files a/binaries/VSCFoundation.xcframework.zip and b/binaries/VSCFoundation.xcframework.zip differ diff --git a/binaries/VSCFoundation.xcframework.zip.sha256sum b/binaries/VSCFoundation.xcframework.zip.sha256sum index bc5c98382..0b5bb29f7 100644 --- a/binaries/VSCFoundation.xcframework.zip.sha256sum +++ b/binaries/VSCFoundation.xcframework.zip.sha256sum @@ -1 +1 @@ -fe21fa73c6098f22d7451a5504adc45be575c6e781fea91616c27ec00c4c0a0a +b38a85c73b033dc62b55e1d7c7e4988504176b451fd2e87eaad86b616921276a diff --git a/binaries/VSCPythia.xcframework.zip b/binaries/VSCPythia.xcframework.zip index 93f942942..67f7c4616 100644 Binary files a/binaries/VSCPythia.xcframework.zip and b/binaries/VSCPythia.xcframework.zip differ diff --git a/binaries/VSCPythia.xcframework.zip.sha256sum b/binaries/VSCPythia.xcframework.zip.sha256sum index 36426c474..375c29b19 100644 --- a/binaries/VSCPythia.xcframework.zip.sha256sum +++ b/binaries/VSCPythia.xcframework.zip.sha256sum @@ -1 +1 @@ -30e61166b400aaccc46c016c1d2e6db490311fbf07dfde081406ca2f69a53560 +6d5fde11d0ff1c531a7943006a4b1816e37135ea5692f60f47497b9049a649b5 diff --git a/binaries/VSCRatchet.xcframework.zip b/binaries/VSCRatchet.xcframework.zip index 7cf2cd990..7f39a456d 100644 Binary files a/binaries/VSCRatchet.xcframework.zip and b/binaries/VSCRatchet.xcframework.zip differ diff --git a/binaries/VSCRatchet.xcframework.zip.sha256sum b/binaries/VSCRatchet.xcframework.zip.sha256sum index 370062bc0..f8ced0fad 100644 --- a/binaries/VSCRatchet.xcframework.zip.sha256sum +++ b/binaries/VSCRatchet.xcframework.zip.sha256sum @@ -1 +1 @@ -632f5ea5f696870c0433fdb0d39f921d495057988ad28c9b65ec8170007eefc6 +31e8e7ed15c7596262546b53ec36622876f2025f855799e22346d3bf13c0291a diff --git a/carthage-specs/VSCCommon.json b/carthage-specs/VSCCommon.json index f82ec34dc..dd264e139 100644 --- a/carthage-specs/VSCCommon.json +++ b/carthage-specs/VSCCommon.json @@ -1,3 +1,3 @@ { - "0.17.0": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.0/VSCCommon.xcframework.zip" + "0.17.1": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.1/VSCCommon.xcframework.zip" } diff --git a/carthage-specs/VSCFoundation.json b/carthage-specs/VSCFoundation.json index 4d49387ea..84d5814fc 100644 --- a/carthage-specs/VSCFoundation.json +++ b/carthage-specs/VSCFoundation.json @@ -1,3 +1,3 @@ { - "0.17.0": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.0/VSCFoundation.xcframework.zip" + "0.17.1": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.1/VSCFoundation.xcframework.zip" } diff --git a/carthage-specs/VSCPythia.json b/carthage-specs/VSCPythia.json index a8fe906d1..eb5cfab25 100644 --- a/carthage-specs/VSCPythia.json +++ b/carthage-specs/VSCPythia.json @@ -1,3 +1,3 @@ { - "0.17.0": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.0/VSCPythia.xcframework.zip" + "0.17.1": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.1/VSCPythia.xcframework.zip" } diff --git a/carthage-specs/VSCRatchet.json b/carthage-specs/VSCRatchet.json index 45dd6a047..534bd9914 100644 --- a/carthage-specs/VSCRatchet.json +++ b/carthage-specs/VSCRatchet.json @@ -1,3 +1,3 @@ { - "0.17.0": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.0/VSCRatchet.xcframework.zip" + "0.17.1": "https://github.com/VirgilSecurity/virgil-crypto-c/releases/download/v0.17.1/VSCRatchet.xcframework.zip" } diff --git a/codegen/main.xml b/codegen/main.xml index bdbe1cc95..76fec1b22 100644 --- a/codegen/main.xml +++ b/codegen/main.xml @@ -42,7 +42,7 @@ - + diff --git a/codegen/models/project_common/project_common.xml b/codegen/models/project_common/project_common.xml index 702d9685f..28c3be3aa 100644 --- a/codegen/models/project_common/project_common.xml +++ b/codegen/models/project_common/project_common.xml @@ -9,7 +9,7 @@ wrappers="python" > - + Copyright (C) 2015-2022 Virgil Security, Inc. diff --git a/codegen/models/project_foundation/project_foundation.xml b/codegen/models/project_foundation/project_foundation.xml index b2674d424..cdc6d5922 100644 --- a/codegen/models/project_foundation/project_foundation.xml +++ b/codegen/models/project_foundation/project_foundation.xml @@ -9,7 +9,7 @@ wrappers="swift,java,python,wasm,go,php" > - + Copyright (C) 2015-2022 Virgil Security, Inc. diff --git a/codegen/models/project_phe/project_phe.xml b/codegen/models/project_phe/project_phe.xml index 80871f75c..f8cc4be2d 100644 --- a/codegen/models/project_phe/project_phe.xml +++ b/codegen/models/project_phe/project_phe.xml @@ -9,7 +9,7 @@ wrappers="java,python,wasm,go,php" > - + Copyright (C) 2015-2022 Virgil Security, Inc. diff --git a/codegen/models/project_pythia/project_pythia.xml b/codegen/models/project_pythia/project_pythia.xml index dec3b75b1..e77f33814 100644 --- a/codegen/models/project_pythia/project_pythia.xml +++ b/codegen/models/project_pythia/project_pythia.xml @@ -9,7 +9,7 @@ wrappers="java,swift,python,wasm,php" > - + Copyright (C) 2015-2022 Virgil Security, Inc. diff --git a/codegen/models/project_ratchet/project_ratchet.xml b/codegen/models/project_ratchet/project_ratchet.xml index 9bf005f07..b077a4c21 100644 --- a/codegen/models/project_ratchet/project_ratchet.xml +++ b/codegen/models/project_ratchet/project_ratchet.xml @@ -9,7 +9,7 @@ wrappers="java,swift,wasm" > - + Copyright (C) 2015-2022 Virgil Security, Inc. diff --git a/library/common/include/virgil/crypto/common/vsc_library.h b/library/common/include/virgil/crypto/common/vsc_library.h index 3cdb483ac..95492c179 100644 --- a/library/common/include/virgil/crypto/common/vsc_library.h +++ b/library/common/include/virgil/crypto/common/vsc_library.h @@ -118,7 +118,7 @@ extern "C" { #define VSC_VERSION_MINOR 17 -#define VSC_VERSION_PATCH 0 +#define VSC_VERSION_PATCH 1 #define VSC_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch)) diff --git a/library/foundation/include/virgil/crypto/foundation/vscf_library.h b/library/foundation/include/virgil/crypto/foundation/vscf_library.h index a6e828503..6275a9b24 100644 --- a/library/foundation/include/virgil/crypto/foundation/vscf_library.h +++ b/library/foundation/include/virgil/crypto/foundation/vscf_library.h @@ -118,7 +118,7 @@ extern "C" { #define VSCF_VERSION_MINOR 17 -#define VSCF_VERSION_PATCH 0 +#define VSCF_VERSION_PATCH 1 #define VSCF_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch)) diff --git a/library/phe/include/virgil/crypto/phe/vsce_library.h b/library/phe/include/virgil/crypto/phe/vsce_library.h index adb1c63f8..51874a5d6 100644 --- a/library/phe/include/virgil/crypto/phe/vsce_library.h +++ b/library/phe/include/virgil/crypto/phe/vsce_library.h @@ -118,7 +118,7 @@ extern "C" { #define VSCE_VERSION_MINOR 17 -#define VSCE_VERSION_PATCH 0 +#define VSCE_VERSION_PATCH 1 #define VSCE_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch)) diff --git a/library/pythia/CMakeLists.txt b/library/pythia/CMakeLists.txt index 40ee9627f..a817846f5 100644 --- a/library/pythia/CMakeLists.txt +++ b/library/pythia/CMakeLists.txt @@ -96,6 +96,7 @@ target_sources(pythia ${CMAKE_CURRENT_LIST_DIR}/src/pythia_buf_exports.h ${CMAKE_CURRENT_LIST_DIR}/src/pythia_buf_sizes_c.h ${CMAKE_CURRENT_LIST_DIR}/src/pythia_c.h + ${CMAKE_CURRENT_LIST_DIR}/src/pythia_init_c.h ${CMAKE_CURRENT_LIST_DIR}/src/pythia_buf.c ${CMAKE_CURRENT_LIST_DIR}/src/pythia_buf_exports.c diff --git a/library/pythia/include/virgil/crypto/pythia/vscp_library.h b/library/pythia/include/virgil/crypto/pythia/vscp_library.h index f27f6d345..b207e2172 100644 --- a/library/pythia/include/virgil/crypto/pythia/vscp_library.h +++ b/library/pythia/include/virgil/crypto/pythia/vscp_library.h @@ -118,7 +118,7 @@ extern "C" { #define VSCP_VERSION_MINOR 17 -#define VSCP_VERSION_PATCH 0 +#define VSCP_VERSION_PATCH 1 #define VSCP_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch)) diff --git a/library/pythia/src/pythia_buf_exports.c b/library/pythia/src/pythia_buf_exports.c index 11a3d0ecf..5d2aab6d4 100644 --- a/library/pythia/src/pythia_buf_exports.c +++ b/library/pythia/src/pythia_buf_exports.c @@ -17,7 +17,6 @@ #include #include -#include #include #include "pythia_buf.h" #include "pythia_buf_exports.h" @@ -25,13 +24,13 @@ static void check_size_read(const pythia_buf_t *buf, size_t min_size, size_t max_size) { if (!buf || buf->len < min_size || buf->len > max_size) - RLC_THROW(ERR_NO_BUFFER); + THROW(ERR_NO_BUFFER); } static void check_size_write(const pythia_buf_t *buf, size_t min_size) { if (!buf || buf->allocated < min_size) - RLC_THROW(ERR_NO_BUFFER); + THROW(ERR_NO_BUFFER); } void @@ -40,8 +39,8 @@ bn_read_buf(bn_t b, const pythia_buf_t *buf) { uint8_t sign = buf->p[0]; - if (sign != RLC_POS && sign != RLC_NEG) - RLC_THROW(ERR_NO_VALID); + if (sign != BN_POS && sign != BN_NEG) + THROW(ERR_NO_VALID); bn_read_bin(b, buf->p + 1, (int)(buf->len - 1)); b->sign = sign; @@ -57,7 +56,7 @@ gt_read_buf(gt_t g, const pythia_buf_t *buf) { zeroBytes += buf->p[i] == 0; } if (zeroBytes > 24) - RLC_THROW(ERR_NO_VALID); + THROW(ERR_NO_VALID); gt_read_bin(g, buf->p, (int)buf->len); } @@ -67,7 +66,7 @@ g1_read_buf(g1_t g, const pythia_buf_t *buf) { check_size_read(buf, 1, PYTHIA_G1_BUF_SIZE); g1_read_bin(g, buf->p, (int)buf->len); if (!g1_is_valid(g)) - RLC_THROW(ERR_NO_VALID); + THROW(ERR_NO_VALID); } void @@ -75,7 +74,7 @@ g2_read_buf(g2_t g, const pythia_buf_t *buf) { check_size_read(buf, 1, PYTHIA_G2_BUF_SIZE); g2_read_bin(g, buf->p, (int)buf->len); if (!g2_is_valid(g)) - RLC_THROW(ERR_NO_VALID); + THROW(ERR_NO_VALID); } void diff --git a/library/pythia/src/pythia_buf_sizes_c.h b/library/pythia/src/pythia_buf_sizes_c.h index 5722cd0d0..b478f2ec7 100644 --- a/library/pythia/src/pythia_buf_sizes_c.h +++ b/library/pythia/src/pythia_buf_sizes_c.h @@ -20,11 +20,11 @@ #include -#define DEF_PYTHIA_G1_BUF_SIZE RLC_FP_BYTES + 1 +#define DEF_PYTHIA_G1_BUF_SIZE FP_BYTES + 1 -#define DEF_PYTHIA_G2_BUF_SIZE 2 * RLC_FP_BYTES + 1 +#define DEF_PYTHIA_G2_BUF_SIZE 2 * FP_BYTES + 1 -#define DEF_PYTHIA_GT_BUF_SIZE 8 * RLC_FP_BYTES +#define DEF_PYTHIA_GT_BUF_SIZE 8 * FP_BYTES #define DEF_PYTHIA_BN_BUF_SIZE DEF_PYTHIA_G1_BUF_SIZE + 1 diff --git a/library/pythia/src/pythia_c.c b/library/pythia/src/pythia_c.c index 921ecd528..93da23b74 100644 --- a/library/pythia/src/pythia_c.c +++ b/library/pythia/src/pythia_c.c @@ -15,38 +15,33 @@ * along with this program. If not, see . */ +#include #include "pythia_c.h" #include "pythia_init.h" +#include "pythia_init_c.h" #include "pythia_buf_sizes_c.h" -#include -#include - -#if MULTI == PTHREAD -#define thread __thread -#else -#define thread /* */ -#endif - -static __thread bn_t g1_ord; -static __thread g1_t g1_gen; -static __thread bn_t gt_ord; -static __thread gt_t gt_gen; +static bn_t g1_ord; +static g1_t g1_gen; +static bn_t gt_ord; +static gt_t gt_gen; int pythia_init(const pythia_init_args_t *init_args) { if (core_get()) return 0; - if (core_init() != RLC_OK) + if (core_init() != STS_OK) return -1; + pythia_err_init(); + if (!init_args || !init_args->callback) return -1; rand_seed(init_args->callback, init_args->args); - if (ep_param_set_any_pairf() != RLC_OK) + if (ep_param_set_any_pairf() != STS_OK) return -1; bn_null(g1_ord); @@ -54,7 +49,7 @@ pythia_init(const pythia_init_args_t *init_args) { bn_null(gt_ord); gt_null(gt_gen); - RLC_TRY { + TRY { bn_new(g1_ord); g1_get_ord(g1_ord); @@ -67,7 +62,7 @@ pythia_init(const pythia_init_args_t *init_args) { gt_new(gt_gen); gt_get_gen(gt_gen); } - RLC_CATCH_ANY { + CATCH_ANY { gt_free(gt_gen); bn_free(gt_ord); g1_free(g1_gen); @@ -89,10 +84,15 @@ pythia_deinit(void) { bn_free(g1_ord); } +void +pythia_err_init(void) { + err_core_reset_default(); +} + static void random_bn_mod(bn_t r, bn_t max) { if (!max) { - bn_rand(r, RLC_POS, 256); + bn_rand(r, BN_POS, 256); } else { bn_rand_mod(r, max); } @@ -111,13 +111,13 @@ hashG2(g2_t g2, const uint8_t *msg, size_t msg_size) { static void compute_kw(bn_t kw, const uint8_t *w, size_t w_size, const uint8_t *msk, size_t msk_size, const uint8_t *s, size_t s_size) { - uint8_t mac[RLC_MD_LEN]; + uint8_t mac[MD_LEN]; uint8_t *zw = NULL; bn_t b; bn_null(b); - RLC_TRY { + TRY { zw = calloc(s_size + w_size, sizeof(uint8_t)); memcpy(zw, s, s_size); memcpy(zw + s_size, w, w_size); @@ -125,14 +125,14 @@ compute_kw(bn_t kw, const uint8_t *w, size_t w_size, const uint8_t *msk, size_t md_hmac(mac, zw, (int)(s_size + w_size), msk, (int)msk_size); bn_new(b); - bn_read_bin(b, mac, RLC_MD_LEN); + bn_read_bin(b, mac, MD_LEN); bn_mod(kw, b, gt_ord); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { bn_free(b); free(zw); } @@ -143,16 +143,16 @@ gt_pow(gt_t res, gt_t a, bn_t exp) { bn_t e; bn_null(e); - RLC_TRY { + TRY { bn_new(e); bn_mod(e, exp, gt_ord); gt_exp(res, a, e); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { bn_free(e); } } @@ -162,16 +162,16 @@ scalar_mul_g1(g1_t r, const g1_t p, bn_t a) { bn_t mod; bn_null(mod); - RLC_TRY { + TRY { bn_new(mod); bn_mod(mod, a, g1_ord); g1_mul(r, p, mod); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { bn_free(mod); } } @@ -191,7 +191,7 @@ hashZ(bn_t hash, const uint8_t *const *args, size_t args_size, const size_t *arg const uint8_t tag_msg[31] = "TAG_RELIC_HASH_ZMESSAGE_HASH_Z"; uint8_t *c = NULL; - RLC_TRY { + TRY { size_t total_size = 0; for (size_t i = 0; i < args_size; i++) total_size += args_sizes[i]; @@ -204,15 +204,15 @@ hashZ(bn_t hash, const uint8_t *const *args, size_t args_size, const size_t *arg p += args_sizes[i]; } - uint8_t mac[RLC_MD_LEN]; + uint8_t mac[MD_LEN]; md_hmac(mac, c, (int)total_size, tag_msg, 31); - bn_read_bin(hash, mac, RLC_MD_LEN_SH256); // We need only 256 bits from that number + bn_read_bin(hash, mac, MD_LEN_SH256); // We need only 256 bits from that number } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { free(c); } } @@ -220,7 +220,7 @@ hashZ(bn_t hash, const uint8_t *const *args, size_t args_size, const size_t *arg static void check_size(size_t size, size_t min_size, size_t max_size) { if (size < min_size || size > max_size) - RLC_THROW(ERR_NO_VALID); + THROW(ERR_NO_VALID); } void @@ -246,14 +246,14 @@ pythia_blind(const uint8_t *m, size_t m_size, g1_t x, bn_t rInv) { g1_t g1; g1_null(g1); - RLC_TRY { + TRY { bn_new(r); bn_new(gcd); random_bn_mod(r, NULL); bn_gcd_ext(gcd, rInv, NULL, r, g1_ord); - if (bn_cmp_dig(gcd, (dig_t)1) != RLC_EQ) { - RLC_THROW(ERR_NO_VALID); + if (bn_cmp_dig(gcd, (dig_t)1) != CMP_EQ) { + THROW(ERR_NO_VALID); } g1_new(g1); @@ -261,10 +261,10 @@ pythia_blind(const uint8_t *m, size_t m_size, g1_t x, bn_t rInv) { g1_mul(x, g1, r); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { g1_free(g1); bn_free(gcd); bn_free(r); @@ -273,13 +273,13 @@ pythia_blind(const uint8_t *m, size_t m_size, g1_t x, bn_t rInv) { void pythia_deblind(gt_t y, bn_t rInv, gt_t u) { - RLC_TRY { + TRY { gt_pow(u, y, rInv); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { } } @@ -290,7 +290,7 @@ pythia_eval(g1_t x, const uint8_t *t, size_t t_size, bn_t kw, gt_t y, g2_t tTild g1_t xKw; g1_null(xKw); - RLC_TRY { + TRY { hashG2(tTilde, t, t_size); g1_new(xKw); @@ -298,10 +298,10 @@ pythia_eval(g1_t x, const uint8_t *t, size_t t_size, bn_t kw, gt_t y, g2_t tTild pc_map(y, xKw, tTilde); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { g1_free(xKw); } } @@ -324,7 +324,7 @@ pythia_prove(gt_t y, g1_t x, g2_t tTilde, bn_t kw, g1_t pi_p, bn_t pi_c, bn_t pi bn_t vscpkw; bn_null(vscpkw); - RLC_TRY { + TRY { gt_new(beta); pc_map(beta, x, tTilde); @@ -374,10 +374,10 @@ pythia_prove(gt_t y, g1_t x, g2_t tTilde, bn_t kw, g1_t pi_p, bn_t pi_c, bn_t pi bn_mod(pi_u, vscpkw, gt_ord); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { bn_free(vscpkw); bn_free(cpkw); @@ -421,7 +421,7 @@ pythia_verify(gt_t y, g1_t x, const uint8_t *t, size_t t_size, g1_t pi_p, bn_t p bn_t cPrime; bn_null(cPrime); - RLC_TRY { + TRY { g2_new(tTilde); hashG2(tTilde, t, t_size); @@ -477,12 +477,12 @@ pythia_verify(gt_t y, g1_t x, const uint8_t *t, size_t t_size, g1_t pi_p, bn_t p bn_new(cPrime); hashZ(cPrime, args, 6, args_sizes); - *verified = bn_cmp(cPrime, pi_c) == RLC_EQ; + *verified = bn_cmp(cPrime, pi_c) == CMP_EQ; } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { bn_free(cPrime) free(q_bin); @@ -512,13 +512,13 @@ get_delta(bn_t kw0, bn_t kw1, bn_t delta) { bn_t kw1kw0Inv; bn_null(kw1kw0Inv); - RLC_TRY { + TRY { bn_new(kw0Inv); bn_new(gcd); bn_gcd_ext(gcd, kw0Inv, NULL, kw0, gt_ord); - if (bn_cmp_dig(gcd, (dig_t)1) != RLC_EQ) { - RLC_THROW(ERR_NO_VALID); + if (bn_cmp_dig(gcd, (dig_t)1) != CMP_EQ) { + THROW(ERR_NO_VALID); } bn_new(kw1kw0Inv); @@ -526,10 +526,10 @@ get_delta(bn_t kw0, bn_t kw1, bn_t delta) { bn_mod(delta, kw1kw0Inv, gt_ord); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { bn_free(kw1kw0Inv); bn_free(gcd); bn_free(kw0Inv); @@ -538,12 +538,12 @@ get_delta(bn_t kw0, bn_t kw1, bn_t delta) { void pythia_update_with_delta(gt_t u0, bn_t delta, gt_t u1) { - RLC_TRY { + TRY { gt_pow(u1, u0, delta); } - RLC_CATCH_ANY { - RLC_THROW(ERR_CAUGHT); + CATCH_ANY { + THROW(ERR_CAUGHT); } - RLC_FINALLY { + FINALLY { } } diff --git a/library/pythia/src/pythia_init_c.h b/library/pythia/src/pythia_init_c.h new file mode 100644 index 000000000..6410ef7b3 --- /dev/null +++ b/library/pythia/src/pythia_init_c.h @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2015-2018 Virgil Security Inc. + + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef PYTHIA_PYTHIA_INIT_C_H +#define PYTHIA_PYTHIA_INIT_C_H + +#ifdef __cplusplus +extern "C" { +#endif + +void +pythia_err_init(void); + +#ifdef __cplusplus +} +#endif + +#endif // PYTHIA_PYTHIA_INIT_C_H diff --git a/library/pythia/src/pythia_wrapper.c b/library/pythia/src/pythia_wrapper.c index 34b9c5624..46e816475 100644 --- a/library/pythia/src/pythia_wrapper.c +++ b/library/pythia/src/pythia_wrapper.c @@ -18,19 +18,21 @@ #include "pythia_c.h" #include "pythia_buf_exports.h" #include "pythia_init.h" +#include "pythia_init_c.h" #include "pythia_wrapper.h" #include int pythia_w_blind(const pythia_buf_t *password, pythia_buf_t *blinded_password, pythia_buf_t *blinding_secret) { + pythia_err_init(); g1_t blinded_ep; g1_null(blinded_ep); bn_t rInv_bn; bn_null(rInv_bn); - RLC_TRY { + TRY { g1_new(blinded_ep); bn_new(rInv_bn); @@ -39,10 +41,12 @@ pythia_w_blind(const pythia_buf_t *password, pythia_buf_t *blinded_password, pyt g1_write_buf(blinded_password, blinded_ep); bn_write_buf(blinding_secret, rInv_bn); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { bn_free(rInv_bn); g1_free(blinded_ep); } @@ -53,6 +57,7 @@ pythia_w_blind(const pythia_buf_t *password, pythia_buf_t *blinded_password, pyt int pythia_w_deblind(const pythia_buf_t *transformed_password, const pythia_buf_t *blinding_secret, pythia_buf_t *deblinded_password) { + pythia_err_init(); gt_t a_gt; gt_null(a_gt); @@ -61,7 +66,7 @@ pythia_w_deblind(const pythia_buf_t *transformed_password, const pythia_buf_t *b bn_t rInv_bn; bn_null(rInv_bn); - RLC_TRY { + TRY { gt_new(a_gt); gt_new(y_gt); gt_read_buf(y_gt, transformed_password); @@ -73,10 +78,12 @@ pythia_w_deblind(const pythia_buf_t *transformed_password, const pythia_buf_t *b gt_write_buf(deblinded_password, a_gt); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { bn_free(rInv_bn); gt_free(y_gt); gt_free(a_gt); @@ -89,13 +96,14 @@ int pythia_w_compute_transformation_key_pair(const pythia_buf_t *transformation_key_id, const pythia_buf_t *pythia_secret, const pythia_buf_t *pythia_scope_secret, pythia_buf_t *transformation_private_key, pythia_buf_t *transformation_public_key) { + pythia_err_init(); bn_t kw; bn_null(kw); g1_t pi_p; g1_null(pi_p); - RLC_TRY { + TRY { bn_new(kw); g1_new(pi_p); @@ -105,10 +113,12 @@ pythia_w_compute_transformation_key_pair(const pythia_buf_t *transformation_key_ bn_write_buf(transformation_private_key, kw); g1_write_buf(transformation_public_key, pi_p); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { bn_free(kw); g1_free(pi_p); } @@ -120,6 +130,7 @@ int pythia_w_transform(const pythia_buf_t *blinded_password, const pythia_buf_t *tweak, const pythia_buf_t *transformation_private_key, pythia_buf_t *transformed_password, pythia_buf_t *transformed_tweak) { + pythia_err_init(); gt_t y_gt; gt_null(y_gt); @@ -130,7 +141,7 @@ pythia_w_transform(const pythia_buf_t *blinded_password, const pythia_buf_t *twe g1_t x_ep; g1_null(x_ep); - RLC_TRY { + TRY { gt_new(y_gt); bn_new(kw_bn); g2_new(tTilde_g2); @@ -144,10 +155,12 @@ pythia_w_transform(const pythia_buf_t *blinded_password, const pythia_buf_t *twe gt_write_buf(transformed_password, y_gt); g2_write_buf(transformed_tweak, tTilde_g2); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { g1_free(x_ep); g2_free(tTilde_g2); bn_free(kw_bn); @@ -161,6 +174,7 @@ int pythia_w_prove(const pythia_buf_t *transformed_password, const pythia_buf_t *blinded_password, const pythia_buf_t *transformed_tweak, const pythia_buf_t *transformation_private_key, const pythia_buf_t *transformation_public_key, pythia_buf_t *proof_value_c, pythia_buf_t *proof_value_u) { + pythia_err_init(); g1_t pi_p; g1_null(pi_p); @@ -177,7 +191,7 @@ pythia_w_prove(const pythia_buf_t *transformed_password, const pythia_buf_t *bli gt_t y_gt; gt_null(y_gt); - RLC_TRY { + TRY { g1_new(x_g1); g1_read_buf(x_g1, blinded_password); @@ -200,10 +214,12 @@ pythia_w_prove(const pythia_buf_t *transformed_password, const pythia_buf_t *bli bn_write_buf(proof_value_c, c_bn); bn_write_buf(proof_value_u, u_bn); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { g1_free(pi_p); gt_free(y_gt); bn_free(kw_bn); @@ -220,6 +236,7 @@ int pythia_w_verify(const pythia_buf_t *transformed_password, const pythia_buf_t *blinded_password, const pythia_buf_t *tweak, const pythia_buf_t *transformation_public_key, const pythia_buf_t *proof_value_c, const pythia_buf_t *proof_value_u, int *verified) { + pythia_err_init(); g1_t x_g1; g1_null(x_g1); @@ -232,7 +249,7 @@ pythia_w_verify(const pythia_buf_t *transformed_password, const pythia_buf_t *bl bn_t u_bn; bn_null(u_bn); - RLC_TRY { + TRY { g1_new(x_g1); g1_read_buf(x_g1, blinded_password); @@ -250,10 +267,12 @@ pythia_w_verify(const pythia_buf_t *transformed_password, const pythia_buf_t *bl pythia_verify(y_gt, x_g1, tweak->p, tweak->len, p_g1, c_bn, u_bn, verified); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { gt_free(y_gt); g1_free(x_g1); bn_free(u_bn); @@ -267,6 +286,7 @@ pythia_w_verify(const pythia_buf_t *transformed_password, const pythia_buf_t *bl int pythia_w_get_password_update_token(const pythia_buf_t *previous_transformation_private_key, const pythia_buf_t *new_transformation_private_key, pythia_buf_t *password_update_token) { + pythia_err_init(); bn_t delta_bn; bn_null(delta_bn); @@ -275,7 +295,7 @@ pythia_w_get_password_update_token(const pythia_buf_t *previous_transformation_p bn_t kw1; bn_null(kw1); - RLC_TRY { + TRY { bn_new(kw0); bn_read_buf(kw0, previous_transformation_private_key); @@ -287,10 +307,12 @@ pythia_w_get_password_update_token(const pythia_buf_t *previous_transformation_p bn_write_buf(password_update_token, delta_bn); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { bn_free(delta_bn); bn_free(kw0); bn_free(kw1); @@ -302,6 +324,7 @@ pythia_w_get_password_update_token(const pythia_buf_t *previous_transformation_p int pythia_w_update_deblinded_with_token(const pythia_buf_t *deblinded_password, const pythia_buf_t *password_update_token, pythia_buf_t *updated_deblinded_password) { + pythia_err_init(); gt_t r_gt; gt_null(r_gt); @@ -310,7 +333,7 @@ pythia_w_update_deblinded_with_token(const pythia_buf_t *deblinded_password, con bn_t delta_bn; bn_null(delta_bn); - RLC_TRY { + TRY { gt_new(r_gt); gt_new(z_gt); gt_read_buf(z_gt, deblinded_password); @@ -322,10 +345,12 @@ pythia_w_update_deblinded_with_token(const pythia_buf_t *deblinded_password, con gt_write_buf(updated_deblinded_password, r_gt); } - RLC_CATCH_ANY { + CATCH_ANY { + pythia_err_init(); + return -1; } - RLC_FINALLY { + FINALLY { bn_free(delta_bn); gt_free(z_gt); gt_free(r_gt); diff --git a/library/pythia/src/vscp_pythia.c b/library/pythia/src/vscp_pythia.c index 1a5981ed7..7abac7b74 100644 --- a/library/pythia/src/vscp_pythia.c +++ b/library/pythia/src/vscp_pythia.c @@ -65,9 +65,9 @@ // @end -static __thread bool g_globally_inited = false; -static __thread mbedtls_entropy_context g_entropy; -static __thread mbedtls_ctr_drbg_context g_rng; +static bool g_globally_inited = false; +static mbedtls_entropy_context g_entropy; +static mbedtls_ctr_drbg_context g_rng; // @generated diff --git a/library/ratchet/include/virgil/crypto/ratchet/vscr_library.h b/library/ratchet/include/virgil/crypto/ratchet/vscr_library.h index 0a9b56aab..fec34b8ee 100644 --- a/library/ratchet/include/virgil/crypto/ratchet/vscr_library.h +++ b/library/ratchet/include/virgil/crypto/ratchet/vscr_library.h @@ -118,7 +118,7 @@ extern "C" { #define VSCR_VERSION_MINOR 17 -#define VSCR_VERSION_PATCH 0 +#define VSCR_VERSION_PATCH 1 #define VSCR_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch)) diff --git a/scripts/build_apple_frameworks.sh b/scripts/build_apple_frameworks.sh index e0cd6bfec..1c0ab815a 100755 --- a/scripts/build_apple_frameworks.sh +++ b/scripts/build_apple_frameworks.sh @@ -143,14 +143,14 @@ function build_ios { -DRELIC_USE_PTHREAD=ON \ -DCMAKE_INSTALL_LIBDIR=dev \ -H"${SRC_DIR}" -B"${BUILD_DIR}/dev" - cmake --build "${BUILD_DIR}/dev" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/dev" --target install -- -j$(sysctl -n hw.physicalcpu) cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX="${FRAMEWORKS_DIR}" \ -DAPPLE_PLATFORM=IOS_SIM \ -DRELIC_USE_PTHREAD=OFF \ -DCMAKE_INSTALL_LIBDIR=sim \ -H"${SRC_DIR}" -B"${BUILD_DIR}/sim" - cmake --build "${BUILD_DIR}/sim" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/sim" --target install -- -j$(sysctl -n hw.physicalcpu) show_info "Installed iOS C Frameworks to ${FRAMEWORKS_DIR}" } @@ -169,14 +169,14 @@ function build_tvos { -DRELIC_USE_PTHREAD=ON \ -DCMAKE_INSTALL_LIBDIR=dev \ -H"${SRC_DIR}" -B"${BUILD_DIR}/dev" - cmake --build "${BUILD_DIR}/dev" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/dev" --target install -- -j$(sysctl -n hw.physicalcpu) cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX="${FRAMEWORKS_DIR}" \ -DAPPLE_PLATFORM=TVOS_SIM \ -DRELIC_USE_PTHREAD=ON \ -DCMAKE_INSTALL_LIBDIR=sim \ -H"${SRC_DIR}" -B"${BUILD_DIR}/sim" - cmake --build "${BUILD_DIR}/sim" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/sim" --target install -- -j$(sysctl -n hw.physicalcpu) show_info "Installed tvOS C Frameworks to ${FRAMEWORKS_DIR}" } @@ -195,14 +195,14 @@ function build_watchos { -DRELIC_USE_PTHREAD=ON \ -DCMAKE_INSTALL_LIBDIR=dev \ -H"${SRC_DIR}" -B"${BUILD_DIR}/dev" - cmake --build "${BUILD_DIR}/dev" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/dev" --target install -- -j$(sysctl -n hw.physicalcpu) cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX="${FRAMEWORKS_DIR}" \ -DAPPLE_PLATFORM=WATCHOS_SIM \ -DRELIC_USE_PTHREAD=OFF \ -DCMAKE_INSTALL_LIBDIR=sim \ -H"${SRC_DIR}" -B"${BUILD_DIR}/sim" - cmake --build "${BUILD_DIR}/sim" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/sim" --target install -- -j$(sysctl -n hw.physicalcpu) show_info "Installed watchOS C Frameworks for to ${FRAMEWORKS_DIR}" } @@ -221,7 +221,7 @@ function build_macosx { -DRELIC_USE_PTHREAD=ON \ -DCMAKE_INSTALL_LIBDIR=dev \ -H"${SRC_DIR}" -B"${BUILD_DIR}/dev" - cmake --build "${BUILD_DIR}/dev" --target install -- -j$(nproc) + cmake --build "${BUILD_DIR}/dev" --target install -- -j$(sysctl -n hw.physicalcpu) show_info "Installed macOS C Frameworks to ${FRAMEWORKS_DIR}" } diff --git a/scripts/bumpver.sh b/scripts/bumpver.sh index b09af2ed7..5adb3c02b 100755 --- a/scripts/bumpver.sh +++ b/scripts/bumpver.sh @@ -73,7 +73,7 @@ echo "${VERSION_FULL}" > "${ROOT_DIR}/VERSION" # ########################################################################### show_info "Change version within CMakeLists.txt file." sed_replace "VERSION *[0-9]*\.[0-9]*\.[0-9]" "VERSION ${VERSION}" "${ROOT_DIR}/CMakeLists.txt" -sed_replace "(VIRGIL_CRYPTO_VERSION_LABEL) *\"[a-zA-Z0-9_]*\"" "\1 \"${VERSION_LABEL}\"" "${ROOT_DIR}/CMakeLists.txt" +sed_replace "(VIRGIL_CRYPTO_VERSION_LABEL) *\"[a-zA-Z0-9.]*\"" "\1 \"${VERSION_LABEL}\"" "${ROOT_DIR}/CMakeLists.txt" # ########################################################################### diff --git a/tests/pythia/benchmark_pythia_c.c b/tests/pythia/benchmark_pythia_c.c index b4602ef1b..992259107 100644 --- a/tests/pythia/benchmark_pythia_c.c +++ b/tests/pythia/benchmark_pythia_c.c @@ -26,6 +26,7 @@ #include "pythia.h" #include "pythia_c.h" #include "pythia_init.h" +#include "pythia_init_c.h" #include "vscp_pythia.h" #include @@ -60,7 +61,7 @@ bench1_BlindEvalProveVerify() { bn_t u; bn_null(u); - RLC_TRY { + TRY { g1_new(blinded); bn_new(rInv); @@ -84,10 +85,10 @@ bench1_BlindEvalProveVerify() { pythia_verify(y, blinded, t, 5, pi_p, c, u, &verified); TEST_ASSERT_NOT_EQUAL(verified, 0); } - RLC_CATCH_ANY { + CATCH_ANY { TEST_FAIL(); } - RLC_FINALLY { + FINALLY { bn_free(u); bn_free(c); g1_free(pi_p); diff --git a/tests/pythia/test_pythia_c.c b/tests/pythia/test_pythia_c.c index 657ec544e..526e0d886 100644 --- a/tests/pythia/test_pythia_c.c +++ b/tests/pythia/test_pythia_c.c @@ -25,36 +25,17 @@ #include "pythia_c.h" #include "pythia_init.h" +#include "pythia_init_c.h" #include "vscp_pythia.h" -// clang-format off -static const uint8_t deblinded_bin[384] = { - 0x17, 0xD6, 0x40, 0x4D, 0xB8, 0x6F, 0xB1, 0x84, 0xB3, 0xD6, 0x53, 0xD6, 0xBF, 0xA1, 0xA7, 0xB2, - 0xFE, 0x7C, 0xDB, 0x49, 0x52, 0x34, 0x28, 0x46, 0x0B, 0x9C, 0x1B, 0xB0, 0x42, 0x8D, 0x3F, 0x21, - 0x61, 0xDB, 0xA0, 0xE0, 0xF0, 0x31, 0x4D, 0xCB, 0xFD, 0xC7, 0x6A, 0xAE, 0xD5, 0xAC, 0xC2, 0x5D, - 0x13, 0xC4, 0x34, 0xF9, 0xF3, 0x87, 0xF2, 0x49, 0x92, 0xCF, 0x0C, 0xF2, 0xB2, 0xFA, 0x3E, 0x0D, - 0x14, 0x47, 0xAA, 0xFC, 0xFA, 0x37, 0xC8, 0x8B, 0x3B, 0xAC, 0xD2, 0xA1, 0x5F, 0xAB, 0x24, 0x46, - 0x03, 0x22, 0xEE, 0xE1, 0x52, 0xF5, 0x62, 0x44, 0xEF, 0xA6, 0x29, 0xC5, 0xE7, 0xB3, 0x4C, 0x76, - 0x07, 0x52, 0xBD, 0x23, 0x81, 0x13, 0xAC, 0xF0, 0xDE, 0xE7, 0xE8, 0x99, 0xD3, 0xA8, 0xFF, 0x76, - 0x8C, 0x76, 0x00, 0xD4, 0x50, 0x62, 0x25, 0x68, 0x71, 0x47, 0x08, 0x27, 0x3C, 0xF1, 0x28, 0x63, - 0xB0, 0x7C, 0x53, 0x6F, 0x64, 0x6A, 0xF0, 0x82, 0x2A, 0x3A, 0x41, 0xCD, 0x37, 0x4A, 0xC6, 0x87, - 0x04, 0xF7, 0xDE, 0xDE, 0x5E, 0xF6, 0x44, 0x4F, 0xA8, 0x6B, 0xAE, 0xF0, 0x25, 0x38, 0xB9, 0xEA, - 0x20, 0xDC, 0x6E, 0xC8, 0x2C, 0x37, 0x3B, 0x27, 0x06, 0x99, 0x81, 0xA1, 0x4C, 0x59, 0xCC, 0xD2, - 0x6F, 0xE9, 0x65, 0xDD, 0x70, 0xF5, 0xC6, 0xFB, 0xA1, 0xFD, 0xE6, 0xC8, 0xD4, 0xF6, 0x30, 0x21, - 0x09, 0x08, 0x4F, 0x77, 0xFF, 0x90, 0xB5, 0xB1, 0xB2, 0x49, 0x09, 0x02, 0x21, 0x90, 0xDF, 0xDC, - 0xE2, 0x42, 0x08, 0xF4, 0x6F, 0xF1, 0x6A, 0xB0, 0xD7, 0x2F, 0xAF, 0x3B, 0x0C, 0xBE, 0xEC, 0xFB, - 0x36, 0xB3, 0x76, 0xAD, 0x0F, 0x91, 0x09, 0x64, 0x22, 0x5B, 0x2A, 0x17, 0xE2, 0x4D, 0x87, 0x17, - 0x03, 0x50, 0x7B, 0x39, 0xB6, 0x49, 0x39, 0x94, 0x52, 0xDD, 0xDC, 0xBC, 0x43, 0x77, 0x15, 0xEC, - 0x15, 0xC5, 0xED, 0x5F, 0x8D, 0xB0, 0x6B, 0x29, 0x77, 0x97, 0x9D, 0x53, 0x65, 0xE2, 0x54, 0x51, - 0x10, 0x16, 0xE8, 0x99, 0x29, 0xF8, 0x8E, 0x65, 0x91, 0xD9, 0xCC, 0x88, 0x74, 0x45, 0x7C, 0x60, - 0x15, 0x9F, 0x6E, 0x78, 0x14, 0xAD, 0x4D, 0x01, 0x84, 0xFA, 0x77, 0x33, 0x36, 0x36, 0x6D, 0x59, - 0x44, 0xE2, 0x9E, 0xDB, 0x8A, 0xC2, 0xF7, 0x3F, 0x26, 0x7B, 0x3F, 0xA2, 0xBE, 0xEA, 0x6F, 0xFB, - 0x9E, 0xA2, 0xF0, 0xB7, 0x67, 0x45, 0x2D, 0x65, 0xF4, 0xE6, 0x15, 0x42, 0x7D, 0xA2, 0x07, 0xB7, - 0x0B, 0x66, 0xAE, 0x90, 0x3E, 0xFD, 0x08, 0xA9, 0xDE, 0xD9, 0x5F, 0xBE, 0x41, 0x36, 0xB1, 0xDF, - 0x14, 0x1A, 0xD8, 0x4D, 0x23, 0x58, 0x62, 0x6C, 0xAF, 0xDA, 0x9F, 0xD8, 0x05, 0x1D, 0x70, 0xF0, - 0xDC, 0x70, 0x1B, 0x33, 0xF3, 0xF4, 0xD0, 0x83, 0xD0, 0x10, 0x88, 0xD4, 0x0C, 0xA6, 0xAE, 0x6F, -}; -// clang-format on +static const char deblinded_hex[769] = + "13273238e3119262f86d3213b8eb6b99c093ef48737dfcfae96210f7350e096cbc7e6b992e4e6f705ac3f0a915d1622c1644596408e3d1" + "6126ddfa9ce594e9f361b21ef9c82309e5714c09bcd7f7ec5c2666591134c645d45ed8c9703e718ee005fe4b97fc40f69b424728831d0a" + "889cd39be04683dd380daa0df67c38279e3b9fe32f6c40780311f2dfbb6e89fc90ef15fb2c7958e387182dc7ef57f716fdd152a58ac1d3" + "f0d19bfa2f789024333976c69fbe9e24b58d6cd8fa49c5f4d642b00f8e390c199f37f7b3125758ef284ae10fd9c2da7ea280550baccd55" + "dadd70873a063bcfc9cac9079042af88a543a6cc09aaed6ba4954d6ee8ccc6e1145944328266616cd00f8a616f0e79e52ddd2ef970c8ba" + "8f8ffce35505dc643c8e2b6e430a1474a6d043a4daf9b62af87c1d45ca994d23f908f7898a3f44ca7bb642122087ca819308b3d8afad17" + "ca1f6148e8750870336ca68eb783c89b0dc9d92392f453c650e9f09232b9fcffd1c2cad24b14d2b4952b7f54552295ce0e854996913c"; static const uint8_t password[9] = "password"; static const uint8_t w[11] = "virgil.com"; static const uint8_t t[6] = "alice"; @@ -111,6 +92,13 @@ test1_DeblindStability() { gt_new(deblinded1); + uint8_t deblinded_bin[384]; + const char *pos = deblinded_hex; + for (size_t count = 0; count < 384; count++) { + sscanf(pos, "%2hhx", &deblinded_bin[count]); + pos += 2; + } + gt_read_bin(deblinded1, deblinded_bin, 384); const int iterations = 10; @@ -119,7 +107,7 @@ test1_DeblindStability() { gt_new(deblinded2); blind_eval_deblind(deblinded2); - TEST_ASSERT_EQUAL_INT(gt_cmp(deblinded1, deblinded2), RLC_EQ); + TEST_ASSERT_EQUAL_INT(gt_cmp(deblinded1, deblinded2), CMP_EQ); gt_free(deblinded2); } @@ -261,7 +249,7 @@ test3_UpdateDelta() { pythia_deblind(y1, rInv1, deblinded2); - TEST_ASSERT_EQUAL_INT(gt_cmp(deblinded1, deblinded2), RLC_EQ); + TEST_ASSERT_EQUAL_INT(gt_cmp(deblinded1, deblinded2), CMP_EQ); gt_free(deblinded2); g2_free(tTilde1); diff --git a/tests/pythia/test_pythia_mt.c b/tests/pythia/test_pythia_mt.c index 5da3bccd1..d43e452ec 100644 --- a/tests/pythia/test_pythia_mt.c +++ b/tests/pythia/test_pythia_mt.c @@ -30,37 +30,18 @@ #include #include #include +#include static int finished = 0; -// clang-format off -static const uint8_t deblinded_bin[384] = { - 0x17, 0xD6, 0x40, 0x4D, 0xB8, 0x6F, 0xB1, 0x84, 0xB3, 0xD6, 0x53, 0xD6, 0xBF, 0xA1, 0xA7, 0xB2, - 0xFE, 0x7C, 0xDB, 0x49, 0x52, 0x34, 0x28, 0x46, 0x0B, 0x9C, 0x1B, 0xB0, 0x42, 0x8D, 0x3F, 0x21, - 0x61, 0xDB, 0xA0, 0xE0, 0xF0, 0x31, 0x4D, 0xCB, 0xFD, 0xC7, 0x6A, 0xAE, 0xD5, 0xAC, 0xC2, 0x5D, - 0x13, 0xC4, 0x34, 0xF9, 0xF3, 0x87, 0xF2, 0x49, 0x92, 0xCF, 0x0C, 0xF2, 0xB2, 0xFA, 0x3E, 0x0D, - 0x14, 0x47, 0xAA, 0xFC, 0xFA, 0x37, 0xC8, 0x8B, 0x3B, 0xAC, 0xD2, 0xA1, 0x5F, 0xAB, 0x24, 0x46, - 0x03, 0x22, 0xEE, 0xE1, 0x52, 0xF5, 0x62, 0x44, 0xEF, 0xA6, 0x29, 0xC5, 0xE7, 0xB3, 0x4C, 0x76, - 0x07, 0x52, 0xBD, 0x23, 0x81, 0x13, 0xAC, 0xF0, 0xDE, 0xE7, 0xE8, 0x99, 0xD3, 0xA8, 0xFF, 0x76, - 0x8C, 0x76, 0x00, 0xD4, 0x50, 0x62, 0x25, 0x68, 0x71, 0x47, 0x08, 0x27, 0x3C, 0xF1, 0x28, 0x63, - 0xB0, 0x7C, 0x53, 0x6F, 0x64, 0x6A, 0xF0, 0x82, 0x2A, 0x3A, 0x41, 0xCD, 0x37, 0x4A, 0xC6, 0x87, - 0x04, 0xF7, 0xDE, 0xDE, 0x5E, 0xF6, 0x44, 0x4F, 0xA8, 0x6B, 0xAE, 0xF0, 0x25, 0x38, 0xB9, 0xEA, - 0x20, 0xDC, 0x6E, 0xC8, 0x2C, 0x37, 0x3B, 0x27, 0x06, 0x99, 0x81, 0xA1, 0x4C, 0x59, 0xCC, 0xD2, - 0x6F, 0xE9, 0x65, 0xDD, 0x70, 0xF5, 0xC6, 0xFB, 0xA1, 0xFD, 0xE6, 0xC8, 0xD4, 0xF6, 0x30, 0x21, - 0x09, 0x08, 0x4F, 0x77, 0xFF, 0x90, 0xB5, 0xB1, 0xB2, 0x49, 0x09, 0x02, 0x21, 0x90, 0xDF, 0xDC, - 0xE2, 0x42, 0x08, 0xF4, 0x6F, 0xF1, 0x6A, 0xB0, 0xD7, 0x2F, 0xAF, 0x3B, 0x0C, 0xBE, 0xEC, 0xFB, - 0x36, 0xB3, 0x76, 0xAD, 0x0F, 0x91, 0x09, 0x64, 0x22, 0x5B, 0x2A, 0x17, 0xE2, 0x4D, 0x87, 0x17, - 0x03, 0x50, 0x7B, 0x39, 0xB6, 0x49, 0x39, 0x94, 0x52, 0xDD, 0xDC, 0xBC, 0x43, 0x77, 0x15, 0xEC, - 0x15, 0xC5, 0xED, 0x5F, 0x8D, 0xB0, 0x6B, 0x29, 0x77, 0x97, 0x9D, 0x53, 0x65, 0xE2, 0x54, 0x51, - 0x10, 0x16, 0xE8, 0x99, 0x29, 0xF8, 0x8E, 0x65, 0x91, 0xD9, 0xCC, 0x88, 0x74, 0x45, 0x7C, 0x60, - 0x15, 0x9F, 0x6E, 0x78, 0x14, 0xAD, 0x4D, 0x01, 0x84, 0xFA, 0x77, 0x33, 0x36, 0x36, 0x6D, 0x59, - 0x44, 0xE2, 0x9E, 0xDB, 0x8A, 0xC2, 0xF7, 0x3F, 0x26, 0x7B, 0x3F, 0xA2, 0xBE, 0xEA, 0x6F, 0xFB, - 0x9E, 0xA2, 0xF0, 0xB7, 0x67, 0x45, 0x2D, 0x65, 0xF4, 0xE6, 0x15, 0x42, 0x7D, 0xA2, 0x07, 0xB7, - 0x0B, 0x66, 0xAE, 0x90, 0x3E, 0xFD, 0x08, 0xA9, 0xDE, 0xD9, 0x5F, 0xBE, 0x41, 0x36, 0xB1, 0xDF, - 0x14, 0x1A, 0xD8, 0x4D, 0x23, 0x58, 0x62, 0x6C, 0xAF, 0xDA, 0x9F, 0xD8, 0x05, 0x1D, 0x70, 0xF0, - 0xDC, 0x70, 0x1B, 0x33, 0xF3, 0xF4, 0xD0, 0x83, 0xD0, 0x10, 0x88, 0xD4, 0x0C, 0xA6, 0xAE, 0x6F, -}; -// clang-format on +static const char deblinded_hex[769] = + "13273238e3119262f86d3213b8eb6b99c093ef48737dfcfae96210f7350e096cbc7e6b992e4e6f705ac3f0a915d1622c1644596408e3d1" + "6126ddfa9ce594e9f361b21ef9c82309e5714c09bcd7f7ec5c2666591134c645d45ed8c9703e718ee005fe4b97fc40f69b424728831d0a" + "889cd39be04683dd380daa0df67c38279e3b9fe32f6c40780311f2dfbb6e89fc90ef15fb2c7958e387182dc7ef57f716fdd152a58ac1d3" + "f0d19bfa2f789024333976c69fbe9e24b58d6cd8fa49c5f4d642b00f8e390c199f37f7b3125758ef284ae10fd9c2da7ea280550baccd55" + "dadd70873a063bcfc9cac9079042af88a543a6cc09aaed6ba4954d6ee8ccc6e1145944328266616cd00f8a616f0e79e52ddd2ef970c8ba" + "8f8ffce35505dc643c8e2b6e430a1474a6d043a4daf9b62af87c1d45ca994d23f908f7898a3f44ca7bb642122087ca819308b3d8afad17" + "ca1f6148e8750870336ca68eb783c89b0dc9d92392f453c650e9f09232b9fcffd1c2cad24b14d2b4952b7f54552295ce0e854996913c"; static const uint8_t password[9] = "password"; static const uint8_t w[11] = "virgil.com"; static const uint8_t t[6] = "alice"; @@ -130,6 +111,13 @@ blind_eval_deblind(pythia_buf_t *deblinded_password) { void deblind_stability() { + uint8_t deblinded_bin[384]; + const char *pos = deblinded_hex; + for (size_t count = 0; count < 384; count++) { + sscanf(pos, "%2hhx", &deblinded_bin[count]); + pos += 2; + } + pythia_buf_t deblinded_password; deblinded_password.p = (uint8_t *)malloc(PYTHIA_GT_BUF_SIZE); @@ -145,38 +133,38 @@ deblind_stability() { void * pythia_succ(void *ptr) { - TEST_ASSERT_EQUAL(vscp_status_SUCCESS, vscp_pythia_configure()); while (!finished) { deblind_stability(); } - vscp_pythia_cleanup(); return NULL; } void * pythia_err(void *ptr) { - TEST_ASSERT_EQUAL(vscp_status_SUCCESS, vscp_pythia_configure()); while (!finished) { int caught = 0; - RLC_TRY { - RLC_THROW(ERR_CAUGHT); + pythia_err_init(); + + TRY { + THROW(ERR_CAUGHT); } - RLC_CATCH_ANY { + CATCH_ANY { caught = 1; } - RLC_FINALLY{}; + FINALLY{}; TEST_ASSERT_NOT_EQUAL(0, caught); } - vscp_pythia_cleanup(); return NULL; } void test(void) { + TEST_ASSERT_EQUAL(vscp_status_SUCCESS, vscp_pythia_configure()); + pthread_t t1, t2; pthread_create(&t1, NULL, pythia_succ, NULL); @@ -197,6 +185,8 @@ test(void) { pthread_join(t1, NULL); pthread_join(t2, NULL); + + vscp_pythia_cleanup(); } #endif diff --git a/tests/pythia/test_pythia_w.c b/tests/pythia/test_pythia_w.c index 8e5e762d2..149659e3f 100644 --- a/tests/pythia/test_pythia_w.c +++ b/tests/pythia/test_pythia_w.c @@ -26,34 +26,14 @@ #include "pythia.h" #include "vscp_pythia.h" -// clang-format off -static const uint8_t deblinded_bin[384] = { - 0x17, 0xD6, 0x40, 0x4D, 0xB8, 0x6F, 0xB1, 0x84, 0xB3, 0xD6, 0x53, 0xD6, 0xBF, 0xA1, 0xA7, 0xB2, - 0xFE, 0x7C, 0xDB, 0x49, 0x52, 0x34, 0x28, 0x46, 0x0B, 0x9C, 0x1B, 0xB0, 0x42, 0x8D, 0x3F, 0x21, - 0x61, 0xDB, 0xA0, 0xE0, 0xF0, 0x31, 0x4D, 0xCB, 0xFD, 0xC7, 0x6A, 0xAE, 0xD5, 0xAC, 0xC2, 0x5D, - 0x13, 0xC4, 0x34, 0xF9, 0xF3, 0x87, 0xF2, 0x49, 0x92, 0xCF, 0x0C, 0xF2, 0xB2, 0xFA, 0x3E, 0x0D, - 0x14, 0x47, 0xAA, 0xFC, 0xFA, 0x37, 0xC8, 0x8B, 0x3B, 0xAC, 0xD2, 0xA1, 0x5F, 0xAB, 0x24, 0x46, - 0x03, 0x22, 0xEE, 0xE1, 0x52, 0xF5, 0x62, 0x44, 0xEF, 0xA6, 0x29, 0xC5, 0xE7, 0xB3, 0x4C, 0x76, - 0x07, 0x52, 0xBD, 0x23, 0x81, 0x13, 0xAC, 0xF0, 0xDE, 0xE7, 0xE8, 0x99, 0xD3, 0xA8, 0xFF, 0x76, - 0x8C, 0x76, 0x00, 0xD4, 0x50, 0x62, 0x25, 0x68, 0x71, 0x47, 0x08, 0x27, 0x3C, 0xF1, 0x28, 0x63, - 0xB0, 0x7C, 0x53, 0x6F, 0x64, 0x6A, 0xF0, 0x82, 0x2A, 0x3A, 0x41, 0xCD, 0x37, 0x4A, 0xC6, 0x87, - 0x04, 0xF7, 0xDE, 0xDE, 0x5E, 0xF6, 0x44, 0x4F, 0xA8, 0x6B, 0xAE, 0xF0, 0x25, 0x38, 0xB9, 0xEA, - 0x20, 0xDC, 0x6E, 0xC8, 0x2C, 0x37, 0x3B, 0x27, 0x06, 0x99, 0x81, 0xA1, 0x4C, 0x59, 0xCC, 0xD2, - 0x6F, 0xE9, 0x65, 0xDD, 0x70, 0xF5, 0xC6, 0xFB, 0xA1, 0xFD, 0xE6, 0xC8, 0xD4, 0xF6, 0x30, 0x21, - 0x09, 0x08, 0x4F, 0x77, 0xFF, 0x90, 0xB5, 0xB1, 0xB2, 0x49, 0x09, 0x02, 0x21, 0x90, 0xDF, 0xDC, - 0xE2, 0x42, 0x08, 0xF4, 0x6F, 0xF1, 0x6A, 0xB0, 0xD7, 0x2F, 0xAF, 0x3B, 0x0C, 0xBE, 0xEC, 0xFB, - 0x36, 0xB3, 0x76, 0xAD, 0x0F, 0x91, 0x09, 0x64, 0x22, 0x5B, 0x2A, 0x17, 0xE2, 0x4D, 0x87, 0x17, - 0x03, 0x50, 0x7B, 0x39, 0xB6, 0x49, 0x39, 0x94, 0x52, 0xDD, 0xDC, 0xBC, 0x43, 0x77, 0x15, 0xEC, - 0x15, 0xC5, 0xED, 0x5F, 0x8D, 0xB0, 0x6B, 0x29, 0x77, 0x97, 0x9D, 0x53, 0x65, 0xE2, 0x54, 0x51, - 0x10, 0x16, 0xE8, 0x99, 0x29, 0xF8, 0x8E, 0x65, 0x91, 0xD9, 0xCC, 0x88, 0x74, 0x45, 0x7C, 0x60, - 0x15, 0x9F, 0x6E, 0x78, 0x14, 0xAD, 0x4D, 0x01, 0x84, 0xFA, 0x77, 0x33, 0x36, 0x36, 0x6D, 0x59, - 0x44, 0xE2, 0x9E, 0xDB, 0x8A, 0xC2, 0xF7, 0x3F, 0x26, 0x7B, 0x3F, 0xA2, 0xBE, 0xEA, 0x6F, 0xFB, - 0x9E, 0xA2, 0xF0, 0xB7, 0x67, 0x45, 0x2D, 0x65, 0xF4, 0xE6, 0x15, 0x42, 0x7D, 0xA2, 0x07, 0xB7, - 0x0B, 0x66, 0xAE, 0x90, 0x3E, 0xFD, 0x08, 0xA9, 0xDE, 0xD9, 0x5F, 0xBE, 0x41, 0x36, 0xB1, 0xDF, - 0x14, 0x1A, 0xD8, 0x4D, 0x23, 0x58, 0x62, 0x6C, 0xAF, 0xDA, 0x9F, 0xD8, 0x05, 0x1D, 0x70, 0xF0, - 0xDC, 0x70, 0x1B, 0x33, 0xF3, 0xF4, 0xD0, 0x83, 0xD0, 0x10, 0x88, 0xD4, 0x0C, 0xA6, 0xAE, 0x6F, -}; -// clang-format on +static const char deblinded_hex[769] = + "13273238e3119262f86d3213b8eb6b99c093ef48737dfcfae96210f7350e096cbc7e6b992e4e6f705ac3f0a915d1622c1644596408e3d1" + "6126ddfa9ce594e9f361b21ef9c82309e5714c09bcd7f7ec5c2666591134c645d45ed8c9703e718ee005fe4b97fc40f69b424728831d0a" + "889cd39be04683dd380daa0df67c38279e3b9fe32f6c40780311f2dfbb6e89fc90ef15fb2c7958e387182dc7ef57f716fdd152a58ac1d3" + "f0d19bfa2f789024333976c69fbe9e24b58d6cd8fa49c5f4d642b00f8e390c199f37f7b3125758ef284ae10fd9c2da7ea280550baccd55" + "dadd70873a063bcfc9cac9079042af88a543a6cc09aaed6ba4954d6ee8ccc6e1145944328266616cd00f8a616f0e79e52ddd2ef970c8ba" + "8f8ffce35505dc643c8e2b6e430a1474a6d043a4daf9b62af87c1d45ca994d23f908f7898a3f44ca7bb642122087ca819308b3d8afad17" + "ca1f6148e8750870336ca68eb783c89b0dc9d92392f453c650e9f09232b9fcffd1c2cad24b14d2b4952b7f54552295ce0e854996913c"; static const uint8_t password[9] = "password"; static const uint8_t w[11] = "virgil.com"; static const uint8_t t[6] = "alice"; @@ -126,9 +106,17 @@ void test1_DeblindStability() { TEST_ASSERT_EQUAL(vscp_status_SUCCESS, vscp_pythia_configure()); - pythia_buf_t deblinded_password; + uint8_t deblinded_bin[384]; + const char *pos = deblinded_hex; + for (size_t count = 0; count < 384; count++) { + sscanf(pos, "%2hhx", &deblinded_bin[count]); + pos += 2; + } const int iterations = 10; + + pythia_buf_t deblinded_password; + for (int i = 0; i < iterations; i++) { deblinded_password.p = (uint8_t *)malloc(PYTHIA_GT_BUF_SIZE); deblinded_password.allocated = PYTHIA_GT_BUF_SIZE; diff --git a/thirdparty/nanopb/CMakeLists.txt b/thirdparty/nanopb/CMakeLists.txt index 624aad199..3ae272043 100644 --- a/thirdparty/nanopb/CMakeLists.txt +++ b/thirdparty/nanopb/CMakeLists.txt @@ -99,12 +99,13 @@ ExternalProject_Add(protobuf-nanopb-ext GIT_REPOSITORY https://github.com/nanopb/nanopb GIT_TAG - 0.4.6.4 + 8ef41e0ebd45daaf19459a011f67e66224b247cd CMAKE_ARGS "${TRANSITIVE_ARGS}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_INSTALL_PREFIX=${NANOPB_INSTALL_LOCATION}" + "-Dnanopb_PYTHON_INSTDIR_OVERRIDE=${NANOPB_INSTALL_LOCATION}" "-DBUILD_SHARED_LIBS=OFF" "-Dnanopb_BUILD_RUNTIME=ON" "-Dnanopb_BUILD_GENERATOR=ON" @@ -172,6 +173,17 @@ ExternalProject_Add_Step(protobuf-nanopb-ext install-nanopb-utils install ) +ExternalProject_Add_Step(protobuf-nanopb-ext install-nanopb-init + COMMAND + "${CMAKE_COMMAND}" -E copy_if_different + "/generator/proto/__init__.py" + "${NANOPB_INSTALL_LOCATION}/generator/proto/__init__.py" + COMMENT + "Install file: _utils.py" + DEPENDEES + install + ) + ExternalProject_Add_Step(protobuf-nanopb-ext install-nanopb-pb2 COMMAND "${CMAKE_COMMAND}" -E copy_if_different diff --git a/thirdparty/relic/CMakeLists.txt b/thirdparty/relic/CMakeLists.txt index 23390b92e..603f0e74e 100755 --- a/thirdparty/relic/CMakeLists.txt +++ b/thirdparty/relic/CMakeLists.txt @@ -43,14 +43,7 @@ set(RELIC_ARGS_FILE ${CMAKE_CURRENT_LIST_DIR}/relic-args.cmake) include("${CMAKE_CURRENT_LIST_DIR}/features.cmake") if(RELIC_USE_PTHREAD) - set(RELIC_CMAKE_ARGS ${RELIC_CMAKE_ARGS} -DMULTI=PTHREAD) -endif() - -set(RELIC_WSIZE 64) -if(CMAKE_CROSSCOMPILING AND APPLE) - if (("i386" IN_LIST CMAKE_OSX_ARCHITECTURES) OR ("armv7k" IN_LIST CMAKE_OSX_ARCHITECTURES)) - set(RELIC_WSIZE 32) - endif() + set(RELIC_CMAKE_ARGS ${RELIC_CMAKE_ARGS} -DERRMO=ERRMO_SPTHREAD) endif() # --------------------------------------------------------------------------- @@ -58,14 +51,14 @@ endif() # --------------------------------------------------------------------------- include(ExternalProject) ExternalProject_Add(relic-ext - GIT_REPOSITORY https://github.com/relic-toolkit/relic.git - GIT_TAG 0.6.0 + GIT_REPOSITORY https://github.com/VirgilSecurity/relic.git + GIT_TAG relic-toolkit-0.4.1 CMAKE_ARGS "${TRANSITIVE_ARGS}" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_INSTALL_PREFIX=${RELIC_LOCATION}" - -DRAND=CALL -DWSIZE=${RELIC_WSIZE} $<$:-DARCH=> + -DRAND=CALL -DMULTI= ${RELIC_CMAKE_ARGS} -C "${RELIC_ARGS_FILE}" BUILD_BYPRODUCTS "${RELIC_LOCATION}/lib/librelic_s.a" ) diff --git a/thirdparty/relic/relic-args.cmake b/thirdparty/relic/relic-args.cmake index f19b5cf57..b3e4f3822 100644 --- a/thirdparty/relic/relic-args.cmake +++ b/thirdparty/relic/relic-args.cmake @@ -1,27 +1,26 @@ -set(ALLOC DYNAMIC CACHE STRING "" FORCE) -set(FP_PRIME 381 CACHE STRING "" FORCE) -set(SHLIB OFF CACHE BOOL "" FORCE) -set(STLIB ON CACHE BOOL "" FORCE) -set(SEED UDEV CACHE STRING "" FORCE) -set(RAND CALL CACHE STRING "" FORCE) -set(TESTS 0 CACHE STRING "" FORCE) -set(BENCH 0 CACHE STRING "" FORCE) -set(CHECK ON CACHE BOOL "" FORCE) -set(DOCUM OFF CACHE BOOL "" FORCE) -set(VERBS OFF CACHE BOOL "" FORCE) -# set(QUIET ON CACHE STRING "" FORCE) -set(FP_PMERS OFF CACHE BOOL "" FORCE) -set(FP_QNRES ON CACHE BOOL "" FORCE) -set(EP_PLAIN OFF CACHE BOOL "" FORCE) -set(EP_SUPER OFF CACHE BOOL "" FORCE) -set(STRIP OFF CACHE BOOL "" FORCE) -set(MD_METHD SH384 CACHE STRING "" FORCE) -set(MD_MAP SH384 CACHE STRING "" FORCE) -set(COMP "-O3 -funroll-loops -fPIC" CACHE STRING "" FORCE) -set(BN_METHD "COMBA;COMBA;MONTY;SLIDE;BASIC;BASIC" CACHE STRING "" FORCE) -set(EP_METHD "PROJC;LWNAF;COMBS;INTER" CACHE STRING "" FORCE) -set(FB_METHD "LODAH;LUTBL;QUICK;QUICK;QUICK;QUICK;EXGCD;SLIDE;QUICK" CACHE STRING "" FORCE) -set(FP_METHD "INTEG;COMBA;COMBA;MONTY;EXGCD;JMPDS;SLIDE" CACHE STRING "" FORCE) -set(FPX_METHD "INTEG;INTEG;LAZYR" CACHE STRING "" FORCE) -set(PP_METHD "LAZYR;OATEP" CACHE STRING "" FORCE) -set(WITH "MD;BN;DV;FP;FPX;EP;EPX;PC;PP" CACHE STRING "" FORCE) +set(ALLOC DYNAMIC CACHE INTERNAL "") +set(FP_PRIME 381 CACHE INTERNAL "") +set(SHLIB OFF CACHE INTERNAL "") +set(STLIB ON CACHE INTERNAL "") +set(SEED UDEV CACHE INTERNAL "") +set(RAND HASH CACHE INTERNAL "") +set(TESTS 0 CACHE INTERNAL "") +set(BENCH 0 CACHE INTERNAL "") + +set(CHECK ON CACHE INTERNAL "") +set(DOCUM OFF CACHE INTERNAL "") +set(VERBS OFF CACHE INTERNAL "") +set(QUIET ON CACHE INTERNAL "") +set(FP_PMERS OFF CACHE INTERNAL "") +set(FP_QNRES ON CACHE INTERNAL "") +set(EP_PLAIN OFF CACHE INTERNAL "") +set(EP_SUPER OFF CACHE INTERNAL "") +set(STRIP ON CACHE INTERNAL "") +set(MD_METHD SH384 CACHE INTERNAL "") +set(MD_MAP SH384 CACHE INTERNAL "") +set(COMP "-O3 -funroll-loops -fPIC" CACHE INTERNAL "") +set(BN_METHD "COMBA;COMBA;MONTY;SLIDE;LEHME;BASIC") +set(FP_METHD "INTEG;COMBA;COMBA;MONTY;EXGCD;SLIDE" CACHE INTERNAL "") +set(FPX_METHD "INTEG;INTEG;LAZYR" CACHE INTERNAL "") +set(PP_METHD "LAZYR;OATEP" CACHE INTERNAL "") +set(WITH "MD;BN;DV;FP;FPX;EP;EPX;PC;PP" CACHE INTERNAL "") diff --git a/wrappers/java/android/build.gradle b/wrappers/java/android/build.gradle index b8bc6676f..92ded54b7 100644 --- a/wrappers/java/android/build.gradle +++ b/wrappers/java/android/build.gradle @@ -21,7 +21,7 @@ allprojects { mavenLocal() } group "com.virgilsecurity.crypto" - version "0.17.0" + version "0.17.1" def authentication_username = hasProperty('authentication_username') ? authentication_username : System.getenv('authentication_username') def authentication_password = hasProperty('authentication_password') ? authentication_password : System.getenv('authentication_password') diff --git a/wrappers/java/benchmark/pom.xml b/wrappers/java/benchmark/pom.xml index 0ed0bc7ea..b81c9727d 100644 --- a/wrappers/java/benchmark/pom.xml +++ b/wrappers/java/benchmark/pom.xml @@ -5,7 +5,7 @@ com.virgilsecurity.crypto parent - 0.17.0 + 0.17.1 benchmark diff --git a/wrappers/java/common/pom.xml b/wrappers/java/common/pom.xml index 34b5bff7b..1263f68c6 100755 --- a/wrappers/java/common/pom.xml +++ b/wrappers/java/common/pom.xml @@ -36,7 +36,7 @@ com.virgilsecurity.crypto parent - 0.17.0 + 0.17.1 jar common diff --git a/wrappers/java/foundation/pom.xml b/wrappers/java/foundation/pom.xml index dc4cba56b..f8042ca35 100755 --- a/wrappers/java/foundation/pom.xml +++ b/wrappers/java/foundation/pom.xml @@ -36,7 +36,7 @@ com.virgilsecurity.crypto parent - 0.17.0 + 0.17.1 foundation diff --git a/wrappers/java/phe/pom.xml b/wrappers/java/phe/pom.xml index f7f6090dd..cd90e331d 100755 --- a/wrappers/java/phe/pom.xml +++ b/wrappers/java/phe/pom.xml @@ -36,7 +36,7 @@ com.virgilsecurity.crypto parent - 0.17.0 + 0.17.1 phe diff --git a/wrappers/java/pom.xml b/wrappers/java/pom.xml index e3723c648..ba6828b9d 100644 --- a/wrappers/java/pom.xml +++ b/wrappers/java/pom.xml @@ -36,7 +36,7 @@ com.virgilsecurity.crypto parent pom - 0.17.0 + 0.17.1 Virgil Security Crypto Library diff --git a/wrappers/java/pythia/pom.xml b/wrappers/java/pythia/pom.xml index 8ef8d2c09..8374af3da 100755 --- a/wrappers/java/pythia/pom.xml +++ b/wrappers/java/pythia/pom.xml @@ -36,7 +36,7 @@ com.virgilsecurity.crypto parent - 0.17.0 + 0.17.1 pythia diff --git a/wrappers/java/ratchet/pom.xml b/wrappers/java/ratchet/pom.xml index d57aa6544..9aec36124 100755 --- a/wrappers/java/ratchet/pom.xml +++ b/wrappers/java/ratchet/pom.xml @@ -36,7 +36,7 @@ com.virgilsecurity.crypto parent - 0.17.0 + 0.17.1 ratchet diff --git a/wrappers/php/VirgilCryptoWrapper/extensions/foundation/vscf_foundation_php.c b/wrappers/php/VirgilCryptoWrapper/extensions/foundation/vscf_foundation_php.c index 9b6eb323a..9df422d9d 100644 --- a/wrappers/php/VirgilCryptoWrapper/extensions/foundation/vscf_foundation_php.c +++ b/wrappers/php/VirgilCryptoWrapper/extensions/foundation/vscf_foundation_php.c @@ -356,7 +356,7 @@ vscf_handle_throw_exception(vscf_status_t status) { // // Constants // -const char VSCF_FOUNDATION_PHP_VERSION[] = "0.17.0"; +const char VSCF_FOUNDATION_PHP_VERSION[] = "0.17.1"; const char VSCF_FOUNDATION_PHP_EXTNAME[] = "vscf_foundation_php"; static const char VSCF_IMPL_T_PHP_RES_NAME[] = "vscf_impl_t"; diff --git a/wrappers/php/VirgilCryptoWrapper/extensions/phe/vsce_phe_php.c b/wrappers/php/VirgilCryptoWrapper/extensions/phe/vsce_phe_php.c index c7710aa6c..71b296c63 100644 --- a/wrappers/php/VirgilCryptoWrapper/extensions/phe/vsce_phe_php.c +++ b/wrappers/php/VirgilCryptoWrapper/extensions/phe/vsce_phe_php.c @@ -84,7 +84,7 @@ vsce_handle_throw_exception(vsce_status_t status) { // // Constants // -const char VSCE_PHE_PHP_VERSION[] = "0.17.0"; +const char VSCE_PHE_PHP_VERSION[] = "0.17.1"; const char VSCE_PHE_PHP_EXTNAME[] = "vsce_phe_php"; static const char VSCE_PHE_SERVER_T_PHP_RES_NAME[] = "vsce_phe_server_t"; diff --git a/wrappers/php/VirgilCryptoWrapper/extensions/pythia/vscp_pythia_php.c b/wrappers/php/VirgilCryptoWrapper/extensions/pythia/vscp_pythia_php.c index c54516103..ebc967c19 100644 --- a/wrappers/php/VirgilCryptoWrapper/extensions/pythia/vscp_pythia_php.c +++ b/wrappers/php/VirgilCryptoWrapper/extensions/pythia/vscp_pythia_php.c @@ -65,7 +65,7 @@ vscp_handle_throw_exception(vscp_status_t status) { // // Constants // -const char VSCP_PYTHIA_PHP_VERSION[] = "0.17.0"; +const char VSCP_PYTHIA_PHP_VERSION[] = "0.17.1"; const char VSCP_PYTHIA_PHP_EXTNAME[] = "vscp_pythia_php"; // diff --git a/wrappers/php/_handwritten/foundation/extension/vscf_php.c b/wrappers/php/_handwritten/foundation/extension/vscf_php.c index 946ceb5c6..fdc88e23f 100644 --- a/wrappers/php/_handwritten/foundation/extension/vscf_php.c +++ b/wrappers/php/_handwritten/foundation/extension/vscf_php.c @@ -58,7 +58,7 @@ // -------------------------------------------------------------------------- // Constants // -------------------------------------------------------------------------- -const char VSCF_PHP_VERSION[] = "0.17.0"; +const char VSCF_PHP_VERSION[] = "0.17.1"; const char VSCF_PHP_EXTNAME[] = "vscf_php"; const char VSCF_IMPL_PHP_RES_NAME[] = "vscf_php"; diff --git a/wrappers/php/_handwritten/phe/extension/vsce_phe_php.c b/wrappers/php/_handwritten/phe/extension/vsce_phe_php.c index caf3e1e1c..e23b6cfa4 100644 --- a/wrappers/php/_handwritten/phe/extension/vsce_phe_php.c +++ b/wrappers/php/_handwritten/phe/extension/vsce_phe_php.c @@ -51,7 +51,7 @@ // -------------------------------------------------------------------------- // Constants // -------------------------------------------------------------------------- -const char VSCE_PHE_PHP_VERSION[] = "0.17.0"; +const char VSCE_PHE_PHP_VERSION[] = "0.17.1"; const char VSCE_PHE_PHP_EXTNAME[] = "vsce_phe_php"; const char VSCE_PHE_CLIENT_PHP_RES_NAME[] = "vsce_phe_client_t"; diff --git a/wrappers/php/_handwritten/pythia/extension/vscp_pythia_php.c b/wrappers/php/_handwritten/pythia/extension/vscp_pythia_php.c index 28f426cf7..88b2169a5 100644 --- a/wrappers/php/_handwritten/pythia/extension/vscp_pythia_php.c +++ b/wrappers/php/_handwritten/pythia/extension/vscp_pythia_php.c @@ -48,7 +48,7 @@ // -------------------------------------------------------------------------- // Constants // -------------------------------------------------------------------------- -const char VSCP_PYTHIA_PHP_VERSION[] = "0.17.0"; +const char VSCP_PYTHIA_PHP_VERSION[] = "0.17.1"; const char VSCP_PYTHIA_PHP_EXTNAME[] = "vscp_pythia_php"; const char VSCP_PYTHIA_PHP_RES_NAME[] = "vscp_pythia_t"; diff --git a/wrappers/python/virgil_crypto_lib/__init__.py b/wrappers/python/virgil_crypto_lib/__init__.py index da26dd524..042524b3b 100644 --- a/wrappers/python/virgil_crypto_lib/__init__.py +++ b/wrappers/python/virgil_crypto_lib/__init__.py @@ -34,4 +34,4 @@ __author__ = "Virgil Security" -__version__ = "0.17.0" +__version__ = "0.17.1" diff --git a/wrappers/wasm/package.json b/wrappers/wasm/package.json index 59ee0e7ca..31f714751 100644 --- a/wrappers/wasm/package.json +++ b/wrappers/wasm/package.json @@ -1,6 +1,6 @@ { "name": "@virgilsecurity/crypto", - "version": "0.17.0", + "version": "0.17.1", "description": "Virgil Crypto C wrapper", "repository": "https://github.com/VirgilSecurity/virgil-crypto-c", "author": "Virgil Security Inc. ",