From 6f113dd7b3b4de918c4efb81d38a1ffe1d391b5b Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 27 Sep 2016 11:57:29 +0200 Subject: OLMKit: Make the project build Make OLMKit CocoaPods expose the obj-c wrapper of libolm --- OLMKit.podspec | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 OLMKit.podspec (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec new file mode 100644 index 0000000..a27d0f7 --- /dev/null +++ b/OLMKit.podspec @@ -0,0 +1,55 @@ +Pod::Spec.new do |s| + + # The libolm version + MAJOR = 1 + MINOR = 3 + PATCH = 0 + + s.name = "OLMKit" + s.version = "#{MAJOR}.#{MINOR}.#{PATCH}" + s.summary = "An Objective-C wrapper of olm (http://matrix.org/git/olm)" + + s.description = <<-DESC + olm is an implementation of the Double Ratchet cryptographic ratchet in C++ + DESC + + s.homepage = "http://matrix.org/git/olm" + + s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } + + s.authors = { "Chris Ballinger" => "chrisballinger@gmail.com", + "matrix.org" => "support@matrix.org" } + + s.platform = :ios, "5.0" + + # Expose the Objective-C wrapper API of libolm + s.public_header_files = "xcode/OLMKit/*.h" + + s.source = { + :git => "https://matrix.org/git/olm.git", + :tag => s.version.to_s + } + + s.source_files = "xcode/OLMKit/*.{h,m}", "include/**/*.{h,hh}", "src/*.{c,cpp}", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.c", "lib/crypto-algorithms/aes.c", "lib/curve25519-donna/curve25519-donna.c" + + s.library = "c++" + + + # Use the same compiler options for C and C++ as olm/Makefile + + s.compiler_flags = "-g -O3 -DOLMLIB_VERSION_MAJOR=#{MAJOR} -DOLMLIB_VERSION_MINOR=#{MINOR} -DOLMLIB_VERSION_PATCH=#{PATCH}" + s.xcconfig = { + 'USER_HEADER_SEARCH_PATHS' =>"#{File.join(File.dirname(__FILE__), 'include')} #{File.join(File.dirname(__FILE__), 'lib')}" + } + + s.subspec 'olmc' do |olmc| + olmc.source_files = "src/*.{c}", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.c", "lib/crypto-algorithms/aes.c", "lib/curve25519-donna/curve25519-donna.c" + olmc.compiler_flags = ' -std=c99 -fPIC' + end + + s.subspec 'olmcpp' do |olmcpp| + olmcpp.source_files = "src/*.{cpp}" + olmcpp.compiler_flags = ' -std=c++11 -fPIC' + end + +end -- cgit v1.2.3-70-g09d2 From 34998b52c79661d79efe3a12100fad9ce2d5fae6 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 3 Nov 2016 17:33:31 +0100 Subject: OLMKit: Attempt to make podspec work when the pod is downloaded from git --- OLMKit.podspec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec index a27d0f7..c4ba16d 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -38,8 +38,11 @@ Pod::Spec.new do |s| # Use the same compiler options for C and C++ as olm/Makefile s.compiler_flags = "-g -O3 -DOLMLIB_VERSION_MAJOR=#{MAJOR} -DOLMLIB_VERSION_MINOR=#{MINOR} -DOLMLIB_VERSION_PATCH=#{PATCH}" + + # For headers search paths, manage first the normal installation. Then, use paths used + # when the pod is local s.xcconfig = { - 'USER_HEADER_SEARCH_PATHS' =>"#{File.join(File.dirname(__FILE__), 'include')} #{File.join(File.dirname(__FILE__), 'lib')}" + 'USER_HEADER_SEARCH_PATHS' =>"${PODS_ROOT}/OLMKit/include ${PODS_ROOT}/OLMKit/lib #{File.join(File.dirname(__FILE__), 'include')} #{File.join(File.dirname(__FILE__), 'lib')}" } s.subspec 'olmc' do |olmc| -- cgit v1.2.3-70-g09d2 From 671218dc07da836faf22af09e6da81e5a100e75d Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 4 Nov 2016 09:53:55 +0100 Subject: OLMKit: podspec: Some files are missing --- OLMKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec index c4ba16d..025e979 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -46,7 +46,7 @@ Pod::Spec.new do |s| } s.subspec 'olmc' do |olmc| - olmc.source_files = "src/*.{c}", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.c", "lib/crypto-algorithms/aes.c", "lib/curve25519-donna/curve25519-donna.c" + olmc.source_files = "src/*.{c}", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.{h,c}", "lib/crypto-algorithms/aes.{h,c}", "lib/curve25519-donna/curve25519-donna.c" olmc.compiler_flags = ' -std=c99 -fPIC' end -- cgit v1.2.3-70-g09d2 From 09b14c2b3d809b9149100e39c5efd0cb3c0f281e Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 4 Nov 2016 10:10:56 +0100 Subject: OLMKit: podspec: Some files are missing --- OLMKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec index 025e979..86bc611 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -46,7 +46,7 @@ Pod::Spec.new do |s| } s.subspec 'olmc' do |olmc| - olmc.source_files = "src/*.{c}", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.{h,c}", "lib/crypto-algorithms/aes.{h,c}", "lib/curve25519-donna/curve25519-donna.c" + olmc.source_files = "src/*.{c}", "lib/curve25519-donna.h", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.{h,c}", "lib/crypto-algorithms/aes.{h,c}", "lib/curve25519-donna/curve25519-donna.c" olmc.compiler_flags = ' -std=c99 -fPIC' end -- cgit v1.2.3-70-g09d2 From 9ac937a200e22dc486ce80ed4df674a4d52bacd0 Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 4 Nov 2016 11:01:09 +0100 Subject: OLMKit: podspec: Attempt to fix duplicate symbols because ed25519.c includes .c files --- OLMKit.podspec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec index 86bc611..a1cc74c 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -30,7 +30,10 @@ Pod::Spec.new do |s| :tag => s.version.to_s } - s.source_files = "xcode/OLMKit/*.{h,m}", "include/**/*.{h,hh}", "src/*.{c,cpp}", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.c", "lib/crypto-algorithms/aes.c", "lib/curve25519-donna/curve25519-donna.c" + s.source_files = "xcode/OLMKit/*.{h,m}", "include/**/*.{h,hh}", "src/*.{c,cpp}", "lib/crypto-algorithms/sha256.c", "lib/crypto-algorithms/aes.c", "lib/curve25519-donna/curve25519-donna.c" + + # Those files (including .c) are included by ed25519.c. We do not want to compile them twice + s.preserve_paths = "lib/ed25519/**/*.{h,c}" s.library = "c++" -- cgit v1.2.3-70-g09d2 From 62f52806702b799b9e25e7cdf07be1c8a31325a2 Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 4 Nov 2016 11:07:36 +0100 Subject: OLMKit: podspec: Attempt to fix duplicate symbols because ed25519.c includes .c files --- OLMKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec index a1cc74c..3c56773 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -49,7 +49,7 @@ Pod::Spec.new do |s| } s.subspec 'olmc' do |olmc| - olmc.source_files = "src/*.{c}", "lib/curve25519-donna.h", "lib/ed25519/**/*.{h,c}", "lib/crypto-algorithms/sha256.{h,c}", "lib/crypto-algorithms/aes.{h,c}", "lib/curve25519-donna/curve25519-donna.c" + olmc.source_files = "src/*.{c}", "lib/curve25519-donna.h", "lib/crypto-algorithms/sha256.{h,c}", "lib/crypto-algorithms/aes.{h,c}", "lib/curve25519-donna/curve25519-donna.c" olmc.compiler_flags = ' -std=c99 -fPIC' end -- cgit v1.2.3-70-g09d2 From 27a8c28da4e5c62d8863ee3d30642109d713c4d6 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 7 Nov 2016 17:27:09 +0100 Subject: OLMKit: Update obj-c wrapper to 2.0.0 --- OLMKit.podspec | 4 ++-- xcode/OLMKit.xcodeproj/project.pbxproj | 4 ++-- xcode/OLMKit/OLMInboundGroupSession.h | 2 +- xcode/OLMKit/OLMInboundGroupSession.m | 4 ++-- xcode/OLMKitTests/OLMKitGroupTests.m | 4 +++- xcode/Podfile.lock | 14 +++++++------- 6 files changed, 17 insertions(+), 15 deletions(-) (limited to 'OLMKit.podspec') diff --git a/OLMKit.podspec b/OLMKit.podspec index 3c56773..0877e3a 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -1,8 +1,8 @@ Pod::Spec.new do |s| # The libolm version - MAJOR = 1 - MINOR = 3 + MAJOR = 2 + MINOR = 0 PATCH = 0 s.name = "OLMKit" diff --git a/xcode/OLMKit.xcodeproj/project.pbxproj b/xcode/OLMKit.xcodeproj/project.pbxproj index fa02539..0ec7587 100644 --- a/xcode/OLMKit.xcodeproj/project.pbxproj +++ b/xcode/OLMKit.xcodeproj/project.pbxproj @@ -273,7 +273,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 793D0533290528B7C0E17CAD /* [CP] Copy Pods Resources */ = { @@ -303,7 +303,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run \'pod install\' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/xcode/OLMKit/OLMInboundGroupSession.h b/xcode/OLMKit/OLMInboundGroupSession.h index a507490..46de3a0 100644 --- a/xcode/OLMKit/OLMInboundGroupSession.h +++ b/xcode/OLMKit/OLMInboundGroupSession.h @@ -24,6 +24,6 @@ - (NSString*)sessionIdentifier; /** base64 ciphertext -> UTF-8 plaintext */ -- (NSString*)decryptMessage:(NSString*)message; +- (NSString*)decryptMessage:(NSString*)message messageIndex:(NSUInteger*)messageIndex; @end diff --git a/xcode/OLMKit/OLMInboundGroupSession.m b/xcode/OLMKit/OLMInboundGroupSession.m index d95d1ab..ea79e14 100644 --- a/xcode/OLMKit/OLMInboundGroupSession.m +++ b/xcode/OLMKit/OLMInboundGroupSession.m @@ -79,7 +79,7 @@ return idString; } -- (NSString *)decryptMessage:(NSString *)message +- (NSString *)decryptMessage:(NSString *)message messageIndex:(NSUInteger*)messageIndex { NSParameterAssert(message != nil); NSData *messageData = [message dataUsingEncoding:NSUTF8StringEncoding]; @@ -96,7 +96,7 @@ // message buffer is destroyed by olm_group_decrypt_max_plaintext_length mutMessage = messageData.mutableCopy; NSMutableData *plaintextData = [NSMutableData dataWithLength:maxPlaintextLength]; - size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length); + size_t plaintextLength = olm_group_decrypt(session, mutMessage.mutableBytes, mutMessage.length, plaintextData.mutableBytes, plaintextData.length, messageIndex); if (plaintextLength == olm_error()) { const char *error = olm_inbound_group_session_last_error(session); NSAssert(NO, @"olm_group_decrypt error: %s", error); diff --git a/xcode/OLMKitTests/OLMKitGroupTests.m b/xcode/OLMKitTests/OLMKitGroupTests.m index 9f5ad10..cdfb704 100644 --- a/xcode/OLMKitTests/OLMKitGroupTests.m +++ b/xcode/OLMKitTests/OLMKitGroupTests.m @@ -55,8 +55,10 @@ OLMInboundGroupSession *bobSession = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithSessionKey:sessionKey]; XCTAssertEqualObjects(aliceSession.sessionIdentifier, bobSession.sessionIdentifier); - NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg]; + NSUInteger messageIndex; + NSString *plaintext = [bobSession decryptMessage:aliceToBobMsg messageIndex:&messageIndex]; XCTAssertEqualObjects(message, plaintext); + XCTAssertEqual(messageIndex, 0); } - (void)testOutboundGroupSessionSerialization { diff --git a/xcode/Podfile.lock b/xcode/Podfile.lock index b091109..3ac110a 100644 --- a/xcode/Podfile.lock +++ b/xcode/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - OLMKit (1.3.0): - - OLMKit/olmc (= 1.3.0) - - OLMKit/olmcpp (= 1.3.0) - - OLMKit/olmc (1.3.0) - - OLMKit/olmcpp (1.3.0) + - OLMKit (2.0.0): + - OLMKit/olmc (= 2.0.0) + - OLMKit/olmcpp (= 2.0.0) + - OLMKit/olmc (2.0.0) + - OLMKit/olmcpp (2.0.0) DEPENDENCIES: - OLMKit (from `../OLMKit.podspec`) @@ -13,8 +13,8 @@ EXTERNAL SOURCES: :path: ../OLMKit.podspec SPEC CHECKSUMS: - OLMKit: 49b73677a77988cc25e51d023f39a8a3e451cb23 + OLMKit: ed17cdf7695bc0de1e2bf98243eb65f5b9ddebc1 PODFILE CHECKSUM: 4e261dae61d833ec5585ced2473023b98909fd35 -COCOAPODS: 1.0.1 +COCOAPODS: 1.1.1 -- cgit v1.2.3-70-g09d2 From 0b1ecbff2d31b94046834358b851c369ad36ee88 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 17 Nov 2016 14:03:15 +0100 Subject: OLMKit: Add it to olm from version 2.0.1 --- CHANGELOG.rst | 7 +++++++ Makefile | 2 +- OLMKit.podspec | 2 +- README.rst | 16 ++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) (limited to 'OLMKit.podspec') diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a35eedf..47b1547 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,10 @@ +Changes in `2.0.1 `_ +=============================================================== + +This release includes the following changes since 2.0.0 + +* Add OLMKit, the Objective-C wrapper. + Changes in `2.0.0 `_ =============================================================== diff --git a/Makefile b/Makefile index 77aa485..d511ddb 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ MAJOR := 2 MINOR := 0 -PATCH := 0 +PATCH := 1 VERSION := $(MAJOR).$(MINOR).$(PATCH) PREFIX ?= /usr/local BUILD_DIR := build diff --git a/OLMKit.podspec b/OLMKit.podspec index 0877e3a..6403fdc 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| # The libolm version MAJOR = 2 MINOR = 0 - PATCH = 0 + PATCH = 1 s.name = "OLMKit" s.version = "#{MAJOR}.#{MINOR}.#{PATCH}" diff --git a/README.rst b/README.rst index be1fb1a..9b14efe 100644 --- a/README.rst +++ b/README.rst @@ -33,6 +33,14 @@ To build the javascript bindings, install emscripten from http://kripken.github. make js +To build the Xcode workspace for Objective-C bindings, run: + +.. code:: bash + + cd xcode + pod install + open OLMKit.xcworkspace + Release process --------------- @@ -50,6 +58,14 @@ Release process git tag $VERSION -s git push --tags + # OLMKit CocoaPod release + # Make sure the version OLMKit.podspec is the same as the git tag + # (this should be checked before git tagging) + pod spec lint OLMKit.podspec --use-libraries --allow-warnings + pod trunk push OLMKit.podspec --use-libraries --allow-warnings + # Check the pod has been successully published with: + pod search OLMKit + It's probably sensible to do the above on a release branch (``release-vx.y.z`` by convention), and merge back to master once complete. -- cgit v1.2.3-70-g09d2