@appzung/react-native-code-push 8.3.2 → 10.0.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CodePush.js +22 -19
- package/CodePush.podspec +3 -3
- package/LICENSE.md +1 -1
- package/README.md +159 -296
- package/android/app/.gradle/config.properties +2 -0
- package/android/app/build.gradle +2 -0
- package/android/app/local.properties +8 -0
- package/android/app/src/main/AndroidManifest.xml +1 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +27 -21
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +5 -5
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +5 -5
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +14 -14
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +2 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +16 -9
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/SettingsManager.java +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +1 -1
- package/android/build.gradle +3 -0
- package/android/codepush.gradle +3 -3
- package/docs/advanced-usage.md +56 -0
- package/docs/api-android.md +12 -75
- package/docs/api-ios.md +5 -17
- package/docs/api-js.md +18 -55
- package/docs/setup-android.md +15 -397
- package/docs/setup-ios.md +24 -198
- package/docs/setup-windows.md +7 -74
- package/ios/CodePush/CodePush.h +4 -4
- package/ios/CodePush/CodePush.m +10 -9
- package/ios/CodePush/CodePushConfig.m +14 -11
- package/ios/CodePush/CodePushPackage.m +60 -60
- package/ios/CodePush/CodePushTelemetryManager.m +13 -13
- package/ios/CodePush.xcodeproj/project.pbxproj +24 -470
- package/ios/PrivacyInfo.xcprivacy +31 -0
- package/package.json +27 -24
- package/react-native.config.js +1 -1
- package/scripts/generateBundledResourcesHash.js +1 -1
- package/scripts/getFilesInFolder.js +1 -1
- package/scripts/recordFilesBeforeBundleCommand.js +1 -1
- package/typings/react-native-code-push.d.ts +22 -22
- package/windows/CodePush/CodePushConfig.cpp +3 -3
- package/windows/CodePush/CodePushConfig.h +3 -3
- package/windows/CodePush/CodePushNativeModule.cpp +27 -27
- package/windows/CodePush/CodePushNativeModule.h +4 -4
- package/windows/CodePush/CodePushTelemetryManager.cpp +12 -12
- package/windows/CodePush/CodePushTelemetryManager.h +1 -1
- package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
- package/.azurepipelines/test-rn-code-push.yml +0 -94
- package/.config/CredScanSuppressions.json +0 -14
- package/SECURITY.md +0 -41
- package/docs/multi-deployment-testing-android.md +0 -148
- package/docs/multi-deployment-testing-ios.md +0 -59
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
- package/ios/CodePush/Base64/README.md +0 -47
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
- package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
- package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
- package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
- package/ios/CodePush/JWT/LICENSE +0 -19
- package/ios/CodePush/JWT/README.md +0 -489
- package/ios/CodePush/SSZipArchive/Common.h +0 -81
- package/ios/CodePush/SSZipArchive/README.md +0 -1
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +0 -76
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +0 -691
- package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
- package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
- package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
- package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
- package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
- package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
- package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
- package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
- package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
- package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
- package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
- package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
- package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
- package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
- package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
- package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
- package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
- package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
- package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
- package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
- package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
- package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
- package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
- package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
- package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
- package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
- package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
- package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
- package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
- package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
- package/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
- package/windows-legacy/CodePush/CodePush.csproj +0 -128
- package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
- package/windows-legacy/CodePush/FileUtils.cs +0 -40
- package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
- package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
- package/windows-legacy/CodePush/UpdateManager.cs +0 -305
- package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
- package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
- package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
- package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
- package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
- package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
- package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
- package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
- package/windows-legacy/CodePush.Net46/packages.config +0 -5
- package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
- package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
- package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
- package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
- package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
- package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
- package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
- package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
- package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
- package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
- package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
- package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
- package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
- package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
- package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
- package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
---------------------------------------------------------------------------
|
|
3
|
-
Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved.
|
|
4
|
-
|
|
5
|
-
The redistribution and use of this software (with or without changes)
|
|
6
|
-
is allowed without the payment of fees or royalties provided that:
|
|
7
|
-
|
|
8
|
-
source code distributions include the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer;
|
|
10
|
-
|
|
11
|
-
binary distributions include the above copyright notice, this list
|
|
12
|
-
of conditions and the following disclaimer in their documentation.
|
|
13
|
-
|
|
14
|
-
This software is provided 'as is' with no explicit or implied warranties
|
|
15
|
-
in respect of its operation, including, but not limited to, correctness
|
|
16
|
-
and fitness for purpose.
|
|
17
|
-
---------------------------------------------------------------------------
|
|
18
|
-
Issue Date: 20/12/2007
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
#include "aesopt.h"
|
|
22
|
-
#include "aestab.h"
|
|
23
|
-
|
|
24
|
-
#if defined(__cplusplus)
|
|
25
|
-
extern "C"
|
|
26
|
-
{
|
|
27
|
-
#endif
|
|
28
|
-
|
|
29
|
-
#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c])
|
|
30
|
-
#define so(y,x,c) word_out(y, c, s(x,c))
|
|
31
|
-
|
|
32
|
-
#if defined(ARRAYS)
|
|
33
|
-
#define locals(y,x) x[4],y[4]
|
|
34
|
-
#else
|
|
35
|
-
#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
|
|
36
|
-
#endif
|
|
37
|
-
|
|
38
|
-
#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
|
|
39
|
-
s(y,2) = s(x,2); s(y,3) = s(x,3);
|
|
40
|
-
#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3)
|
|
41
|
-
#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
|
|
42
|
-
#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
|
|
43
|
-
|
|
44
|
-
#if ( FUNCS_IN_C & ENCRYPTION_IN_C )
|
|
45
|
-
|
|
46
|
-
/* Visual C++ .Net v7.1 provides the fastest encryption code when using
|
|
47
|
-
Pentium optimiation with small code but this is poor for decryption
|
|
48
|
-
so we need to control this with the following VC++ pragmas
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
#if defined( _MSC_VER ) && !defined( _WIN64 )
|
|
52
|
-
#pragma optimize( "s", on )
|
|
53
|
-
#endif
|
|
54
|
-
|
|
55
|
-
/* Given the column (c) of the output state variable, the following
|
|
56
|
-
macros give the input state variables which are needed in its
|
|
57
|
-
computation for each row (r) of the state. All the alternative
|
|
58
|
-
macros give the same end values but expand into different ways
|
|
59
|
-
of calculating these values. In particular the complex macro
|
|
60
|
-
used for dynamically variable block sizes is designed to expand
|
|
61
|
-
to a compile time constant whenever possible but will expand to
|
|
62
|
-
conditional clauses on some branches (I am grateful to Frank
|
|
63
|
-
Yellin for this construction)
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
#define fwd_var(x,r,c)\
|
|
67
|
-
( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
|
|
68
|
-
: r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\
|
|
69
|
-
: r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
|
|
70
|
-
: ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2)))
|
|
71
|
-
|
|
72
|
-
#if defined(FT4_SET)
|
|
73
|
-
#undef dec_fmvars
|
|
74
|
-
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c))
|
|
75
|
-
#elif defined(FT1_SET)
|
|
76
|
-
#undef dec_fmvars
|
|
77
|
-
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c))
|
|
78
|
-
#else
|
|
79
|
-
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c)))
|
|
80
|
-
#endif
|
|
81
|
-
|
|
82
|
-
#if defined(FL4_SET)
|
|
83
|
-
#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c))
|
|
84
|
-
#elif defined(FL1_SET)
|
|
85
|
-
#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c))
|
|
86
|
-
#else
|
|
87
|
-
#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c))
|
|
88
|
-
#endif
|
|
89
|
-
|
|
90
|
-
AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1])
|
|
91
|
-
{ uint_32t locals(b0, b1);
|
|
92
|
-
const uint_32t *kp;
|
|
93
|
-
#if defined( dec_fmvars )
|
|
94
|
-
dec_fmvars; /* declare variables for fwd_mcol() if needed */
|
|
95
|
-
#endif
|
|
96
|
-
|
|
97
|
-
if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 )
|
|
98
|
-
return EXIT_FAILURE;
|
|
99
|
-
|
|
100
|
-
kp = cx->ks;
|
|
101
|
-
state_in(b0, in, kp);
|
|
102
|
-
|
|
103
|
-
#if (ENC_UNROLL == FULL)
|
|
104
|
-
|
|
105
|
-
switch(cx->inf.b[0])
|
|
106
|
-
{
|
|
107
|
-
case 14 * 16:
|
|
108
|
-
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
|
|
109
|
-
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
|
|
110
|
-
kp += 2 * N_COLS;
|
|
111
|
-
case 12 * 16:
|
|
112
|
-
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
|
|
113
|
-
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
|
|
114
|
-
kp += 2 * N_COLS;
|
|
115
|
-
case 10 * 16:
|
|
116
|
-
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
|
|
117
|
-
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
|
|
118
|
-
round(fwd_rnd, b1, b0, kp + 3 * N_COLS);
|
|
119
|
-
round(fwd_rnd, b0, b1, kp + 4 * N_COLS);
|
|
120
|
-
round(fwd_rnd, b1, b0, kp + 5 * N_COLS);
|
|
121
|
-
round(fwd_rnd, b0, b1, kp + 6 * N_COLS);
|
|
122
|
-
round(fwd_rnd, b1, b0, kp + 7 * N_COLS);
|
|
123
|
-
round(fwd_rnd, b0, b1, kp + 8 * N_COLS);
|
|
124
|
-
round(fwd_rnd, b1, b0, kp + 9 * N_COLS);
|
|
125
|
-
round(fwd_lrnd, b0, b1, kp +10 * N_COLS);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
#else
|
|
129
|
-
|
|
130
|
-
#if (ENC_UNROLL == PARTIAL)
|
|
131
|
-
{ uint_32t rnd;
|
|
132
|
-
for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd)
|
|
133
|
-
{
|
|
134
|
-
kp += N_COLS;
|
|
135
|
-
round(fwd_rnd, b1, b0, kp);
|
|
136
|
-
kp += N_COLS;
|
|
137
|
-
round(fwd_rnd, b0, b1, kp);
|
|
138
|
-
}
|
|
139
|
-
kp += N_COLS;
|
|
140
|
-
round(fwd_rnd, b1, b0, kp);
|
|
141
|
-
#else
|
|
142
|
-
{ uint_32t rnd;
|
|
143
|
-
for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd)
|
|
144
|
-
{
|
|
145
|
-
kp += N_COLS;
|
|
146
|
-
round(fwd_rnd, b1, b0, kp);
|
|
147
|
-
l_copy(b0, b1);
|
|
148
|
-
}
|
|
149
|
-
#endif
|
|
150
|
-
kp += N_COLS;
|
|
151
|
-
round(fwd_lrnd, b0, b1, kp);
|
|
152
|
-
}
|
|
153
|
-
#endif
|
|
154
|
-
|
|
155
|
-
state_out(out, b0);
|
|
156
|
-
return EXIT_SUCCESS;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
#endif
|
|
160
|
-
|
|
161
|
-
#if ( FUNCS_IN_C & DECRYPTION_IN_C)
|
|
162
|
-
|
|
163
|
-
/* Visual C++ .Net v7.1 provides the fastest encryption code when using
|
|
164
|
-
Pentium optimiation with small code but this is poor for decryption
|
|
165
|
-
so we need to control this with the following VC++ pragmas
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
#if defined( _MSC_VER ) && !defined( _WIN64 )
|
|
169
|
-
#pragma optimize( "t", on )
|
|
170
|
-
#endif
|
|
171
|
-
|
|
172
|
-
/* Given the column (c) of the output state variable, the following
|
|
173
|
-
macros give the input state variables which are needed in its
|
|
174
|
-
computation for each row (r) of the state. All the alternative
|
|
175
|
-
macros give the same end values but expand into different ways
|
|
176
|
-
of calculating these values. In particular the complex macro
|
|
177
|
-
used for dynamically variable block sizes is designed to expand
|
|
178
|
-
to a compile time constant whenever possible but will expand to
|
|
179
|
-
conditional clauses on some branches (I am grateful to Frank
|
|
180
|
-
Yellin for this construction)
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
#define inv_var(x,r,c)\
|
|
184
|
-
( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
|
|
185
|
-
: r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\
|
|
186
|
-
: r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
|
|
187
|
-
: ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0)))
|
|
188
|
-
|
|
189
|
-
#if defined(IT4_SET)
|
|
190
|
-
#undef dec_imvars
|
|
191
|
-
#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c))
|
|
192
|
-
#elif defined(IT1_SET)
|
|
193
|
-
#undef dec_imvars
|
|
194
|
-
#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c))
|
|
195
|
-
#else
|
|
196
|
-
#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)))
|
|
197
|
-
#endif
|
|
198
|
-
|
|
199
|
-
#if defined(IL4_SET)
|
|
200
|
-
#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c))
|
|
201
|
-
#elif defined(IL1_SET)
|
|
202
|
-
#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c))
|
|
203
|
-
#else
|
|
204
|
-
#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))
|
|
205
|
-
#endif
|
|
206
|
-
|
|
207
|
-
/* This code can work with the decryption key schedule in the */
|
|
208
|
-
/* order that is used for encrytpion (where the 1st decryption */
|
|
209
|
-
/* round key is at the high end ot the schedule) or with a key */
|
|
210
|
-
/* schedule that has been reversed to put the 1st decryption */
|
|
211
|
-
/* round key at the low end of the schedule in memory (when */
|
|
212
|
-
/* AES_REV_DKS is defined) */
|
|
213
|
-
|
|
214
|
-
#ifdef AES_REV_DKS
|
|
215
|
-
#define key_ofs 0
|
|
216
|
-
#define rnd_key(n) (kp + n * N_COLS)
|
|
217
|
-
#else
|
|
218
|
-
#define key_ofs 1
|
|
219
|
-
#define rnd_key(n) (kp - n * N_COLS)
|
|
220
|
-
#endif
|
|
221
|
-
|
|
222
|
-
AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1])
|
|
223
|
-
{ uint_32t locals(b0, b1);
|
|
224
|
-
#if defined( dec_imvars )
|
|
225
|
-
dec_imvars; /* declare variables for inv_mcol() if needed */
|
|
226
|
-
#endif
|
|
227
|
-
const uint_32t *kp;
|
|
228
|
-
|
|
229
|
-
if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 )
|
|
230
|
-
return EXIT_FAILURE;
|
|
231
|
-
|
|
232
|
-
kp = cx->ks + (key_ofs ? (cx->inf.b[0] >> 2) : 0);
|
|
233
|
-
state_in(b0, in, kp);
|
|
234
|
-
|
|
235
|
-
#if (DEC_UNROLL == FULL)
|
|
236
|
-
|
|
237
|
-
kp = cx->ks + (key_ofs ? 0 : (cx->inf.b[0] >> 2));
|
|
238
|
-
switch(cx->inf.b[0])
|
|
239
|
-
{
|
|
240
|
-
case 14 * 16:
|
|
241
|
-
round(inv_rnd, b1, b0, rnd_key(-13));
|
|
242
|
-
round(inv_rnd, b0, b1, rnd_key(-12));
|
|
243
|
-
case 12 * 16:
|
|
244
|
-
round(inv_rnd, b1, b0, rnd_key(-11));
|
|
245
|
-
round(inv_rnd, b0, b1, rnd_key(-10));
|
|
246
|
-
case 10 * 16:
|
|
247
|
-
round(inv_rnd, b1, b0, rnd_key(-9));
|
|
248
|
-
round(inv_rnd, b0, b1, rnd_key(-8));
|
|
249
|
-
round(inv_rnd, b1, b0, rnd_key(-7));
|
|
250
|
-
round(inv_rnd, b0, b1, rnd_key(-6));
|
|
251
|
-
round(inv_rnd, b1, b0, rnd_key(-5));
|
|
252
|
-
round(inv_rnd, b0, b1, rnd_key(-4));
|
|
253
|
-
round(inv_rnd, b1, b0, rnd_key(-3));
|
|
254
|
-
round(inv_rnd, b0, b1, rnd_key(-2));
|
|
255
|
-
round(inv_rnd, b1, b0, rnd_key(-1));
|
|
256
|
-
round(inv_lrnd, b0, b1, rnd_key( 0));
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
#else
|
|
260
|
-
|
|
261
|
-
#if (DEC_UNROLL == PARTIAL)
|
|
262
|
-
{ uint_32t rnd;
|
|
263
|
-
for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd)
|
|
264
|
-
{
|
|
265
|
-
kp = rnd_key(1);
|
|
266
|
-
round(inv_rnd, b1, b0, kp);
|
|
267
|
-
kp = rnd_key(1);
|
|
268
|
-
round(inv_rnd, b0, b1, kp);
|
|
269
|
-
}
|
|
270
|
-
kp = rnd_key(1);
|
|
271
|
-
round(inv_rnd, b1, b0, kp);
|
|
272
|
-
#else
|
|
273
|
-
{ uint_32t rnd;
|
|
274
|
-
for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd)
|
|
275
|
-
{
|
|
276
|
-
kp = rnd_key(1);
|
|
277
|
-
round(inv_rnd, b1, b0, kp);
|
|
278
|
-
l_copy(b0, b1);
|
|
279
|
-
}
|
|
280
|
-
#endif
|
|
281
|
-
kp = rnd_key(1);
|
|
282
|
-
round(inv_lrnd, b0, b1, kp);
|
|
283
|
-
}
|
|
284
|
-
#endif
|
|
285
|
-
|
|
286
|
-
state_out(out, b0);
|
|
287
|
-
return EXIT_SUCCESS;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
#endif
|
|
291
|
-
|
|
292
|
-
#if defined(__cplusplus)
|
|
293
|
-
}
|
|
294
|
-
#endif
|