- Update Pod
This commit is contained in:
parent
ef4deb51f6
commit
6a5119dbe3
@ -328,7 +328,7 @@
|
||||
};
|
||||
43252B3B955A9E6FDF55EF8C /* 📦 Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
buildActionMask = 12;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
|
||||
@ -89,26 +89,11 @@
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
<AdditionalOption
|
||||
key = "DYLD_INSERT_LIBRARIES"
|
||||
value = "/usr/lib/libgmalloc.dylib"
|
||||
isEnabled = "YES">
|
||||
</AdditionalOption>
|
||||
<AdditionalOption
|
||||
key = "NSZombieEnabled"
|
||||
value = "YES"
|
||||
isEnabled = "YES">
|
||||
</AdditionalOption>
|
||||
<AdditionalOption
|
||||
key = "MallocGuardEdges"
|
||||
value = ""
|
||||
isEnabled = "YES">
|
||||
</AdditionalOption>
|
||||
<AdditionalOption
|
||||
key = "MallocScribble"
|
||||
value = ""
|
||||
isEnabled = "YES">
|
||||
</AdditionalOption>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
|
||||
@ -20,7 +20,8 @@ PODS:
|
||||
- Bolts/AppLinks (1.6.0):
|
||||
- Bolts/Tasks
|
||||
- Bolts/Tasks (1.6.0)
|
||||
- CodFis-Helper (0.1.2)
|
||||
- CocoaSecurity (1.2.4)
|
||||
- CodFis-Helper (0.1.3)
|
||||
- Expecta (1.0.5)
|
||||
- Expecta+Snapshots (2.0.0):
|
||||
- Expecta (~> 1.0)
|
||||
@ -36,28 +37,31 @@ PODS:
|
||||
- FBSnapshotTestCase/Core (2.0.7)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.7):
|
||||
- FBSnapshotTestCase/Core
|
||||
- NSDate_Utils (0.1.2)
|
||||
- NSString-Helper (1.0.3)
|
||||
- NACrypto (1.0.6)
|
||||
- NSDate_Utils (0.1.3)
|
||||
- NSString-Helper (1.0.4)
|
||||
- NSUserDefaults-AESEncryptor (0.0.4):
|
||||
- CocoaSecurity (~> 1.2.2)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (0.3.17):
|
||||
- PNObject (0.3.18):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- FBSDKCoreKit
|
||||
- FBSDKLoginKit
|
||||
- FBSDKShareKit
|
||||
- NACrypto
|
||||
- NSDate_Utils
|
||||
- NSString-Helper
|
||||
- NSUserDefaults-AESEncryptor
|
||||
- nv-ios-http-status
|
||||
- PEAR-FileManager-iOS
|
||||
- RNCryptor
|
||||
- StrongestPasswordValidator
|
||||
- UIDevice-Utils
|
||||
- PureLayout (3.0.1)
|
||||
- RNCryptor (4.0.0)
|
||||
- Specta (1.0.5)
|
||||
- StrongestPasswordValidator (0.1.1)
|
||||
- UIDevice-Utils (0.1.4)
|
||||
- StrongestPasswordValidator (0.1.2)
|
||||
- UIDevice-Utils (0.1.5)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking
|
||||
@ -85,24 +89,26 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
|
||||
Bolts: f52a250053bb517ca874523c3913776359ab3def
|
||||
CodFis-Helper: f303810699f22dbcba8fb8c600545ac91fc3ec42
|
||||
CocoaSecurity: d288a6f87e0f363823d2cb83e753814a6944f71a
|
||||
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
|
||||
FBSDKCoreKit: 13bec8373fb3af94d44daf2aa1e0958687897fbd
|
||||
FBSDKLoginKit: d3d4a2e9d31954deb00bfea964167a05ca1ea976
|
||||
FBSDKShareKit: 54587b4624706ace1e810cf83412a918141f807a
|
||||
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
|
||||
NSDate_Utils: 6f310af16917c48536836d4c17e1e47bf6fbe8e4
|
||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||
NACrypto: ce3900f1775f1b0cc27ce7c4953b94c598a74149
|
||||
NSDate_Utils: 68669d2c81f310ee13026c791f4f0ed227b94c65
|
||||
NSString-Helper: b4183f73f0a00c6fcd607edebb6c35a7a461376d
|
||||
NSUserDefaults-AESEncryptor: da02cfef056f1e18ebe2748767915f08b274c9c5
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: ecc91ff0b61392abb7ab87b4d4c0c633f2f8520b
|
||||
PNObject: 9c66f67c7861a646060f8dc7a550eeeb3f8bd924
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
StrongestPasswordValidator: 554de9038705e18904f0337903dfd3b85a6b271b
|
||||
UIDevice-Utils: 0beb5f9d2bd256a3efe05c1e43a2a8b8702199c4
|
||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||
UIDevice-Utils: a87bbaed53a74d503deb3e25511c9a4d865b92ea
|
||||
|
||||
PODFILE CHECKSUM: 2e494b482bc938579e08ab48dab20d64709c3062
|
||||
|
||||
COCOAPODS: 1.0.0.beta.5
|
||||
COCOAPODS: 1.0.0.beta.6
|
||||
|
||||
85
Example/Pods/CocoaSecurity/CocoaSecurity/CocoaSecurity.h
generated
Normal file
85
Example/Pods/CocoaSecurity/CocoaSecurity/CocoaSecurity.h
generated
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
CocoaSecurity 1.1
|
||||
|
||||
Created by Kelp on 12/5/12.
|
||||
Copyright (c) 2012 Kelp http://kelp.phate.org/
|
||||
MIT License
|
||||
|
||||
CocoaSecurity is core. It provides AES encrypt, AES decrypt, Hash(MD5, HmacMD5, SHA1~SHA512, HmacSHA1~HmacSHA512) messages.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Foundation/NSException.h>
|
||||
|
||||
|
||||
#pragma mark - CocoaSecurityResult
|
||||
@interface CocoaSecurityResult : NSObject
|
||||
|
||||
@property (strong, nonatomic, readonly) NSData *data;
|
||||
@property (strong, nonatomic, readonly) NSString *utf8String;
|
||||
@property (strong, nonatomic, readonly) NSString *hex;
|
||||
@property (strong, nonatomic, readonly) NSString *hexLower;
|
||||
@property (strong, nonatomic, readonly) NSString *base64;
|
||||
|
||||
- (id)initWithBytes:(unsigned char[])initData length:(NSUInteger)length;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - CocoaSecurity
|
||||
@interface CocoaSecurity : NSObject
|
||||
#pragma mark - AES Encrypt
|
||||
+ (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)aesEncrypt:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv;
|
||||
+ (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSData *)key iv:(NSData *)iv;
|
||||
+ (CocoaSecurityResult *)aesEncryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv;
|
||||
#pragma mark AES Decrypt
|
||||
+ (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv;
|
||||
+ (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSData *)key iv:(NSData *)iv;
|
||||
+ (CocoaSecurityResult *)aesDecryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv;
|
||||
|
||||
#pragma mark - MD5
|
||||
+ (CocoaSecurityResult *)md5:(NSString *)hashString;
|
||||
+ (CocoaSecurityResult *)md5WithData:(NSData *)hashData;
|
||||
#pragma mark HMAC-MD5
|
||||
+ (CocoaSecurityResult *)hmacMd5:(NSString *)hashString hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacMd5WithData:(NSData *)hashData hmacKey:(NSString *)key;
|
||||
|
||||
#pragma mark - SHA
|
||||
+ (CocoaSecurityResult *)sha1:(NSString *)hashString;
|
||||
+ (CocoaSecurityResult *)sha1WithData:(NSData *)hashData;
|
||||
+ (CocoaSecurityResult *)sha224:(NSString *)hashString;
|
||||
+ (CocoaSecurityResult *)sha224WithData:(NSData *)hashData;
|
||||
+ (CocoaSecurityResult *)sha256:(NSString *)hashString;
|
||||
+ (CocoaSecurityResult *)sha256WithData:(NSData *)hashData;
|
||||
+ (CocoaSecurityResult *)sha384:(NSString *)hashString;
|
||||
+ (CocoaSecurityResult *)sha384WithData:(NSData *)hashData;
|
||||
+ (CocoaSecurityResult *)sha512:(NSString *)hashString;
|
||||
+ (CocoaSecurityResult *)sha512WithData:(NSData *)hashData;
|
||||
#pragma mark HMAC-SHA
|
||||
+ (CocoaSecurityResult *)hmacSha1:(NSString *)hashString hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha1WithData:(NSData *)hashData hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha224:(NSString *)hashString hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha224WithData:(NSData *)hashData hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha256:(NSString *)hashString hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha256WithData:(NSData *)hashData hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha384:(NSString *)hashString hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha384WithData:(NSData *)hashData hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha512:(NSString *)hashString hmacKey:(NSString *)key;
|
||||
+ (CocoaSecurityResult *)hmacSha512WithData:(NSData *)hashData hmacKey:(NSString *)key;
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - CocoaSecurityEncoder
|
||||
@interface CocoaSecurityEncoder : NSObject
|
||||
- (NSString *)base64:(NSData *)data;
|
||||
- (NSString *)hex:(NSData *)data useLower:(BOOL)isOutputLower;
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - CocoaSecurityDecoder
|
||||
@interface CocoaSecurityDecoder : NSObject
|
||||
- (NSData *)base64:(NSString *)data;
|
||||
- (NSData *)hex:(NSString *)data;
|
||||
@end
|
||||
508
Example/Pods/CocoaSecurity/CocoaSecurity/CocoaSecurity.m
generated
Normal file
508
Example/Pods/CocoaSecurity/CocoaSecurity/CocoaSecurity.m
generated
Normal file
@ -0,0 +1,508 @@
|
||||
//
|
||||
// CocoaSecurity.m
|
||||
//
|
||||
// Created by Kelp on 12/5/12.
|
||||
// Copyright (c) 2012 Kelp http://kelp.phate.org/
|
||||
// MIT License
|
||||
//
|
||||
|
||||
#import "CocoaSecurity.h"
|
||||
#import <CommonCrypto/CommonHMAC.h>
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
#import "Base64.h"
|
||||
|
||||
#pragma mark - CocoaSecurity
|
||||
@implementation CocoaSecurity
|
||||
|
||||
|
||||
#pragma mark - AES Encrypt
|
||||
// default AES Encrypt, key -> SHA384(key).sub(0, 32), iv -> SHA384(key).sub(32, 16)
|
||||
+ (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSString *)key
|
||||
{
|
||||
CocoaSecurityResult * sha = [self sha384:key];
|
||||
NSData *aesKey = [sha.data subdataWithRange:NSMakeRange(0, 32)];
|
||||
NSData *aesIv = [sha.data subdataWithRange:NSMakeRange(32, 16)];
|
||||
|
||||
return [self aesEncrypt:data key:aesKey iv:aesIv];
|
||||
}
|
||||
#pragma mark AES Encrypt 128, 192, 256
|
||||
+ (CocoaSecurityResult *)aesEncrypt:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv
|
||||
{
|
||||
CocoaSecurityDecoder *decoder = [CocoaSecurityDecoder new];
|
||||
NSData *aesKey = [decoder hex:key];
|
||||
NSData *aesIv = [decoder hex:iv];
|
||||
|
||||
return [self aesEncrypt:data key:aesKey iv:aesIv];
|
||||
}
|
||||
+ (CocoaSecurityResult *)aesEncrypt:(NSString *)data key:(NSData *)key iv:(NSData *)iv
|
||||
{
|
||||
return [self aesEncryptWithData:[data dataUsingEncoding:NSUTF8StringEncoding] key:key iv:iv];
|
||||
}
|
||||
+ (CocoaSecurityResult *)aesEncryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv
|
||||
{
|
||||
// check length of key and iv
|
||||
if ([iv length] != 16) {
|
||||
@throw [NSException exceptionWithName:@"Cocoa Security"
|
||||
reason:@"Length of iv is wrong. Length of iv should be 16(128bits)"
|
||||
userInfo:nil];
|
||||
}
|
||||
if ([key length] != 16 && [key length] != 24 && [key length] != 32 ) {
|
||||
@throw [NSException exceptionWithName:@"Cocoa Security"
|
||||
reason:@"Length of key is wrong. Length of iv should be 16, 24 or 32(128, 192 or 256bits)"
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
// setup output buffer
|
||||
size_t bufferSize = [data length] + kCCBlockSizeAES128;
|
||||
void *buffer = malloc(bufferSize);
|
||||
|
||||
// do encrypt
|
||||
size_t encryptedSize = 0;
|
||||
CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt,
|
||||
kCCAlgorithmAES128,
|
||||
kCCOptionPKCS7Padding,
|
||||
[key bytes], // Key
|
||||
[key length], // kCCKeySizeAES
|
||||
[iv bytes], // IV
|
||||
[data bytes],
|
||||
[data length],
|
||||
buffer,
|
||||
bufferSize,
|
||||
&encryptedSize);
|
||||
if (cryptStatus == kCCSuccess) {
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:buffer length:encryptedSize];
|
||||
free(buffer);
|
||||
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
free(buffer);
|
||||
@throw [NSException exceptionWithName:@"Cocoa Security"
|
||||
reason:@"Encrypt Error!"
|
||||
userInfo:nil];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
#pragma mark - AES Decrypt
|
||||
// default AES Decrypt, key -> SHA384(key).sub(0, 32), iv -> SHA384(key).sub(32, 16)
|
||||
+ (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSString *)key
|
||||
{
|
||||
CocoaSecurityResult * sha = [self sha384:key];
|
||||
NSData *aesKey = [sha.data subdataWithRange:NSMakeRange(0, 32)];
|
||||
NSData *aesIv = [sha.data subdataWithRange:NSMakeRange(32, 16)];
|
||||
|
||||
return [self aesDecryptWithBase64:data key:aesKey iv:aesIv];
|
||||
}
|
||||
#pragma mark AES Decrypt 128, 192, 256
|
||||
+ (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data hexKey:(NSString *)key hexIv:(NSString *)iv
|
||||
{
|
||||
CocoaSecurityDecoder *decoder = [CocoaSecurityDecoder new];
|
||||
NSData *aesKey = [decoder hex:key];
|
||||
NSData *aesIv = [decoder hex:iv];
|
||||
|
||||
return [self aesDecryptWithBase64:data key:aesKey iv:aesIv];
|
||||
}
|
||||
+ (CocoaSecurityResult *)aesDecryptWithBase64:(NSString *)data key:(NSData *)key iv:(NSData *)iv
|
||||
{
|
||||
CocoaSecurityDecoder *decoder = [CocoaSecurityDecoder new];
|
||||
return [self aesDecryptWithData:[decoder base64:data] key:key iv:iv];
|
||||
}
|
||||
+ (CocoaSecurityResult *)aesDecryptWithData:(NSData *)data key:(NSData *)key iv:(NSData *)iv
|
||||
{
|
||||
// check length of key and iv
|
||||
if ([iv length] != 16) {
|
||||
@throw [NSException exceptionWithName:@"Cocoa Security"
|
||||
reason:@"Length of iv is wrong. Length of iv should be 16(128bits)"
|
||||
userInfo:nil];
|
||||
}
|
||||
if ([key length] != 16 && [key length] != 24 && [key length] != 32 ) {
|
||||
@throw [NSException exceptionWithName:@"Cocoa Security"
|
||||
reason:@"Length of key is wrong. Length of iv should be 16, 24 or 32(128, 192 or 256bits)"
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
// setup output buffer
|
||||
size_t bufferSize = [data length] + kCCBlockSizeAES128;
|
||||
void *buffer = malloc(bufferSize);
|
||||
|
||||
// do encrypt
|
||||
size_t encryptedSize = 0;
|
||||
CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt,
|
||||
kCCAlgorithmAES128,
|
||||
kCCOptionPKCS7Padding,
|
||||
[key bytes], // Key
|
||||
[key length], // kCCKeySizeAES
|
||||
[iv bytes], // IV
|
||||
[data bytes],
|
||||
[data length],
|
||||
buffer,
|
||||
bufferSize,
|
||||
&encryptedSize);
|
||||
if (cryptStatus == kCCSuccess) {
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:buffer length:encryptedSize];
|
||||
free(buffer);
|
||||
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
free(buffer);
|
||||
@throw [NSException exceptionWithName:@"Cocoa Security"
|
||||
reason:@"Decrypt Error!"
|
||||
userInfo:nil];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - MD5
|
||||
+ (CocoaSecurityResult *)md5:(NSString *)hashString
|
||||
{
|
||||
return [self md5WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
+ (CocoaSecurityResult *)md5WithData:(NSData *)hashData
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_MD5_DIGEST_LENGTH);
|
||||
|
||||
CC_MD5([hashData bytes], (CC_LONG)[hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_MD5_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark - HMAC-MD5
|
||||
+ (CocoaSecurityResult *)hmacMd5:(NSString *)hashString hmacKey:(NSString *)key
|
||||
{
|
||||
return [self hmacMd5WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key];
|
||||
}
|
||||
+ (CocoaSecurityResult *)hmacMd5WithData:(NSData *)hashData hmacKey:(NSString *)key
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_MD5_DIGEST_LENGTH);
|
||||
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
CCHmac(kCCHmacAlgMD5, cKey, strlen(cKey), [hashData bytes], [hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_MD5_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
cKey = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - SHA1
|
||||
+ (CocoaSecurityResult *)sha1:(NSString *)hashString
|
||||
{
|
||||
return [self sha1WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
+ (CocoaSecurityResult *)sha1WithData:(NSData *)hashData
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA1_DIGEST_LENGTH);
|
||||
|
||||
CC_SHA1([hashData bytes], (CC_LONG)[hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA1_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark SHA224
|
||||
+ (CocoaSecurityResult *)sha224:(NSString *)hashString
|
||||
{
|
||||
return [self sha224WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
+ (CocoaSecurityResult *)sha224WithData:(NSData *)hashData
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA224_DIGEST_LENGTH);
|
||||
|
||||
CC_SHA224([hashData bytes], (CC_LONG)[hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA224_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark SHA256
|
||||
+ (CocoaSecurityResult *)sha256:(NSString *)hashString
|
||||
{
|
||||
return [self sha256WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
+ (CocoaSecurityResult *)sha256WithData:(NSData *)hashData
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA256_DIGEST_LENGTH);
|
||||
|
||||
CC_SHA256([hashData bytes], (CC_LONG)[hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA256_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark SHA384
|
||||
+ (CocoaSecurityResult *)sha384:(NSString *)hashString
|
||||
{
|
||||
return [self sha384WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
+ (CocoaSecurityResult *)sha384WithData:(NSData *)hashData
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA384_DIGEST_LENGTH);
|
||||
|
||||
CC_SHA384([hashData bytes], (CC_LONG)[hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA384_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark SHA512
|
||||
+ (CocoaSecurityResult *)sha512:(NSString *)hashString
|
||||
{
|
||||
return [self sha512WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
+ (CocoaSecurityResult *)sha512WithData:(NSData *)hashData
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA512_DIGEST_LENGTH);
|
||||
|
||||
CC_SHA512([hashData bytes], (CC_LONG)[hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA512_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - HMAC-SHA1
|
||||
+ (CocoaSecurityResult *)hmacSha1:(NSString *)hashString hmacKey:(NSString *)key
|
||||
{
|
||||
return [self hmacSha1WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key];
|
||||
}
|
||||
+ (CocoaSecurityResult *)hmacSha1WithData:(NSData *)hashData hmacKey:(NSString *)key
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA1_DIGEST_LENGTH);
|
||||
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
CCHmac(kCCHmacAlgSHA1, cKey, strlen(cKey), [hashData bytes], [hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA1_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
cKey = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark HMAC-SHA224
|
||||
+ (CocoaSecurityResult *)hmacSha224:(NSString *)hashString hmacKey:(NSString *)key
|
||||
{
|
||||
return [self hmacSha224WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key];
|
||||
}
|
||||
+ (CocoaSecurityResult *)hmacSha224WithData:(NSData *)hashData hmacKey:(NSString *)key
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA224_DIGEST_LENGTH);
|
||||
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
CCHmac(kCCHmacAlgSHA224, cKey, strlen(cKey), [hashData bytes], [hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA224_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
cKey = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark HMAC-SHA256
|
||||
+ (CocoaSecurityResult *)hmacSha256:(NSString *)hashString hmacKey:(NSString *)key
|
||||
{
|
||||
return [self hmacSha256WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key];
|
||||
}
|
||||
+ (CocoaSecurityResult *)hmacSha256WithData:(NSData *)hashData hmacKey:(NSString *)key
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA256_DIGEST_LENGTH);
|
||||
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), [hashData bytes], [hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA256_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
cKey = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark HMAC-SHA384
|
||||
+ (CocoaSecurityResult *)hmacSha384:(NSString *)hashString hmacKey:(NSString *)key
|
||||
{
|
||||
return [self hmacSha384WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key];
|
||||
}
|
||||
+ (CocoaSecurityResult *)hmacSha384WithData:(NSData *)hashData hmacKey:(NSString *)key
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA384_DIGEST_LENGTH);
|
||||
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
CCHmac(kCCHmacAlgSHA384, cKey, strlen(cKey), [hashData bytes], [hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA384_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
cKey = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
#pragma mark HMAC-SHA512
|
||||
+ (CocoaSecurityResult *)hmacSha512:(NSString *)hashString hmacKey:(NSString *)key
|
||||
{
|
||||
return [self hmacSha512WithData:[hashString dataUsingEncoding:NSUTF8StringEncoding] hmacKey:key];
|
||||
}
|
||||
+ (CocoaSecurityResult *)hmacSha512WithData:(NSData *)hashData hmacKey:(NSString *)key
|
||||
{
|
||||
unsigned char *digest;
|
||||
digest = malloc(CC_SHA512_DIGEST_LENGTH);
|
||||
const char *cKey = [key cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
CCHmac(kCCHmacAlgSHA512, cKey, strlen(cKey), [hashData bytes], [hashData length], digest);
|
||||
CocoaSecurityResult *result = [[CocoaSecurityResult alloc] initWithBytes:digest length:CC_SHA512_DIGEST_LENGTH];
|
||||
free(digest);
|
||||
cKey = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#pragma mark - CocoaSecurityResult
|
||||
@implementation CocoaSecurityResult
|
||||
|
||||
@synthesize data = _data;
|
||||
|
||||
#pragma mark - Init
|
||||
- (id)initWithBytes:(unsigned char[])initData length:(NSUInteger)length
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_data = [NSData dataWithBytes:initData length:length];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark UTF8 String
|
||||
// convert CocoaSecurityResult to UTF8 string
|
||||
- (NSString *)utf8String
|
||||
{
|
||||
NSString *result = [[NSString alloc] initWithData:_data encoding:NSUTF8StringEncoding];
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma mark HEX
|
||||
// convert CocoaSecurityResult to HEX string
|
||||
- (NSString *)hex
|
||||
{
|
||||
CocoaSecurityEncoder *encoder = [CocoaSecurityEncoder new];
|
||||
return [encoder hex:_data useLower:false];
|
||||
}
|
||||
- (NSString *)hexLower
|
||||
{
|
||||
CocoaSecurityEncoder *encoder = [CocoaSecurityEncoder new];
|
||||
return [encoder hex:_data useLower:true];
|
||||
}
|
||||
|
||||
#pragma mark Base64
|
||||
// convert CocoaSecurityResult to Base64 string
|
||||
- (NSString *)base64
|
||||
{
|
||||
CocoaSecurityEncoder *encoder = [CocoaSecurityEncoder new];
|
||||
return [encoder base64:_data];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma mark - CocoaSecurityEncoder
|
||||
@implementation CocoaSecurityEncoder
|
||||
|
||||
// convert NSData to Base64
|
||||
- (NSString *)base64:(NSData *)data
|
||||
{
|
||||
return [data base64EncodedString];
|
||||
}
|
||||
|
||||
// convert NSData to hex string
|
||||
- (NSString *)hex:(NSData *)data useLower:(BOOL)isOutputLower
|
||||
{
|
||||
if (data.length == 0) { return nil; }
|
||||
|
||||
static const char HexEncodeCharsLower[] = "0123456789abcdef";
|
||||
static const char HexEncodeChars[] = "0123456789ABCDEF";
|
||||
char *resultData;
|
||||
// malloc result data
|
||||
resultData = malloc([data length] * 2 +1);
|
||||
// convert imgData(NSData) to char[]
|
||||
unsigned char *sourceData = ((unsigned char *)[data bytes]);
|
||||
NSUInteger length = [data length];
|
||||
|
||||
if (isOutputLower) {
|
||||
for (NSUInteger index = 0; index < length; index++) {
|
||||
// set result data
|
||||
resultData[index * 2] = HexEncodeCharsLower[(sourceData[index] >> 4)];
|
||||
resultData[index * 2 + 1] = HexEncodeCharsLower[(sourceData[index] % 0x10)];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (NSUInteger index = 0; index < length; index++) {
|
||||
// set result data
|
||||
resultData[index * 2] = HexEncodeChars[(sourceData[index] >> 4)];
|
||||
resultData[index * 2 + 1] = HexEncodeChars[(sourceData[index] % 0x10)];
|
||||
}
|
||||
}
|
||||
resultData[[data length] * 2] = 0;
|
||||
|
||||
// convert result(char[]) to NSString
|
||||
NSString *result = [NSString stringWithCString:resultData encoding:NSASCIIStringEncoding];
|
||||
sourceData = nil;
|
||||
free(resultData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - CocoaSecurityDecoder
|
||||
@implementation CocoaSecurityDecoder
|
||||
- (NSData *)base64:(NSString *)string
|
||||
{
|
||||
return [NSData dataWithBase64EncodedString:string];
|
||||
}
|
||||
- (NSData *)hex:(NSString *)data
|
||||
{
|
||||
if (data.length == 0) { return nil; }
|
||||
|
||||
static const unsigned char HexDecodeChars[] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, //49
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 0, 0, //59
|
||||
0, 0, 0, 0, 0, 10, 11, 12, 13, 14,
|
||||
15, 0, 0, 0, 0, 0, 0, 0, 0, 0, //79
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 10, 11, 12, //99
|
||||
13, 14, 15
|
||||
};
|
||||
|
||||
// convert data(NSString) to CString
|
||||
const char *source = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
// malloc buffer
|
||||
unsigned char *buffer;
|
||||
NSUInteger length = strlen(source) / 2;
|
||||
buffer = malloc(length);
|
||||
for (NSUInteger index = 0; index < length; index++) {
|
||||
buffer[index] = (HexDecodeChars[source[index * 2]] << 4) + (HexDecodeChars[source[index * 2 + 1]]);
|
||||
}
|
||||
// init result NSData
|
||||
NSData *result = [NSData dataWithBytes:buffer length:length];
|
||||
free(buffer);
|
||||
source = nil;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
8
Example/Pods/CocoaSecurity/LICENSE
generated
Normal file
8
Example/Pods/CocoaSecurity/LICENSE
generated
Normal file
@ -0,0 +1,8 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Kelp https://github.com/kelp404
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
111
Example/Pods/CocoaSecurity/README.md
generated
Normal file
111
Example/Pods/CocoaSecurity/README.md
generated
Normal file
@ -0,0 +1,111 @@
|
||||
#CocoaSecurity [](http://travis-ci.org/#!/kelp404/CocoaSecurity)
|
||||
|
||||
Kelp https://twitter.com/kelp404/
|
||||
[MIT License][mit]
|
||||
[MIT]: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
|
||||
CocoaSecurity include 4 classes, `CocoaSecurity`, `CocoaSecurityResult`, `CocoaSecurityEncoder` and `CocoaSecurityDecoder`.
|
||||
|
||||
##CocoaSecurity
|
||||
CocoaSecurity is core. It provides AES encrypt, AES decrypt, Hash(MD5, HmacMD5, SHA1~SHA512, HmacSHA1~HmacSHA512) messages.
|
||||
|
||||
**MD5:**
|
||||
```objective-c
|
||||
CocoaSecurityResult *md5 = [CocoaSecurity md5:@"kelp"];
|
||||
|
||||
// md5.hex = 'C40C69779E15780ADAE46C45EB451E23'
|
||||
// md5.hexLower = 'c40c69779e15780adae46c45eb451e23'
|
||||
// md5.base64 = 'xAxpd54VeAra5GxF60UeIw=='
|
||||
```
|
||||
**SHA256:**
|
||||
```objective-c
|
||||
CocoaSecurityResult *sha256 = [CocoaSecurity sha256:@"kelp"];
|
||||
|
||||
// sha256.hexLower = '280f8bb8c43d532f389ef0e2a5321220b0782b065205dcdfcb8d8f02ed5115b9'
|
||||
// sha256.base64 = 'KA+LuMQ9Uy84nvDipTISILB4KwZSBdzfy42PAu1RFbk='
|
||||
```
|
||||
**default AES Encrypt:**<br/>
|
||||
key -> SHA384(key).sub(0, 32)<br/>
|
||||
iv -> SHA384(key).sub(32, 16)
|
||||
```objective-c
|
||||
CocoaSecurityResult *aesDefault = [CocoaSecurity aesEncrypt:@"kelp" key:@"key"];
|
||||
|
||||
// aesDefault.base64 = 'ez9uubPneV1d2+rpjnabJw=='
|
||||
```
|
||||
**AES256 Encrypt & Decrypt:**
|
||||
```objective-c
|
||||
CocoaSecurityResult *aes256 = [CocoaSecurity aesEncrypt:@"kelp"
|
||||
hexKey:@"280f8bb8c43d532f389ef0e2a5321220b0782b065205dcdfcb8d8f02ed5115b9"
|
||||
hexIv:@"CC0A69779E15780ADAE46C45EB451A23"];
|
||||
// aes256.base64 = 'WQYg5qvcGyCBY3IF0hPsoQ=='
|
||||
|
||||
CocoaSecurityResult *aes256Decrypt = [CocoaSecurity aesDecryptWithBase64:@"WQYg5qvcGyCBY3IF0hPsoQ=="
|
||||
hexKey:@"280f8bb8c43d532f389ef0e2a5321220b0782b065205dcdfcb8d8f02ed5115b9"
|
||||
hexIv:@"CC0A69779E15780ADAE46C45EB451A23"];
|
||||
// aes256Decrypt.utf8String = 'kelp'
|
||||
```
|
||||
|
||||
|
||||
##CocoaSecurityResult
|
||||
CocoaSecurityResult is the result class of CocoaSecurity. It provides convert result data to NSData, NSString, HEX string, Base64 string.
|
||||
|
||||
```objective-c
|
||||
@property (strong, nonatomic, readonly) NSData *data;
|
||||
@property (strong, nonatomic, readonly) NSString *utf8String;
|
||||
@property (strong, nonatomic, readonly) NSString *hex;
|
||||
@property (strong, nonatomic, readonly) NSString *hexLower;
|
||||
@property (strong, nonatomic, readonly) NSString *base64;
|
||||
```
|
||||
|
||||
|
||||
##CocoaSecurityEncoder
|
||||
CocoaSecurityEncoder provides convert NSData to HEX string, Base64 string.
|
||||
|
||||
```objective-c
|
||||
- (NSString *)base64:(NSData *)data;
|
||||
- (NSString *)hex:(NSData *)data useLower:(BOOL)isOutputLower;
|
||||
```
|
||||
**example:**
|
||||
```objective-c
|
||||
CocoaSecurityEncoder *encoder = [CocoaSecurityEncoder new];
|
||||
NSString *str1 = [encoder hex:[@"kelp" dataUsingEncoding:NSUTF8StringEncoding] useLower:NO];
|
||||
// str1 = '6B656C70'
|
||||
NSString *str2 = [encoder base64:[@"kelp" dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
// str2 = 'a2VscA=='
|
||||
```
|
||||
|
||||
##CocoaSecurityDecoder
|
||||
CocoaSecurityEncoder provides convert HEX string or Base64 string to NSData.
|
||||
|
||||
```objective-c
|
||||
- (NSData *)base64:(NSString *)data;
|
||||
- (NSData *)hex:(NSString *)data;
|
||||
```
|
||||
**example:**
|
||||
```objective-c
|
||||
CocoaSecurityDecoder *decoder = [CocoaSecurityDecoder new];
|
||||
NSData *data1 = [decoder hex:@"CC0A69779E15780ADAE46C45EB451A23"];
|
||||
// data1 = <cc0a6977 9e15780a dae46c45 eb451a23>
|
||||
NSData *data2 = [decoder base64:@"zT1PS64MnXIUDCUiy13RRg=="];
|
||||
// data2 = <cd3d4f4b ae0c9d72 140c2522 cb5dd146>
|
||||
```
|
||||
|
||||
|
||||
##Installation
|
||||
1. **git:**
|
||||
```
|
||||
$ git clone git://github.com/kelp404/CocoaSecurity.git
|
||||
$ cd CocoaSecurity
|
||||
$ git submodule update --init
|
||||
```
|
||||
|
||||
2. **<a href="http://cocoapods.org/?q=CocoaSecurity" target="_blank">CocoadPods</a>:**
|
||||
add `Podfile` in your project path
|
||||
```
|
||||
platform :ios
|
||||
pod 'CocoaSecurity'
|
||||
```
|
||||
```
|
||||
$ pod install
|
||||
```
|
||||
53
Example/Pods/CocoaSecurity/submodules/Base64/Base64/Base64.h
generated
Normal file
53
Example/Pods/CocoaSecurity/submodules/Base64/Base64/Base64.h
generated
Normal file
@ -0,0 +1,53 @@
|
||||
//
|
||||
// Base64.h
|
||||
//
|
||||
// Version 1.2
|
||||
//
|
||||
// Created by Nick Lockwood on 12/01/2012.
|
||||
// Copyright (C) 2012 Charcoal Design
|
||||
//
|
||||
// Distributed under the permissive zlib License
|
||||
// Get the latest version from here:
|
||||
//
|
||||
// https://github.com/nicklockwood/Base64
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSData (Base64)
|
||||
|
||||
+ (NSData *)dataWithBase64EncodedString:(NSString *)string;
|
||||
- (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth;
|
||||
- (NSString *)base64EncodedString;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSString (Base64)
|
||||
|
||||
+ (NSString *)stringWithBase64EncodedString:(NSString *)string;
|
||||
- (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth;
|
||||
- (NSString *)base64EncodedString;
|
||||
- (NSString *)base64DecodedString;
|
||||
- (NSData *)base64DecodedData;
|
||||
|
||||
@end
|
||||
167
Example/Pods/CocoaSecurity/submodules/Base64/Base64/Base64.m
generated
Normal file
167
Example/Pods/CocoaSecurity/submodules/Base64/Base64/Base64.m
generated
Normal file
@ -0,0 +1,167 @@
|
||||
//
|
||||
// Base64.m
|
||||
//
|
||||
// Version 1.2
|
||||
//
|
||||
// Created by Nick Lockwood on 12/01/2012.
|
||||
// Copyright (C) 2012 Charcoal Design
|
||||
//
|
||||
// Distributed under the permissive zlib License
|
||||
// Get the latest version from here:
|
||||
//
|
||||
// https://github.com/nicklockwood/Base64
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an aacknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#import "Base64.h"
|
||||
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wselector"
|
||||
|
||||
|
||||
#import <Availability.h>
|
||||
#if !__has_feature(objc_arc)
|
||||
#error This library requires automatic reference counting
|
||||
#endif
|
||||
|
||||
|
||||
@implementation NSData (Base64)
|
||||
|
||||
+ (NSData *)dataWithBase64EncodedString:(NSString *)string
|
||||
{
|
||||
if (![string length]) return nil;
|
||||
|
||||
NSData *decoded = nil;
|
||||
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9 || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
|
||||
|
||||
if (![NSData instancesRespondToSelector:@selector(initWithBase64EncodedString:options:)])
|
||||
{
|
||||
decoded = [[self alloc] initWithBase64Encoding:[string stringByReplacingOccurrencesOfString:@"[^A-Za-z0-9+/=]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, [string length])]];
|
||||
}
|
||||
else
|
||||
|
||||
#endif
|
||||
|
||||
{
|
||||
decoded = [[self alloc] initWithBase64EncodedString:string options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
}
|
||||
|
||||
return [decoded length]? decoded: nil;
|
||||
}
|
||||
|
||||
- (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth
|
||||
{
|
||||
if (![self length]) return nil;
|
||||
|
||||
NSString *encoded = nil;
|
||||
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9 || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
|
||||
|
||||
if (![NSData instancesRespondToSelector:@selector(base64EncodedStringWithOptions:)])
|
||||
{
|
||||
encoded = [self base64Encoding];
|
||||
}
|
||||
else
|
||||
|
||||
#endif
|
||||
|
||||
{
|
||||
switch (wrapWidth)
|
||||
{
|
||||
case 64:
|
||||
{
|
||||
return [self base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
|
||||
}
|
||||
case 76:
|
||||
{
|
||||
return [self base64EncodedStringWithOptions:NSDataBase64Encoding76CharacterLineLength];
|
||||
}
|
||||
default:
|
||||
{
|
||||
encoded = [self base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!wrapWidth || wrapWidth >= [encoded length])
|
||||
{
|
||||
return encoded;
|
||||
}
|
||||
|
||||
wrapWidth = (wrapWidth / 4) * 4;
|
||||
NSMutableString *result = [NSMutableString string];
|
||||
for (NSUInteger i = 0; i < [encoded length]; i+= wrapWidth)
|
||||
{
|
||||
if (i + wrapWidth >= [encoded length])
|
||||
{
|
||||
[result appendString:[encoded substringFromIndex:i]];
|
||||
break;
|
||||
}
|
||||
[result appendString:[encoded substringWithRange:NSMakeRange(i, wrapWidth)]];
|
||||
[result appendString:@"\r\n"];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)base64EncodedString
|
||||
{
|
||||
return [self base64EncodedStringWithWrapWidth:0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSString (Base64)
|
||||
|
||||
+ (NSString *)stringWithBase64EncodedString:(NSString *)string
|
||||
{
|
||||
NSData *data = [NSData dataWithBase64EncodedString:string];
|
||||
if (data)
|
||||
{
|
||||
return [[self alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth
|
||||
{
|
||||
NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
||||
return [data base64EncodedStringWithWrapWidth:wrapWidth];
|
||||
}
|
||||
|
||||
- (NSString *)base64EncodedString
|
||||
{
|
||||
NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
||||
return [data base64EncodedString];
|
||||
}
|
||||
|
||||
- (NSString *)base64DecodedString
|
||||
{
|
||||
return [NSString stringWithBase64EncodedString:self];
|
||||
}
|
||||
|
||||
- (NSData *)base64DecodedData
|
||||
{
|
||||
return [NSData dataWithBase64EncodedString:self];
|
||||
}
|
||||
|
||||
@end
|
||||
16
Example/Pods/Local Podspecs/PNObject.podspec.json
generated
16
Example/Pods/Local Podspecs/PNObject.podspec.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PNObject",
|
||||
"version": "0.3.17",
|
||||
"version": "0.3.18",
|
||||
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
||||
"homepage": "https://github.com/giuseppenucifora/PNObject",
|
||||
"license": "MIT",
|
||||
@ -9,18 +9,13 @@
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/giuseppenucifora/PNObject.git",
|
||||
"tag": "0.3.17"
|
||||
"tag": "0.3.18"
|
||||
},
|
||||
"platforms": {
|
||||
"ios": "7.0"
|
||||
"ios": "8.0"
|
||||
},
|
||||
"requires_arc": true,
|
||||
"source_files": "Pod/Classes/**/*",
|
||||
"resource_bundles": {
|
||||
"PNObject": [
|
||||
"Pod/Assets/*.png"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"AFNetworking": [
|
||||
|
||||
@ -55,7 +50,10 @@
|
||||
"FBSDKLoginKit": [
|
||||
|
||||
],
|
||||
"RNCryptor": [
|
||||
"NACrypto": [
|
||||
|
||||
],
|
||||
"NSUserDefaults-AESEncryptor": [
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
38
Example/Pods/Manifest.lock
generated
38
Example/Pods/Manifest.lock
generated
@ -20,7 +20,8 @@ PODS:
|
||||
- Bolts/AppLinks (1.6.0):
|
||||
- Bolts/Tasks
|
||||
- Bolts/Tasks (1.6.0)
|
||||
- CodFis-Helper (0.1.2)
|
||||
- CocoaSecurity (1.2.4)
|
||||
- CodFis-Helper (0.1.3)
|
||||
- Expecta (1.0.5)
|
||||
- Expecta+Snapshots (2.0.0):
|
||||
- Expecta (~> 1.0)
|
||||
@ -36,28 +37,31 @@ PODS:
|
||||
- FBSnapshotTestCase/Core (2.0.7)
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.7):
|
||||
- FBSnapshotTestCase/Core
|
||||
- NSDate_Utils (0.1.2)
|
||||
- NSString-Helper (1.0.3)
|
||||
- NACrypto (1.0.6)
|
||||
- NSDate_Utils (0.1.3)
|
||||
- NSString-Helper (1.0.4)
|
||||
- NSUserDefaults-AESEncryptor (0.0.4):
|
||||
- CocoaSecurity (~> 1.2.2)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (0.3.17):
|
||||
- PNObject (0.3.18):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- FBSDKCoreKit
|
||||
- FBSDKLoginKit
|
||||
- FBSDKShareKit
|
||||
- NACrypto
|
||||
- NSDate_Utils
|
||||
- NSString-Helper
|
||||
- NSUserDefaults-AESEncryptor
|
||||
- nv-ios-http-status
|
||||
- PEAR-FileManager-iOS
|
||||
- RNCryptor
|
||||
- StrongestPasswordValidator
|
||||
- UIDevice-Utils
|
||||
- PureLayout (3.0.1)
|
||||
- RNCryptor (4.0.0)
|
||||
- Specta (1.0.5)
|
||||
- StrongestPasswordValidator (0.1.1)
|
||||
- UIDevice-Utils (0.1.4)
|
||||
- StrongestPasswordValidator (0.1.2)
|
||||
- UIDevice-Utils (0.1.5)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking
|
||||
@ -85,24 +89,26 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: a0075feb321559dc78d9d85b55d11caa19eabb93
|
||||
Bolts: f52a250053bb517ca874523c3913776359ab3def
|
||||
CodFis-Helper: f303810699f22dbcba8fb8c600545ac91fc3ec42
|
||||
CocoaSecurity: d288a6f87e0f363823d2cb83e753814a6944f71a
|
||||
CodFis-Helper: 28be4c74d7202542459d72354f59b1215871de87
|
||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||
Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba
|
||||
FBSDKCoreKit: 13bec8373fb3af94d44daf2aa1e0958687897fbd
|
||||
FBSDKLoginKit: d3d4a2e9d31954deb00bfea964167a05ca1ea976
|
||||
FBSDKShareKit: 54587b4624706ace1e810cf83412a918141f807a
|
||||
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
|
||||
NSDate_Utils: 6f310af16917c48536836d4c17e1e47bf6fbe8e4
|
||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||
NACrypto: ce3900f1775f1b0cc27ce7c4953b94c598a74149
|
||||
NSDate_Utils: 68669d2c81f310ee13026c791f4f0ed227b94c65
|
||||
NSString-Helper: b4183f73f0a00c6fcd607edebb6c35a7a461376d
|
||||
NSUserDefaults-AESEncryptor: da02cfef056f1e18ebe2748767915f08b274c9c5
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: ecc91ff0b61392abb7ab87b4d4c0c633f2f8520b
|
||||
PNObject: 9c66f67c7861a646060f8dc7a550eeeb3f8bd924
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
StrongestPasswordValidator: 554de9038705e18904f0337903dfd3b85a6b271b
|
||||
UIDevice-Utils: 0beb5f9d2bd256a3efe05c1e43a2a8b8702199c4
|
||||
StrongestPasswordValidator: 921e42615bdf353513c6f925bffd4fc29865dbd7
|
||||
UIDevice-Utils: a87bbaed53a74d503deb3e25511c9a4d865b92ea
|
||||
|
||||
PODFILE CHECKSUM: 2e494b482bc938579e08ab48dab20d64709c3062
|
||||
|
||||
COCOAPODS: 1.0.0.beta.5
|
||||
COCOAPODS: 1.0.0.beta.6
|
||||
|
||||
22
Example/Pods/NACrypto/LICENSE
generated
Normal file
22
Example/Pods/NACrypto/LICENSE
generated
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gabriel Handford
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
25
Example/Pods/NACrypto/NACrypto/NAAES.h
generated
Normal file
25
Example/Pods/NACrypto/NACrypto/NAAES.h
generated
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// NAAES.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM (NSUInteger, NAAESAlgorithm) {
|
||||
NAAESAlgorithm256CTR = 1,
|
||||
};
|
||||
|
||||
@interface NAAES : NSObject
|
||||
|
||||
@property (readonly) NAAESAlgorithm algorithm;
|
||||
|
||||
- (instancetype)initWithAlgorithm:(NAAESAlgorithm)algorithm;
|
||||
|
||||
- (NSData *)encrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error;
|
||||
|
||||
- (NSData *)decrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error;
|
||||
|
||||
@end
|
||||
72
Example/Pods/NACrypto/NACrypto/NAAES.m
generated
Normal file
72
Example/Pods/NACrypto/NACrypto/NAAES.m
generated
Normal file
@ -0,0 +1,72 @@
|
||||
//
|
||||
// NAAES.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NAAES.h"
|
||||
|
||||
//#include "crypto_stream_aes256estream.h"
|
||||
#include <CommonCrypto/CommonCryptor.h>
|
||||
|
||||
#import "NACounter.h"
|
||||
#import "NANSMutableData+Utils.h"
|
||||
|
||||
#define AES_256_CTR_NONCE_BYTES (16)
|
||||
#define AES_256_CTR_KEY_BYTES (32)
|
||||
|
||||
@implementation NAAES
|
||||
|
||||
- (instancetype)initWithAlgorithm:(NAAESAlgorithm)algorithm {
|
||||
if ((self = [super init])) {
|
||||
_algorithm = algorithm;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSData *)encrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error {
|
||||
NSAssert(_algorithm == NAAESAlgorithm256CTR, @"Unsupported algorithm");
|
||||
|
||||
if (!nonce || [nonce length] < AES_256_CTR_NONCE_BYTES) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:600 userInfo:@{NSLocalizedDescriptionKey: @"Invalid AES nonce"}];
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (!key || [key length] != AES_256_CTR_KEY_BYTES) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:601 userInfo:@{NSLocalizedDescriptionKey: @"Invalid AES key"}];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// This libsodium version doesn't return what I expected
|
||||
//int retval = crypto_stream_aes256estream_xor([outData mutableBytes], [data bytes], [data length], [nonce bytes], [key bytes]);
|
||||
|
||||
NSMutableData *outData = [data mutableCopy];
|
||||
|
||||
CCCryptorStatus cryptStatus;
|
||||
CCCryptorRef cryptor;
|
||||
cryptStatus = CCCryptorCreateWithMode(kCCEncrypt, kCCModeCTR, kCCAlgorithmAES128, ccNoPadding, [nonce bytes], [key bytes], [key length], NULL, 0, 0, kCCModeOptionCTR_BE, &cryptor);
|
||||
|
||||
if (cryptStatus != kCCSuccess) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:604 userInfo:@{NSLocalizedDescriptionKey: @"Failed AES (1)"}];
|
||||
return nil;
|
||||
}
|
||||
|
||||
size_t bytesEncrypted;
|
||||
cryptStatus = CCCryptorUpdate(cryptor, [data bytes],[ data length], [outData mutableBytes], [outData length], &bytesEncrypted);
|
||||
|
||||
if (cryptStatus != kCCSuccess) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:605 userInfo:@{NSLocalizedDescriptionKey: @"Failed AES (2)"}];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return outData;
|
||||
}
|
||||
|
||||
- (NSData *)decrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error {
|
||||
NSAssert(_algorithm == NAAESAlgorithm256CTR, @"Unsupported algorithm");
|
||||
return [self encrypt:data nonce:nonce key:key error:error];
|
||||
}
|
||||
|
||||
@end
|
||||
20
Example/Pods/NACrypto/NACrypto/NACounter.h
generated
Normal file
20
Example/Pods/NACrypto/NACrypto/NACounter.h
generated
Normal file
@ -0,0 +1,20 @@
|
||||
//
|
||||
// NACounter.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Counter for CTR mode
|
||||
@interface NACounter : NSObject
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data;
|
||||
|
||||
- (void)increment;
|
||||
|
||||
- (NSData *)data;
|
||||
|
||||
@end
|
||||
44
Example/Pods/NACrypto/NACrypto/NACounter.m
generated
Normal file
44
Example/Pods/NACrypto/NACrypto/NACounter.m
generated
Normal file
@ -0,0 +1,44 @@
|
||||
//
|
||||
// NACounter.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NACounter.h"
|
||||
|
||||
@interface NACounter ()
|
||||
@property NSMutableData *counterData;
|
||||
@end
|
||||
|
||||
#define DEFAULT_LENGTH (16)
|
||||
|
||||
@implementation NACounter
|
||||
|
||||
- (instancetype)init {
|
||||
NSAssert(NO, @"Use initWithData:");
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data {
|
||||
if ((self = [super init])) {
|
||||
_counterData = [data mutableCopy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)increment {
|
||||
for (NSInteger i = [_counterData length] - 1; i >= 0; i--) {
|
||||
uint8_t *bytes = [_counterData mutableBytes];
|
||||
bytes[i]++;
|
||||
if (bytes[i])
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSData *)data {
|
||||
return _counterData;
|
||||
}
|
||||
|
||||
@end
|
||||
33
Example/Pods/NACrypto/NACrypto/NACrypto.h
generated
Normal file
33
Example/Pods/NACrypto/NACrypto/NACrypto.h
generated
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// NACrypto.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/16/15.
|
||||
// Copyright (c) 2015 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for NACrypto.
|
||||
FOUNDATION_EXPORT double NACryptoVersionNumber;
|
||||
|
||||
//! Project version string for NACrypto.
|
||||
FOUNDATION_EXPORT const unsigned char NACryptoVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <NACrypto/PublicHeader.h>
|
||||
|
||||
#import <NACrypto/NASecRandom.h>
|
||||
#import <NACrypto/NAHMAC.h>
|
||||
#import <NACrypto/NAKeychain.h>
|
||||
|
||||
#import <NACrypto/NATwoFish.h>
|
||||
#import <NACrypto/NAAES.h>
|
||||
#import <NACrypto/NACounter.h>
|
||||
|
||||
#import <NACrypto/NADigest.h>
|
||||
#import <NACrypto/NASHA3.h>
|
||||
|
||||
#import <NACrypto/NANSData+Utils.h>
|
||||
#import <NACrypto/NANSString+Utils.h>
|
||||
#import <NACrypto/NANSMutableData+Utils.h>
|
||||
|
||||
34
Example/Pods/NACrypto/NACrypto/NADigest.h
generated
Normal file
34
Example/Pods/NACrypto/NACrypto/NADigest.h
generated
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// NADigest.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 7/3/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM (NSUInteger, NADigestAlgorithm) {
|
||||
//NADigestAlgorithmSHA1 = 1, // SHA1 might not be secure enough
|
||||
NADigestAlgorithmSHA2_224 = 2,
|
||||
NADigestAlgorithmSHA2_256,
|
||||
NADigestAlgorithmSHA2_384,
|
||||
NADigestAlgorithmSHA2_512,
|
||||
|
||||
// SHA3
|
||||
NADigestAlgorithmSHA3_256,
|
||||
NADigestAlgorithmSHA3_384,
|
||||
NADigestAlgorithmSHA3_512,
|
||||
};
|
||||
|
||||
@interface NADigest : NSObject
|
||||
|
||||
@property NADigestAlgorithm algorithm;
|
||||
|
||||
- (instancetype)initWithAlgorithm:(NADigestAlgorithm)algorithm;
|
||||
|
||||
- (NSData *)digestForData:(NSData *)data;
|
||||
|
||||
+ (NSData *)digestForData:(NSData *)data algorithm:(NADigestAlgorithm)algorithm;
|
||||
|
||||
@end
|
||||
77
Example/Pods/NACrypto/NACrypto/NADigest.m
generated
Normal file
77
Example/Pods/NACrypto/NACrypto/NADigest.m
generated
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// NADigest.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 7/3/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NADigest.h"
|
||||
#import "NASHA3.h"
|
||||
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
@implementation NADigest
|
||||
|
||||
- (instancetype)initWithAlgorithm:(NADigestAlgorithm)algorithm {
|
||||
if ((self = [super init])) {
|
||||
_algorithm = algorithm;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSData *)digestForData:(NSData *)data {
|
||||
return [NADigest digestForData:data algorithm:_algorithm];
|
||||
}
|
||||
|
||||
+ (NSData *)digestForData:(NSData *)data algorithm:(NADigestAlgorithm)algorithm {
|
||||
switch (algorithm) {
|
||||
case NADigestAlgorithmSHA2_224:
|
||||
case NADigestAlgorithmSHA2_256:
|
||||
case NADigestAlgorithmSHA2_384:
|
||||
case NADigestAlgorithmSHA2_512:
|
||||
return [self _SHAForData:data algorithm:algorithm];
|
||||
|
||||
case NADigestAlgorithmSHA3_256:
|
||||
return [NASHA3 SHA3ForData:data digestBitLength:256];
|
||||
case NADigestAlgorithmSHA3_384:
|
||||
return [NASHA3 SHA3ForData:data digestBitLength:384];
|
||||
case NADigestAlgorithmSHA3_512:
|
||||
return [NASHA3 SHA3ForData:data digestBitLength:512];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSData *)_SHAForData:(NSData *)data algorithm:(NADigestAlgorithm)algorithm {
|
||||
switch (algorithm) {
|
||||
case NADigestAlgorithmSHA2_224: {
|
||||
uint8_t digest[CC_SHA224_DIGEST_LENGTH];
|
||||
CC_SHA224(data.bytes, (CC_LONG)data.length, digest);
|
||||
return [[NSData alloc] initWithBytes:digest length:sizeof(digest)];
|
||||
}
|
||||
|
||||
case NADigestAlgorithmSHA2_256: {
|
||||
uint8_t digest[CC_SHA256_DIGEST_LENGTH];
|
||||
CC_SHA256(data.bytes, (CC_LONG)data.length, digest);
|
||||
return [[NSData alloc] initWithBytes:digest length:sizeof(digest)];
|
||||
}
|
||||
|
||||
case NADigestAlgorithmSHA2_384: {
|
||||
uint8_t digest[CC_SHA384_DIGEST_LENGTH];
|
||||
CC_SHA384(data.bytes, (CC_LONG)data.length, digest);
|
||||
return [[NSData alloc] initWithBytes:digest length:sizeof(digest)];
|
||||
}
|
||||
|
||||
case NADigestAlgorithmSHA2_512: {
|
||||
uint8_t digest[CC_SHA512_DIGEST_LENGTH];
|
||||
CC_SHA512(data.bytes, (CC_LONG)data.length, digest);
|
||||
return [[NSData alloc] initWithBytes:digest length:sizeof(digest)];
|
||||
}
|
||||
|
||||
default: {
|
||||
NSAssert(NO, @"Unsupported algorithm");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
34
Example/Pods/NACrypto/NACrypto/NAHMAC.h
generated
Normal file
34
Example/Pods/NACrypto/NACrypto/NAHMAC.h
generated
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// NAHMAC.h
|
||||
// NACL
|
||||
//
|
||||
// Created by Gabriel Handford on 1/16/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM (NSUInteger, NAHMACAlgorithm) {
|
||||
NAHMACAlgorithmSHA1,
|
||||
NAHMACAlgorithmSHA2_224,
|
||||
NAHMACAlgorithmSHA2_256,
|
||||
NAHMACAlgorithmSHA2_384,
|
||||
NAHMACAlgorithmSHA2_512,
|
||||
|
||||
// SHA3
|
||||
NAHMACAlgorithmSHA3_256,
|
||||
NAHMACAlgorithmSHA3_384,
|
||||
NAHMACAlgorithmSHA3_512,
|
||||
};
|
||||
|
||||
@interface NAHMAC : NSObject
|
||||
|
||||
@property NAHMACAlgorithm algorithm;
|
||||
|
||||
- (instancetype)initWithAlgorithm:(NAHMACAlgorithm)algorithm;
|
||||
|
||||
- (NSData *)HMACForKey:(NSData *)key data:(NSData *)data;
|
||||
|
||||
+ (NSData *)HMACForKey:(NSData *)key data:(NSData *)data algorithm:(NAHMACAlgorithm)algorithm;
|
||||
|
||||
@end
|
||||
121
Example/Pods/NACrypto/NACrypto/NAHMAC.m
generated
Normal file
121
Example/Pods/NACrypto/NACrypto/NAHMAC.m
generated
Normal file
@ -0,0 +1,121 @@
|
||||
//
|
||||
// NAHMAC.m
|
||||
// NACL
|
||||
//
|
||||
// Created by Gabriel Handford on 1/16/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NAHMAC.h"
|
||||
|
||||
#include <CommonCrypto/CommonHMAC.h>
|
||||
#import "NANSData+Utils.h"
|
||||
#import "NANSString+Utils.h"
|
||||
#import "NASHA3.h"
|
||||
|
||||
@implementation NAHMAC
|
||||
|
||||
- (instancetype)initWithAlgorithm:(NAHMACAlgorithm)algorithm {
|
||||
if ((self = [super init])) {
|
||||
_algorithm = algorithm;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSData *)HMACForKey:(NSData *)key data:(NSData *)data {
|
||||
return [NAHMAC HMACForKey:key data:data algorithm:_algorithm];
|
||||
}
|
||||
|
||||
+ (NSData *)HMACForKey:(NSData *)key data:(NSData *)data algorithm:(NAHMACAlgorithm)algorithm {
|
||||
NSParameterAssert(key);
|
||||
|
||||
switch (algorithm) {
|
||||
case NAHMACAlgorithmSHA1:
|
||||
case NAHMACAlgorithmSHA2_224:
|
||||
case NAHMACAlgorithmSHA2_256:
|
||||
case NAHMACAlgorithmSHA2_384:
|
||||
case NAHMACAlgorithmSHA2_512:
|
||||
return [self _HMACSHAForKey:key data:data algorithm:algorithm];
|
||||
|
||||
case NAHMACAlgorithmSHA3_256:
|
||||
case NAHMACAlgorithmSHA3_384:
|
||||
case NAHMACAlgorithmSHA3_512:
|
||||
return [self _HMACSHA3ForKey:key data:data algorithm:algorithm];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSData *)_HMACSHAForKey:(NSData *)key data:(NSData *)data algorithm:(NAHMACAlgorithm)algorithm {
|
||||
CCHmacAlgorithm ccAlgorithm;
|
||||
NSUInteger dataLength;
|
||||
switch (algorithm) {
|
||||
case NAHMACAlgorithmSHA1: ccAlgorithm = kCCHmacAlgSHA1; dataLength = CC_SHA1_DIGEST_LENGTH; break;
|
||||
case NAHMACAlgorithmSHA2_224: ccAlgorithm = kCCHmacAlgSHA224; dataLength = CC_SHA224_DIGEST_LENGTH; break;
|
||||
case NAHMACAlgorithmSHA2_256: ccAlgorithm = kCCHmacAlgSHA256; dataLength = CC_SHA256_DIGEST_LENGTH; break;
|
||||
case NAHMACAlgorithmSHA2_384: ccAlgorithm = kCCHmacAlgSHA384; dataLength = CC_SHA384_DIGEST_LENGTH; break;
|
||||
case NAHMACAlgorithmSHA2_512: ccAlgorithm = kCCHmacAlgSHA512; dataLength = CC_SHA512_DIGEST_LENGTH; break;
|
||||
default:
|
||||
NSAssert(NO, @"Unsupported algorithm");
|
||||
return nil;
|
||||
}
|
||||
|
||||
CCHmacContext ctx;
|
||||
CCHmacInit(&ctx, ccAlgorithm, [key bytes], [key length]);
|
||||
|
||||
CCHmacUpdate(&ctx, [data bytes], [data length]);
|
||||
|
||||
NSMutableData *macOut = [NSMutableData dataWithLength:dataLength];
|
||||
CCHmacFinal(&ctx, [macOut mutableBytes]);
|
||||
return macOut;
|
||||
}
|
||||
|
||||
+ (NSData *)_HMACSHA3ForKey:(NSData *)key data:(NSData *)data algorithm:(NAHMACAlgorithm)algorithm {
|
||||
NSUInteger blockLength = 72;
|
||||
NSUInteger keyLength = [key length];
|
||||
|
||||
NSUInteger digestBitLength;
|
||||
switch (algorithm) {
|
||||
case NAHMACAlgorithmSHA3_256: digestBitLength = 256; break;
|
||||
case NAHMACAlgorithmSHA3_384: digestBitLength = 384; break;
|
||||
case NAHMACAlgorithmSHA3_512: digestBitLength = 512; break;
|
||||
|
||||
default:
|
||||
NSAssert(NO, @"Unsupported algorithm");
|
||||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Used this as a reference:
|
||||
// http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/Source/API/CommonHMAC.c
|
||||
//
|
||||
|
||||
uint8_t *keyP;
|
||||
|
||||
if (keyLength > blockLength) {
|
||||
key = [NASHA3 SHA3ForData:key digestBitLength:digestBitLength];
|
||||
keyLength = [key length];
|
||||
}
|
||||
|
||||
NSMutableData *keyIn = [NSMutableData dataWithLength:blockLength];
|
||||
uint8_t *k_ipad = [keyIn mutableBytes];
|
||||
NSMutableData *keyOut = [NSMutableData dataWithLength:blockLength];
|
||||
uint8_t *k_opad = [keyOut mutableBytes];
|
||||
|
||||
keyP = (uint8_t *)[key bytes];
|
||||
/* Copy the key into k_ipad and k_opad while doing the XOR. */
|
||||
for (uint32_t byte = 0; byte < keyLength; byte++) {
|
||||
k_ipad[byte] = keyP[byte] ^ 0x36;
|
||||
k_opad[byte] = keyP[byte] ^ 0x5c;
|
||||
}
|
||||
/* Fill the remainder of k_ipad and k_opad with 0 XORed with the appropriate value. */
|
||||
if (keyLength < blockLength) {
|
||||
memset(k_ipad + keyLength, 0x36, blockLength - keyLength);
|
||||
memset(k_opad + keyLength, 0x5c, blockLength - keyLength);
|
||||
}
|
||||
|
||||
NSData *macOut = [NASHA3 SHA3ForDatas:@[keyIn, data] digestBitLength:digestBitLength];
|
||||
|
||||
/* Perform outer digest */
|
||||
return [NASHA3 SHA3ForDatas:@[keyOut, macOut] digestBitLength:digestBitLength];
|
||||
}
|
||||
|
||||
@end
|
||||
17
Example/Pods/NACrypto/NACrypto/NAKeychain.h
generated
Normal file
17
Example/Pods/NACrypto/NACrypto/NAKeychain.h
generated
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// NAKeychain.h
|
||||
// NACL
|
||||
//
|
||||
// Created by Gabriel Handford on 1/21/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NAKeychain : NSObject
|
||||
|
||||
+ (BOOL)addSymmetricKey:(NSData *)symmetricKey applicationLabel:(NSString *)applicationLabel tag:(NSData *)tag label:(NSString *)label;
|
||||
|
||||
+ (NSData *)symmetricKeyWithApplicationLabel:(NSString *)applicationLabel;
|
||||
|
||||
@end
|
||||
104
Example/Pods/NACrypto/NACrypto/NAKeychain.m
generated
Normal file
104
Example/Pods/NACrypto/NACrypto/NAKeychain.m
generated
Normal file
@ -0,0 +1,104 @@
|
||||
//
|
||||
// NAKeychain.m
|
||||
// NACL
|
||||
//
|
||||
// Created by Gabriel Handford on 1/21/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NAKeychain.h"
|
||||
|
||||
@implementation NAKeychain
|
||||
|
||||
+ (BOOL)addKey:(NSData *)key attributes:(NSDictionary *)attributes {
|
||||
if (!key || attributes[(__bridge id)(kSecAttrKeyClass)] == nil || attributes[(__bridge id)(kSecAttrApplicationLabel)] == nil) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSMutableDictionary *allAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
|
||||
allAttributes[(__bridge __strong id)(kSecClass)] = (__bridge id)(kSecClassKey);
|
||||
allAttributes[(__bridge __strong id)(kSecValueData)] = key;
|
||||
if (allAttributes[(__bridge id)(kSecAttrIsPermanent)] == nil) {
|
||||
allAttributes[(__bridge __strong id)(kSecAttrIsPermanent)] = @(YES);
|
||||
}
|
||||
|
||||
OSStatus status = SecItemAdd((__bridge CFDictionaryRef)(allAttributes), NULL);
|
||||
if (status != errSecSuccess) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (BOOL)addSymmetricKey:(NSData *)symmetricKey applicationLabel:(NSString *)applicationLabel tag:(NSData *)tag label:(NSString *)label {
|
||||
|
||||
if (!symmetricKey || !applicationLabel) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
attributes[(__bridge __strong id)kSecAttrKeyClass] = (__bridge id)kSecAttrKeyClassSymmetric;
|
||||
attributes[(__bridge __strong id)kSecAttrAccessible] = (__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly;
|
||||
attributes[(__bridge __strong id)kSecAttrApplicationLabel] = applicationLabel;
|
||||
if (tag) {
|
||||
attributes[(__bridge __strong id)kSecAttrApplicationTag] = tag;
|
||||
}
|
||||
if (label) {
|
||||
attributes[(__bridge __strong id)kSecAttrLabel] = label;
|
||||
}
|
||||
|
||||
return [self addKey:symmetricKey attributes:attributes];
|
||||
}
|
||||
|
||||
+ (NSData *)keyWithApplicationLabel:(NSString *)applicationLabel attributes:(NSDictionary *)attributes {
|
||||
if (!applicationLabel || !attributes[(__bridge id)(kSecAttrKeyClass)]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableDictionary *allAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes];
|
||||
allAttributes[(__bridge __strong id)(kSecClass)] = (__bridge id)(kSecClassKey);
|
||||
allAttributes[(__bridge __strong id)kSecAttrApplicationLabel] = applicationLabel;
|
||||
if (allAttributes[(__bridge id)(kSecAttrIsPermanent)] == nil) {
|
||||
allAttributes[(__bridge __strong id)(kSecAttrIsPermanent)] = @(YES);
|
||||
}
|
||||
allAttributes[(__bridge __strong id)(kSecReturnData)] = @(YES);
|
||||
|
||||
CFTypeRef keyData = nil;
|
||||
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)allAttributes, &keyData);
|
||||
if (status != errSecSuccess) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return (__bridge_transfer NSData *)keyData;
|
||||
}
|
||||
|
||||
+ (NSData *)symmetricKeyWithApplicationLabel:(NSString *)applicationLabel {
|
||||
NSDictionary *attributes = @{(__bridge __strong id)kSecAttrKeyClass: (__bridge id)kSecAttrKeyClassSymmetric};
|
||||
return [self keyWithApplicationLabel:applicationLabel attributes:attributes];
|
||||
}
|
||||
|
||||
+ (NSDictionary *)keyAttributesWithApplicationLabel:(NSString *)applicationLabel queryAttributes:(NSDictionary *)queryAttributes {
|
||||
if (!applicationLabel || !queryAttributes || !queryAttributes[(__bridge id)(kSecAttrKeyClass)]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableDictionary *allAttributes = [NSMutableDictionary dictionaryWithDictionary:queryAttributes];
|
||||
allAttributes[(__bridge __strong id)(kSecClass)] = (__bridge id)(kSecClassKey);
|
||||
allAttributes[(__bridge __strong id)(kSecAttrApplicationLabel)] = applicationLabel;
|
||||
allAttributes[(__bridge __strong id)(kSecReturnData)] = @YES;
|
||||
allAttributes[(__bridge __strong id)(kSecReturnAttributes)] = @YES;
|
||||
|
||||
CFTypeRef resultData = nil;
|
||||
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)allAttributes, &resultData);
|
||||
if (status != errSecSuccess) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return (__bridge_transfer NSDictionary *)resultData;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)symmetricKeyAttributesWithApplicationLabel:(NSString *)applicationLabel {
|
||||
NSDictionary *queryAttributes = @{(__bridge __strong id)(kSecAttrKeyClass): (__bridge id)(kSecAttrKeyClassSymmetric)};
|
||||
return [self keyAttributesWithApplicationLabel:applicationLabel queryAttributes:queryAttributes];
|
||||
}
|
||||
|
||||
@end
|
||||
23
Example/Pods/NACrypto/NACrypto/NANSData+Utils.h
generated
Normal file
23
Example/Pods/NACrypto/NACrypto/NANSData+Utils.h
generated
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// NANSData+Utils.h
|
||||
// NACL
|
||||
//
|
||||
// Created by Gabriel Handford on 1/16/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSData (NAUtils)
|
||||
|
||||
- (NSString *)na_hexString;
|
||||
|
||||
+ (NSData *)na_dataWithDatas:(NSArray *)datas;
|
||||
|
||||
- (BOOL)na_isEqualConstantTime:(NSData *)data;
|
||||
|
||||
- (void)na_sliceNoCopyAtIndex:(NSUInteger)index data:(NSData **)data1 data:(NSData **)data2;
|
||||
|
||||
+ (NSData *)na_dataNoCopy:(NSData *)data offset:(NSUInteger)offset length:(NSUInteger)length;
|
||||
|
||||
@end
|
||||
70
Example/Pods/NACrypto/NACrypto/NANSData+Utils.m
generated
Normal file
70
Example/Pods/NACrypto/NACrypto/NANSData+Utils.m
generated
Normal file
@ -0,0 +1,70 @@
|
||||
//
|
||||
// NANSData+Utils.m
|
||||
// NACL
|
||||
//
|
||||
// Created by Gabriel Handford on 1/16/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NANSData+Utils.h"
|
||||
|
||||
@implementation NSData (NAUtils)
|
||||
|
||||
- (NSString *)na_hexString {
|
||||
if ([self length] == 0) return nil;
|
||||
NSMutableString *hexString = [NSMutableString stringWithCapacity:[self length] * 2];
|
||||
for (NSUInteger i = 0; i < [self length]; ++i) {
|
||||
[hexString appendFormat:@"%02X", *((uint8_t *)[self bytes] + i)];
|
||||
}
|
||||
return [hexString lowercaseString];
|
||||
}
|
||||
|
||||
+ (NSData *)na_dataWithDatas:(NSArray *)datas {
|
||||
NSInteger length = 0;
|
||||
for (NSData *data in datas) {
|
||||
length += data.length;
|
||||
}
|
||||
NSMutableData *combined = [NSMutableData dataWithCapacity:length];
|
||||
for (NSData *data in datas) {
|
||||
[combined appendData:data];
|
||||
}
|
||||
return combined;
|
||||
}
|
||||
|
||||
- (BOOL)na_isEqualConstantTime:(NSData *)data {
|
||||
if ([self length] != [data length]) return NO;
|
||||
|
||||
const uint8_t *dataPtr = (uint8_t *)self.bytes;
|
||||
const uint8_t *data2Ptr = (uint8_t *)data.bytes;
|
||||
|
||||
uint8_t result = 0;
|
||||
for (int i = 0; i < self.length; i++) {
|
||||
result = result ^ (dataPtr[i] ^ data2Ptr[i]);
|
||||
}
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
- (void)na_sliceNoCopyAtIndex:(NSUInteger)index data:(NSData **)data1 data:(NSData **)data2 {
|
||||
if (index > [self length]) {
|
||||
[NSException raise:NSRangeException format:@"Index is out of bounds"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (index > 0) {
|
||||
*data1 = [NSData dataWithBytesNoCopy:(uint8_t *)[self bytes] length:index freeWhenDone:NO];
|
||||
} else {
|
||||
*data1 = [NSData data];
|
||||
}
|
||||
|
||||
if ([self length] > index) {
|
||||
*data2 = [NSData dataWithBytesNoCopy:((uint8_t *)[self bytes] + index) length:([self length] - index) freeWhenDone:NO];
|
||||
} else {
|
||||
*data2 = [NSData data];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSData *)na_dataNoCopy:(NSData *)data offset:(NSUInteger)offset length:(NSUInteger)length {
|
||||
return [NSData dataWithBytesNoCopy:((uint8_t *)[data bytes] + offset) length:length freeWhenDone:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
15
Example/Pods/NACrypto/NACrypto/NANSMutableData+Utils.h
generated
Normal file
15
Example/Pods/NACrypto/NACrypto/NANSMutableData+Utils.h
generated
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// NANSMutableData+Utils.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSMutableData (NAUtils)
|
||||
|
||||
- (void)na_XORWithData:(NSData *)data index:(NSInteger)index;
|
||||
|
||||
@end
|
||||
24
Example/Pods/NACrypto/NACrypto/NANSMutableData+Utils.m
generated
Normal file
24
Example/Pods/NACrypto/NACrypto/NANSMutableData+Utils.m
generated
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// NANSMutableData+Utils.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NANSMutableData+Utils.h"
|
||||
|
||||
@implementation NSMutableData (NAUtils)
|
||||
|
||||
- (void)na_XORWithData:(NSData *)data index:(NSInteger)index {
|
||||
uint8_t *dataPtr = (uint8_t *)self.mutableBytes;
|
||||
const uint8_t *data2Ptr = (uint8_t *)data.bytes;
|
||||
|
||||
NSAssert(index < self.length, @"Invalid index");
|
||||
|
||||
for (int i = 0; i < data.length && (i + index) < self.length; i++) {
|
||||
dataPtr[i + index] = dataPtr[i + index] ^ data2Ptr[i];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
15
Example/Pods/NACrypto/NACrypto/NANSString+Utils.h
generated
Normal file
15
Example/Pods/NACrypto/NACrypto/NANSString+Utils.h
generated
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// NANSString+Utils.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/19/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSString (NAUtils)
|
||||
|
||||
- (NSData *)na_dataFromHexString;
|
||||
|
||||
@end
|
||||
33
Example/Pods/NACrypto/NACrypto/NANSString+Utils.m
generated
Normal file
33
Example/Pods/NACrypto/NACrypto/NANSString+Utils.m
generated
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// NANSString+Utils.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/19/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NANSString+Utils.h"
|
||||
|
||||
@implementation NSString (NAUtils)
|
||||
|
||||
- (NSData *)na_dataFromHexString {
|
||||
if ((self.length % 2) != 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
const char *chars = [self UTF8String];
|
||||
NSMutableData *data = [NSMutableData dataWithCapacity:self.length / 2];
|
||||
char byteChars[3] = {0, 0, 0};
|
||||
unsigned long wholeByte;
|
||||
|
||||
for (int i = 0; i < self.length; i += 2) {
|
||||
byteChars[0] = chars[i];
|
||||
byteChars[1] = chars[i + 1];
|
||||
wholeByte = strtoul(byteChars, NULL, 16);
|
||||
[data appendBytes:&wholeByte length:1];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@end
|
||||
17
Example/Pods/NACrypto/NACrypto/NASHA3.h
generated
Normal file
17
Example/Pods/NACrypto/NACrypto/NASHA3.h
generated
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// NASHA3.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/23/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NASHA3 : NSObject
|
||||
|
||||
+ (NSData *)SHA3ForData:(NSData *)data digestBitLength:(NSUInteger)digestBitLength;
|
||||
|
||||
+ (NSData *)SHA3ForDatas:(NSArray *)datas digestBitLength:(NSUInteger)digestBitLength;
|
||||
|
||||
@end
|
||||
37
Example/Pods/NACrypto/NACrypto/NASHA3.m
generated
Normal file
37
Example/Pods/NACrypto/NACrypto/NASHA3.m
generated
Normal file
@ -0,0 +1,37 @@
|
||||
//
|
||||
// NASHA3.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/23/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NASHA3.h"
|
||||
|
||||
#import "KeccakNISTInterface.h"
|
||||
|
||||
@implementation NASHA3
|
||||
|
||||
+ (NSData *)SHA3ForData:(NSData *)data digestBitLength:(NSUInteger)digestBitLength {
|
||||
return [self SHA3ForDatas:@[data] digestBitLength:digestBitLength];
|
||||
}
|
||||
|
||||
+ (NSData *)SHA3ForDatas:(NSArray *)datas digestBitLength:(NSUInteger)digestBitLength {
|
||||
NSUInteger digestLength = digestBitLength/8;
|
||||
NSMutableData *outData = [NSMutableData dataWithLength:digestLength];
|
||||
|
||||
hashState state;
|
||||
int result;
|
||||
result = Init(&state, (int)digestBitLength); // Bit length
|
||||
NSAssert(result == 0, @"Failed to init");
|
||||
for (NSData *data in datas) {
|
||||
result = Update(&state, (const BitSequence *)[data bytes], [data length] * 8); // Bit length
|
||||
NSAssert(result == 0, @"Failed to update");
|
||||
}
|
||||
result = Final(&state, [outData mutableBytes]);
|
||||
NSAssert(result == 0, @"Failed to finalize");
|
||||
|
||||
return outData;
|
||||
}
|
||||
|
||||
@end
|
||||
27
Example/Pods/NACrypto/NACrypto/NASecRandom.h
generated
Normal file
27
Example/Pods/NACrypto/NACrypto/NASecRandom.h
generated
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// NASecRandom.h
|
||||
//
|
||||
// Created by Gabriel Handford on 1/16/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NASecRandom : NSObject
|
||||
|
||||
/*!
|
||||
Generate random data.
|
||||
The source code of SecRandomCopyBytes() is located at
|
||||
http://opensource.apple.com/source/Security/Security-55179.11/sec/Security/SecFramework.c
|
||||
|
||||
@param len Number of random bytes to generate
|
||||
@result NSData of length bytes, or nil if an error occurred
|
||||
*/
|
||||
+ (NSData *)randomData:(size_t)numBytes error:(NSError **)error;
|
||||
|
||||
/*!
|
||||
Generate random base64 string.
|
||||
*/
|
||||
+ (NSString *)randomBase64String:(size_t)length error:(NSError **)error;
|
||||
|
||||
@end
|
||||
35
Example/Pods/NACrypto/NACrypto/NASecRandom.m
generated
Normal file
35
Example/Pods/NACrypto/NACrypto/NASecRandom.m
generated
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// NASecRandom.m
|
||||
//
|
||||
// Created by Gabriel Handford on 1/16/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NASecRandom.h"
|
||||
#import "NANSData+Utils.h"
|
||||
|
||||
#include <Security/SecRandom.h>
|
||||
|
||||
@implementation NASecRandom
|
||||
|
||||
+ (NSData *)randomData:(size_t)numBytes error:(NSError **)error {
|
||||
NSMutableData *data = [NSMutableData dataWithLength:numBytes];
|
||||
int ret = SecRandomCopyBytes(kSecRandomDefault, numBytes, [data mutableBytes]);
|
||||
if (ret == -1) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:50 userInfo:@{NSLocalizedDescriptionKey: @"Unable to generate random data"}];
|
||||
return nil;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
+ (NSString *)randomBase64String:(size_t)length error:(NSError **)error {
|
||||
size_t numBytes = (size_t)ceil((length * 8.0) / 6.0);
|
||||
NSData *data = [self randomData:numBytes error:error];
|
||||
if (!data) return nil;
|
||||
|
||||
NSString *base64String = [data base64EncodedStringWithOptions:0];
|
||||
if ([base64String length] > length) base64String = [base64String substringToIndex:length];
|
||||
return base64String;
|
||||
}
|
||||
|
||||
@end
|
||||
17
Example/Pods/NACrypto/NACrypto/NATwoFish.h
generated
Normal file
17
Example/Pods/NACrypto/NACrypto/NATwoFish.h
generated
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// NATwoFish.h
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NATwoFish : NSObject
|
||||
|
||||
- (NSData *)encrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error;
|
||||
|
||||
- (NSData *)decrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error;
|
||||
|
||||
@end
|
||||
58
Example/Pods/NACrypto/NACrypto/NATwoFish.m
generated
Normal file
58
Example/Pods/NACrypto/NACrypto/NATwoFish.m
generated
Normal file
@ -0,0 +1,58 @@
|
||||
//
|
||||
// NATwoFish.m
|
||||
// NACrypto
|
||||
//
|
||||
// Created by Gabriel on 6/20/14.
|
||||
// Copyright (c) 2014 Gabriel Handford. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NATwoFish.h"
|
||||
|
||||
#import "NACounter.h"
|
||||
#import "NANSMutableData+Utils.h"
|
||||
#import "NANSData+Utils.h"
|
||||
|
||||
#include "twofish.h"
|
||||
|
||||
@implementation NATwoFish
|
||||
|
||||
static dispatch_once_t twoFishInit;
|
||||
|
||||
- (NSData *)encrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error {
|
||||
if (!nonce || [nonce length] < 16) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:700 userInfo:@{NSLocalizedDescriptionKey: @"Invalid TwoFish nonce"}];
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (!key || [key length] != 32) {
|
||||
if (error) *error = [NSError errorWithDomain:@"NACrypto" code:701 userInfo:@{NSLocalizedDescriptionKey: @"Invalid TwoFish key"}];
|
||||
return nil;
|
||||
}
|
||||
|
||||
dispatch_once(&twoFishInit, ^{ Twofish_initialise(); });
|
||||
|
||||
Twofish_key xkey;
|
||||
Twofish_prepare_key((uint8_t *)[key bytes], (int)[key length], &xkey);
|
||||
|
||||
NACounter *counter = [[NACounter alloc] initWithData:nonce];
|
||||
|
||||
NSInteger blockLength = [nonce length];
|
||||
|
||||
NSMutableData *outData = [data mutableCopy];
|
||||
|
||||
NSMutableData *blockOutData = [NSMutableData dataWithLength:blockLength];
|
||||
|
||||
for (NSInteger index = 0; index < [data length]; index += blockLength) {
|
||||
Twofish_encrypt(&xkey, (uint8_t *)[counter.data bytes], [blockOutData mutableBytes]);
|
||||
[outData na_XORWithData:blockOutData index:index];
|
||||
[counter increment];
|
||||
}
|
||||
|
||||
return outData;
|
||||
}
|
||||
|
||||
- (NSData *)decrypt:(NSData *)data nonce:(NSData *)nonce key:(NSData *)key error:(NSError **)error {
|
||||
return [self encrypt:data nonce:nonce key:key error:error];
|
||||
}
|
||||
|
||||
@end
|
||||
1691
Example/Pods/NACrypto/NACrypto/TwoFish/twofish.c
generated
Normal file
1691
Example/Pods/NACrypto/NACrypto/TwoFish/twofish.c
generated
Normal file
File diff suppressed because it is too large
Load Diff
180
Example/Pods/NACrypto/NACrypto/TwoFish/twofish.h
generated
Normal file
180
Example/Pods/NACrypto/NACrypto/TwoFish/twofish.h
generated
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Fast, portable, and easy-to-use Twofish implementation,
|
||||
* Version 0.3.
|
||||
* Copyright (c) 2002 by Niels Ferguson.
|
||||
*
|
||||
* See the twofish.c file for the details of the how and why of this code.
|
||||
*
|
||||
* The author hereby grants a perpetual license to everybody to
|
||||
* use this code for any purpose as long as the copyright message is included
|
||||
* in the source code of this or any derived work.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* PLATFORM FIXES
|
||||
* ==============
|
||||
*
|
||||
* The following definitions have to be fixed for each particular platform
|
||||
* you work on. If you have a multi-platform program, you no doubt have
|
||||
* portable definitions that you can substitute here without changing
|
||||
* the rest of the code.
|
||||
*
|
||||
* The defaults provided here should work on most PC compilers.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* A Twofish_Byte must be an unsigned 8-bit integer.
|
||||
* It must also be the elementary data size of your C platform,
|
||||
* i.e. sizeof( Twofish_Byte ) == 1.
|
||||
*/
|
||||
typedef uint8_t Twofish_Byte;
|
||||
|
||||
/*
|
||||
* A Twofish_UInt32 must be an unsigned integer of at least 32 bits.
|
||||
*
|
||||
* This type is used only internally in the implementation, so ideally it
|
||||
* would not appear in the header file, but it is used inside the
|
||||
* Twofish_key structure which means it has to be included here.
|
||||
*/
|
||||
typedef uint32_t Twofish_UInt32;
|
||||
|
||||
|
||||
/*
|
||||
* END OF PLATFORM FIXES
|
||||
* =====================
|
||||
*
|
||||
* You should not have to touch the rest of this file, but the code
|
||||
* in twofish.c has a few things you need to fix too.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Structure that contains a prepared Twofish key.
|
||||
* A cipher key is used in two stages. In the first stage it is converted
|
||||
* form the original form to an internal representation.
|
||||
* This internal form is then used to encrypt and decrypt data.
|
||||
* This structure contains the internal form. It is rather large: 4256 bytes
|
||||
* on a platform with 32-bit unsigned values.
|
||||
*
|
||||
* Treat this as an opague structure, and don't try to manipulate the
|
||||
* elements in it. I wish I could hide the inside of the structure,
|
||||
* but C doesn't allow that.
|
||||
*/
|
||||
typedef
|
||||
struct
|
||||
{
|
||||
Twofish_UInt32 s[4][256]; /* pre-computed S-boxes */
|
||||
Twofish_UInt32 K[40]; /* Round key words */
|
||||
}
|
||||
Twofish_key;
|
||||
|
||||
|
||||
/*
|
||||
* Initialise and test the Twofish implementation.
|
||||
*
|
||||
* This function MUST be called before any other function in the
|
||||
* Twofish implementation is called.
|
||||
* It only needs to be called once.
|
||||
*
|
||||
* Apart from initialising the implementation it performs a self test.
|
||||
* If the Twofish_fatal function is not called, the code passed the test.
|
||||
* (See the twofish.c file for details on the Twofish_fatal function.)
|
||||
*/
|
||||
extern void Twofish_initialise();
|
||||
|
||||
|
||||
/*
|
||||
* Convert a cipher key to the internal form used for
|
||||
* encryption and decryption.
|
||||
*
|
||||
* The cipher key is an array of bytes; the Twofish_Byte type is
|
||||
* defined above to a type suitable on your platform.
|
||||
*
|
||||
* Any key must be converted to an internal form in the Twofisk_key structure
|
||||
* before it can be used.
|
||||
* The encryption and decryption functions only work with the internal form.
|
||||
* The conversion to internal form need only be done once for each key value.
|
||||
*
|
||||
* Be sure to wipe all key storage, including the Twofish_key structure,
|
||||
* once you are done with the key data.
|
||||
* A simple memset( TwofishKey, 0, sizeof( TwofishKey ) ) will do just fine.
|
||||
*
|
||||
* Unlike most implementations, this one allows any key size from 0 bytes
|
||||
* to 32 bytes. According to the Twofish specifications,
|
||||
* irregular key sizes are handled by padding the key with zeroes at the end
|
||||
* until the key size is 16, 24, or 32 bytes, whichever
|
||||
* comes first. Note that each key of irregular size is equivalent to exactly
|
||||
* one key of 16, 24, or 32 bytes.
|
||||
*
|
||||
* WARNING: Short keys have low entropy, and result in low security.
|
||||
* Anything less than 8 bytes is utterly insecure. For good security
|
||||
* use at least 16 bytes. I prefer to use 32-byte keys to prevent
|
||||
* any collision attacks on the key.
|
||||
*
|
||||
* The key length argument key_len must be in the proper range.
|
||||
* If key_len is not in the range 0,...,32 this routine attempts to generate
|
||||
* a fatal error (depending on the code environment),
|
||||
* and at best (or worst) returns without having done anything.
|
||||
*
|
||||
* Arguments:
|
||||
* key Array of key bytes
|
||||
* key_len Number of key bytes, must be in the range 0,1,...,32.
|
||||
* xkey Pointer to an Twofish_key structure that will be filled
|
||||
* with the internal form of the cipher key.
|
||||
*/
|
||||
extern void Twofish_prepare_key(
|
||||
Twofish_Byte key[],
|
||||
int key_len,
|
||||
Twofish_key * xkey
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Encrypt a single block of data.
|
||||
*
|
||||
* This function encrypts a single block of 16 bytes of data.
|
||||
* If you want to encrypt a larger or variable-length message,
|
||||
* you will have to use a cipher mode, such as CBC or CTR.
|
||||
* These are outside the scope of this implementation.
|
||||
*
|
||||
* The xkey structure is not modified by this routine, and can be
|
||||
* used for further encryption and decryption operations.
|
||||
*
|
||||
* Arguments:
|
||||
* xkey pointer to Twofish_key, internal form of the key
|
||||
* produces by Twofish_prepare_key()
|
||||
* p Plaintext to be encrypted
|
||||
* c Place to store the ciphertext
|
||||
*/
|
||||
extern void Twofish_encrypt(
|
||||
Twofish_key * xkey,
|
||||
Twofish_Byte p[16],
|
||||
Twofish_Byte c[16]
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Decrypt a single block of data.
|
||||
*
|
||||
* This function decrypts a single block of 16 bytes of data.
|
||||
* If you want to decrypt a larger or variable-length message,
|
||||
* you will have to use a cipher mode, such as CBC or CTR.
|
||||
* These are outside the scope of this implementation.
|
||||
*
|
||||
* The xkey structure is not modified by this routine, and can be
|
||||
* used for further encryption and decryption operations.
|
||||
*
|
||||
* Arguments:
|
||||
* xkey pointer to Twofish_key, internal form of the key
|
||||
* produces by Twofish_prepare_key()
|
||||
* c Ciphertext to be decrypted
|
||||
* p Place to store the plaintext
|
||||
*/
|
||||
extern void Twofish_decrypt(
|
||||
Twofish_key * xkey,
|
||||
Twofish_Byte c[16],
|
||||
Twofish_Byte p[16]
|
||||
);
|
||||
562
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32-rvk.h
generated
Normal file
562
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32-rvk.h
generated
Normal file
@ -0,0 +1,562 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by Ronny Van Keer,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include "KeccakF-1600-interface.h"
|
||||
|
||||
#ifndef _Keccak1600_32_rvk_h_
|
||||
#define _Keccak1600_32_rvk_h_
|
||||
|
||||
static const UINT32 KeccakF1600RoundConstants_int2[2*24] =
|
||||
{
|
||||
0x00000001UL, 0x00000000UL,
|
||||
0x00000000UL, 0x00000089UL,
|
||||
0x00000000UL, 0x8000008bUL,
|
||||
0x00000000UL, 0x80008080UL,
|
||||
0x00000001UL, 0x0000008bUL,
|
||||
0x00000001UL, 0x00008000UL,
|
||||
0x00000001UL, 0x80008088UL,
|
||||
0x00000001UL, 0x80000082UL,
|
||||
0x00000000UL, 0x0000000bUL,
|
||||
0x00000000UL, 0x0000000aUL,
|
||||
0x00000001UL, 0x00008082UL,
|
||||
0x00000000UL, 0x00008003UL,
|
||||
0x00000001UL, 0x0000808bUL,
|
||||
0x00000001UL, 0x8000000bUL,
|
||||
0x00000001UL, 0x8000008aUL,
|
||||
0x00000001UL, 0x80000081UL,
|
||||
0x00000000UL, 0x80000081UL,
|
||||
0x00000000UL, 0x80000008UL,
|
||||
0x00000000UL, 0x00000083UL,
|
||||
0x00000000UL, 0x80008003UL,
|
||||
0x00000001UL, 0x80008088UL,
|
||||
0x00000000UL, 0x80000088UL,
|
||||
0x00000001UL, 0x00008000UL,
|
||||
0x00000000UL, 0x80008082UL
|
||||
};
|
||||
|
||||
#undef rounds
|
||||
|
||||
#define rounds \
|
||||
{ \
|
||||
UINT32 Da0, De0, Di0, Do0, Du0; \
|
||||
UINT32 Da1, De1, Di1, Do1, Du1; \
|
||||
UINT32 Ba, Be, Bi, Bo, Bu; \
|
||||
UINT32 Aba0, Abe0, Abi0, Abo0, Abu0; \
|
||||
UINT32 Aba1, Abe1, Abi1, Abo1, Abu1; \
|
||||
UINT32 Aga0, Age0, Agi0, Ago0, Agu0; \
|
||||
UINT32 Aga1, Age1, Agi1, Ago1, Agu1; \
|
||||
UINT32 Aka0, Ake0, Aki0, Ako0, Aku0; \
|
||||
UINT32 Aka1, Ake1, Aki1, Ako1, Aku1; \
|
||||
UINT32 Ama0, Ame0, Ami0, Amo0, Amu0; \
|
||||
UINT32 Ama1, Ame1, Ami1, Amo1, Amu1; \
|
||||
UINT32 Asa0, Ase0, Asi0, Aso0, Asu0; \
|
||||
UINT32 Asa1, Ase1, Asi1, Aso1, Asu1; \
|
||||
UINT32 Cw, Cx, Cy, Cz; \
|
||||
UINT32 Eba0, Ebe0, Ebi0, Ebo0, Ebu0; \
|
||||
UINT32 Eba1, Ebe1, Ebi1, Ebo1, Ebu1; \
|
||||
UINT32 Ega0, Ege0, Egi0, Ego0, Egu0; \
|
||||
UINT32 Ega1, Ege1, Egi1, Ego1, Egu1; \
|
||||
UINT32 Eka0, Eke0, Eki0, Eko0, Eku0; \
|
||||
UINT32 Eka1, Eke1, Eki1, Eko1, Eku1; \
|
||||
UINT32 Ema0, Eme0, Emi0, Emo0, Emu0; \
|
||||
UINT32 Ema1, Eme1, Emi1, Emo1, Emu1; \
|
||||
UINT32 Esa0, Ese0, Esi0, Eso0, Esu0; \
|
||||
UINT32 Esa1, Ese1, Esi1, Eso1, Esu1; \
|
||||
const UINT32 * pRoundConstants = KeccakF1600RoundConstants_int2; \
|
||||
UINT32 i; \
|
||||
\
|
||||
copyFromState(A, state) \
|
||||
\
|
||||
for( i = 12; i != 0; --i ) { \
|
||||
Cx = Abu0^Agu0^Aku0^Amu0^Asu0; \
|
||||
Du1 = Abe1^Age1^Ake1^Ame1^Ase1; \
|
||||
Da0 = Cx^ROL32(Du1, 1); \
|
||||
Cz = Abu1^Agu1^Aku1^Amu1^Asu1; \
|
||||
Du0 = Abe0^Age0^Ake0^Ame0^Ase0; \
|
||||
Da1 = Cz^Du0; \
|
||||
\
|
||||
Cw = Abi0^Agi0^Aki0^Ami0^Asi0; \
|
||||
Do0 = Cw^ROL32(Cz, 1); \
|
||||
Cy = Abi1^Agi1^Aki1^Ami1^Asi1; \
|
||||
Do1 = Cy^Cx; \
|
||||
\
|
||||
Cx = Aba0^Aga0^Aka0^Ama0^Asa0; \
|
||||
De0 = Cx^ROL32(Cy, 1); \
|
||||
Cz = Aba1^Aga1^Aka1^Ama1^Asa1; \
|
||||
De1 = Cz^Cw; \
|
||||
\
|
||||
Cy = Abo1^Ago1^Ako1^Amo1^Aso1; \
|
||||
Di0 = Du0^ROL32(Cy, 1); \
|
||||
Cw = Abo0^Ago0^Ako0^Amo0^Aso0; \
|
||||
Di1 = Du1^Cw; \
|
||||
\
|
||||
Du0 = Cw^ROL32(Cz, 1); \
|
||||
Du1 = Cy^Cx; \
|
||||
\
|
||||
Aba0 ^= Da0; \
|
||||
Ba = Aba0; \
|
||||
Age0 ^= De0; \
|
||||
Be = ROL32(Age0, 22); \
|
||||
Aki1 ^= Di1; \
|
||||
Bi = ROL32(Aki1, 22); \
|
||||
Amo1 ^= Do1; \
|
||||
Bo = ROL32(Amo1, 11); \
|
||||
Asu0 ^= Du0; \
|
||||
Bu = ROL32(Asu0, 7); \
|
||||
Eba0 = Ba ^((~Be)& Bi ) ^ *(pRoundConstants++); \
|
||||
Ebe0 = Be ^((~Bi)& Bo ); \
|
||||
Ebi0 = Bi ^((~Bo)& Bu ); \
|
||||
Ebo0 = Bo ^((~Bu)& Ba ); \
|
||||
Ebu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abo0 ^= Do0; \
|
||||
Ba = ROL32(Abo0, 14); \
|
||||
Agu0 ^= Du0; \
|
||||
Be = ROL32(Agu0, 10); \
|
||||
Aka1 ^= Da1; \
|
||||
Bi = ROL32(Aka1, 2); \
|
||||
Ame1 ^= De1; \
|
||||
Bo = ROL32(Ame1, 23); \
|
||||
Asi1 ^= Di1; \
|
||||
Bu = ROL32(Asi1, 31); \
|
||||
Ega0 = Ba ^((~Be)& Bi ); \
|
||||
Ege0 = Be ^((~Bi)& Bo ); \
|
||||
Egi0 = Bi ^((~Bo)& Bu ); \
|
||||
Ego0 = Bo ^((~Bu)& Ba ); \
|
||||
Egu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abe1 ^= De1; \
|
||||
Ba = ROL32(Abe1, 1); \
|
||||
Agi0 ^= Di0; \
|
||||
Be = ROL32(Agi0, 3); \
|
||||
Ako1 ^= Do1; \
|
||||
Bi = ROL32(Ako1, 13); \
|
||||
Amu0 ^= Du0; \
|
||||
Bo = ROL32(Amu0, 4); \
|
||||
Asa0 ^= Da0; \
|
||||
Bu = ROL32(Asa0, 9); \
|
||||
Eka0 = Ba ^((~Be)& Bi ); \
|
||||
Eke0 = Be ^((~Bi)& Bo ); \
|
||||
Eki0 = Bi ^((~Bo)& Bu ); \
|
||||
Eko0 = Bo ^((~Bu)& Ba ); \
|
||||
Eku0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abu1 ^= Du1; \
|
||||
Ba = ROL32(Abu1, 14); \
|
||||
Aga0 ^= Da0; \
|
||||
Be = ROL32(Aga0, 18); \
|
||||
Ake0 ^= De0; \
|
||||
Bi = ROL32(Ake0, 5); \
|
||||
Ami1 ^= Di1; \
|
||||
Bo = ROL32(Ami1, 8); \
|
||||
Aso0 ^= Do0; \
|
||||
Bu = ROL32(Aso0, 28); \
|
||||
Ema0 = Ba ^((~Be)& Bi ); \
|
||||
Eme0 = Be ^((~Bi)& Bo ); \
|
||||
Emi0 = Bi ^((~Bo)& Bu ); \
|
||||
Emo0 = Bo ^((~Bu)& Ba ); \
|
||||
Emu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abi0 ^= Di0; \
|
||||
Ba = ROL32(Abi0, 31); \
|
||||
Ago1 ^= Do1; \
|
||||
Be = ROL32(Ago1, 28); \
|
||||
Aku1 ^= Du1; \
|
||||
Bi = ROL32(Aku1, 20); \
|
||||
Ama1 ^= Da1; \
|
||||
Bo = ROL32(Ama1, 21); \
|
||||
Ase0 ^= De0; \
|
||||
Bu = ROL32(Ase0, 1); \
|
||||
Esa0 = Ba ^((~Be)& Bi ); \
|
||||
Ese0 = Be ^((~Bi)& Bo ); \
|
||||
Esi0 = Bi ^((~Bo)& Bu ); \
|
||||
Eso0 = Bo ^((~Bu)& Ba ); \
|
||||
Esu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Aba1 ^= Da1; \
|
||||
Ba = Aba1; \
|
||||
Age1 ^= De1; \
|
||||
Be = ROL32(Age1, 22); \
|
||||
Aki0 ^= Di0; \
|
||||
Bi = ROL32(Aki0, 21); \
|
||||
Amo0 ^= Do0; \
|
||||
Bo = ROL32(Amo0, 10); \
|
||||
Asu1 ^= Du1; \
|
||||
Bu = ROL32(Asu1, 7); \
|
||||
Eba1 = Ba ^((~Be)& Bi ); \
|
||||
Eba1 ^= *(pRoundConstants++); \
|
||||
Ebe1 = Be ^((~Bi)& Bo ); \
|
||||
Ebi1 = Bi ^((~Bo)& Bu ); \
|
||||
Ebo1 = Bo ^((~Bu)& Ba ); \
|
||||
Ebu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abo1 ^= Do1; \
|
||||
Ba = ROL32(Abo1, 14); \
|
||||
Agu1 ^= Du1; \
|
||||
Be = ROL32(Agu1, 10); \
|
||||
Aka0 ^= Da0; \
|
||||
Bi = ROL32(Aka0, 1); \
|
||||
Ame0 ^= De0; \
|
||||
Bo = ROL32(Ame0, 22); \
|
||||
Asi0 ^= Di0; \
|
||||
Bu = ROL32(Asi0, 30); \
|
||||
Ega1 = Ba ^((~Be)& Bi ); \
|
||||
Ege1 = Be ^((~Bi)& Bo ); \
|
||||
Egi1 = Bi ^((~Bo)& Bu ); \
|
||||
Ego1 = Bo ^((~Bu)& Ba ); \
|
||||
Egu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abe0 ^= De0; \
|
||||
Ba = Abe0; \
|
||||
Agi1 ^= Di1; \
|
||||
Be = ROL32(Agi1, 3); \
|
||||
Ako0 ^= Do0; \
|
||||
Bi = ROL32(Ako0, 12); \
|
||||
Amu1 ^= Du1; \
|
||||
Bo = ROL32(Amu1, 4); \
|
||||
Asa1 ^= Da1; \
|
||||
Bu = ROL32(Asa1, 9); \
|
||||
Eka1 = Ba ^((~Be)& Bi ); \
|
||||
Eke1 = Be ^((~Bi)& Bo ); \
|
||||
Eki1 = Bi ^((~Bo)& Bu ); \
|
||||
Eko1 = Bo ^((~Bu)& Ba ); \
|
||||
Eku1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abu0 ^= Du0; \
|
||||
Ba = ROL32(Abu0, 13); \
|
||||
Aga1 ^= Da1; \
|
||||
Be = ROL32(Aga1, 18); \
|
||||
Ake1 ^= De1; \
|
||||
Bi = ROL32(Ake1, 5); \
|
||||
Ami0 ^= Di0; \
|
||||
Bo = ROL32(Ami0, 7); \
|
||||
Aso1 ^= Do1; \
|
||||
Bu = ROL32(Aso1, 28); \
|
||||
Ema1 = Ba ^((~Be)& Bi ); \
|
||||
Eme1 = Be ^((~Bi)& Bo ); \
|
||||
Emi1 = Bi ^((~Bo)& Bu ); \
|
||||
Emo1 = Bo ^((~Bu)& Ba ); \
|
||||
Emu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Abi1 ^= Di1; \
|
||||
Ba = ROL32(Abi1, 31); \
|
||||
Ago0 ^= Do0; \
|
||||
Be = ROL32(Ago0, 27); \
|
||||
Aku0 ^= Du0; \
|
||||
Bi = ROL32(Aku0, 19); \
|
||||
Ama0 ^= Da0; \
|
||||
Bo = ROL32(Ama0, 20); \
|
||||
Ase1 ^= De1; \
|
||||
Bu = ROL32(Ase1, 1); \
|
||||
Esa1 = Ba ^((~Be)& Bi ); \
|
||||
Ese1 = Be ^((~Bi)& Bo ); \
|
||||
Esi1 = Bi ^((~Bo)& Bu ); \
|
||||
Eso1 = Bo ^((~Bu)& Ba ); \
|
||||
Esu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Cx = Ebu0^Egu0^Eku0^Emu0^Esu0; \
|
||||
Du1 = Ebe1^Ege1^Eke1^Eme1^Ese1; \
|
||||
Da0 = Cx^ROL32(Du1, 1); \
|
||||
Cz = Ebu1^Egu1^Eku1^Emu1^Esu1; \
|
||||
Du0 = Ebe0^Ege0^Eke0^Eme0^Ese0; \
|
||||
Da1 = Cz^Du0; \
|
||||
\
|
||||
Cw = Ebi0^Egi0^Eki0^Emi0^Esi0; \
|
||||
Do0 = Cw^ROL32(Cz, 1); \
|
||||
Cy = Ebi1^Egi1^Eki1^Emi1^Esi1; \
|
||||
Do1 = Cy^Cx; \
|
||||
\
|
||||
Cx = Eba0^Ega0^Eka0^Ema0^Esa0; \
|
||||
De0 = Cx^ROL32(Cy, 1); \
|
||||
Cz = Eba1^Ega1^Eka1^Ema1^Esa1; \
|
||||
De1 = Cz^Cw; \
|
||||
\
|
||||
Cy = Ebo1^Ego1^Eko1^Emo1^Eso1; \
|
||||
Di0 = Du0^ROL32(Cy, 1); \
|
||||
Cw = Ebo0^Ego0^Eko0^Emo0^Eso0; \
|
||||
Di1 = Du1^Cw; \
|
||||
\
|
||||
Du0 = Cw^ROL32(Cz, 1); \
|
||||
Du1 = Cy^Cx; \
|
||||
\
|
||||
Eba0 ^= Da0; \
|
||||
Ba = Eba0; \
|
||||
Ege0 ^= De0; \
|
||||
Be = ROL32(Ege0, 22); \
|
||||
Eki1 ^= Di1; \
|
||||
Bi = ROL32(Eki1, 22); \
|
||||
Emo1 ^= Do1; \
|
||||
Bo = ROL32(Emo1, 11); \
|
||||
Esu0 ^= Du0; \
|
||||
Bu = ROL32(Esu0, 7); \
|
||||
Aba0 = Ba ^((~Be)& Bi ); \
|
||||
Aba0 ^= *(pRoundConstants++); \
|
||||
Abe0 = Be ^((~Bi)& Bo ); \
|
||||
Abi0 = Bi ^((~Bo)& Bu ); \
|
||||
Abo0 = Bo ^((~Bu)& Ba ); \
|
||||
Abu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebo0 ^= Do0; \
|
||||
Ba = ROL32(Ebo0, 14); \
|
||||
Egu0 ^= Du0; \
|
||||
Be = ROL32(Egu0, 10); \
|
||||
Eka1 ^= Da1; \
|
||||
Bi = ROL32(Eka1, 2); \
|
||||
Eme1 ^= De1; \
|
||||
Bo = ROL32(Eme1, 23); \
|
||||
Esi1 ^= Di1; \
|
||||
Bu = ROL32(Esi1, 31); \
|
||||
Aga0 = Ba ^((~Be)& Bi ); \
|
||||
Age0 = Be ^((~Bi)& Bo ); \
|
||||
Agi0 = Bi ^((~Bo)& Bu ); \
|
||||
Ago0 = Bo ^((~Bu)& Ba ); \
|
||||
Agu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebe1 ^= De1; \
|
||||
Ba = ROL32(Ebe1, 1); \
|
||||
Egi0 ^= Di0; \
|
||||
Be = ROL32(Egi0, 3); \
|
||||
Eko1 ^= Do1; \
|
||||
Bi = ROL32(Eko1, 13); \
|
||||
Emu0 ^= Du0; \
|
||||
Bo = ROL32(Emu0, 4); \
|
||||
Esa0 ^= Da0; \
|
||||
Bu = ROL32(Esa0, 9); \
|
||||
Aka0 = Ba ^((~Be)& Bi ); \
|
||||
Ake0 = Be ^((~Bi)& Bo ); \
|
||||
Aki0 = Bi ^((~Bo)& Bu ); \
|
||||
Ako0 = Bo ^((~Bu)& Ba ); \
|
||||
Aku0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebu1 ^= Du1; \
|
||||
Ba = ROL32(Ebu1, 14); \
|
||||
Ega0 ^= Da0; \
|
||||
Be = ROL32(Ega0, 18); \
|
||||
Eke0 ^= De0; \
|
||||
Bi = ROL32(Eke0, 5); \
|
||||
Emi1 ^= Di1; \
|
||||
Bo = ROL32(Emi1, 8); \
|
||||
Eso0 ^= Do0; \
|
||||
Bu = ROL32(Eso0, 28); \
|
||||
Ama0 = Ba ^((~Be)& Bi ); \
|
||||
Ame0 = Be ^((~Bi)& Bo ); \
|
||||
Ami0 = Bi ^((~Bo)& Bu ); \
|
||||
Amo0 = Bo ^((~Bu)& Ba ); \
|
||||
Amu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebi0 ^= Di0; \
|
||||
Ba = ROL32(Ebi0, 31); \
|
||||
Ego1 ^= Do1; \
|
||||
Be = ROL32(Ego1, 28); \
|
||||
Eku1 ^= Du1; \
|
||||
Bi = ROL32(Eku1, 20); \
|
||||
Ema1 ^= Da1; \
|
||||
Bo = ROL32(Ema1, 21); \
|
||||
Ese0 ^= De0; \
|
||||
Bu = ROL32(Ese0, 1); \
|
||||
Asa0 = Ba ^((~Be)& Bi ); \
|
||||
Ase0 = Be ^((~Bi)& Bo ); \
|
||||
Asi0 = Bi ^((~Bo)& Bu ); \
|
||||
Aso0 = Bo ^((~Bu)& Ba ); \
|
||||
Asu0 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Eba1 ^= Da1; \
|
||||
Ba = Eba1; \
|
||||
Ege1 ^= De1; \
|
||||
Be = ROL32(Ege1, 22); \
|
||||
Eki0 ^= Di0; \
|
||||
Bi = ROL32(Eki0, 21); \
|
||||
Emo0 ^= Do0; \
|
||||
Bo = ROL32(Emo0, 10); \
|
||||
Esu1 ^= Du1; \
|
||||
Bu = ROL32(Esu1, 7); \
|
||||
Aba1 = Ba ^((~Be)& Bi ); \
|
||||
Aba1 ^= *(pRoundConstants++); \
|
||||
Abe1 = Be ^((~Bi)& Bo ); \
|
||||
Abi1 = Bi ^((~Bo)& Bu ); \
|
||||
Abo1 = Bo ^((~Bu)& Ba ); \
|
||||
Abu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebo1 ^= Do1; \
|
||||
Ba = ROL32(Ebo1, 14); \
|
||||
Egu1 ^= Du1; \
|
||||
Be = ROL32(Egu1, 10); \
|
||||
Eka0 ^= Da0; \
|
||||
Bi = ROL32(Eka0, 1); \
|
||||
Eme0 ^= De0; \
|
||||
Bo = ROL32(Eme0, 22); \
|
||||
Esi0 ^= Di0; \
|
||||
Bu = ROL32(Esi0, 30); \
|
||||
Aga1 = Ba ^((~Be)& Bi ); \
|
||||
Age1 = Be ^((~Bi)& Bo ); \
|
||||
Agi1 = Bi ^((~Bo)& Bu ); \
|
||||
Ago1 = Bo ^((~Bu)& Ba ); \
|
||||
Agu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebe0 ^= De0; \
|
||||
Ba = Ebe0; \
|
||||
Egi1 ^= Di1; \
|
||||
Be = ROL32(Egi1, 3); \
|
||||
Eko0 ^= Do0; \
|
||||
Bi = ROL32(Eko0, 12); \
|
||||
Emu1 ^= Du1; \
|
||||
Bo = ROL32(Emu1, 4); \
|
||||
Esa1 ^= Da1; \
|
||||
Bu = ROL32(Esa1, 9); \
|
||||
Aka1 = Ba ^((~Be)& Bi ); \
|
||||
Ake1 = Be ^((~Bi)& Bo ); \
|
||||
Aki1 = Bi ^((~Bo)& Bu ); \
|
||||
Ako1 = Bo ^((~Bu)& Ba ); \
|
||||
Aku1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebu0 ^= Du0; \
|
||||
Ba = ROL32(Ebu0, 13); \
|
||||
Ega1 ^= Da1; \
|
||||
Be = ROL32(Ega1, 18); \
|
||||
Eke1 ^= De1; \
|
||||
Bi = ROL32(Eke1, 5); \
|
||||
Emi0 ^= Di0; \
|
||||
Bo = ROL32(Emi0, 7); \
|
||||
Eso1 ^= Do1; \
|
||||
Bu = ROL32(Eso1, 28); \
|
||||
Ama1 = Ba ^((~Be)& Bi ); \
|
||||
Ame1 = Be ^((~Bi)& Bo ); \
|
||||
Ami1 = Bi ^((~Bo)& Bu ); \
|
||||
Amo1 = Bo ^((~Bu)& Ba ); \
|
||||
Amu1 = Bu ^((~Ba)& Be ); \
|
||||
\
|
||||
Ebi1 ^= Di1; \
|
||||
Ba = ROL32(Ebi1, 31); \
|
||||
Ego0 ^= Do0; \
|
||||
Be = ROL32(Ego0, 27); \
|
||||
Eku0 ^= Du0; \
|
||||
Bi = ROL32(Eku0, 19); \
|
||||
Ema0 ^= Da0; \
|
||||
Bo = ROL32(Ema0, 20); \
|
||||
Ese1 ^= De1; \
|
||||
Bu = ROL32(Ese1, 1); \
|
||||
Asa1 = Ba ^((~Be)& Bi ); \
|
||||
Ase1 = Be ^((~Bi)& Bo ); \
|
||||
Asi1 = Bi ^((~Bo)& Bu ); \
|
||||
Aso1 = Bo ^((~Bu)& Ba ); \
|
||||
Asu1 = Bu ^((~Ba)& Be ); \
|
||||
} \
|
||||
copyToState(state, A) \
|
||||
}
|
||||
|
||||
#define copyFromState(X, state) \
|
||||
X##ba0 = state[ 0]; \
|
||||
X##ba1 = state[ 1]; \
|
||||
X##be0 = state[ 2]; \
|
||||
X##be1 = state[ 3]; \
|
||||
X##bi0 = state[ 4]; \
|
||||
X##bi1 = state[ 5]; \
|
||||
X##bo0 = state[ 6]; \
|
||||
X##bo1 = state[ 7]; \
|
||||
X##bu0 = state[ 8]; \
|
||||
X##bu1 = state[ 9]; \
|
||||
X##ga0 = state[10]; \
|
||||
X##ga1 = state[11]; \
|
||||
X##ge0 = state[12]; \
|
||||
X##ge1 = state[13]; \
|
||||
X##gi0 = state[14]; \
|
||||
X##gi1 = state[15]; \
|
||||
X##go0 = state[16]; \
|
||||
X##go1 = state[17]; \
|
||||
X##gu0 = state[18]; \
|
||||
X##gu1 = state[19]; \
|
||||
X##ka0 = state[20]; \
|
||||
X##ka1 = state[21]; \
|
||||
X##ke0 = state[22]; \
|
||||
X##ke1 = state[23]; \
|
||||
X##ki0 = state[24]; \
|
||||
X##ki1 = state[25]; \
|
||||
X##ko0 = state[26]; \
|
||||
X##ko1 = state[27]; \
|
||||
X##ku0 = state[28]; \
|
||||
X##ku1 = state[29]; \
|
||||
X##ma0 = state[30]; \
|
||||
X##ma1 = state[31]; \
|
||||
X##me0 = state[32]; \
|
||||
X##me1 = state[33]; \
|
||||
X##mi0 = state[34]; \
|
||||
X##mi1 = state[35]; \
|
||||
X##mo0 = state[36]; \
|
||||
X##mo1 = state[37]; \
|
||||
X##mu0 = state[38]; \
|
||||
X##mu1 = state[39]; \
|
||||
X##sa0 = state[40]; \
|
||||
X##sa1 = state[41]; \
|
||||
X##se0 = state[42]; \
|
||||
X##se1 = state[43]; \
|
||||
X##si0 = state[44]; \
|
||||
X##si1 = state[45]; \
|
||||
X##so0 = state[46]; \
|
||||
X##so1 = state[47]; \
|
||||
X##su0 = state[48]; \
|
||||
X##su1 = state[49]; \
|
||||
|
||||
#define copyToState(state, X) \
|
||||
state[ 0] = X##ba0; \
|
||||
state[ 1] = X##ba1; \
|
||||
state[ 2] = X##be0; \
|
||||
state[ 3] = X##be1; \
|
||||
state[ 4] = X##bi0; \
|
||||
state[ 5] = X##bi1; \
|
||||
state[ 6] = X##bo0; \
|
||||
state[ 7] = X##bo1; \
|
||||
state[ 8] = X##bu0; \
|
||||
state[ 9] = X##bu1; \
|
||||
state[10] = X##ga0; \
|
||||
state[11] = X##ga1; \
|
||||
state[12] = X##ge0; \
|
||||
state[13] = X##ge1; \
|
||||
state[14] = X##gi0; \
|
||||
state[15] = X##gi1; \
|
||||
state[16] = X##go0; \
|
||||
state[17] = X##go1; \
|
||||
state[18] = X##gu0; \
|
||||
state[19] = X##gu1; \
|
||||
state[20] = X##ka0; \
|
||||
state[21] = X##ka1; \
|
||||
state[22] = X##ke0; \
|
||||
state[23] = X##ke1; \
|
||||
state[24] = X##ki0; \
|
||||
state[25] = X##ki1; \
|
||||
state[26] = X##ko0; \
|
||||
state[27] = X##ko1; \
|
||||
state[28] = X##ku0; \
|
||||
state[29] = X##ku1; \
|
||||
state[30] = X##ma0; \
|
||||
state[31] = X##ma1; \
|
||||
state[32] = X##me0; \
|
||||
state[33] = X##me1; \
|
||||
state[34] = X##mi0; \
|
||||
state[35] = X##mi1; \
|
||||
state[36] = X##mo0; \
|
||||
state[37] = X##mo1; \
|
||||
state[38] = X##mu0; \
|
||||
state[39] = X##mu1; \
|
||||
state[40] = X##sa0; \
|
||||
state[41] = X##sa1; \
|
||||
state[42] = X##se0; \
|
||||
state[43] = X##se1; \
|
||||
state[44] = X##si0; \
|
||||
state[45] = X##si1; \
|
||||
state[46] = X##so0; \
|
||||
state[47] = X##so1; \
|
||||
state[48] = X##su0; \
|
||||
state[49] = X##su1; \
|
||||
|
||||
|
||||
#endif
|
||||
1191
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32-s1.h
generated
Normal file
1191
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32-s1.h
generated
Normal file
File diff suppressed because it is too large
Load Diff
1140
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32-s2.h
generated
Normal file
1140
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32-s2.h
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32.h
generated
Normal file
26
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-32.h
generated
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#ifdef UseSchedule
|
||||
#if (UseSchedule == 1)
|
||||
#include "KeccakF-1600-32-s1.h"
|
||||
#elif (UseSchedule == 2)
|
||||
#include "KeccakF-1600-32-s2.h"
|
||||
#elif (UseSchedule == 3)
|
||||
#include "KeccakF-1600-32-rvk.h"
|
||||
#else
|
||||
#error "This schedule is not supported."
|
||||
#endif
|
||||
#else
|
||||
#include "KeccakF-1600-32-s1.h"
|
||||
#endif
|
||||
6
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-int-set.h
generated
Normal file
6
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-int-set.h
generated
Normal file
@ -0,0 +1,6 @@
|
||||
#define ProvideFast576
|
||||
#define ProvideFast832
|
||||
#define ProvideFast1024
|
||||
#define ProvideFast1088
|
||||
#define ProvideFast1152
|
||||
#define ProvideFast1344
|
||||
51
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-interface.h
generated
Normal file
51
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-interface.h
generated
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#ifndef _KeccakPermutationInterface_h_
|
||||
#define _KeccakPermutationInterface_h_
|
||||
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
typedef uint64_t UINT64;
|
||||
|
||||
#include "KeccakF-1600-int-set.h"
|
||||
|
||||
void KeccakInitialize( void );
|
||||
void KeccakInitializeState(unsigned char *state);
|
||||
void KeccakPermutation(unsigned char *state);
|
||||
#ifdef ProvideFast576
|
||||
void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data);
|
||||
#endif
|
||||
#ifdef ProvideFast832
|
||||
void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data);
|
||||
#endif
|
||||
#ifdef ProvideFast1024
|
||||
void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data);
|
||||
#endif
|
||||
#ifdef ProvideFast1088
|
||||
void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data);
|
||||
#endif
|
||||
#ifdef ProvideFast1152
|
||||
void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data);
|
||||
#endif
|
||||
#ifdef ProvideFast1344
|
||||
void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data);
|
||||
#endif
|
||||
void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount);
|
||||
#ifdef ProvideFast1024
|
||||
void KeccakExtract1024bits(const unsigned char *state, unsigned char *data);
|
||||
#endif
|
||||
void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount);
|
||||
|
||||
#endif
|
||||
6
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-opt32-settings.h
generated
Normal file
6
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-opt32-settings.h
generated
Normal file
@ -0,0 +1,6 @@
|
||||
#define Unrolling 2
|
||||
#define UseSchedule 3
|
||||
/*
|
||||
#define UseBebigokimisa
|
||||
#define UseInterleaveTables
|
||||
*/
|
||||
519
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-opt32.c
generated
Normal file
519
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-opt32.c
generated
Normal file
@ -0,0 +1,519 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "brg_endian.h"
|
||||
#include "KeccakF-1600-opt32-settings.h"
|
||||
#include "KeccakF-1600-interface.h"
|
||||
|
||||
#ifdef UseInterleaveTables
|
||||
static int interleaveTablesBuilt = 0;
|
||||
static UINT16 interleaveTable[65536];
|
||||
static UINT16 deinterleaveTable[65536];
|
||||
|
||||
static void buildInterleaveTables()
|
||||
{
|
||||
UINT32 i, j;
|
||||
UINT16 x;
|
||||
|
||||
if (!interleaveTablesBuilt) {
|
||||
for(i=0; i<65536; i++) {
|
||||
x = 0;
|
||||
for(j=0; j<16; j++) {
|
||||
if (i & (1 << j))
|
||||
x |= (1 << (j/2 + 8*(j%2)));
|
||||
}
|
||||
interleaveTable[i] = x;
|
||||
deinterleaveTable[x] = (UINT16)i;
|
||||
}
|
||||
interleaveTablesBuilt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
||||
|
||||
#define xor2bytesIntoInterleavedWords(even, odd, source, j) \
|
||||
i##j = interleaveTable[((const UINT16*)source)[j]]; \
|
||||
((UINT8*)even)[j] ^= i##j & 0xFF; \
|
||||
((UINT8*)odd)[j] ^= i##j >> 8;
|
||||
|
||||
#define setInterleavedWordsInto2bytes(dest, even, odd, j) \
|
||||
d##j = deinterleaveTable[((even >> (j*8)) & 0xFF) ^ (((odd >> (j*8)) & 0xFF) << 8)]; \
|
||||
((UINT16*)dest)[j] = d##j;
|
||||
|
||||
#else /* (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) */
|
||||
|
||||
#define xor2bytesIntoInterleavedWords(even, odd, source, j) \
|
||||
i##j = interleaveTable[source[2*j] ^ ((UINT16)source[2*j+1] << 8)]; \
|
||||
*even ^= (i##j & 0xFF) << (j*8); \
|
||||
*odd ^= ((i##j >> 8) & 0xFF) << (j*8);
|
||||
|
||||
#define setInterleavedWordsInto2bytes(dest, even, odd, j) \
|
||||
d##j = deinterleaveTable[((even >> (j*8)) & 0xFF) ^ (((odd >> (j*8)) & 0xFF) << 8)]; \
|
||||
dest[2*j] = d##j & 0xFF; \
|
||||
dest[2*j+1] = d##j >> 8;
|
||||
|
||||
#endif /* Endianness */
|
||||
|
||||
static void xor8bytesIntoInterleavedWords(UINT32 *even, UINT32 *odd, const UINT8* source)
|
||||
{
|
||||
UINT16 i0, i1, i2, i3;
|
||||
|
||||
xor2bytesIntoInterleavedWords(even, odd, source, 0)
|
||||
xor2bytesIntoInterleavedWords(even, odd, source, 1)
|
||||
xor2bytesIntoInterleavedWords(even, odd, source, 2)
|
||||
xor2bytesIntoInterleavedWords(even, odd, source, 3)
|
||||
}
|
||||
|
||||
#define xorLanesIntoState(laneCount, state, input) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i<(laneCount); i++) \
|
||||
xor8bytesIntoInterleavedWords(state+i*2, state+i*2+1, input+i*8); \
|
||||
}
|
||||
|
||||
static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32 even, UINT32 odd)
|
||||
{
|
||||
UINT16 d0, d1, d2, d3;
|
||||
|
||||
setInterleavedWordsInto2bytes(dest, even, odd, 0)
|
||||
setInterleavedWordsInto2bytes(dest, even, odd, 1)
|
||||
setInterleavedWordsInto2bytes(dest, even, odd, 2)
|
||||
setInterleavedWordsInto2bytes(dest, even, odd, 3)
|
||||
}
|
||||
|
||||
#define extractLanes(laneCount, state, data) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i<(laneCount); i++) \
|
||||
setInterleavedWordsInto8bytes(data+i*8, ((UINT32*)state)[i*2], ((UINT32*)state)[i*2+1]); \
|
||||
}
|
||||
|
||||
#else /* No interleaving tables */
|
||||
|
||||
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
||||
|
||||
/* Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002 */
|
||||
#define xorInterleavedLE(rateInLanes, state, input) \
|
||||
{ \
|
||||
const UINT32 * pI = (const UINT32 *)input; \
|
||||
UINT32 * pS = state; \
|
||||
UINT32 t, x0, x1; \
|
||||
int i; \
|
||||
for (i = (rateInLanes)-1; i >= 0; --i) \
|
||||
{ \
|
||||
x0 = *(pI++); \
|
||||
t = (x0 ^ (x0 >> 1)) & 0x22222222UL; x0 = x0 ^ t ^ (t << 1); \
|
||||
t = (x0 ^ (x0 >> 2)) & 0x0C0C0C0CUL; x0 = x0 ^ t ^ (t << 2); \
|
||||
t = (x0 ^ (x0 >> 4)) & 0x00F000F0UL; x0 = x0 ^ t ^ (t << 4); \
|
||||
t = (x0 ^ (x0 >> 8)) & 0x0000FF00UL; x0 = x0 ^ t ^ (t << 8); \
|
||||
x1 = *(pI++); \
|
||||
t = (x1 ^ (x1 >> 1)) & 0x22222222UL; x1 = x1 ^ t ^ (t << 1); \
|
||||
t = (x1 ^ (x1 >> 2)) & 0x0C0C0C0CUL; x1 = x1 ^ t ^ (t << 2); \
|
||||
t = (x1 ^ (x1 >> 4)) & 0x00F000F0UL; x1 = x1 ^ t ^ (t << 4); \
|
||||
t = (x1 ^ (x1 >> 8)) & 0x0000FF00UL; x1 = x1 ^ t ^ (t << 8); \
|
||||
*(pS++) ^= (UINT16)x0 | (x1 << 16); \
|
||||
*(pS++) ^= (x0 >> 16) | (x1 & 0xFFFF0000); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define xorLanesIntoState(laneCount, state, input) \
|
||||
xorInterleavedLE(laneCount, state, input)
|
||||
|
||||
#else /* (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) */
|
||||
|
||||
/* Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002 */
|
||||
UINT64 toInterleaving(UINT64 x)
|
||||
{
|
||||
UINT64 t;
|
||||
|
||||
t = (x ^ (x >> 1)) & 0x2222222222222222ULL; x = x ^ t ^ (t << 1);
|
||||
t = (x ^ (x >> 2)) & 0x0C0C0C0C0C0C0C0CULL; x = x ^ t ^ (t << 2);
|
||||
t = (x ^ (x >> 4)) & 0x00F000F000F000F0ULL; x = x ^ t ^ (t << 4);
|
||||
t = (x ^ (x >> 8)) & 0x0000FF000000FF00ULL; x = x ^ t ^ (t << 8);
|
||||
t = (x ^ (x >> 16)) & 0x00000000FFFF0000ULL; x = x ^ t ^ (t << 16);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
static void xor8bytesIntoInterleavedWords(UINT32* evenAndOdd, const UINT8* source)
|
||||
{
|
||||
/* This can be optimized */
|
||||
UINT64 sourceWord =
|
||||
(UINT64)source[0]
|
||||
^ (((UINT64)source[1]) << 8)
|
||||
^ (((UINT64)source[2]) << 16)
|
||||
^ (((UINT64)source[3]) << 24)
|
||||
^ (((UINT64)source[4]) << 32)
|
||||
^ (((UINT64)source[5]) << 40)
|
||||
^ (((UINT64)source[6]) << 48)
|
||||
^ (((UINT64)source[7]) << 56);
|
||||
UINT64 evenAndOddWord = toInterleaving(sourceWord);
|
||||
evenAndOdd[0] ^= (UINT32)evenAndOddWord;
|
||||
evenAndOdd[1] ^= (UINT32)(evenAndOddWord >> 32);
|
||||
}
|
||||
|
||||
#define xorLanesIntoState(laneCount, state, input) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i<(laneCount); i++) \
|
||||
xor8bytesIntoInterleavedWords(state+i*2, input+i*8); \
|
||||
}
|
||||
|
||||
#endif /* Endianness */
|
||||
|
||||
/* Credit: Henry S. Warren, Hacker's Delight, Addison-Wesley, 2002 */
|
||||
UINT64 fromInterleaving(UINT64 x)
|
||||
{
|
||||
UINT64 t;
|
||||
|
||||
t = (x ^ (x >> 16)) & 0x00000000FFFF0000ULL; x = x ^ t ^ (t << 16);
|
||||
t = (x ^ (x >> 8)) & 0x0000FF000000FF00ULL; x = x ^ t ^ (t << 8);
|
||||
t = (x ^ (x >> 4)) & 0x00F000F000F000F0ULL; x = x ^ t ^ (t << 4);
|
||||
t = (x ^ (x >> 2)) & 0x0C0C0C0C0C0C0C0CULL; x = x ^ t ^ (t << 2);
|
||||
t = (x ^ (x >> 1)) & 0x2222222222222222ULL; x = x ^ t ^ (t << 1);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
static void setInterleavedWordsInto8bytes(UINT8* dest, UINT32* evenAndOdd)
|
||||
{
|
||||
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
|
||||
((UINT64*)dest)[0] = fromInterleaving(*(UINT64*)evenAndOdd);
|
||||
#else /* (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) */
|
||||
/* This can be optimized */
|
||||
UINT64 evenAndOddWord = (UINT64)evenAndOdd[0] ^ ((UINT64)evenAndOdd[1] << 32);
|
||||
UINT64 destWord = fromInterleaving(evenAndOddWord);
|
||||
dest[0] = destWord & 0xFF;
|
||||
dest[1] = (destWord >> 8) & 0xFF;
|
||||
dest[2] = (destWord >> 16) & 0xFF;
|
||||
dest[3] = (destWord >> 24) & 0xFF;
|
||||
dest[4] = (destWord >> 32) & 0xFF;
|
||||
dest[5] = (destWord >> 40) & 0xFF;
|
||||
dest[6] = (destWord >> 48) & 0xFF;
|
||||
dest[7] = (destWord >> 56) & 0xFF;
|
||||
#endif /* Endianness */
|
||||
}
|
||||
|
||||
#define extractLanes(laneCount, state, data) \
|
||||
{ \
|
||||
int i; \
|
||||
for(i=0; i<(laneCount); i++) \
|
||||
setInterleavedWordsInto8bytes(data+i*8, (UINT32*)state+i*2); \
|
||||
}
|
||||
|
||||
#endif /* With or without interleaving tables */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define ROL32(a, offset) _rotl(a, offset)
|
||||
#elif (defined (__arm__) && defined(__ARMCC_VERSION))
|
||||
#define ROL32(a, offset) __ror(a, 32-(offset))
|
||||
#else
|
||||
#define ROL32(a, offset) ((((UINT32)a) << (offset)) ^ (((UINT32)a) >> (32-(offset))))
|
||||
#endif
|
||||
|
||||
#include "KeccakF-1600-unrolling.h"
|
||||
#include "KeccakF-1600-32.h"
|
||||
|
||||
#if (UseSchedule == 3)
|
||||
|
||||
#ifdef UseBebigokimisa
|
||||
#error "No lane complementing with schedule 3."
|
||||
#endif
|
||||
|
||||
#if (Unrolling != 2)
|
||||
#error "Only unrolling 2 is supported by schedule 3."
|
||||
#endif
|
||||
|
||||
static void KeccakPermutationOnWords(UINT32 *state)
|
||||
{
|
||||
rounds
|
||||
}
|
||||
|
||||
static void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount)
|
||||
{
|
||||
xorLanesIntoState(laneCount, state, input)
|
||||
rounds
|
||||
}
|
||||
|
||||
#ifdef ProvideFast576
|
||||
static void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
xorLanesIntoState(9, state, input)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast832
|
||||
static void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
xorLanesIntoState(13, state, input)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1024
|
||||
static void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
xorLanesIntoState(16, state, input)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1088
|
||||
static void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
xorLanesIntoState(17, state, input)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1152
|
||||
static void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
xorLanesIntoState(18, state, input)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1344
|
||||
static void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
xorLanesIntoState(21, state, input)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* (Schedule != 3) */
|
||||
|
||||
static void KeccakPermutationOnWords(UINT32 *state)
|
||||
{
|
||||
declareABCDE
|
||||
#if (Unrolling != 24)
|
||||
unsigned int i;
|
||||
#endif
|
||||
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
|
||||
static void KeccakPermutationOnWordsAfterXoring(UINT32 *state, const UINT8 *input, unsigned int laneCount)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(laneCount, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
|
||||
#ifdef ProvideFast576
|
||||
static void KeccakPermutationOnWordsAfterXoring576bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(9, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast832
|
||||
static void KeccakPermutationOnWordsAfterXoring832bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(13, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1024
|
||||
static void KeccakPermutationOnWordsAfterXoring1024bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(16, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1088
|
||||
static void KeccakPermutationOnWordsAfterXoring1088bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(17, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1152
|
||||
static void KeccakPermutationOnWordsAfterXoring1152bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(18, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1344
|
||||
static void KeccakPermutationOnWordsAfterXoring1344bits(UINT32 *state, const UINT8 *input)
|
||||
{
|
||||
declareABCDE
|
||||
unsigned int i;
|
||||
|
||||
xorLanesIntoState(21, state, input)
|
||||
copyFromState(A, state)
|
||||
rounds
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void KeccakInitialize()
|
||||
{
|
||||
#ifdef UseInterleaveTables
|
||||
buildInterleaveTables();
|
||||
#endif
|
||||
}
|
||||
|
||||
void KeccakInitializeState(unsigned char *state)
|
||||
{
|
||||
memset(state, 0, 200);
|
||||
#ifdef UseBebigokimisa
|
||||
((UINT32*)state)[ 2] = ~(UINT32)0;
|
||||
((UINT32*)state)[ 3] = ~(UINT32)0;
|
||||
((UINT32*)state)[ 4] = ~(UINT32)0;
|
||||
((UINT32*)state)[ 5] = ~(UINT32)0;
|
||||
((UINT32*)state)[16] = ~(UINT32)0;
|
||||
((UINT32*)state)[17] = ~(UINT32)0;
|
||||
((UINT32*)state)[24] = ~(UINT32)0;
|
||||
((UINT32*)state)[25] = ~(UINT32)0;
|
||||
((UINT32*)state)[34] = ~(UINT32)0;
|
||||
((UINT32*)state)[35] = ~(UINT32)0;
|
||||
((UINT32*)state)[40] = ~(UINT32)0;
|
||||
((UINT32*)state)[41] = ~(UINT32)0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void KeccakPermutation(unsigned char *state)
|
||||
{
|
||||
/* We assume the state is always stored as interleaved 32-bit words */
|
||||
KeccakPermutationOnWords((UINT32*)state);
|
||||
}
|
||||
|
||||
#ifdef ProvideFast576
|
||||
void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring576bits((UINT32*)state, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast832
|
||||
void KeccakAbsorb832bits(unsigned char *state, const unsigned char *data)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring832bits((UINT32*)state, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1024
|
||||
void KeccakAbsorb1024bits(unsigned char *state, const unsigned char *data)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring1024bits((UINT32*)state, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1088
|
||||
void KeccakAbsorb1088bits(unsigned char *state, const unsigned char *data)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring1088bits((UINT32*)state, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1152
|
||||
void KeccakAbsorb1152bits(unsigned char *state, const unsigned char *data)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring1152bits((UINT32*)state, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ProvideFast1344
|
||||
void KeccakAbsorb1344bits(unsigned char *state, const unsigned char *data)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring1344bits((UINT32*)state, data);
|
||||
}
|
||||
#endif
|
||||
|
||||
void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsigned int laneCount)
|
||||
{
|
||||
KeccakPermutationOnWordsAfterXoring((UINT32*)state, data, laneCount);
|
||||
}
|
||||
|
||||
#ifdef ProvideFast1024
|
||||
void KeccakExtract1024bits(const unsigned char *state, unsigned char *data)
|
||||
{
|
||||
extractLanes(16, state, data)
|
||||
#ifdef UseBebigokimisa
|
||||
((UINT32*)data)[ 2] = ~((UINT32*)data)[ 2];
|
||||
((UINT32*)data)[ 3] = ~((UINT32*)data)[ 3];
|
||||
((UINT32*)data)[ 4] = ~((UINT32*)data)[ 4];
|
||||
((UINT32*)data)[ 5] = ~((UINT32*)data)[ 5];
|
||||
((UINT32*)data)[16] = ~((UINT32*)data)[16];
|
||||
((UINT32*)data)[17] = ~((UINT32*)data)[17];
|
||||
((UINT32*)data)[24] = ~((UINT32*)data)[24];
|
||||
((UINT32*)data)[25] = ~((UINT32*)data)[25];
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void KeccakExtract(const unsigned char *state, unsigned char *data, unsigned int laneCount)
|
||||
{
|
||||
extractLanes(laneCount, state, data)
|
||||
#ifdef UseBebigokimisa
|
||||
if (laneCount > 1) {
|
||||
((UINT32*)data)[ 2] = ~((UINT32*)data)[ 2];
|
||||
((UINT32*)data)[ 3] = ~((UINT32*)data)[ 3];
|
||||
if (laneCount > 2) {
|
||||
((UINT32*)data)[ 4] = ~((UINT32*)data)[ 4];
|
||||
((UINT32*)data)[ 5] = ~((UINT32*)data)[ 5];
|
||||
if (laneCount > 8) {
|
||||
((UINT32*)data)[16] = ~((UINT32*)data)[16];
|
||||
((UINT32*)data)[17] = ~((UINT32*)data)[17];
|
||||
if (laneCount > 12) {
|
||||
((UINT32*)data)[24] = ~((UINT32*)data)[24];
|
||||
((UINT32*)data)[25] = ~((UINT32*)data)[25];
|
||||
if (laneCount > 17) {
|
||||
((UINT32*)data)[34] = ~((UINT32*)data)[34];
|
||||
((UINT32*)data)[35] = ~((UINT32*)data)[35];
|
||||
if (laneCount > 20) {
|
||||
((UINT32*)data)[40] = ~((UINT32*)data)[40];
|
||||
((UINT32*)data)[41] = ~((UINT32*)data)[41];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
128
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-unrolling.h
generated
Normal file
128
Example/Pods/NACrypto/NACrypto/keccak/KeccakF-1600-unrolling.h
generated
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
#ifndef _Keccak1600_unrolling_h_
|
||||
#define _Keccak1600_unrolling_h_
|
||||
|
||||
#if (Unrolling == 24)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
thetaRhoPiChiIotaPrepareTheta( 0, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 1, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 2, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 3, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 4, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 5, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 6, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 7, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 8, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta( 9, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(10, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(11, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(12, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(13, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(14, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(15, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(16, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(17, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(18, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(19, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(20, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(21, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(22, A, E) \
|
||||
thetaRhoPiChiIota(23, E, A) \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 12)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i+=12) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 1, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 2, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 3, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 4, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 5, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 6, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 7, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 8, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+ 9, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+10, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+11, E, A) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 8)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i+=8) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+4, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+5, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+6, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+7, E, A) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 6)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i+=6) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+4, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+5, E, A) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 4)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i+=4) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+3, E, A) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 3)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i+=3) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+2, A, E) \
|
||||
copyStateVariables(A, E) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 2)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i+=2) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
thetaRhoPiChiIotaPrepareTheta(i+1, E, A) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#elif (Unrolling == 1)
|
||||
#define rounds \
|
||||
prepareTheta \
|
||||
for(i=0; i<24; i++) { \
|
||||
thetaRhoPiChiIotaPrepareTheta(i , A, E) \
|
||||
copyStateVariables(A, E) \
|
||||
} \
|
||||
copyToState(state, A)
|
||||
#else
|
||||
#error "Unrolling is not correctly specified!"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
83
Example/Pods/NACrypto/NACrypto/keccak/KeccakNISTInterface.c
generated
Normal file
83
Example/Pods/NACrypto/NACrypto/keccak/KeccakNISTInterface.c
generated
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "KeccakNISTInterface.h"
|
||||
#include "KeccakF-1600-interface.h"
|
||||
|
||||
HashReturn Init(hashState *state, int hashbitlen)
|
||||
{
|
||||
switch(hashbitlen) {
|
||||
case 0: /* Default parameters, arbitrary length output */
|
||||
InitSponge((spongeState*)state, 1024, 576);
|
||||
break;
|
||||
case 224:
|
||||
InitSponge((spongeState*)state, 1152, 448);
|
||||
break;
|
||||
case 256:
|
||||
InitSponge((spongeState*)state, 1088, 512);
|
||||
break;
|
||||
case 384:
|
||||
InitSponge((spongeState*)state, 832, 768);
|
||||
break;
|
||||
case 512:
|
||||
InitSponge((spongeState*)state, 576, 1024);
|
||||
break;
|
||||
default:
|
||||
return BAD_HASHLEN;
|
||||
}
|
||||
state->fixedOutputLength = hashbitlen;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen)
|
||||
{
|
||||
if ((databitlen % 8) == 0)
|
||||
return Absorb((spongeState*)state, data, databitlen);
|
||||
else {
|
||||
HashReturn ret = Absorb((spongeState*)state, data, databitlen - (databitlen % 8));
|
||||
if (ret == SUCCESS) {
|
||||
unsigned char lastByte;
|
||||
/* Align the last partial byte to the least significant bits */
|
||||
lastByte = data[databitlen/8] >> (8 - (databitlen % 8));
|
||||
return Absorb((spongeState*)state, &lastByte, databitlen % 8);
|
||||
}
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
HashReturn Final(hashState *state, BitSequence *hashval)
|
||||
{
|
||||
return Squeeze(state, hashval, state->fixedOutputLength);
|
||||
}
|
||||
|
||||
/*
|
||||
static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval)
|
||||
{
|
||||
hashState state;
|
||||
HashReturn result;
|
||||
|
||||
if ((hashbitlen != 224) && (hashbitlen != 256) && (hashbitlen != 384) && (hashbitlen != 512))
|
||||
return BAD_HASHLEN; * Only the four fixed output lengths available through this API *
|
||||
result = Init(&state, hashbitlen);
|
||||
if (result != SUCCESS)
|
||||
return result;
|
||||
result = Update(&state, data, databitlen);
|
||||
if (result != SUCCESS)
|
||||
return result;
|
||||
result = Final(&state, hashval);
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
72
Example/Pods/NACrypto/NACrypto/keccak/KeccakNISTInterface.h
generated
Normal file
72
Example/Pods/NACrypto/NACrypto/keccak/KeccakNISTInterface.h
generated
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#ifndef _KeccakNISTInterface_h_
|
||||
#define _KeccakNISTInterface_h_
|
||||
|
||||
#include "KeccakSponge.h"
|
||||
|
||||
typedef unsigned char BitSequence;
|
||||
typedef unsigned long long DataLength;
|
||||
typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2 } HashReturn;
|
||||
|
||||
typedef spongeState hashState;
|
||||
|
||||
/**
|
||||
* Function to initialize the state of the Keccak[r, c] sponge function.
|
||||
* The rate r and capacity c values are determined from @a hashbitlen.
|
||||
* @param state Pointer to the state of the sponge function to be initialized.
|
||||
* @param hashbitlen The desired number of output bits,
|
||||
* or 0 for Keccak[] with default parameters
|
||||
* and arbitrarily-long output.
|
||||
* @pre The value of hashbitlen must be one of 0, 224, 256, 384 and 512.
|
||||
* @return SUCCESS if successful, BAD_HASHLEN if the value of hashbitlen is incorrect.
|
||||
*/
|
||||
HashReturn Init(hashState *state, int hashbitlen);
|
||||
/**
|
||||
* Function to give input data for the sponge function to absorb.
|
||||
* @param state Pointer to the state of the sponge function initialized by Init().
|
||||
* @param data Pointer to the input data.
|
||||
* When @a databitLen is not a multiple of 8, the last bits of data must be
|
||||
* in the most significant bits of the last byte.
|
||||
* @param databitLen The number of input bits provided in the input data.
|
||||
* @pre In the previous call to Absorb(), databitLen was a multiple of 8.
|
||||
* @return SUCCESS if successful, FAIL otherwise.
|
||||
*/
|
||||
HashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);
|
||||
/**
|
||||
* Function to squeeze output data from the sponge function.
|
||||
* If @a hashbitlen was not 0 in the call to Init(), the number of output bits is equal to @a hashbitlen.
|
||||
* If @a hashbitlen was 0 in the call to Init(), the output bits must be extracted using the Squeeze() function.
|
||||
* @param state Pointer to the state of the sponge function initialized by Init().
|
||||
* @param hashval Pointer to the buffer where to store the output data.
|
||||
* @return SUCCESS if successful, FAIL otherwise.
|
||||
*/
|
||||
HashReturn Final(hashState *state, BitSequence *hashval);
|
||||
/**
|
||||
* Function to compute a hash using the Keccak[r, c] sponge function.
|
||||
* The rate r and capacity c values are determined from @a hashbitlen.
|
||||
* @param hashbitlen The desired number of output bits.
|
||||
* @param data Pointer to the input data.
|
||||
* When @a databitLen is not a multiple of 8, the last bits of data must be
|
||||
* in the most significant bits of the last byte.
|
||||
* @param databitLen The number of input bits provided in the input data.
|
||||
* @param hashval Pointer to the buffer where to store the output data.
|
||||
* @pre The value of hashbitlen must be one of 224, 256, 384 and 512.
|
||||
* @return SUCCESS if successful, BAD_HASHLEN if the value of hashbitlen is incorrect.
|
||||
*/
|
||||
/*
|
||||
static HashReturn Hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
|
||||
*/
|
||||
|
||||
#endif
|
||||
266
Example/Pods/NACrypto/NACrypto/keccak/KeccakSponge.c
generated
Normal file
266
Example/Pods/NACrypto/NACrypto/keccak/KeccakSponge.c
generated
Normal file
@ -0,0 +1,266 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "KeccakSponge.h"
|
||||
#include "KeccakF-1600-interface.h"
|
||||
#ifdef KeccakReference
|
||||
#include "displayIntermediateValues.h"
|
||||
#endif
|
||||
|
||||
int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity)
|
||||
{
|
||||
if (rate+capacity != 1600)
|
||||
return 1;
|
||||
if ((rate <= 0) || (rate >= 1600) || ((rate % 64) != 0))
|
||||
return 1;
|
||||
KeccakInitialize();
|
||||
state->rate = rate;
|
||||
state->capacity = capacity;
|
||||
state->fixedOutputLength = 0;
|
||||
KeccakInitializeState(state->state);
|
||||
memset(state->dataQueue, 0, KeccakMaximumRateInBytes);
|
||||
state->bitsInQueue = 0;
|
||||
state->squeezing = 0;
|
||||
state->bitsAvailableForSqueezing = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void AbsorbQueue(spongeState *state)
|
||||
{
|
||||
/* state->bitsInQueue is assumed to be equal to state->rate */
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", state->dataQueue, state->rate/8);
|
||||
#endif
|
||||
#ifdef ProvideFast576
|
||||
if (state->rate == 576)
|
||||
KeccakAbsorb576bits(state->state, state->dataQueue);
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast832
|
||||
if (state->rate == 832)
|
||||
KeccakAbsorb832bits(state->state, state->dataQueue);
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1024
|
||||
if (state->rate == 1024)
|
||||
KeccakAbsorb1024bits(state->state, state->dataQueue);
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1088
|
||||
if (state->rate == 1088)
|
||||
KeccakAbsorb1088bits(state->state, state->dataQueue);
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1152
|
||||
if (state->rate == 1152)
|
||||
KeccakAbsorb1152bits(state->state, state->dataQueue);
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1344
|
||||
if (state->rate == 1344)
|
||||
KeccakAbsorb1344bits(state->state, state->dataQueue);
|
||||
else
|
||||
#endif
|
||||
KeccakAbsorb(state->state, state->dataQueue, state->rate/64);
|
||||
state->bitsInQueue = 0;
|
||||
}
|
||||
|
||||
int Absorb(spongeState *state, const unsigned char *data, unsigned long long databitlen)
|
||||
{
|
||||
unsigned long long i, j, wholeBlocks;
|
||||
unsigned int partialBlock, partialByte;
|
||||
const unsigned char *curData;
|
||||
|
||||
if ((state->bitsInQueue % 8) != 0)
|
||||
return 1; /* Only the last call may contain a partial byte */
|
||||
if (state->squeezing)
|
||||
return 1; /* Too late for additional input */
|
||||
|
||||
i = 0;
|
||||
while(i < databitlen) {
|
||||
if ((state->bitsInQueue == 0) && (databitlen >= state->rate) && (i <= (databitlen-state->rate))) {
|
||||
wholeBlocks = (databitlen-i)/state->rate;
|
||||
curData = data+i/8;
|
||||
#ifdef ProvideFast576
|
||||
if (state->rate == 576) {
|
||||
for(j=0; j<wholeBlocks; j++, curData+=576/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb576bits(state->state, curData);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast832
|
||||
if (state->rate == 832) {
|
||||
for(j=0; j<wholeBlocks; j++, curData+=832/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb832bits(state->state, curData);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1024
|
||||
if (state->rate == 1024) {
|
||||
for(j=0; j<wholeBlocks; j++, curData+=1024/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb1024bits(state->state, curData);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1088
|
||||
if (state->rate == 1088) {
|
||||
for(j=0; j<wholeBlocks; j++, curData+=1088/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb1088bits(state->state, curData);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1152
|
||||
if (state->rate == 1152) {
|
||||
for(j=0; j<wholeBlocks; j++, curData+=1152/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb1152bits(state->state, curData);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef ProvideFast1344
|
||||
if (state->rate == 1344) {
|
||||
for(j=0; j<wholeBlocks; j++, curData+=1344/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb1344bits(state->state, curData);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for(j=0; j<wholeBlocks; j++, curData+=state->rate/8) {
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed", curData, state->rate/8);
|
||||
#endif
|
||||
KeccakAbsorb(state->state, curData, state->rate/64);
|
||||
}
|
||||
}
|
||||
i += wholeBlocks*state->rate;
|
||||
}
|
||||
else {
|
||||
partialBlock = (unsigned int)(databitlen - i);
|
||||
if (partialBlock+state->bitsInQueue > state->rate)
|
||||
partialBlock = state->rate-state->bitsInQueue;
|
||||
partialByte = partialBlock % 8;
|
||||
partialBlock -= partialByte;
|
||||
memcpy(state->dataQueue+state->bitsInQueue/8, data+i/8, partialBlock/8);
|
||||
state->bitsInQueue += partialBlock;
|
||||
i += partialBlock;
|
||||
if (state->bitsInQueue == state->rate)
|
||||
AbsorbQueue(state);
|
||||
if (partialByte > 0) {
|
||||
unsigned char mask = (1 << partialByte)-1;
|
||||
state->dataQueue[state->bitsInQueue/8] = data[i/8] & mask;
|
||||
state->bitsInQueue += partialByte;
|
||||
i += partialByte;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void PadAndSwitchToSqueezingPhase(spongeState *state)
|
||||
{
|
||||
/* Note: the bits are numbered from 0=LSB to 7=MSB */
|
||||
if (state->bitsInQueue + 1 == state->rate) {
|
||||
state->dataQueue[state->bitsInQueue/8 ] |= 1 << (state->bitsInQueue % 8);
|
||||
AbsorbQueue(state);
|
||||
memset(state->dataQueue, 0, state->rate/8);
|
||||
}
|
||||
else {
|
||||
memset(state->dataQueue + (state->bitsInQueue+7)/8, 0, state->rate/8 - (state->bitsInQueue+7)/8);
|
||||
state->dataQueue[state->bitsInQueue/8 ] |= 1 << (state->bitsInQueue % 8);
|
||||
}
|
||||
state->dataQueue[(state->rate-1)/8] |= 1 << ((state->rate-1) % 8);
|
||||
AbsorbQueue(state);
|
||||
|
||||
#ifdef KeccakReference
|
||||
displayText(1, "--- Switching to squeezing phase ---");
|
||||
#endif
|
||||
#ifdef ProvideFast1024
|
||||
if (state->rate == 1024) {
|
||||
KeccakExtract1024bits(state->state, state->dataQueue);
|
||||
state->bitsAvailableForSqueezing = 1024;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
KeccakExtract(state->state, state->dataQueue, state->rate/64);
|
||||
state->bitsAvailableForSqueezing = state->rate;
|
||||
}
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block available for squeezing", state->dataQueue, state->bitsAvailableForSqueezing/8);
|
||||
#endif
|
||||
state->squeezing = 1;
|
||||
}
|
||||
|
||||
int Squeeze(spongeState *state, unsigned char *output, unsigned long long outputLength)
|
||||
{
|
||||
unsigned long long i;
|
||||
unsigned int partialBlock;
|
||||
|
||||
if (!state->squeezing)
|
||||
PadAndSwitchToSqueezingPhase(state);
|
||||
if ((outputLength % 8) != 0)
|
||||
return 1; /* Only multiple of 8 bits are allowed, truncation can be done at user level */
|
||||
|
||||
i = 0;
|
||||
while(i < outputLength) {
|
||||
if (state->bitsAvailableForSqueezing == 0) {
|
||||
KeccakPermutation(state->state);
|
||||
#ifdef ProvideFast1024
|
||||
if (state->rate == 1024) {
|
||||
KeccakExtract1024bits(state->state, state->dataQueue);
|
||||
state->bitsAvailableForSqueezing = 1024;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
KeccakExtract(state->state, state->dataQueue, state->rate/64);
|
||||
state->bitsAvailableForSqueezing = state->rate;
|
||||
}
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block available for squeezing", state->dataQueue, state->bitsAvailableForSqueezing/8);
|
||||
#endif
|
||||
}
|
||||
partialBlock = state->bitsAvailableForSqueezing;
|
||||
if ((unsigned long long)partialBlock > outputLength - i)
|
||||
partialBlock = (unsigned int)(outputLength - i);
|
||||
memcpy(output+i/8, state->dataQueue+(state->rate-state->bitsAvailableForSqueezing)/8, partialBlock/8);
|
||||
state->bitsAvailableForSqueezing -= partialBlock;
|
||||
i += partialBlock;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
77
Example/Pods/NACrypto/NACrypto/keccak/KeccakSponge.h
generated
Normal file
77
Example/Pods/NACrypto/NACrypto/keccak/KeccakSponge.h
generated
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
The Keccak sponge function, designed by Guido Bertoni, Joan Daemen,
|
||||
Michaël Peeters and Gilles Van Assche. For more information, feedback or
|
||||
questions, please refer to our website: http://keccak.noekeon.org/
|
||||
|
||||
Implementation by the designers,
|
||||
hereby denoted as "the implementer".
|
||||
|
||||
To the extent possible under law, the implementer has waived all copyright
|
||||
and related or neighboring rights to the source code in this file.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
#ifndef _KeccakSponge_h_
|
||||
#define _KeccakSponge_h_
|
||||
|
||||
#define KeccakPermutationSize 1600
|
||||
#define KeccakPermutationSizeInBytes (KeccakPermutationSize/8)
|
||||
#define KeccakMaximumRate 1536
|
||||
#define KeccakMaximumRateInBytes (KeccakMaximumRate/8)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#undef ALIGN
|
||||
#define ALIGN __attribute__ ((aligned(32)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define ALIGN __declspec(align(32))
|
||||
#else
|
||||
#define ALIGN
|
||||
#endif
|
||||
|
||||
ALIGN typedef struct spongeStateStruct {
|
||||
ALIGN unsigned char state[KeccakPermutationSizeInBytes];
|
||||
ALIGN unsigned char dataQueue[KeccakMaximumRateInBytes];
|
||||
unsigned int rate;
|
||||
unsigned int capacity;
|
||||
unsigned int bitsInQueue;
|
||||
unsigned int fixedOutputLength;
|
||||
int squeezing;
|
||||
unsigned int bitsAvailableForSqueezing;
|
||||
} spongeState;
|
||||
|
||||
/**
|
||||
* Function to initialize the state of the Keccak[r, c] sponge function.
|
||||
* The sponge function is set to the absorbing phase.
|
||||
* @param state Pointer to the state of the sponge function to be initialized.
|
||||
* @param rate The value of the rate r.
|
||||
* @param capacity The value of the capacity c.
|
||||
* @pre One must have r+c=1600 and the rate a multiple of 64 bits in this implementation.
|
||||
* @return Zero if successful, 1 otherwise.
|
||||
*/
|
||||
int InitSponge(spongeState *state, unsigned int rate, unsigned int capacity);
|
||||
/**
|
||||
* Function to give input data for the sponge function to absorb.
|
||||
* @param state Pointer to the state of the sponge function initialized by InitSponge().
|
||||
* @param data Pointer to the input data.
|
||||
* When @a databitLen is not a multiple of 8, the last bits of data must be
|
||||
* in the least significant bits of the last byte.
|
||||
* @param databitLen The number of input bits provided in the input data.
|
||||
* @pre In the previous call to Absorb(), databitLen was a multiple of 8.
|
||||
* @pre The sponge function must be in the absorbing phase,
|
||||
* i.e., Squeeze() must not have been called before.
|
||||
* @return Zero if successful, 1 otherwise.
|
||||
*/
|
||||
int Absorb(spongeState *state, const unsigned char *data, unsigned long long databitlen);
|
||||
/**
|
||||
* Function to squeeze output data from the sponge function.
|
||||
* If the sponge function was in the absorbing phase, this function
|
||||
* switches it to the squeezing phase.
|
||||
* @param state Pointer to the state of the sponge function initialized by InitSponge().
|
||||
* @param output Pointer to the buffer where to store the output data.
|
||||
* @param outputLength The number of output bits desired.
|
||||
* It must be a multiple of 8.
|
||||
* @return Zero if successful, 1 otherwise.
|
||||
*/
|
||||
int Squeeze(spongeState *state, unsigned char *output, unsigned long long outputLength);
|
||||
|
||||
#endif
|
||||
152
Example/Pods/NACrypto/NACrypto/keccak/brg_endian.h
generated
Normal file
152
Example/Pods/NACrypto/NACrypto/keccak/brg_endian.h
generated
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
|
||||
|
||||
LICENSE TERMS
|
||||
|
||||
The redistribution and use of this software (with or without changes)
|
||||
is allowed without the payment of fees or royalties provided that:
|
||||
|
||||
1. source code distributions include the above copyright notice, this
|
||||
list of conditions and the following disclaimer;
|
||||
|
||||
2. binary distributions include the above copyright notice, this list
|
||||
of conditions and the following disclaimer in their documentation;
|
||||
|
||||
3. the name of the copyright holder is not used to endorse products
|
||||
built using this software without specific written permission.
|
||||
|
||||
DISCLAIMER
|
||||
|
||||
This software is provided 'as is' with no explicit or implied warranties
|
||||
in respect of its properties, including, but not limited to, correctness
|
||||
and/or fitness for purpose.
|
||||
---------------------------------------------------------------------------
|
||||
Issue Date: 20/12/2007
|
||||
Changes for ARM 9/9/2010
|
||||
*/
|
||||
|
||||
/* modified by justin@basho.com to include Solaris endianness test */
|
||||
|
||||
#ifndef _BRG_ENDIAN_H
|
||||
#define _BRG_ENDIAN_H
|
||||
|
||||
#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
|
||||
#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
|
||||
|
||||
#if 0
|
||||
/* Include files where endian defines and byteswap functions may reside */
|
||||
#if defined( __sun )
|
||||
# include <sys/isa_defs.h>
|
||||
#elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ ) || \
|
||||
defined (__DragonFly__)
|
||||
# include <sys/types.h>
|
||||
# include <sys/endian.h>
|
||||
#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
|
||||
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
|
||||
# include <machine/endian.h>
|
||||
#elif defined (__SVR4) && defined (__sun)
|
||||
# ifdef __sparc__
|
||||
# define BYTE_ORDER IS_BIG_ENDIAN
|
||||
# else
|
||||
# define BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
|
||||
# if !defined( __MINGW32__ ) && !defined( _AIX )
|
||||
# include <endian.h>
|
||||
# if !defined( __BEOS__ )
|
||||
# include <byteswap.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Now attempt to set the define for platform byte order using any */
|
||||
/* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */
|
||||
/* seem to encompass most endian symbol definitions */
|
||||
|
||||
#if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN )
|
||||
# if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
# elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif defined( BIG_ENDIAN )
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
#elif defined( LITTLE_ENDIAN )
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN )
|
||||
# if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
# elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif defined( _BIG_ENDIAN )
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
#elif defined( _LITTLE_ENDIAN )
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN )
|
||||
# if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
# elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif defined( __BIG_ENDIAN )
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
#elif defined( __LITTLE_ENDIAN )
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ )
|
||||
# if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
# elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif defined( __BIG_ENDIAN__ )
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
#elif defined( __LITTLE_ENDIAN__ )
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/* if the platform byte order could not be determined, then try to */
|
||||
/* set this define using common machine defines */
|
||||
#if !defined(PLATFORM_BYTE_ORDER)
|
||||
|
||||
#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \
|
||||
defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \
|
||||
defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \
|
||||
defined( vax ) || defined( vms ) || defined( VMS ) || \
|
||||
defined( __VMS ) || defined( _M_X64 )
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
|
||||
#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \
|
||||
defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \
|
||||
defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \
|
||||
defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \
|
||||
defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \
|
||||
defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \
|
||||
defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX )
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
|
||||
#elif defined(__arm__)
|
||||
# ifdef __BIG_ENDIAN
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
# else
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif 1 /* **** EDIT HERE IF NECESSARY **** */
|
||||
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
||||
#elif 0 /* **** EDIT HERE IF NECESSARY **** */
|
||||
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
||||
#else
|
||||
# error Please edit lines 132 or 134 in brg_endian.h to set the platform byte order
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
71
Example/Pods/NACrypto/README.md
generated
Normal file
71
Example/Pods/NACrypto/README.md
generated
Normal file
@ -0,0 +1,71 @@
|
||||
NACrypto
|
||||
=========
|
||||
|
||||
You should be using [NAChloride](https://github.com/gabriel/NAChloride) (libsodium/NaCl) instead. This is for advanced crypto only.
|
||||
|
||||
The following use Apple's CommonCrypto framework:
|
||||
|
||||
* HMAC: *SHA1*, *SHA2*
|
||||
* Digest: *SHA2*
|
||||
* AES (256-CTR)
|
||||
|
||||
The following are implemented from included reference C libraries:
|
||||
|
||||
* HMAC: *SHA3/Keccak*
|
||||
* Digest: *SHA3/Keccak*
|
||||
* TwoFish (CTR)
|
||||
|
||||
# Podfile
|
||||
|
||||
```ruby
|
||||
pod "NACrypto"
|
||||
```
|
||||
|
||||
# HMAC (SHA1, SHA2, SHA3)
|
||||
|
||||
```objc
|
||||
NSData *mac1 = [NAHMAC HMACForKey:key data:data algorithm:NAHMACAlgorithmSHA2_512];
|
||||
NSData *mac2 = [NAHMAC HMACForKey:key data:data algorithm:NAHMACAlgorithmSHA3_512];
|
||||
```
|
||||
|
||||
# AES (256-CTR)
|
||||
|
||||
```objc
|
||||
// Nonce should be 16 bytes
|
||||
// Key should be 32 bytes
|
||||
NAAES *AES = [[NAAES alloc] initWithAlgorithm:NAAESAlgorithm256CTR];
|
||||
NSData *encrypted = [AES encrypt:message nonce:nonce key:key error:&error];
|
||||
```
|
||||
|
||||
# TwoFish (CTR)
|
||||
|
||||
```objc
|
||||
// Nonce should be 16 bytes
|
||||
// Key should be 32 bytes
|
||||
NATwoFish *twoFish = [[NATwoFish alloc] init];
|
||||
NSData *encrypted = [twoFish encrypt:message nonce:nonce key:key error:&error];
|
||||
```
|
||||
|
||||
# Digest (SHA2, SHA3)
|
||||
|
||||
```objc
|
||||
NSData *digest1 = [NADigest digestForData:data algorithm:NADigestAlgorithmSHA2_256];
|
||||
NSData *digest2 = [NADigest digestForData:data algorithm:NADigestAlgorithmSHA3_512];
|
||||
|
||||
// Directly use SHA3
|
||||
NSData *sha = [NASHA3 SHA3ForData:data digestBitLength:512];
|
||||
```
|
||||
|
||||
# Keychain Utils
|
||||
|
||||
```objc
|
||||
NSData *key = [NASecRandom randomData:32 error:&error];
|
||||
[NAKeychain addSymmetricKey:key applicationLabel:@"NACrypto" tag:nil label:nil];
|
||||
NSData *keyOut = [NAKeychain symmetricKeyWithApplicationLabel:@"NACrypto"];
|
||||
```
|
||||
|
||||
# NSData Utils
|
||||
```objc
|
||||
NSData *data = [@"deadbeef" na_dataFromHexString];
|
||||
[data na_hexString]; // @"deadbeef";
|
||||
```
|
||||
@ -1,6 +1,4 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Rob Napier
|
||||
Copyright (c) 2013 No Zebra Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
38
Example/Pods/NSUserDefaults-AESEncryptor/NSUserDefaults-AESEncryptor/NSUserDefaults+AESEncryptor.h
generated
Normal file
38
Example/Pods/NSUserDefaults-AESEncryptor/NSUserDefaults-AESEncryptor/NSUserDefaults+AESEncryptor.h
generated
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// NSUserDefaults+AESEncryptor.h
|
||||
// NSUserDefaults-AESEncryptor
|
||||
//
|
||||
// Created by Bruno Tortato Furtado on 08/12/13.
|
||||
// Copyright (c) 2013 No Zebra Network. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSUserDefaults (AESEncryptor)
|
||||
|
||||
- (NSString *)decryptedValueForKey:(NSString *)key;
|
||||
- (void)encryptValue:(NSString *)value withKey:(NSString *)key;
|
||||
|
||||
- (void)removeObjectForAESKey:(NSString *)key;
|
||||
|
||||
- (void)setAESKey:(NSString *)key;
|
||||
- (NSString *)AESKey;
|
||||
|
||||
@end
|
||||
89
Example/Pods/NSUserDefaults-AESEncryptor/NSUserDefaults-AESEncryptor/NSUserDefaults+AESEncryptor.m
generated
Normal file
89
Example/Pods/NSUserDefaults-AESEncryptor/NSUserDefaults-AESEncryptor/NSUserDefaults+AESEncryptor.m
generated
Normal file
@ -0,0 +1,89 @@
|
||||
//
|
||||
// NSUserDefaults+AESEncryptor.m
|
||||
// NSUserDefaults-AESEncryptor
|
||||
//
|
||||
// Created by Bruno Tortato Furtado on 08/12/13.
|
||||
// Copyright (c) 2013 No Zebra Network. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSUserDefaults+AESEncryptor.h"
|
||||
#import "CocoaSecurity.h"
|
||||
|
||||
static NSString * AESKeyString = @"aes key not found";
|
||||
|
||||
@implementation NSUserDefaults (AESEncryptor)
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark - Public methods
|
||||
|
||||
- (NSString *)decryptedValueForKey:(NSString *)key
|
||||
{
|
||||
NSString *encryptedKey = [CocoaSecurity aesEncrypt:key
|
||||
key:[self AESKey]].base64;
|
||||
|
||||
NSString *encryptedValue = [self objectForKey:encryptedKey];
|
||||
|
||||
if (!encryptedValue) {
|
||||
NSLog(@"%s\n\nkey '%@' not found \n\n", __PRETTY_FUNCTION__, key);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
NSString *value = [CocoaSecurity aesDecryptWithBase64:encryptedValue
|
||||
key:[self AESKey]].utf8String;
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"%s\n\n \
|
||||
aesKey: [%@]\n\n \
|
||||
[encrypt_key, encrypt_value]: [%@, %@] \n\n \
|
||||
[key, value]: [%@, %@] \n\n",
|
||||
__PRETTY_FUNCTION__,
|
||||
[self AESKey],
|
||||
encryptedKey, encryptedValue,
|
||||
key, value);
|
||||
#endif
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)encryptValue:(NSString *)value withKey:(NSString *)key
|
||||
{
|
||||
NSString *encryptedKey = [CocoaSecurity aesEncrypt:key
|
||||
key:[self AESKey]].base64;
|
||||
|
||||
NSString *encryptedValue = [CocoaSecurity aesEncrypt:value
|
||||
key:[self AESKey]].base64;
|
||||
|
||||
[self setObject:encryptedValue forKey:encryptedKey];
|
||||
[self synchronize];
|
||||
|
||||
#ifdef DEBUG
|
||||
NSLog(@"%s\n\n \
|
||||
aesKey: [%@]\n\n \
|
||||
[key, value]: [%@, %@] \n\n \
|
||||
[encrypt_key, encrypt_value]: [%@, %@] \n\n",
|
||||
__PRETTY_FUNCTION__,
|
||||
[self AESKey],
|
||||
key, value,
|
||||
encryptedKey, encryptedValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)removeObjectForAESKey:(NSString *)key
|
||||
{
|
||||
NSString *encryptedKey = [CocoaSecurity aesEncrypt:key key:[self AESKey]].base64;
|
||||
[self removeObjectForKey:encryptedKey];
|
||||
[self synchronize];
|
||||
}
|
||||
|
||||
- (void)setAESKey:(NSString *)key
|
||||
{
|
||||
AESKeyString = key;
|
||||
}
|
||||
|
||||
- (NSString *)AESKey
|
||||
{
|
||||
return AESKeyString;
|
||||
}
|
||||
|
||||
@end
|
||||
60
Example/Pods/NSUserDefaults-AESEncryptor/README.md
generated
Normal file
60
Example/Pods/NSUserDefaults-AESEncryptor/README.md
generated
Normal file
@ -0,0 +1,60 @@
|
||||
#NSUserDefaults-AESEncryptor 
|
||||
|
||||
NSUserDefaults-AESEncryptor is a NSUserDefaults category. Its purpose to encrypt/decrypt keys and values with AES encryptor.
|
||||
|
||||
[](https://api.travis-ci.org/NZN/NSUserDefaults-AESEncryptor.png)
|
||||
[](http://beta.cocoapods.org/?q=name%3Ansuserdefaults%20name%3Aaesencryptor%2A)
|
||||
[](http://beta.cocoapods.org/?q=name%3Ansuserdefaults%20name%3Aaesencryptor%2A)
|
||||
|
||||
## Requirements
|
||||
|
||||
NSUserDefaults-AESEncryptor works on iOS 5.0+ version and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates:
|
||||
|
||||
* Foundation.framework
|
||||
|
||||
You will need LLVM 3.0 or later in order to build NSUserDefaults-AESEncryptor.
|
||||
|
||||
NSUserDefaults-AESEncryptor uses [CocoaSecurity](https://github.com/kelp404/CocoaSecurity) to encrypt/decrypt.
|
||||
|
||||
## Adding NSUserDefaults-AESEncryptor to your project
|
||||
|
||||
### Cocoapods
|
||||
|
||||
[CocoaPods](http://cocoapods.org) is the recommended way to add `NSUserDefaults-AESEncryptor` to your project.
|
||||
|
||||
* Add a pod entry for NSUserDefaults-AESEncryptor to your Podfile `pod 'NSUserDefaults-AESEncryptor'`
|
||||
* Install the pod(s) by running `pod install`.
|
||||
|
||||
### Source files
|
||||
|
||||
Alternatively you can directly add source files to your project.
|
||||
|
||||
1. Download the [latest code version](https://github.com/NZN/NSUserDefaults-AESEncryptor/archive/master.zip) or add the repository as a git submodule to your git-tracked project.
|
||||
2. Open your project in Xcode, then drag and drop all files at NSUserDefaults-AESEncryptor folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
|
||||
2. Install [CocoaSecurity](https://github.com/kelp404/CocoaSecurity).
|
||||
|
||||
## Usage
|
||||
|
||||
* Import `NSUserDefaults+AESEncryptor.h` and add this to `Prefix.pch`
|
||||
|
||||
```objective-c
|
||||
// Set a key. (If no key is set, a default key will be used)
|
||||
[[NSUserDefaults standardUserDefaults] setAESKey:@"World Cup 2014"];
|
||||
|
||||
// Encrypt
|
||||
[[NSUserDefaults standardUserDefaults] encryptValue:@"Brazil" withKey:@"country"];
|
||||
|
||||
// Decrypt
|
||||
NSString value = [[NSUserDefaults standardUserDefaults] decryptedValueForKey:@"country"];
|
||||
|
||||
// Remove object
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForAESKey:@"country"];
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This code is distributed under the terms and conditions of the [MIT license](LICENSE).
|
||||
|
||||
## Change-log
|
||||
|
||||
A brief summary of each NSUserDefaults-AESEncryptor release can be found on the [wiki](https://github.com/NZN/NSUserDefaults-AESEncryptor/wiki/Change-log).
|
||||
8495
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
8495
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
||||
buildForArchiving = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = 'primary'
|
||||
BlueprintIdentifier = 'B289CB22CC811B5C297D8875BA1D848A'
|
||||
BlueprintIdentifier = '2FFC9285C507681846C93EEDEE0FB684'
|
||||
BlueprintName = 'PNObject'
|
||||
ReferencedContainer = 'container:Pods.xcodeproj'
|
||||
BuildableName = 'PNObject.framework'>
|
||||
|
||||
335
Example/Pods/RNCryptor/README.md
generated
335
Example/Pods/RNCryptor/README.md
generated
@ -1,335 +0,0 @@
|
||||
# RNCryptor
|
||||
|
||||
Cross-language AES Encryptor/Decryptor [data format](https://github.com/RNCryptor/RNCryptor-Spec/blob/master/RNCryptor-Spec-v3.md).
|
||||
|
||||
The primary targets are Swift and Objective-C, but implementations are available in [C](https://github.com/RNCryptor/RNCryptor-C), [C++](https://github.com/RNCryptor/RNCryptor-cpp), [C#](https://github.com/RNCryptor/RNCryptor-cs), [Erlang](https://github.com/RNCryptor/RNCryptor-erlang), [Go](https://github.com/RNCryptor/RNCryptor-go), [Haskell](https://github.com/RNCryptor/rncryptor-hs), [Java](https://github.com/RNCryptor/JNCryptor),
|
||||
[PHP](https://github.com/RNCryptor/RNCryptor-php), [Python](https://github.com/RNCryptor/RNCryptor-python),
|
||||
[Javascript](https://github.com/chesstrian/JSCryptor), and [Ruby](https://github.com/RNCryptor/ruby_rncryptor).
|
||||
|
||||
The data format includes all the metadata required to securely implement AES encryption, as described in ["Properly encrypting with AES with CommonCrypto,"](http://robnapier.net/aes-commoncrypto) and [*iOS 6 Programming Pushing the Limits*](http://iosptl.com), Chapter 15. Specifically, it includes:
|
||||
|
||||
* AES-256 encryption
|
||||
* CBC mode
|
||||
* Password stretching with PBKDF2
|
||||
* Password salting
|
||||
* Random IV
|
||||
* Encrypt-then-hash HMAC
|
||||
|
||||
## Contents
|
||||
|
||||
* [Format Versus Implementation](#format-versus-implementation)
|
||||
* [Basic Password Usage](#basic-password-usage)
|
||||
* [Incremental Usage](#incremental-usage)
|
||||
* [Installation](#installation)
|
||||
* [Advanced Usage](#advanced-usage)
|
||||
* [FAQ](#faq)
|
||||
* [Design Considerations](#design-considerations)
|
||||
* [License](#license)
|
||||
|
||||
## Format Versus Implementation
|
||||
|
||||
The RNCryptor data format is cross-platform and there are many implementations. The framework named "RNCryptor" is a specific implementation for Swift and Objective-C. Both have version numbers. The current data format is v3. The current framework implementation (which reads the v3 format) is v4.
|
||||
|
||||
## Basic Password Usage
|
||||
|
||||
### Swift
|
||||
|
||||
```swift
|
||||
// Encryption
|
||||
let data: NSData = ...
|
||||
let password = "Secret password"
|
||||
let ciphertext = RNCryptor.encryptData(data, password: password)
|
||||
|
||||
// Decryption
|
||||
do {
|
||||
let originalData = try RNCryptor.decryptData(ciphertext, password: password)
|
||||
// ...
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
```
|
||||
|
||||
### Obj-C
|
||||
|
||||
``` objc
|
||||
// Encryption
|
||||
NSData *data = ...
|
||||
NSString *password = @"Secret password";
|
||||
NSData *ciphertext = [RNCryptor encryptData:data password:password];
|
||||
|
||||
// Decryption
|
||||
NSError *error = nil;
|
||||
NSData *plaintext = [RNCryptor decryptData:ciphertext password:password error:&error];
|
||||
if (error != nil) {
|
||||
NSLog(@"ERROR:", error);
|
||||
return
|
||||
}
|
||||
// ...
|
||||
```
|
||||
|
||||
## Incremental Usage
|
||||
|
||||
RNCryptor supports incremental use, for example when using with `NSURLSession`. This is also useful for cases where the encrypted or decrypted data will not comfortably fit in memory.
|
||||
|
||||
To operate in incremental mode, you create an `Encryptor` or `Decryptor`, call `updateWithData()` repeatedly, gathering its results, and then call `finalData()` and gather its result.
|
||||
|
||||
### Swift
|
||||
|
||||
```swift
|
||||
//
|
||||
// Encryption
|
||||
//
|
||||
let password = "Secret password"
|
||||
let encryptor = RNCryptor.Encryptor(password: password)
|
||||
let ciphertext = NSMutableData()
|
||||
|
||||
// ... Each time data comes in, update the encryptor and accumulate some ciphertext ...
|
||||
ciphertext.appendData(encryptor.updateWithData(data))
|
||||
|
||||
// ... When data is done, finish up ...
|
||||
ciphertext.appendData(encryptor.finalData())
|
||||
|
||||
//
|
||||
// Decryption
|
||||
//
|
||||
let password = "Secret password"
|
||||
let decryptor = RNCryptor.Decryptor(password: password)
|
||||
let plaintext = NSMutableData()
|
||||
|
||||
// ... Each time data comes in, update the decryptor and accumulate some plaintext ...
|
||||
try plaintext.appendData(decryptor.updateWithData(data))
|
||||
|
||||
// ... When data is done, finish up ...
|
||||
try plaintext.appendData(decryptor.finalData())
|
||||
```
|
||||
|
||||
### Obj-C
|
||||
|
||||
``` objc
|
||||
//
|
||||
// Encryption
|
||||
//
|
||||
NSString *password = @"Secret password";
|
||||
RNEncryptor *encryptor = [[RNEncryptor alloc] initWithPassword:password];
|
||||
NSMutableData *ciphertext = [NSMutableData new];
|
||||
|
||||
// ... Each time data comes in, update the encryptor and accumulate some ciphertext ...
|
||||
[ciphertext appendData:[encryptor updateWithData:data]];
|
||||
|
||||
// ... When data is done, finish up ...
|
||||
[ciphertext appendData:[encryptor finalData]];
|
||||
|
||||
|
||||
//
|
||||
// Decryption
|
||||
//
|
||||
RNDecryptor *decryptor = [[RNDecryptor alloc] initWithPassword:password];
|
||||
NSMutableData *plaintext = [NSMutableData new];
|
||||
|
||||
// ... Each time data comes in, update the decryptor and accumulate some plaintext ...
|
||||
NSError *error = nil;
|
||||
NSData *partialPlaintext = [decryptor updateWithData:data error:&error];
|
||||
if (error != nil) {
|
||||
NSLog(@"FAILED DECRYPT: %@", error);
|
||||
return;
|
||||
}
|
||||
[plaintext appendData:partialPlaintext];
|
||||
|
||||
// ... When data is done, finish up ...
|
||||
NSError *error = nil;
|
||||
NSData *partialPlaintext = [decryptor finalDataAndReturnError:&error];
|
||||
if (error != nil) {
|
||||
NSLog(@"FAILED DECRYPT: %@", error);
|
||||
return;
|
||||
}
|
||||
|
||||
[ciphertext appendData:partialPlaintext];
|
||||
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
### Requirements
|
||||
|
||||
RNCryptor 4 is written in Swift 2, so requires Xcode 7, and can target iOS 7 or later (iOS 8 or later if used as a framework), and OS X 10.9 or later. If you want a pure ObjC implementation that supports older versions of iOS and OS X, see [RNCryptor 3](https://github.com/RNCryptor/RNCryptor/releases/tag/RNCryptor-3.0.1).
|
||||
|
||||
### The Bridging Header
|
||||
|
||||
CommonCrypto is not a modular header in Xcode 7. This makes it very challenging to import into Swift. To work around this, the necessary header files have been copied into `RNCryptor.h`, which needs to be bridged into Swift. You can do this either by using RNCryptor as a framework, adding `#import "RNCryptor/RNCryptor.h"` to your existing bridging header, or making `RNCryptor/RNCryptor.h` your bridging header in Build Settings, "Objective-C Bridging Header."
|
||||
|
||||
Hopefully Apple will [make CommonCrypto a modular header soon](http://www.openradar.me/22965816). When this happens, the bridging header will not be needed, and RNCryptor will be a single file.
|
||||
|
||||
### Installing Manually
|
||||
|
||||
The easiest way to use RNCryptor is by making it part of your project, without a framework. RNCryptor is just one swift file and one bridging header, and you can skip all the complexity of managing frameworks this way. It also makes version control very simple if you use submodules, or checkin specific versions of RNCryptor to your repository.
|
||||
|
||||
This process works for most targets: iOS and OS X GUI apps, Swift frameworks, and OS X commandline apps. **It is not safe for ObjC frameworks or frameworks that may be imported into ObjC, since it would cause duplicate symbols if some other framework includes RNCryptor.**
|
||||
|
||||
* Drag and link `RNCryptor/RNCryptor.swift` into your project
|
||||
* If you already have a bridging header file, add `#import "RNCryptor/RNCryptor.h"`
|
||||
* If you don't have a bridging header, in your target's Build Settings, set "Objective-C Bridging Header" to "RNCryptor/RNCryptor.h"
|
||||
|
||||
Built this way, you don't need to (and can't) `import RNCryptor` into your code. RNCryptor will be part of your module.
|
||||
|
||||
### [Carthage](https://github.com/Carthage/Carthage)
|
||||
|
||||
github "RNCryptor/RNCryptor" "RNCryptor-4.0.0-beta.1"
|
||||
|
||||
Don't forget to embed `RNCryptor.framework`. Built this way, you should add `import RNCryptor` to your code.
|
||||
|
||||
This approach will not work for OS X commandline apps.
|
||||
|
||||
### [CocoaPods](https://cocoapods.org)
|
||||
|
||||
pod 'RNCryptor', '~> 4.0.0-beta'
|
||||
|
||||
This approach will not work for OS X commandline apps.
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Version-Specific Cryptors
|
||||
|
||||
The default `RNCryptor.Encryptor` is the "current" version of the data format (currently v3). If you're interoperating with other implementations, you may need to choose a specific format for compatibility.
|
||||
|
||||
To create a version-locked cryptor, use `RNCryptor.EncryptorV3` and `RNCryptor.DecryptorV3`.
|
||||
|
||||
Remember: the version specified here is the *format* version, not the implementation version. The v4 RNCryptor framework reads and writes the v3 RNCryptor data format.
|
||||
|
||||
### Key-Based Encryption
|
||||
|
||||
*You need a little expertise to use key-based encryption correctly, and it is very easy to make insecure systems that look secure. The most important rule is that keys must be random across all their bytes. If you're not comfortable with basic cryptographic concepts like AES-CBC, IV, and HMAC, you probably should avoid using key-based encryption.*
|
||||
|
||||
Cryptography works with keys, which are random byte sequences of a specific length. The RNCryptor v3 format uses two 256-bit (32-byte) keys to perform encryption and authentication.
|
||||
|
||||
Passwords are not "random byte sequences of a specific length." They're not random at all, and they can be a wide variety of lengths, very seldom exactly 32. RNCryptor defines a specific and secure way to convert passwords into keys, and that is one of it's primary features.
|
||||
|
||||
Occasionally there are reasons to work directly with random keys. Converting a password into a key is intentionally slow (tens of milliseconds). Password-encrypted messages are also a 16 bytes longer than key-encrypted messages. If your system encrypts and decrypts many short messages, this can be a significant performance impact, particularly on a server.
|
||||
|
||||
RNCryptor supports direct key-based encryption and decryption. The size and number of keys may change between format versions, so key-based cryptors are [version-specific](#version-specific-cryptors).
|
||||
|
||||
In order to be secure, the keys must be a random sequence of bytes. If you're starting with a string of any kind, you are almost certainly doing this wrong.
|
||||
|
||||
```swift
|
||||
let encryptor = RNCryptor.EncryptorV3(encryptionKey: encryptKey, hmacKey: hmacKey)
|
||||
let decryptor = RNCryptor.DecryptorV3(encryptionKey: encryptKey, hmacKey: hmacKey)
|
||||
```
|
||||
|
||||
```objc
|
||||
RNEncryptor *encryptor = [[[RNEncryptorV3 alloc] initWithEncryptionKey:encryptionKey hmacKey:hmacKey];
|
||||
RNDecryptor *decryptor = [[[RNDecryptorV3 alloc] initWithEncryptionKey:encryptionKey hmacKey:hmacKey];
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### How do I detect an incorrect password?
|
||||
|
||||
If you decrypt with the wrong password, you will receive an `HMACMismatch` error. This is the same error you will receive if your ciphertext is corrupted.
|
||||
|
||||
The v3 data format has no way to detect incorrect passwords directly. It just decrypts gibberish, and then uses the HMAC (a kind of encrypted hash) to determine that the result is corrupt. You won't discover this until the entire message has been decrypted (during the call to `finalData()`).
|
||||
|
||||
This can be inconvenient for the user if they have entered the wrong password to decrypt a very large file. If you have this situation, the recommendation is to encrypt some small, known piece of data with the same password. Test the password on the small ciphertext before decrypting the larger one.
|
||||
|
||||
The [v4 data format](https://github.com/RNCryptor/RNCryptor-Spec/blob/master/draft-RNCryptor-Spec-v4.0.md) will provide a faster and more useful mechanism for validating the password or key.
|
||||
|
||||
### Can I use RNCryptor to read and write my non-RNCryptor data format?
|
||||
|
||||
No. RNCryptor implements a specific data format. It is not a general-purpose encryption library. If you have created your own data format, you will need to write specific code to deal with whatever you created. Please make sure the data format you've invented is secure. (This is much harder than it sounds.)
|
||||
|
||||
If you're using the OpenSSL encryption format, see [RNOpenSSLCryptor](https://github.com/rnapier/RNOpenSSLCryptor).
|
||||
|
||||
### Can I change the parameters used (algorithm, iterations, etc)?
|
||||
|
||||
No. See previous question. The [v4 format](https://github.com/RNCryptor/RNCryptor-Spec/blob/master/draft-RNCryptor-Spec-v4.0.md) will permit some control over PBKDF2 iterations, but the only thing configurable in the v3 format is whether a password or key is used. This keeps RNCryptor implementations dramatically simpler and interoperable.
|
||||
|
||||
### How do I manually set the IV?
|
||||
|
||||
You don't. See the last two questions.
|
||||
|
||||
Also note that if you ever reuse a key+IV combination, you risk attackers decrypting the beginning of your message. A static IV makes a key+IV reuse much more likely (guarenteed if you also have a static key). Wikipedia has a [quick overview of this problem](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Initialization_vector_.28IV.29).
|
||||
|
||||
### How do I encrypt/decrypt a string?
|
||||
|
||||
AES encrypts bytes. It does not encrypt characters, letters, words, pictures, videos, cats, or ennui. It encrypts bytes. You need to convert other things (such as strings) to and from bytes in a consistent way. There are several ways to do that. Some of the most popular are UTF-8 encoding, Base-64 encoding, and Hex encoding. There are many other options. There is no good way for RNCryptor to guess which encoding you want, so it doesn't try. It accepts and returns bytes in the form of `NSData`.
|
||||
|
||||
To convert strings to data as UTF-8, use `dataUsingEncoding()` and `init(data:encoding:)`. To convert strings to data as Base-64, use `init(base64EncodedString:options:)` and `base64EncodedStringWithOptions()`.
|
||||
|
||||
### Does RNCryptor support random access decryption?
|
||||
|
||||
The usual use case for this is encrypting media files like video. RNCryptor uses CBC encryption, which prevents easy random-access. While other modes are better for random-access (CTR for instance), they are more complicated to implement correctly and CommonCrypto doesn't support using them for random access anyway.
|
||||
|
||||
It would be fairly easy to build a wrapper around RNCryptor that allowed random-access to blocks of some fixed size (say 64k), and that might work well for video with modest overhead (see [inferno](http://securitydriven.net/inferno/) for a similar idea in C#). Such a format would be fairly easy to port to other platforms that already support RNCryptor.
|
||||
|
||||
If there is interest, I may eventually build this as a separate framework.
|
||||
|
||||
## Design Considerations
|
||||
|
||||
`RNCryptor` has several design goals, in order of importance:
|
||||
|
||||
### Easy to use correctly for most common use cases
|
||||
|
||||
The most critical concern is that it be easy for non-experts to use `RNCryptor` correctly. A framework that is more secure, but requires a steep learning curve on the developer will either be not used, or used incorrectly. Whenever possible, a single line of code should "do the right thing" for the most common cases.
|
||||
|
||||
This also requires that it fail correctly and provide good errors.
|
||||
|
||||
### Reliance on CommonCryptor functionality
|
||||
|
||||
`RNCryptor` has very little "security" code. It relies as much as possible on the OS-provided CommonCryptor. If a feature does not exist in CommonCryptor, then it generally will not be provided in `RNCryptor`.
|
||||
|
||||
### Best practice security
|
||||
|
||||
Wherever possible within the above constraints, the best available algorithms
|
||||
are applied. This means AES-256, HMAC+SHA256, and PBKDF2. (Note that several of these decisions were reasonable for v3, but may change for v4.)
|
||||
|
||||
* AES-256. While Bruce Schneier has made some interesting recommendations
|
||||
regarding moving to AES-128 due to certain attacks on AES-256, my current
|
||||
thinking is in line with [Colin
|
||||
Percival](http://www.daemonology.net/blog/2009-07-31-thoughts-on-AES.html).
|
||||
PBKDF2 output is effectively random, which should negate related-keys attacks
|
||||
against the kinds of use cases we're interested in.
|
||||
|
||||
* AES-CBC mode. This was a somewhat complex decision, but the ubiquity of CBC
|
||||
outweighs other considerations here. There are no major problems with CBC mode,
|
||||
and nonce-based modes like CTR have other trade-offs. See ["Mode changes for
|
||||
RNCryptor"](http://robnapier.net/mode-rncryptor) for more details on this
|
||||
decision.
|
||||
|
||||
* Encrypt-then-MAC. If there were a good authenticated AES mode on iOS (GCM for
|
||||
instance), I would probably use that for its simplicity. Colin Percival makes
|
||||
[good arguments for hand-coding an encrypt-than-
|
||||
MAC](http://www.daemonology.net/blog/2009-06-24-encrypt-then-mac.html) rather
|
||||
than using an authenticated AES mode, but in RNCryptor mananging the HMAC
|
||||
actually adds quite a bit of complexity. I'd rather the complexity at a more
|
||||
broadly peer-reviewed layer like CommonCryptor than at the RNCryptor layer. But
|
||||
this isn't an option, so I fall back to my own Encrypt-than-MAC.
|
||||
|
||||
* HMAC+SHA256. No surprises here.
|
||||
|
||||
* PBKDF2. While bcrypt and scrypt may be more secure than PBKDF2, CommonCryptor
|
||||
only supports PBKDF2. [NIST also continues to recommend
|
||||
PBKDF2](http://security.stackexchange.com/questions/4781/do-any-security-experts-recommend-bcrypt-for-password-storage). We use 10k rounds of PBKDF2
|
||||
which represents about 80ms on an iPhone 4.
|
||||
|
||||
### Code simplicity
|
||||
|
||||
RNCryptor endeavors to be implemented as simply as possible, avoiding tricky code. It is designed to be easy to read and code review.
|
||||
|
||||
### Performance
|
||||
|
||||
Performance is a goal, but not the most important goal. The code must be secure
|
||||
and easy to use. Within that, it is as fast and memory-efficient as possible.
|
||||
|
||||
### Portability
|
||||
|
||||
Without sacrificing other goals, it is preferable to read the output format of
|
||||
`RNCryptor` on other platforms.
|
||||
|
||||
## License
|
||||
|
||||
Except where otherwise indicated in the source code, this code is licensed under
|
||||
the MIT License:
|
||||
|
||||
>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```
|
||||
1545
Example/Pods/RNCryptor/RNCryptor.h
generated
1545
Example/Pods/RNCryptor/RNCryptor.h
generated
File diff suppressed because it is too large
Load Diff
778
Example/Pods/RNCryptor/RNCryptor.swift
generated
778
Example/Pods/RNCryptor/RNCryptor.swift
generated
@ -1,778 +0,0 @@
|
||||
//
|
||||
// RNCryptor.swift
|
||||
//
|
||||
// Copyright © 2015 Rob Napier. All rights reserved.
|
||||
//
|
||||
// This code is licensed under the MIT License:
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// The `RNCryptorType` protocol defines generic API to a mutable,
|
||||
/// incremental, password-based encryptor or decryptor. Its generic
|
||||
/// usage is as follows:
|
||||
///
|
||||
/// let cryptor = Encryptor(password: "mypassword")
|
||||
/// // or Decryptor()
|
||||
///
|
||||
/// var result NSMutableData
|
||||
/// for data in datas {
|
||||
/// result.appendData(try cryptor.update(data))
|
||||
/// }
|
||||
/// result.appendData(try cryptor.final())
|
||||
///
|
||||
/// After calling `finalData()`, the cryptor is no longer valid.
|
||||
public protocol RNCryptorType {
|
||||
|
||||
/// Creates and returns a cryptor.
|
||||
///
|
||||
/// - parameter password: Non-empty password string. This will be interpretted as UTF-8.
|
||||
init(password: String)
|
||||
|
||||
/// Updates cryptor with data and returns processed data.
|
||||
///
|
||||
/// - parameter data: Data to process. May be empty.
|
||||
/// - throws: `Error`
|
||||
/// - returns: Processed data. May be empty.
|
||||
func updateWithData(data: NSData) throws -> NSData
|
||||
|
||||
/// Returns trailing data and invalidates the cryptor.
|
||||
///
|
||||
/// - throws: `Error`
|
||||
/// - returns: Trailing data
|
||||
func finalData() throws -> NSData
|
||||
}
|
||||
|
||||
public extension RNCryptorType {
|
||||
/// Simplified, generic interface to `RNCryptorType`. Takes a data,
|
||||
/// returns a processed data. Generally you should use
|
||||
/// `RNCryptor.encryptData(password:)`, or
|
||||
/// `RNCryptor.decryptData(password:)` instead, but this is useful
|
||||
/// for code that is neutral on whether it is encrypting or decrypting.
|
||||
///
|
||||
/// - throws: `Error`
|
||||
private func oneshot(data: NSData) throws -> NSData {
|
||||
let result = NSMutableData(data: try updateWithData(data))
|
||||
result.appendData(try finalData())
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Move this to RNCryptor.Error if @objc can rename it correctly.
|
||||
/// Errors thrown by `RNCryptorType`.
|
||||
@objc public enum RNCryptorError: Int, ErrorType {
|
||||
/// Ciphertext was corrupt or password was incorrect.
|
||||
/// It is not possible to distinguish between these cases in the v3 data format.
|
||||
case HMACMismatch = 1
|
||||
|
||||
/// Unrecognized data format. Usually this means the data is corrupt.
|
||||
case UnknownHeader = 2
|
||||
|
||||
/// `final()` was called before sufficient data was passed to `updateWithData()`
|
||||
case MessageTooShort
|
||||
|
||||
/// Memory allocation failure. This should never happen.
|
||||
case MemoryFailure
|
||||
|
||||
/// A password-based decryptor was used on a key-based ciphertext, or vice-versa.
|
||||
case InvalidCredentialType
|
||||
}
|
||||
|
||||
/// RNCryptor encryption/decryption interface.
|
||||
public class RNCryptor: NSObject {
|
||||
|
||||
/// Encrypt data using password and return encrypted data.
|
||||
public static func encryptData(data: NSData, password: String) -> NSData {
|
||||
return Encryptor(password: password).encryptData(data)
|
||||
}
|
||||
|
||||
/// Decrypt data using password and return decrypted data. Throws if
|
||||
/// password is incorrect or ciphertext is in the wrong format.
|
||||
/// - throws `Error`
|
||||
public static func decryptData(data: NSData, password: String) throws -> NSData {
|
||||
return try Decryptor(password: password).decryptData(data)
|
||||
}
|
||||
|
||||
/// Generates random NSData of given length
|
||||
/// Crashes if `length` is larger than allocatable memory, or if the system random number generator is not available.
|
||||
public static func randomDataOfLength(length: Int) -> NSData {
|
||||
let data = NSMutableData(length: length)!
|
||||
let result = SecRandomCopyBytes(kSecRandomDefault, length, UnsafeMutablePointer<UInt8>(data.mutableBytes))
|
||||
guard result == errSecSuccess else {
|
||||
fatalError("SECURITY FAILURE: Could not generate secure random numbers: \(result).")
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
/// A encryptor for the latest data format. If compatibility with other RNCryptor
|
||||
/// implementations is required, you may wish to use the specific encryptor version rather
|
||||
/// than accepting "latest."
|
||||
///
|
||||
@objc(RNEncryptor)
|
||||
public final class Encryptor: NSObject, RNCryptorType {
|
||||
private let encryptor: EncryptorV3
|
||||
|
||||
/// Creates and returns a cryptor.
|
||||
///
|
||||
/// - parameter password: Non-empty password string. This will be interpretted as UTF-8.
|
||||
public init(password: String) {
|
||||
precondition(password != "")
|
||||
encryptor = EncryptorV3(password: password)
|
||||
}
|
||||
|
||||
/// Updates cryptor with data and returns processed data.
|
||||
///
|
||||
/// - parameter data: Data to process. May be empty.
|
||||
/// - returns: Processed data. May be empty.
|
||||
public func updateWithData(data: NSData) -> NSData {
|
||||
return encryptor.updateWithData(data)
|
||||
}
|
||||
|
||||
/// Returns trailing data and invalidates the cryptor.
|
||||
///
|
||||
/// - returns: Trailing data
|
||||
public func finalData() -> NSData {
|
||||
return encryptor.finalData()
|
||||
}
|
||||
|
||||
/// Simplified, generic interface to `RNCryptorType`. Takes a data,
|
||||
/// returns a processed data, and invalidates the cryptor.
|
||||
public func encryptData(data: NSData) -> NSData {
|
||||
return encryptor.encryptData(data)
|
||||
}
|
||||
}
|
||||
|
||||
/// Password-based decryptor that can handle any supported format.
|
||||
@objc(RNDecryptor)
|
||||
public final class Decryptor : NSObject, RNCryptorType {
|
||||
private var decryptors: [VersionedDecryptorType.Type] = [DecryptorV3.self]
|
||||
|
||||
private var buffer = NSMutableData()
|
||||
private var decryptor: RNCryptorType?
|
||||
private let password: String
|
||||
|
||||
/// Creates and returns a cryptor.
|
||||
///
|
||||
/// - parameter password: Non-empty password string. This will be interpretted as UTF-8.
|
||||
public init(password: String) {
|
||||
assert(password != "")
|
||||
self.password = password
|
||||
}
|
||||
|
||||
/// Decrypt data using password and return decrypted data, invalidating decryptor. Throws if
|
||||
/// password is incorrect or ciphertext is in the wrong format.
|
||||
/// - throws `Error`
|
||||
public func decryptData(data: NSData) throws -> NSData {
|
||||
return try oneshot(data)
|
||||
}
|
||||
|
||||
/// Updates cryptor with data and returns processed data.
|
||||
///
|
||||
/// - parameter data: Data to process. May be empty.
|
||||
/// - throws: `Error`
|
||||
/// - returns: Processed data. May be empty.
|
||||
public func updateWithData(data: NSData) throws -> NSData {
|
||||
if let d = decryptor {
|
||||
return try d.updateWithData(data)
|
||||
}
|
||||
|
||||
buffer.appendData(data)
|
||||
|
||||
let toCheck:[VersionedDecryptorType.Type]
|
||||
(toCheck, decryptors) = decryptors.splitPassFail{ self.buffer.length >= $0.preambleSize }
|
||||
|
||||
for decryptorType in toCheck {
|
||||
if decryptorType.canDecrypt(buffer.bytesView[0..<decryptorType.preambleSize]) {
|
||||
let d = decryptorType.init(password: password)
|
||||
decryptor = d
|
||||
let result = try d.updateWithData(buffer)
|
||||
buffer.length = 0
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
guard !decryptors.isEmpty else { throw RNCryptorError.UnknownHeader }
|
||||
return NSData()
|
||||
}
|
||||
|
||||
/// Returns trailing data and invalidates the cryptor.
|
||||
///
|
||||
/// - throws: `Error`
|
||||
/// - returns: Trailing data
|
||||
public func finalData() throws -> NSData {
|
||||
guard let d = decryptor else {
|
||||
throw RNCryptorError.UnknownHeader
|
||||
}
|
||||
return try d.finalData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// V3 implementaion
|
||||
public extension RNCryptor {
|
||||
/// V3 format settings
|
||||
@objc(RNCryptorFormatV3)
|
||||
public final class FormatV3: NSObject {
|
||||
/// Size of AES and HMAC keys
|
||||
public static let keySize = kCCKeySizeAES256
|
||||
|
||||
/// Size of PBKDF2 salt
|
||||
public static let saltSize = 8
|
||||
|
||||
/// Generate a key from a password and salt
|
||||
/// - parameters:
|
||||
/// - password: Password to convert
|
||||
/// - salt: Salt. Generally constructed with RNCryptor.randomDataOfLength(FormatV3.saltSize)
|
||||
/// - returns: Key of length FormatV3.keySize
|
||||
public static func keyForPassword(password: String, salt: NSData) -> NSData {
|
||||
let derivedKey = NSMutableData(length: keySize)!
|
||||
let derivedKeyPtr = UnsafeMutablePointer<UInt8>(derivedKey.mutableBytes)
|
||||
|
||||
let passwordData = password.dataUsingEncoding(NSUTF8StringEncoding)!
|
||||
let passwordPtr = UnsafePointer<Int8>(passwordData.bytes)
|
||||
|
||||
let saltPtr = UnsafePointer<UInt8>(salt.bytes)
|
||||
|
||||
// All the crazy casting because CommonCryptor hates Swift
|
||||
let algorithm = CCPBKDFAlgorithm(kCCPBKDF2)
|
||||
let prf = CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA1)
|
||||
let pbkdf2Rounds = UInt32(10000)
|
||||
|
||||
let result = CCKeyDerivationPBKDF(
|
||||
algorithm,
|
||||
passwordPtr, passwordData.length,
|
||||
saltPtr, salt.length,
|
||||
prf, pbkdf2Rounds,
|
||||
derivedKeyPtr, derivedKey.length)
|
||||
|
||||
guard result == CCCryptorStatus(kCCSuccess) else {
|
||||
fatalError("SECURITY FAILURE: Could not derive secure password (\(result)): \(derivedKey).")
|
||||
}
|
||||
return derivedKey
|
||||
}
|
||||
|
||||
static let formatVersion = UInt8(3)
|
||||
static let ivSize = kCCBlockSizeAES128
|
||||
static let hmacSize = Int(CC_SHA256_DIGEST_LENGTH)
|
||||
static let keyHeaderSize = 1 + 1 + kCCBlockSizeAES128
|
||||
static let passwordHeaderSize = 1 + 1 + 8 + 8 + kCCBlockSizeAES128
|
||||
}
|
||||
|
||||
/// Format version 3 encryptor. Use this to ensure a specific format verison
|
||||
/// or when using keys (which are inherrently versions-specific). To use
|
||||
/// "the latest encryptor" with a password, use `Encryptor` instead.
|
||||
@objc(RNEncryptorV3)
|
||||
public final class EncryptorV3 : NSObject, RNCryptorType {
|
||||
private var engine: Engine
|
||||
private var hmac: HMACV3
|
||||
private var pendingHeader: NSData?
|
||||
|
||||
/// Creates and returns an encryptor.
|
||||
///
|
||||
/// - parameter password: Non-empty password string. This will be interpretted as UTF-8.
|
||||
public convenience init(password: String) {
|
||||
self.init(
|
||||
password: password,
|
||||
encryptionSalt: RNCryptor.randomDataOfLength(V3.saltSize),
|
||||
hmacSalt: RNCryptor.randomDataOfLength(V3.saltSize),
|
||||
iv: RNCryptor.randomDataOfLength(V3.ivSize))
|
||||
}
|
||||
|
||||
/// Creates and returns an encryptor using keys.
|
||||
///
|
||||
/// - Attention: This method requires some expertise to use correctly.
|
||||
/// Most users should use `init(password:)` which is simpler
|
||||
/// to use securely.
|
||||
///
|
||||
/// Keys should not be generated directly from strings (`.dataUsingEncoding()` or similar).
|
||||
/// Ideally, keys should be random (`Cryptor.randomDataOfLength()` or some other high-quality
|
||||
/// random generator. If keys must be generated from strings, then use `FormatV3.keyForPassword(salt:)`
|
||||
/// with a random salt, or just use password-based encryption (that's what it's for).
|
||||
///
|
||||
/// - parameters:
|
||||
/// - encryptionKey: AES-256 key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
|
||||
/// - hmacKey: HMAC key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
|
||||
public convenience init(encryptionKey: NSData, hmacKey: NSData) {
|
||||
self.init(encryptionKey: encryptionKey, hmacKey: hmacKey, iv: RNCryptor.randomDataOfLength(V3.ivSize))
|
||||
}
|
||||
|
||||
/// Takes a data, returns a processed data, and invalidates the cryptor.
|
||||
public func encryptData(data: NSData) -> NSData {
|
||||
return try! oneshot(data)
|
||||
}
|
||||
|
||||
/// Updates cryptor with data and returns encrypted data.
|
||||
///
|
||||
/// - parameter data: Data to process. May be empty.
|
||||
/// - returns: Processed data. May be empty.
|
||||
public func updateWithData(data: NSData) -> NSData {
|
||||
// It should not be possible for this to fail during encryption
|
||||
return handle(engine.updateWithData(data))
|
||||
}
|
||||
|
||||
/// Returns trailing data and invalidates the cryptor.
|
||||
///
|
||||
/// - returns: Trailing data
|
||||
public func finalData() -> NSData {
|
||||
let result = NSMutableData(data: handle(engine.finalData()))
|
||||
result.appendData(hmac.finalData())
|
||||
return result
|
||||
}
|
||||
|
||||
// Expose random numbers for testing
|
||||
internal convenience init(encryptionKey: NSData, hmacKey: NSData, iv: NSData) {
|
||||
let preamble = [V3.formatVersion, UInt8(0)]
|
||||
let header = NSMutableData(bytes: preamble, length: preamble.count)
|
||||
header.appendData(iv)
|
||||
self.init(encryptionKey: encryptionKey, hmacKey: hmacKey, iv: iv, header: header)
|
||||
}
|
||||
|
||||
// Expose random numbers for testing
|
||||
internal convenience init(password: String, encryptionSalt: NSData, hmacSalt: NSData, iv: NSData) {
|
||||
let encryptionKey = V3.keyForPassword(password, salt: encryptionSalt)
|
||||
let hmacKey = V3.keyForPassword(password, salt: hmacSalt)
|
||||
|
||||
// TODO: This chained-+ is very slow to compile in Swift 2b5 (http://www.openradar.me/21842206)
|
||||
// let header = [V3.version, UInt8(1)] + encryptionSalt + hmacSalt + iv
|
||||
let preamble = [V3.formatVersion, UInt8(1)]
|
||||
let header = NSMutableData(bytes: preamble, length: preamble.count)
|
||||
header.appendData(encryptionSalt)
|
||||
header.appendData(hmacSalt)
|
||||
header.appendData(iv)
|
||||
|
||||
self.init(encryptionKey: encryptionKey, hmacKey: hmacKey, iv: iv, header: header)
|
||||
}
|
||||
|
||||
private init(encryptionKey: NSData, hmacKey: NSData, iv: NSData, header: NSData) {
|
||||
precondition(encryptionKey.length == V3.keySize)
|
||||
precondition(hmacKey.length == V3.keySize)
|
||||
precondition(iv.length == V3.ivSize)
|
||||
hmac = HMACV3(key: hmacKey)
|
||||
engine = Engine(operation: .Encrypt, key: encryptionKey, iv: iv)
|
||||
pendingHeader = header
|
||||
}
|
||||
|
||||
private func handle(data: NSData) -> NSData {
|
||||
var result: NSData
|
||||
if let ph = pendingHeader {
|
||||
let accum = NSMutableData(data: ph)
|
||||
pendingHeader = nil
|
||||
accum.appendData(data)
|
||||
result = accum
|
||||
} else {
|
||||
result = data
|
||||
}
|
||||
hmac.updateWithData(result)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/// Format version 3 decryptor. This is required in order to decrypt
|
||||
/// using keys (since key configuration is version-specific). For password
|
||||
/// decryption, `Decryptor` is generally preferred, and will call this
|
||||
/// if appropriate.
|
||||
@objc(RNDecryptorV3)
|
||||
public final class DecryptorV3: NSObject, VersionedDecryptorType {
|
||||
//
|
||||
// Static methods
|
||||
//
|
||||
private static let preambleSize = 1
|
||||
private static func canDecrypt(preamble: NSData) -> Bool {
|
||||
assert(preamble.length >= 1)
|
||||
return preamble.bytesView[0] == 3
|
||||
}
|
||||
|
||||
//
|
||||
// Private properties
|
||||
//
|
||||
private var buffer = NSMutableData()
|
||||
private var decryptorEngine: DecryptorEngineV3?
|
||||
private let credential: Credential
|
||||
|
||||
|
||||
/// Creates and returns a decryptor.
|
||||
///
|
||||
/// - parameter password: Non-empty password string. This will be interpretted as UTF-8.
|
||||
public init(password: String) {
|
||||
credential = .Password(password)
|
||||
}
|
||||
|
||||
/// Creates and returns a decryptor using keys.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - encryptionKey: AES-256 key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
|
||||
/// - hmacKey: HMAC key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
|
||||
public init(encryptionKey: NSData, hmacKey: NSData) {
|
||||
precondition(encryptionKey.length == V3.keySize)
|
||||
precondition(hmacKey.length == V3.hmacSize)
|
||||
credential = .Keys(encryptionKey: encryptionKey, hmacKey: hmacKey)
|
||||
}
|
||||
|
||||
/// Decrypt data using password and return decrypted data. Throws if
|
||||
/// password is incorrect or ciphertext is in the wrong format.
|
||||
/// - throws `Error`
|
||||
public func decryptData(data: NSData) throws -> NSData {
|
||||
return try oneshot(data)
|
||||
}
|
||||
|
||||
/// Updates cryptor with data and returns encrypted data.
|
||||
///
|
||||
/// - parameter data: Data to process. May be empty.
|
||||
/// - returns: Processed data. May be empty.
|
||||
public func updateWithData(data: NSData) throws -> NSData {
|
||||
if let e = decryptorEngine {
|
||||
return e.updateWithData(data)
|
||||
}
|
||||
|
||||
buffer.appendData(data)
|
||||
guard buffer.length >= requiredHeaderSize else {
|
||||
return NSData()
|
||||
}
|
||||
|
||||
let e = try createEngineWithCredential(credential, header: buffer.bytesView[0..<requiredHeaderSize])
|
||||
decryptorEngine = e
|
||||
let body = buffer.bytesView[requiredHeaderSize..<buffer.length]
|
||||
buffer.length = 0
|
||||
return e.updateWithData(body)
|
||||
}
|
||||
|
||||
/// Returns trailing data and invalidates the cryptor.
|
||||
///
|
||||
/// - returns: Trailing data
|
||||
public func finalData() throws -> NSData {
|
||||
guard let result = try decryptorEngine?.finalData() else {
|
||||
throw RNCryptorError.MessageTooShort
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
//
|
||||
// Private functions
|
||||
//
|
||||
|
||||
private var requiredHeaderSize: Int {
|
||||
switch credential {
|
||||
case .Password(_): return V3.passwordHeaderSize
|
||||
case .Keys(_, _): return V3.keyHeaderSize
|
||||
}
|
||||
}
|
||||
|
||||
private func createEngineWithCredential(credential: Credential, header: NSData) throws -> DecryptorEngineV3 {
|
||||
switch credential {
|
||||
case let .Password(password):
|
||||
return try createEngineWithPassword(password, header: header)
|
||||
case let .Keys(encryptionKey, hmacKey):
|
||||
return try createEngineWithKeys(encryptionKey: encryptionKey, hmacKey: hmacKey, header: header)
|
||||
}
|
||||
}
|
||||
|
||||
private func createEngineWithPassword(password: String, header: NSData) throws -> DecryptorEngineV3 {
|
||||
assert(password != "")
|
||||
precondition(header.length == V3.passwordHeaderSize)
|
||||
|
||||
guard DecryptorV3.canDecrypt(header) else {
|
||||
throw RNCryptorError.UnknownHeader
|
||||
}
|
||||
|
||||
guard header.bytesView[1] == 1 else {
|
||||
throw RNCryptorError.InvalidCredentialType
|
||||
}
|
||||
|
||||
let encryptionSalt = header.bytesView[2...9]
|
||||
let hmacSalt = header.bytesView[10...17]
|
||||
let iv = header.bytesView[18...33]
|
||||
|
||||
let encryptionKey = V3.keyForPassword(password, salt: encryptionSalt)
|
||||
let hmacKey = V3.keyForPassword(password, salt: hmacSalt)
|
||||
|
||||
return DecryptorEngineV3(encryptionKey: encryptionKey, hmacKey: hmacKey, iv: iv, header: header)
|
||||
}
|
||||
|
||||
private func createEngineWithKeys(encryptionKey encryptionKey: NSData, hmacKey: NSData, header: NSData) throws -> DecryptorEngineV3 {
|
||||
precondition(header.length == V3.keyHeaderSize)
|
||||
precondition(encryptionKey.length == V3.keySize)
|
||||
precondition(hmacKey.length == V3.keySize)
|
||||
|
||||
guard DecryptorV3.canDecrypt(header) else {
|
||||
throw RNCryptorError.UnknownHeader
|
||||
}
|
||||
|
||||
guard header.bytesView[1] == 0 else {
|
||||
throw RNCryptorError.InvalidCredentialType
|
||||
}
|
||||
|
||||
let iv = header.bytesView[2..<18]
|
||||
return DecryptorEngineV3(encryptionKey: encryptionKey, hmacKey: hmacKey, iv: iv, header: header)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal enum CryptorOperation: CCOperation {
|
||||
case Encrypt = 0 // CCOperation(kCCEncrypt)
|
||||
case Decrypt = 1 // CCOperation(kCCDecrypt)
|
||||
}
|
||||
|
||||
internal final class Engine {
|
||||
private let cryptor: CCCryptorRef
|
||||
private var buffer = NSMutableData()
|
||||
|
||||
init(operation: CryptorOperation, key: NSData, iv: NSData) {
|
||||
var cryptorOut = CCCryptorRef()
|
||||
let result = CCCryptorCreate(
|
||||
operation.rawValue,
|
||||
CCAlgorithm(kCCAlgorithmAES128), CCOptions(kCCOptionPKCS7Padding),
|
||||
key.bytes, key.length,
|
||||
iv.bytes,
|
||||
&cryptorOut
|
||||
)
|
||||
cryptor = cryptorOut
|
||||
|
||||
// It is a programming error to create us with illegal values
|
||||
// This is an internal class, so we can constrain what is sent to us.
|
||||
// If this is ever made public, it should throw instead of asserting.
|
||||
assert(result == CCCryptorStatus(kCCSuccess))
|
||||
}
|
||||
|
||||
deinit {
|
||||
if cryptor != CCCryptorRef() {
|
||||
CCCryptorRelease(cryptor)
|
||||
}
|
||||
}
|
||||
|
||||
func sizeBufferForDataOfLength(length: Int) -> Int {
|
||||
let size = CCCryptorGetOutputLength(cryptor, length, true)
|
||||
buffer.length = size
|
||||
return size
|
||||
}
|
||||
|
||||
func updateWithData(data: NSData) -> NSData {
|
||||
let outputLength = sizeBufferForDataOfLength(data.length)
|
||||
var dataOutMoved: Int = 0
|
||||
|
||||
let result = CCCryptorUpdate(
|
||||
cryptor,
|
||||
data.bytes, data.length,
|
||||
buffer.mutableBytes, outputLength,
|
||||
&dataOutMoved)
|
||||
|
||||
// The only error returned by CCCryptorUpdate is kCCBufferTooSmall, which would be a programming error
|
||||
assert(result == CCCryptorStatus(kCCSuccess), "RNCRYPTOR BUG. PLEASE REPORT.")
|
||||
|
||||
buffer.length = dataOutMoved
|
||||
return buffer
|
||||
}
|
||||
|
||||
func finalData() -> NSData {
|
||||
let outputLength = sizeBufferForDataOfLength(0)
|
||||
var dataOutMoved: Int = 0
|
||||
|
||||
let result = CCCryptorFinal(
|
||||
cryptor,
|
||||
buffer.mutableBytes, outputLength,
|
||||
&dataOutMoved
|
||||
)
|
||||
|
||||
// Note that since iOS 6, CCryptor will never return padding errors or other decode errors.
|
||||
// I'm not aware of any non-catestrophic (MemoryAllocation) situation in which this
|
||||
// can fail. Using assert() just in case, but we'll ignore errors in Release.
|
||||
// https://devforums.apple.com/message/920802#920802
|
||||
assert(result == CCCryptorStatus(kCCSuccess), "RNCRYPTOR BUG. PLEASE REPORT.")
|
||||
|
||||
buffer.length = dataOutMoved
|
||||
return buffer
|
||||
}
|
||||
}
|
||||
|
||||
internal typealias V3 = RNCryptor.FormatV3
|
||||
|
||||
private enum Credential {
|
||||
case Password(String)
|
||||
case Keys(encryptionKey: NSData, hmacKey: NSData)
|
||||
}
|
||||
|
||||
private final class DecryptorEngineV3 {
|
||||
private let buffer = OverflowingBuffer(capacity: V3.hmacSize)
|
||||
private var hmac: HMACV3
|
||||
private var engine: Engine
|
||||
|
||||
init(encryptionKey: NSData, hmacKey: NSData, iv: NSData, header: NSData) {
|
||||
precondition(encryptionKey.length == V3.keySize)
|
||||
precondition(hmacKey.length == V3.hmacSize)
|
||||
precondition(iv.length == V3.ivSize)
|
||||
|
||||
hmac = HMACV3(key: hmacKey)
|
||||
hmac.updateWithData(header)
|
||||
engine = Engine(operation: .Decrypt, key: encryptionKey, iv: iv)
|
||||
}
|
||||
|
||||
func updateWithData(data: NSData) -> NSData {
|
||||
let overflow = buffer.updateWithData(data)
|
||||
hmac.updateWithData(overflow)
|
||||
return engine.updateWithData(overflow)
|
||||
}
|
||||
|
||||
func finalData() throws -> NSData {
|
||||
let result = engine.finalData()
|
||||
let hash = hmac.finalData()
|
||||
if !isEqualInConsistentTime(trusted: hash, untrusted: buffer.finalData()) {
|
||||
throw RNCryptorError.HMACMismatch
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
private final class HMACV3 {
|
||||
var context: CCHmacContext = CCHmacContext()
|
||||
|
||||
init(key: NSData) {
|
||||
CCHmacInit(
|
||||
&context,
|
||||
CCHmacAlgorithm(kCCHmacAlgSHA256),
|
||||
key.bytes,
|
||||
key.length
|
||||
)
|
||||
}
|
||||
|
||||
func updateWithData(data: NSData) {
|
||||
CCHmacUpdate(&context, data.bytes, data.length)
|
||||
}
|
||||
|
||||
func finalData() -> NSData {
|
||||
let hmac = NSMutableData(length: V3.hmacSize)!
|
||||
CCHmacFinal(&context, hmac.mutableBytes)
|
||||
return hmac
|
||||
}
|
||||
}
|
||||
|
||||
// Internal protocol for version-specific decryptors.
|
||||
private protocol VersionedDecryptorType: RNCryptorType {
|
||||
static var preambleSize: Int { get }
|
||||
static func canDecrypt(preamble: NSData) -> Bool
|
||||
init(password: String)
|
||||
}
|
||||
|
||||
private extension CollectionType {
|
||||
// Split collection into ([pass], [fail]) based on predicate.
|
||||
func splitPassFail(pred: Generator.Element -> Bool) -> ([Generator.Element], [Generator.Element]) {
|
||||
var pass: [Generator.Element] = []
|
||||
var fail: [Generator.Element] = []
|
||||
for e in self {
|
||||
if pred(e) {
|
||||
pass.append(e)
|
||||
} else {
|
||||
fail.append(e)
|
||||
}
|
||||
}
|
||||
return (pass, fail)
|
||||
}
|
||||
}
|
||||
|
||||
internal class OverflowingBuffer {
|
||||
private var buffer = NSMutableData()
|
||||
let capacity: Int
|
||||
|
||||
init(capacity: Int) {
|
||||
self.capacity = capacity
|
||||
}
|
||||
|
||||
@warn_unused_result
|
||||
func updateWithData(data: NSData) -> NSData {
|
||||
if data.length >= capacity {
|
||||
return sendAllArray(data)
|
||||
} else if buffer.length + data.length <= capacity {
|
||||
buffer.appendData(data)
|
||||
return NSData()
|
||||
} else {
|
||||
return sendSomeArray(data)
|
||||
}
|
||||
}
|
||||
|
||||
func finalData() -> NSData {
|
||||
let result = buffer
|
||||
buffer = NSMutableData() // Data belongs to caller now.
|
||||
return result
|
||||
}
|
||||
|
||||
private func sendAllArray(data: NSData) -> NSData {
|
||||
let toSend = data.length - capacity
|
||||
assert(toSend >= 0)
|
||||
assert(data.length - toSend <= capacity)
|
||||
|
||||
let result = NSMutableData(data: buffer)
|
||||
result.appendData(data.bytesView[0..<toSend])
|
||||
buffer.length = 0
|
||||
buffer.appendData(data.bytesView[toSend..<data.length])
|
||||
return result
|
||||
}
|
||||
|
||||
private func sendSomeArray(data: NSData) -> NSData {
|
||||
let toSend = (buffer.length + data.length) - capacity
|
||||
assert(toSend > 0) // If it were <= 0, we would have extended the array
|
||||
assert(toSend < buffer.length) // If we would have sent everything, replaceBuffer should have been called
|
||||
|
||||
let result = buffer.bytesView[0..<toSend]
|
||||
buffer.replaceBytesInRange(NSRange(0..<toSend), withBytes: nil, length: 0)
|
||||
buffer.appendData(data)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
private extension NSData {
|
||||
var bytesView: BytesView { return BytesView(self) }
|
||||
}
|
||||
|
||||
private struct BytesView: CollectionType {
|
||||
let data: NSData
|
||||
init(_ data: NSData) { self.data = data }
|
||||
|
||||
subscript (position: Int) -> UInt8 {
|
||||
return UnsafePointer<UInt8>(data.bytes)[position]
|
||||
}
|
||||
subscript (bounds: Range<Int>) -> NSData {
|
||||
return data.subdataWithRange(NSRange(bounds))
|
||||
}
|
||||
var startIndex: Int = 0
|
||||
var endIndex: Int { return data.length }
|
||||
}
|
||||
|
||||
/** Compare two NSData in time proportional to the untrusted data
|
||||
|
||||
Equatable-based comparisons genreally stop comparing at the first difference.
|
||||
This can be used by attackers, in some situations,
|
||||
to determine a secret value by considering the time required to compare the values.
|
||||
|
||||
We enumerate over the untrusted values so that the time is proportaional to the attacker's data,
|
||||
which provides the attack no informatoin about the length of the secret.
|
||||
*/
|
||||
private func isEqualInConsistentTime(trusted trusted: NSData, untrusted: NSData) -> Bool {
|
||||
// The point of this routine is XOR the bytes of each data and accumulate the results with OR.
|
||||
// If any bytes are different, then the OR will accumulate some non-0 value.
|
||||
|
||||
var result: UInt8 = untrusted.length == trusted.length ? 0 : 1 // Start with 0 (equal) only if our lengths are equal
|
||||
for (i, untrustedByte) in untrusted.bytesView.enumerate() {
|
||||
// Use mod to wrap around ourselves if they are longer than we are.
|
||||
// Remember, we already broke equality if our lengths are different.
|
||||
result |= trusted.bytesView[i % trusted.length] ^ untrustedByte
|
||||
}
|
||||
|
||||
return result == 0
|
||||
}
|
||||
5
Example/Pods/Target Support Files/CocoaSecurity/CocoaSecurity-dummy.m
generated
Normal file
5
Example/Pods/Target Support Files/CocoaSecurity/CocoaSecurity-dummy.m
generated
Normal file
@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_CocoaSecurity : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_CocoaSecurity
|
||||
@end
|
||||
8
Example/Pods/Target Support Files/CocoaSecurity/CocoaSecurity-umbrella.h
generated
Normal file
8
Example/Pods/Target Support Files/CocoaSecurity/CocoaSecurity-umbrella.h
generated
Normal file
@ -0,0 +1,8 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "CocoaSecurity.h"
|
||||
#import "Base64.h"
|
||||
|
||||
FOUNDATION_EXPORT double CocoaSecurityVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char CocoaSecurityVersionString[];
|
||||
|
||||
6
Example/Pods/Target Support Files/CocoaSecurity/CocoaSecurity.modulemap
generated
Normal file
6
Example/Pods/Target Support Files/CocoaSecurity/CocoaSecurity.modulemap
generated
Normal file
@ -0,0 +1,6 @@
|
||||
framework module CocoaSecurity {
|
||||
umbrella header "CocoaSecurity-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/RNCryptor
|
||||
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/CocoaSecurity
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.0.0</string>
|
||||
<string>1.2.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.2</string>
|
||||
<string>0.1.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
@ -11,9 +13,9 @@
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.2</string>
|
||||
<string>1.0.6</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
5
Example/Pods/Target Support Files/NACrypto/NACrypto-dummy.m
generated
Normal file
5
Example/Pods/Target Support Files/NACrypto/NACrypto-dummy.m
generated
Normal file
@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_NACrypto : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_NACrypto
|
||||
@end
|
||||
4
Example/Pods/Target Support Files/NACrypto/NACrypto-prefix.pch
generated
Normal file
4
Example/Pods/Target Support Files/NACrypto/NACrypto-prefix.pch
generated
Normal file
@ -0,0 +1,4 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
30
Example/Pods/Target Support Files/NACrypto/NACrypto-umbrella.h
generated
Normal file
30
Example/Pods/Target Support Files/NACrypto/NACrypto-umbrella.h
generated
Normal file
@ -0,0 +1,30 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "brg_endian.h"
|
||||
#import "KeccakF-1600-32-rvk.h"
|
||||
#import "KeccakF-1600-32-s1.h"
|
||||
#import "KeccakF-1600-32-s2.h"
|
||||
#import "KeccakF-1600-32.h"
|
||||
#import "KeccakF-1600-int-set.h"
|
||||
#import "KeccakF-1600-interface.h"
|
||||
#import "KeccakF-1600-opt32-settings.h"
|
||||
#import "KeccakF-1600-unrolling.h"
|
||||
#import "KeccakNISTInterface.h"
|
||||
#import "KeccakSponge.h"
|
||||
#import "NAAES.h"
|
||||
#import "NACounter.h"
|
||||
#import "NACrypto.h"
|
||||
#import "NADigest.h"
|
||||
#import "NAHMAC.h"
|
||||
#import "NAKeychain.h"
|
||||
#import "NANSData+Utils.h"
|
||||
#import "NANSMutableData+Utils.h"
|
||||
#import "NANSString+Utils.h"
|
||||
#import "NASecRandom.h"
|
||||
#import "NASHA3.h"
|
||||
#import "NATwoFish.h"
|
||||
#import "twofish.h"
|
||||
|
||||
FOUNDATION_EXPORT double NACryptoVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NACryptoVersionString[];
|
||||
|
||||
6
Example/Pods/Target Support Files/NACrypto/NACrypto.modulemap
generated
Normal file
6
Example/Pods/Target Support Files/NACrypto/NACrypto.modulemap
generated
Normal file
@ -0,0 +1,6 @@
|
||||
framework module NACrypto {
|
||||
umbrella header "NACrypto-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
7
Example/Pods/Target Support Files/NACrypto/NACrypto.xcconfig
generated
Normal file
7
Example/Pods/Target Support Files/NACrypto/NACrypto.xcconfig
generated
Normal file
@ -0,0 +1,7 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/NACrypto
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.2</string>
|
||||
<string>0.1.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.3</string>
|
||||
<string>1.0.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
@ -11,9 +13,9 @@
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.3</string>
|
||||
<string>0.0.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
@ -0,0 +1,5 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_NSUserDefaults_AESEncryptor : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_NSUserDefaults_AESEncryptor
|
||||
@end
|
||||
@ -0,0 +1,4 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "NSUserDefaults+AESEncryptor.h"
|
||||
|
||||
FOUNDATION_EXPORT double NSUserDefaults_AESEncryptorVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NSUserDefaults_AESEncryptorVersionString[];
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
framework module NSUserDefaults_AESEncryptor {
|
||||
umbrella header "NSUserDefaults-AESEncryptor-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/NSUserDefaults-AESEncryptor
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/CocoaSecurity"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_SHARED_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.17</string>
|
||||
<string>0.3.18</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
CONFIGURATION_BUILD_DIR = $PODS_SHARED_BUILD_DIR/PNObject
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/AFNetworking" "$PODS_SHARED_BUILD_DIR/Bolts" "$PODS_SHARED_BUILD_DIR/CodFis-Helper" "$PODS_SHARED_BUILD_DIR/FBSDKCoreKit" "$PODS_SHARED_BUILD_DIR/FBSDKLoginKit" "$PODS_SHARED_BUILD_DIR/FBSDKShareKit" "$PODS_SHARED_BUILD_DIR/NSDate_Utils" "$PODS_SHARED_BUILD_DIR/NSString-Helper" "$PODS_SHARED_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_SHARED_BUILD_DIR/RNCryptor" "$PODS_SHARED_BUILD_DIR/StrongestPasswordValidator" "$PODS_SHARED_BUILD_DIR/UIDevice-Utils" "$PODS_SHARED_BUILD_DIR/nv-ios-http-status"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_SHARED_BUILD_DIR/AFNetworking" "$PODS_SHARED_BUILD_DIR/Bolts" "$PODS_SHARED_BUILD_DIR/CocoaSecurity" "$PODS_SHARED_BUILD_DIR/CodFis-Helper" "$PODS_SHARED_BUILD_DIR/FBSDKCoreKit" "$PODS_SHARED_BUILD_DIR/FBSDKLoginKit" "$PODS_SHARED_BUILD_DIR/FBSDKShareKit" "$PODS_SHARED_BUILD_DIR/NACrypto" "$PODS_SHARED_BUILD_DIR/NSDate_Utils" "$PODS_SHARED_BUILD_DIR/NSString-Helper" "$PODS_SHARED_BUILD_DIR/NSUserDefaults-AESEncryptor" "$PODS_SHARED_BUILD_DIR/PEAR-FileManager-iOS" "$PODS_SHARED_BUILD_DIR/StrongestPasswordValidator" "$PODS_SHARED_BUILD_DIR/UIDevice-Utils" "$PODS_SHARED_BUILD_DIR/nv-ios-http-status"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.17</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -57,6 +57,18 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
## CocoaSecurity
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Kelp https://github.com/kelp404
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
## CodFis-Helper
|
||||
|
||||
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -143,6 +155,32 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
## NACrypto
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gabriel Handford
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
## NSDate_Utils
|
||||
|
||||
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -189,6 +227,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## NSUserDefaults-AESEncryptor
|
||||
|
||||
Copyright (c) 2013 No Zebra Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## PEAR-FileManager-iOS
|
||||
|
||||
Copyright (c) <2015> Hiroki Umatani PEAR
|
||||
@ -249,30 +310,6 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
## RNCryptor
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Rob Napier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
## StrongestPasswordValidator
|
||||
|
||||
Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -76,6 +76,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
Copyright (c) 2013 Kelp https://github.com/kelp404
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>CocoaSecurity</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -178,6 +194,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gabriel Handford
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>NACrypto</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -232,6 +278,33 @@ THE SOFTWARE.
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2013 No Zebra Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>NSUserDefaults-AESEncryptor</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) <2015> Hiroki Umatani PEAR
|
||||
@ -304,34 +377,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Rob Napier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.</string>
|
||||
<key>Title</key>
|
||||
<string>RNCryptor</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -16,7 +16,7 @@ install_framework()
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
@ -84,36 +84,40 @@ strip_invalid_archs() {
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PureLayout/PureLayout.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CocoaSecurity/CocoaSecurity.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NACrypto/NACrypto.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PureLayout/PureLayout.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PureLayout/PureLayout.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CocoaSecurity/CocoaSecurity.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NACrypto/NACrypto.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PureLayout/PureLayout.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
fi
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/PureLayout" "$CONFIGURATION_BUILD_DIR/RNCryptor" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CocoaSecurity" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/NACrypto" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/PureLayout" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CodFis_Helper" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "PureLayout" -framework "RNCryptor" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaSecurity/CocoaSecurity.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NACrypto/NACrypto.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CocoaSecurity" -framework "CodFis_Helper" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "NACrypto" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "NSUserDefaults_AESEncryptor" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "PureLayout" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/PureLayout" "$CONFIGURATION_BUILD_DIR/RNCryptor" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CocoaSecurity" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/NACrypto" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/PureLayout" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CodFis_Helper" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "PureLayout" -framework "RNCryptor" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaSecurity/CocoaSecurity.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NACrypto/NACrypto.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CocoaSecurity" -framework "CodFis_Helper" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "NACrypto" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "NSUserDefaults_AESEncryptor" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "PureLayout" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -57,6 +57,18 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
## CocoaSecurity
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Kelp https://github.com/kelp404
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
## CodFis-Helper
|
||||
|
||||
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -143,6 +155,32 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
## NACrypto
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gabriel Handford
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
## NSDate_Utils
|
||||
|
||||
Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -189,6 +227,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## NSUserDefaults-AESEncryptor
|
||||
|
||||
Copyright (c) 2013 No Zebra Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## PEAR-FileManager-iOS
|
||||
|
||||
Copyright (c) <2015> Hiroki Umatani PEAR
|
||||
@ -236,30 +297,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
## RNCryptor
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Rob Napier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
## StrongestPasswordValidator
|
||||
|
||||
Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -76,6 +76,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
Copyright (c) 2013 Kelp https://github.com/kelp404
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>CocoaSecurity</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -178,6 +194,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gabriel Handford
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>NACrypto</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2015 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
@ -232,6 +278,33 @@ THE SOFTWARE.
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2013 No Zebra Network
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</string>
|
||||
<key>Title</key>
|
||||
<string>NSUserDefaults-AESEncryptor</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) <2015> Hiroki Umatani PEAR
|
||||
@ -287,34 +360,6 @@ THE SOFTWARE.
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Rob Napier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.</string>
|
||||
<key>Title</key>
|
||||
<string>RNCryptor</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright (c) 2016 Giuseppe Nucifora <me@giuseppenucifora.com>
|
||||
|
||||
@ -16,7 +16,7 @@ install_framework()
|
||||
local source="$1"
|
||||
fi
|
||||
|
||||
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
||||
|
||||
if [ -L "${source}" ]; then
|
||||
echo "Symlinked..."
|
||||
@ -84,42 +84,46 @@ strip_invalid_archs() {
|
||||
|
||||
|
||||
if [[ "$CONFIGURATION" == "Debug" ]]; then
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Specta/Specta.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CocoaSecurity/CocoaSecurity.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NACrypto/NACrypto.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta/Expecta.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Specta/Specta.framework"
|
||||
fi
|
||||
if [[ "$CONFIGURATION" == "Release" ]]; then
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "$CONFIGURATION_BUILD_DIR/Specta/Specta.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CocoaSecurity/CocoaSecurity.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/CodFis-Helper/CodFis_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKCoreKit/FBSDKCoreKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKLoginKit/FBSDKLoginKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSDKShareKit/FBSDKShareKit.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NACrypto/NACrypto.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSDate_Utils/NSDate_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSString-Helper/NSString_Helper.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/PNObject/PNObject.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/UIDevice-Utils/UIDevice_Utils.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/nv-ios-http-status/nv_ios_http_status.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta/Expecta.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Expecta+Snapshots/Expecta_Snapshots.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework"
|
||||
install_framework "$BUILT_PRODUCTS_DIR/Specta/Specta.framework"
|
||||
fi
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/Expecta" "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/RNCryptor" "$CONFIGURATION_BUILD_DIR/Specta" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CocoaSecurity" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/Expecta" "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$CONFIGURATION_BUILD_DIR/NACrypto" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/Specta" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CodFis_Helper" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "RNCryptor" -framework "Specta" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaSecurity/CocoaSecurity.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NACrypto/NACrypto.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CocoaSecurity" -framework "CodFis_Helper" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "FBSnapshotTestCase" -framework "NACrypto" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "NSUserDefaults_AESEncryptor" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "Specta" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/Expecta" "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/RNCryptor" "$CONFIGURATION_BUILD_DIR/Specta" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
FRAMEWORK_SEARCH_PATHS = $(inherited) "$CONFIGURATION_BUILD_DIR/AFNetworking" "$CONFIGURATION_BUILD_DIR/Bolts" "$CONFIGURATION_BUILD_DIR/CocoaSecurity" "$CONFIGURATION_BUILD_DIR/CodFis-Helper" "$CONFIGURATION_BUILD_DIR/Expecta" "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots" "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$CONFIGURATION_BUILD_DIR/FBSDKShareKit" "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase" "$CONFIGURATION_BUILD_DIR/NACrypto" "$CONFIGURATION_BUILD_DIR/NSDate_Utils" "$CONFIGURATION_BUILD_DIR/NSString-Helper" "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor" "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS" "$CONFIGURATION_BUILD_DIR/PNObject" "$CONFIGURATION_BUILD_DIR/Specta" "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator" "$CONFIGURATION_BUILD_DIR/UIDevice-Utils" "$CONFIGURATION_BUILD_DIR/nv-ios-http-status"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/RNCryptor/RNCryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CodFis_Helper" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "FBSnapshotTestCase" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "RNCryptor" -framework "Specta" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CocoaSecurity/CocoaSecurity.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/CodFis-Helper/CodFis_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta+Snapshots/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSDKShareKit/FBSDKShareKit.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NACrypto/NACrypto.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSDate_Utils/NSDate_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSString-Helper/NSString_Helper.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/NSUserDefaults-AESEncryptor/NSUserDefaults_AESEncryptor.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PEAR-FileManager-iOS/PEAR_FileManager_iOS.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PNObject/PNObject.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta/Specta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/StrongestPasswordValidator/StrongestPasswordValidator.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/UIDevice-Utils/UIDevice_Utils.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/nv-ios-http-status/nv_ios_http_status.framework/Headers"
|
||||
OTHER_LDFLAGS = $(inherited) -framework "AFNetworking" -framework "Bolts" -framework "CocoaSecurity" -framework "CodFis_Helper" -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FBSDKShareKit" -framework "FBSnapshotTestCase" -framework "NACrypto" -framework "NSDate_Utils" -framework "NSString_Helper" -framework "NSUserDefaults_AESEncryptor" -framework "PEAR_FileManager_iOS" -framework "PNObject" -framework "Specta" -framework "StrongestPasswordValidator" -framework "UIDevice_Utils" -framework "nv_ios_http_status"
|
||||
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_RNCryptor : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_RNCryptor
|
||||
@end
|
||||
@ -1,7 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "RNCryptor.h"
|
||||
|
||||
FOUNDATION_EXPORT double RNCryptorVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char RNCryptorVersionString[];
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
framework module RNCryptor {
|
||||
umbrella header "RNCryptor-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.1</string>
|
||||
<string>0.1.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user