@algocare/react-native-code-push 12.6.3 → 13.0.0-rc.0

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.
Files changed (292) hide show
  1. package/CodePush.podspec +6 -8
  2. package/README.md +343 -586
  3. package/android/app/build.gradle +2 -1
  4. package/android/app/proguard-rules.pro +14 -0
  5. package/android/app/src/debug/AndroidManifest.xml +9 -0
  6. package/android/app/src/main/AndroidManifest.xml +1 -2
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -139
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -3
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +108 -63
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +2 -33
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -109
  12. package/android/build.gradle +3 -0
  13. package/app.plugin.js +1 -0
  14. package/bin/code-push.js +6 -0
  15. package/cli/commands/bundleCommand/bundleCodePush.ts +118 -0
  16. package/cli/commands/bundleCommand/index.ts +34 -0
  17. package/cli/commands/createHistoryCommand/createReleaseHistory.ts +37 -0
  18. package/cli/commands/createHistoryCommand/createReleaseHistoryList.ts +40 -0
  19. package/cli/commands/createHistoryCommand/index.ts +44 -0
  20. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.ts +33 -0
  21. package/cli/commands/createPullRequestHistoryCommand/index.ts +31 -0
  22. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.ts +71 -0
  23. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.ts +75 -0
  24. package/cli/commands/createPullRequestReleaseCommand/index.ts +74 -0
  25. package/cli/commands/getPackageHashCommand/index.ts +45 -0
  26. package/cli/commands/initCommand/index.ts +14 -0
  27. package/cli/commands/initCommand/initAndroid.ts +91 -0
  28. package/cli/commands/initCommand/initIos.ts +123 -0
  29. package/cli/commands/initCommand/test/initAndroid.test.ts +128 -0
  30. package/cli/commands/initCommand/test/initIos.test.ts +99 -0
  31. package/cli/commands/releaseCommand/addToReleaseHistory.ts +57 -0
  32. package/cli/commands/releaseCommand/index.ts +90 -0
  33. package/cli/commands/releaseCommand/release.ts +105 -0
  34. package/cli/commands/removePullRequestHistoryCommand/index.ts +37 -0
  35. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.ts +28 -0
  36. package/cli/commands/showHistoryCommand/index.ts +31 -0
  37. package/cli/commands/updateHistoryCommand/index.ts +55 -0
  38. package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +42 -0
  39. package/cli/constant.ts +4 -0
  40. package/cli/dist/commands/bundleCommand/bundleCodePush.js +65 -0
  41. package/cli/dist/commands/bundleCommand/index.js +15 -0
  42. package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +25 -0
  43. package/cli/dist/commands/createHistoryCommand/createReleaseHistoryList.js +27 -0
  44. package/cli/dist/commands/createHistoryCommand/index.js +20 -0
  45. package/cli/dist/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +23 -0
  46. package/cli/dist/commands/createPullRequestHistoryCommand/index.js +15 -0
  47. package/cli/dist/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +51 -0
  48. package/cli/dist/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +39 -0
  49. package/cli/dist/commands/createPullRequestReleaseCommand/index.js +35 -0
  50. package/cli/dist/commands/getPackageHashCommand/index.js +26 -0
  51. package/cli/dist/commands/initCommand/index.js +12 -0
  52. package/cli/dist/commands/initCommand/initAndroid.js +73 -0
  53. package/cli/dist/commands/initCommand/initIos.js +108 -0
  54. package/cli/dist/commands/initCommand/test/initAndroid.test.js +113 -0
  55. package/cli/dist/commands/initCommand/test/initIos.test.js +95 -0
  56. package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +35 -0
  57. package/cli/dist/commands/releaseCommand/index.js +45 -0
  58. package/cli/dist/commands/releaseCommand/release.js +62 -0
  59. package/cli/dist/commands/removePullRequestHistoryCommand/index.js +19 -0
  60. package/cli/dist/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +18 -0
  61. package/cli/dist/commands/showHistoryCommand/index.js +15 -0
  62. package/cli/dist/commands/updateHistoryCommand/index.js +31 -0
  63. package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +28 -0
  64. package/cli/dist/constant.js +4 -0
  65. package/cli/dist/functions/getReactTempDir.js +10 -0
  66. package/cli/{functions → dist/functions}/makeCodePushBundle.js +5 -11
  67. package/cli/{functions → dist/functions}/prepareToBundleJS.js +2 -5
  68. package/cli/dist/functions/runExpoBundleCommand.js +35 -0
  69. package/cli/{functions → dist/functions}/runHermesEmitBinaryCommand.js +36 -71
  70. package/cli/{functions → dist/functions}/runReactNativeBundleCommand.js +19 -24
  71. package/cli/dist/index.js +54 -0
  72. package/cli/dist/utils/datetime.js +17 -0
  73. package/cli/dist/utils/file-utils.js +19 -0
  74. package/cli/dist/utils/fsUtils.js +44 -0
  75. package/cli/{utils → dist/utils}/hash-utils.js +19 -130
  76. package/cli/{utils → dist/utils}/promisfied-fs.js +5 -16
  77. package/cli/dist/utils/showLogo.js +21 -0
  78. package/cli/dist/utils/unzip.js +41 -0
  79. package/cli/{utils → dist/utils}/zip.js +15 -51
  80. package/cli/functions/{getReactTempDir.js → getReactTempDir.ts} +2 -6
  81. package/cli/functions/makeCodePushBundle.ts +26 -0
  82. package/cli/functions/prepareToBundleJS.ts +10 -0
  83. package/cli/functions/runExpoBundleCommand.ts +45 -0
  84. package/cli/functions/runHermesEmitBinaryCommand.ts +203 -0
  85. package/cli/functions/runReactNativeBundleCommand.ts +67 -0
  86. package/cli/index.ts +68 -0
  87. package/cli/package.json +35 -0
  88. package/cli/utils/datetime.ts +19 -0
  89. package/cli/utils/{file-utils.js → file-utils.ts} +4 -21
  90. package/cli/utils/fsUtils.ts +50 -0
  91. package/cli/utils/hash-utils.ts +143 -0
  92. package/cli/utils/promisfied-fs.ts +19 -0
  93. package/cli/utils/{showLogo.js → showLogo.ts} +4 -6
  94. package/cli/utils/unzip.ts +46 -0
  95. package/cli/utils/zip.ts +65 -0
  96. package/expo/plugin/withCodePush.js +14 -0
  97. package/expo/plugin/withCodePushAndroid.js +92 -0
  98. package/expo/plugin/withCodePushIos.js +143 -0
  99. package/ios/CodePush/CodePush.h +0 -16
  100. package/ios/CodePush/CodePush.m +30 -20
  101. package/ios/CodePush/CodePushConfig.m +1 -11
  102. package/ios/CodePush/CodePushPackage.m +12 -69
  103. package/ios/CodePush/CodePushUpdateUtils.m +1 -91
  104. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  105. package/ios/CodePush/SSZipArchive/README.md +1 -1
  106. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  107. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  108. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  109. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  110. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  111. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  112. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  113. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  114. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  115. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  116. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  117. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  118. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  119. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  120. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  121. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  122. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  138. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  139. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  140. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  141. package/ios/CodePush.xcodeproj/project.pbxproj +244 -453
  142. package/ios/PrivacyInfo.xcprivacy +31 -0
  143. package/package.json +67 -41
  144. package/react-native.config.js +1 -1
  145. package/{AlertAdapter.js → src/AlertAdapter.js} +5 -5
  146. package/src/CodePush.js +947 -0
  147. package/{package-mixins.js → src/package-mixins.js} +1 -1
  148. package/{versioning → src/versioning}/BaseVersioning.js +12 -1
  149. package/{versioning → src/versioning}/SemverVersioning.test.js +78 -0
  150. package/typings/react-native-code-push.d.ts +559 -495
  151. package/CONTRIBUTING.md +0 -134
  152. package/CodePush.js +0 -972
  153. package/SECURITY.md +0 -41
  154. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  155. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  156. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  157. package/android/codepush.gradle +0 -162
  158. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  159. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  160. package/android/gradlew +0 -164
  161. package/android/gradlew.bat +0 -90
  162. package/babel.config.js +0 -3
  163. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  164. package/cli/commands/bundleCommand/index.js +0 -55
  165. package/cli/commands/common.js +0 -245
  166. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  167. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  168. package/cli/commands/createHistoryCommand/index.js +0 -95
  169. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  170. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  171. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  172. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  173. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  174. package/cli/commands/getPackageHashCommand/index.js +0 -42
  175. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  176. package/cli/commands/releaseCommand/index.js +0 -151
  177. package/cli/commands/releaseCommand/release.js +0 -121
  178. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  179. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  180. package/cli/commands/showHistoryCommand/index.js +0 -88
  181. package/cli/commands/updateHistoryCommand/index.js +0 -123
  182. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  183. package/cli/constant.js +0 -8
  184. package/cli/index.js +0 -63
  185. package/cli/utils/datetime.js +0 -22
  186. package/cli/utils/fsUtils.js +0 -64
  187. package/cli/utils/version.js +0 -26
  188. package/code-push.config.example.supabase.ts +0 -114
  189. package/code-push.config.js +0 -229
  190. package/code-push.config.ts +0 -175
  191. package/docs/api-android.md +0 -83
  192. package/docs/api-ios.md +0 -31
  193. package/docs/api-js.md +0 -592
  194. package/docs/multi-deployment-testing-android.md +0 -148
  195. package/docs/multi-deployment-testing-ios.md +0 -59
  196. package/docs/setup-android.md +0 -482
  197. package/docs/setup-ios.md +0 -280
  198. package/eslint.config.mjs +0 -32
  199. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  200. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  201. package/ios/CodePush/Base64/README.md +0 -47
  202. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  203. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  204. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  207. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  208. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  209. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  210. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  211. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  212. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  213. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  215. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  216. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  217. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  224. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  225. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  226. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  232. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  233. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  234. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  242. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  243. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  244. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  245. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  246. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  247. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  248. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  249. package/ios/CodePush/JWT/LICENSE +0 -19
  250. package/ios/CodePush/JWT/README.md +0 -489
  251. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  252. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  253. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  254. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  255. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  256. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  257. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  258. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  259. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  260. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  261. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  262. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  263. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  264. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  265. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  266. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  267. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  268. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  269. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  271. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  272. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  273. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  274. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  275. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  276. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  277. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  278. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  279. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  280. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  281. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  282. package/scripts/generateBundledResourcesHash.js +0 -125
  283. package/scripts/getFilesInFolder.js +0 -19
  284. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  285. package/tsconfig.json +0 -20
  286. package/tslint.json +0 -32
  287. /package/{logging.js → src/logging.js} +0 -0
  288. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  289. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  290. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  291. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  292. /package/{versioning → src/versioning}/index.js +0 -0
@@ -1,548 +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
- #ifdef USE_VIA_ACE_IF_PRESENT
25
- # include "aes_via_ace.h"
26
- #endif
27
-
28
- #if defined(__cplusplus)
29
- extern "C"
30
- {
31
- #endif
32
-
33
- /* Initialise the key schedule from the user supplied key. The key
34
- length can be specified in bytes, with legal values of 16, 24
35
- and 32, or in bits, with legal values of 128, 192 and 256. These
36
- values correspond with Nk values of 4, 6 and 8 respectively.
37
-
38
- The following macros implement a single cycle in the key
39
- schedule generation process. The number of cycles needed
40
- for each cx->n_col and nk value is:
41
-
42
- nk = 4 5 6 7 8
43
- ------------------------------
44
- cx->n_col = 4 10 9 8 7 7
45
- cx->n_col = 5 14 11 10 9 9
46
- cx->n_col = 6 19 15 12 11 11
47
- cx->n_col = 7 21 19 16 13 14
48
- cx->n_col = 8 29 23 19 17 14
49
- */
50
-
51
- #if defined( REDUCE_CODE_SIZE )
52
- # define ls_box ls_sub
53
- uint_32t ls_sub(const uint_32t t, const uint_32t n);
54
- # define inv_mcol im_sub
55
- uint_32t im_sub(const uint_32t x);
56
- # ifdef ENC_KS_UNROLL
57
- # undef ENC_KS_UNROLL
58
- # endif
59
- # ifdef DEC_KS_UNROLL
60
- # undef DEC_KS_UNROLL
61
- # endif
62
- #endif
63
-
64
- #if (FUNCS_IN_C & ENC_KEYING_IN_C)
65
-
66
- #if defined(AES_128) || defined( AES_VAR )
67
-
68
- #define ke4(k,i) \
69
- { k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \
70
- k[4*(i)+5] = ss[1] ^= ss[0]; \
71
- k[4*(i)+6] = ss[2] ^= ss[1]; \
72
- k[4*(i)+7] = ss[3] ^= ss[2]; \
73
- }
74
-
75
- AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1])
76
- { uint_32t ss[4];
77
-
78
- cx->ks[0] = ss[0] = word_in(key, 0);
79
- cx->ks[1] = ss[1] = word_in(key, 1);
80
- cx->ks[2] = ss[2] = word_in(key, 2);
81
- cx->ks[3] = ss[3] = word_in(key, 3);
82
-
83
- #ifdef ENC_KS_UNROLL
84
- ke4(cx->ks, 0); ke4(cx->ks, 1);
85
- ke4(cx->ks, 2); ke4(cx->ks, 3);
86
- ke4(cx->ks, 4); ke4(cx->ks, 5);
87
- ke4(cx->ks, 6); ke4(cx->ks, 7);
88
- ke4(cx->ks, 8);
89
- #else
90
- { uint_32t i;
91
- for(i = 0; i < 9; ++i)
92
- ke4(cx->ks, i);
93
- }
94
- #endif
95
- ke4(cx->ks, 9);
96
- cx->inf.l = 0;
97
- cx->inf.b[0] = 10 * 16;
98
-
99
- #ifdef USE_VIA_ACE_IF_PRESENT
100
- if(VIA_ACE_AVAILABLE)
101
- cx->inf.b[1] = 0xff;
102
- #endif
103
- return EXIT_SUCCESS;
104
- }
105
-
106
- #endif
107
-
108
- #if defined(AES_192) || defined( AES_VAR )
109
-
110
- #define kef6(k,i) \
111
- { k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \
112
- k[6*(i)+ 7] = ss[1] ^= ss[0]; \
113
- k[6*(i)+ 8] = ss[2] ^= ss[1]; \
114
- k[6*(i)+ 9] = ss[3] ^= ss[2]; \
115
- }
116
-
117
- #define ke6(k,i) \
118
- { kef6(k,i); \
119
- k[6*(i)+10] = ss[4] ^= ss[3]; \
120
- k[6*(i)+11] = ss[5] ^= ss[4]; \
121
- }
122
-
123
- AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1])
124
- { uint_32t ss[6];
125
-
126
- cx->ks[0] = ss[0] = word_in(key, 0);
127
- cx->ks[1] = ss[1] = word_in(key, 1);
128
- cx->ks[2] = ss[2] = word_in(key, 2);
129
- cx->ks[3] = ss[3] = word_in(key, 3);
130
- cx->ks[4] = ss[4] = word_in(key, 4);
131
- cx->ks[5] = ss[5] = word_in(key, 5);
132
-
133
- #ifdef ENC_KS_UNROLL
134
- ke6(cx->ks, 0); ke6(cx->ks, 1);
135
- ke6(cx->ks, 2); ke6(cx->ks, 3);
136
- ke6(cx->ks, 4); ke6(cx->ks, 5);
137
- ke6(cx->ks, 6);
138
- #else
139
- { uint_32t i;
140
- for(i = 0; i < 7; ++i)
141
- ke6(cx->ks, i);
142
- }
143
- #endif
144
- kef6(cx->ks, 7);
145
- cx->inf.l = 0;
146
- cx->inf.b[0] = 12 * 16;
147
-
148
- #ifdef USE_VIA_ACE_IF_PRESENT
149
- if(VIA_ACE_AVAILABLE)
150
- cx->inf.b[1] = 0xff;
151
- #endif
152
- return EXIT_SUCCESS;
153
- }
154
-
155
- #endif
156
-
157
- #if defined(AES_256) || defined( AES_VAR )
158
-
159
- #define kef8(k,i) \
160
- { k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \
161
- k[8*(i)+ 9] = ss[1] ^= ss[0]; \
162
- k[8*(i)+10] = ss[2] ^= ss[1]; \
163
- k[8*(i)+11] = ss[3] ^= ss[2]; \
164
- }
165
-
166
- #define ke8(k,i) \
167
- { kef8(k,i); \
168
- k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); \
169
- k[8*(i)+13] = ss[5] ^= ss[4]; \
170
- k[8*(i)+14] = ss[6] ^= ss[5]; \
171
- k[8*(i)+15] = ss[7] ^= ss[6]; \
172
- }
173
-
174
- AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1])
175
- { uint_32t ss[8];
176
-
177
- cx->ks[0] = ss[0] = word_in(key, 0);
178
- cx->ks[1] = ss[1] = word_in(key, 1);
179
- cx->ks[2] = ss[2] = word_in(key, 2);
180
- cx->ks[3] = ss[3] = word_in(key, 3);
181
- cx->ks[4] = ss[4] = word_in(key, 4);
182
- cx->ks[5] = ss[5] = word_in(key, 5);
183
- cx->ks[6] = ss[6] = word_in(key, 6);
184
- cx->ks[7] = ss[7] = word_in(key, 7);
185
-
186
- #ifdef ENC_KS_UNROLL
187
- ke8(cx->ks, 0); ke8(cx->ks, 1);
188
- ke8(cx->ks, 2); ke8(cx->ks, 3);
189
- ke8(cx->ks, 4); ke8(cx->ks, 5);
190
- #else
191
- { uint_32t i;
192
- for(i = 0; i < 6; ++i)
193
- ke8(cx->ks, i);
194
- }
195
- #endif
196
- kef8(cx->ks, 6);
197
- cx->inf.l = 0;
198
- cx->inf.b[0] = 14 * 16;
199
-
200
- #ifdef USE_VIA_ACE_IF_PRESENT
201
- if(VIA_ACE_AVAILABLE)
202
- cx->inf.b[1] = 0xff;
203
- #endif
204
- return EXIT_SUCCESS;
205
- }
206
-
207
- #endif
208
-
209
- #if defined( AES_VAR )
210
-
211
- AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1])
212
- {
213
- switch(key_len)
214
- {
215
- case 16: case 128: return aes_encrypt_key128(key, cx);
216
- case 24: case 192: return aes_encrypt_key192(key, cx);
217
- case 32: case 256: return aes_encrypt_key256(key, cx);
218
- default: return EXIT_FAILURE;
219
- }
220
- }
221
-
222
- #endif
223
-
224
- #endif
225
-
226
- #if (FUNCS_IN_C & DEC_KEYING_IN_C)
227
-
228
- /* this is used to store the decryption round keys */
229
- /* in forward or reverse order */
230
-
231
- #ifdef AES_REV_DKS
232
- #define v(n,i) ((n) - (i) + 2 * ((i) & 3))
233
- #else
234
- #define v(n,i) (i)
235
- #endif
236
-
237
- #if DEC_ROUND == NO_TABLES
238
- #define ff(x) (x)
239
- #else
240
- #define ff(x) inv_mcol(x)
241
- #if defined( dec_imvars )
242
- #define d_vars dec_imvars
243
- #endif
244
- #endif
245
-
246
- #if defined(AES_128) || defined( AES_VAR )
247
-
248
- #define k4e(k,i) \
249
- { k[v(40,(4*(i))+4)] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \
250
- k[v(40,(4*(i))+5)] = ss[1] ^= ss[0]; \
251
- k[v(40,(4*(i))+6)] = ss[2] ^= ss[1]; \
252
- k[v(40,(4*(i))+7)] = ss[3] ^= ss[2]; \
253
- }
254
-
255
- #if 1
256
-
257
- #define kdf4(k,i) \
258
- { ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; \
259
- ss[1] = ss[1] ^ ss[3]; \
260
- ss[2] = ss[2] ^ ss[3]; \
261
- ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \
262
- ss[i % 4] ^= ss[4]; \
263
- ss[4] ^= k[v(40,(4*(i)))]; k[v(40,(4*(i))+4)] = ff(ss[4]); \
264
- ss[4] ^= k[v(40,(4*(i))+1)]; k[v(40,(4*(i))+5)] = ff(ss[4]); \
265
- ss[4] ^= k[v(40,(4*(i))+2)]; k[v(40,(4*(i))+6)] = ff(ss[4]); \
266
- ss[4] ^= k[v(40,(4*(i))+3)]; k[v(40,(4*(i))+7)] = ff(ss[4]); \
267
- }
268
-
269
- #define kd4(k,i) \
270
- { ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \
271
- ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
272
- k[v(40,(4*(i))+4)] = ss[4] ^= k[v(40,(4*(i)))]; \
273
- k[v(40,(4*(i))+5)] = ss[4] ^= k[v(40,(4*(i))+1)]; \
274
- k[v(40,(4*(i))+6)] = ss[4] ^= k[v(40,(4*(i))+2)]; \
275
- k[v(40,(4*(i))+7)] = ss[4] ^= k[v(40,(4*(i))+3)]; \
276
- }
277
-
278
- #define kdl4(k,i) \
279
- { ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \
280
- k[v(40,(4*(i))+4)] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; \
281
- k[v(40,(4*(i))+5)] = ss[1] ^ ss[3]; \
282
- k[v(40,(4*(i))+6)] = ss[0]; \
283
- k[v(40,(4*(i))+7)] = ss[1]; \
284
- }
285
-
286
- #else
287
-
288
- #define kdf4(k,i) \
289
- { ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ff(ss[0]); \
290
- ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ff(ss[1]); \
291
- ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ff(ss[2]); \
292
- ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ff(ss[3]); \
293
- }
294
-
295
- #define kd4(k,i) \
296
- { ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \
297
- ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[v(40,(4*(i))+ 4)] = ss[4] ^= k[v(40,(4*(i)))]; \
298
- ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[4] ^= k[v(40,(4*(i))+ 1)]; \
299
- ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[4] ^= k[v(40,(4*(i))+ 2)]; \
300
- ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[4] ^= k[v(40,(4*(i))+ 3)]; \
301
- }
302
-
303
- #define kdl4(k,i) \
304
- { ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ss[0]; \
305
- ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[1]; \
306
- ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[2]; \
307
- ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[3]; \
308
- }
309
-
310
- #endif
311
-
312
- AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1])
313
- { uint_32t ss[5];
314
- #if defined( d_vars )
315
- d_vars;
316
- #endif
317
- cx->ks[v(40,(0))] = ss[0] = word_in(key, 0);
318
- cx->ks[v(40,(1))] = ss[1] = word_in(key, 1);
319
- cx->ks[v(40,(2))] = ss[2] = word_in(key, 2);
320
- cx->ks[v(40,(3))] = ss[3] = word_in(key, 3);
321
-
322
- #ifdef DEC_KS_UNROLL
323
- kdf4(cx->ks, 0); kd4(cx->ks, 1);
324
- kd4(cx->ks, 2); kd4(cx->ks, 3);
325
- kd4(cx->ks, 4); kd4(cx->ks, 5);
326
- kd4(cx->ks, 6); kd4(cx->ks, 7);
327
- kd4(cx->ks, 8); kdl4(cx->ks, 9);
328
- #else
329
- { uint_32t i;
330
- for(i = 0; i < 10; ++i)
331
- k4e(cx->ks, i);
332
- #if !(DEC_ROUND == NO_TABLES)
333
- for(i = N_COLS; i < 10 * N_COLS; ++i)
334
- cx->ks[i] = inv_mcol(cx->ks[i]);
335
- #endif
336
- }
337
- #endif
338
- cx->inf.l = 0;
339
- cx->inf.b[0] = 10 * 16;
340
-
341
- #ifdef USE_VIA_ACE_IF_PRESENT
342
- if(VIA_ACE_AVAILABLE)
343
- cx->inf.b[1] = 0xff;
344
- #endif
345
- return EXIT_SUCCESS;
346
- }
347
-
348
- #endif
349
-
350
- #if defined(AES_192) || defined( AES_VAR )
351
-
352
- #define k6ef(k,i) \
353
- { k[v(48,(6*(i))+ 6)] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \
354
- k[v(48,(6*(i))+ 7)] = ss[1] ^= ss[0]; \
355
- k[v(48,(6*(i))+ 8)] = ss[2] ^= ss[1]; \
356
- k[v(48,(6*(i))+ 9)] = ss[3] ^= ss[2]; \
357
- }
358
-
359
- #define k6e(k,i) \
360
- { k6ef(k,i); \
361
- k[v(48,(6*(i))+10)] = ss[4] ^= ss[3]; \
362
- k[v(48,(6*(i))+11)] = ss[5] ^= ss[4]; \
363
- }
364
-
365
- #define kdf6(k,i) \
366
- { ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ff(ss[0]); \
367
- ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ff(ss[1]); \
368
- ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ff(ss[2]); \
369
- ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ff(ss[3]); \
370
- ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ff(ss[4]); \
371
- ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ff(ss[5]); \
372
- }
373
-
374
- #define kd6(k,i) \
375
- { ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \
376
- ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[v(48,(6*(i))+ 6)] = ss[6] ^= k[v(48,(6*(i)))]; \
377
- ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[6] ^= k[v(48,(6*(i))+ 1)]; \
378
- ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[6] ^= k[v(48,(6*(i))+ 2)]; \
379
- ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[6] ^= k[v(48,(6*(i))+ 3)]; \
380
- ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ss[6] ^= k[v(48,(6*(i))+ 4)]; \
381
- ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ss[6] ^= k[v(48,(6*(i))+ 5)]; \
382
- }
383
-
384
- #define kdl6(k,i) \
385
- { ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ss[0]; \
386
- ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[1]; \
387
- ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[2]; \
388
- ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[3]; \
389
- }
390
-
391
- AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1])
392
- { uint_32t ss[7];
393
- #if defined( d_vars )
394
- d_vars;
395
- #endif
396
- cx->ks[v(48,(0))] = ss[0] = word_in(key, 0);
397
- cx->ks[v(48,(1))] = ss[1] = word_in(key, 1);
398
- cx->ks[v(48,(2))] = ss[2] = word_in(key, 2);
399
- cx->ks[v(48,(3))] = ss[3] = word_in(key, 3);
400
-
401
- #ifdef DEC_KS_UNROLL
402
- cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4));
403
- cx->ks[v(48,(5))] = ff(ss[5] = word_in(key, 5));
404
- kdf6(cx->ks, 0); kd6(cx->ks, 1);
405
- kd6(cx->ks, 2); kd6(cx->ks, 3);
406
- kd6(cx->ks, 4); kd6(cx->ks, 5);
407
- kd6(cx->ks, 6); kdl6(cx->ks, 7);
408
- #else
409
- cx->ks[v(48,(4))] = ss[4] = word_in(key, 4);
410
- cx->ks[v(48,(5))] = ss[5] = word_in(key, 5);
411
- { uint_32t i;
412
-
413
- for(i = 0; i < 7; ++i)
414
- k6e(cx->ks, i);
415
- k6ef(cx->ks, 7);
416
- #if !(DEC_ROUND == NO_TABLES)
417
- for(i = N_COLS; i < 12 * N_COLS; ++i)
418
- cx->ks[i] = inv_mcol(cx->ks[i]);
419
- #endif
420
- }
421
- #endif
422
- cx->inf.l = 0;
423
- cx->inf.b[0] = 12 * 16;
424
-
425
- #ifdef USE_VIA_ACE_IF_PRESENT
426
- if(VIA_ACE_AVAILABLE)
427
- cx->inf.b[1] = 0xff;
428
- #endif
429
- return EXIT_SUCCESS;
430
- }
431
-
432
- #endif
433
-
434
- #if defined(AES_256) || defined( AES_VAR )
435
-
436
- #define k8ef(k,i) \
437
- { k[v(56,(8*(i))+ 8)] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \
438
- k[v(56,(8*(i))+ 9)] = ss[1] ^= ss[0]; \
439
- k[v(56,(8*(i))+10)] = ss[2] ^= ss[1]; \
440
- k[v(56,(8*(i))+11)] = ss[3] ^= ss[2]; \
441
- }
442
-
443
- #define k8e(k,i) \
444
- { k8ef(k,i); \
445
- k[v(56,(8*(i))+12)] = ss[4] ^= ls_box(ss[3],0); \
446
- k[v(56,(8*(i))+13)] = ss[5] ^= ss[4]; \
447
- k[v(56,(8*(i))+14)] = ss[6] ^= ss[5]; \
448
- k[v(56,(8*(i))+15)] = ss[7] ^= ss[6]; \
449
- }
450
-
451
- #define kdf8(k,i) \
452
- { ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ff(ss[0]); \
453
- ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ff(ss[1]); \
454
- ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ff(ss[2]); \
455
- ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ff(ss[3]); \
456
- ss[4] ^= ls_box(ss[3],0); k[v(56,(8*(i))+12)] = ff(ss[4]); \
457
- ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ff(ss[5]); \
458
- ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ff(ss[6]); \
459
- ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ff(ss[7]); \
460
- }
461
-
462
- #define kd8(k,i) \
463
- { ss[8] = ls_box(ss[7],3) ^ t_use(r,c)[i]; \
464
- ss[0] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+ 8)] = ss[8] ^= k[v(56,(8*(i)))]; \
465
- ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[8] ^= k[v(56,(8*(i))+ 1)]; \
466
- ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[8] ^= k[v(56,(8*(i))+ 2)]; \
467
- ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[8] ^= k[v(56,(8*(i))+ 3)]; \
468
- ss[8] = ls_box(ss[3],0); \
469
- ss[4] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+12)] = ss[8] ^= k[v(56,(8*(i))+ 4)]; \
470
- ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ss[8] ^= k[v(56,(8*(i))+ 5)]; \
471
- ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ss[8] ^= k[v(56,(8*(i))+ 6)]; \
472
- ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ss[8] ^= k[v(56,(8*(i))+ 7)]; \
473
- }
474
-
475
- #define kdl8(k,i) \
476
- { ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ss[0]; \
477
- ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[1]; \
478
- ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[2]; \
479
- ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[3]; \
480
- }
481
-
482
- AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1])
483
- { uint_32t ss[9];
484
- #if defined( d_vars )
485
- d_vars;
486
- #endif
487
- cx->ks[v(56,(0))] = ss[0] = word_in(key, 0);
488
- cx->ks[v(56,(1))] = ss[1] = word_in(key, 1);
489
- cx->ks[v(56,(2))] = ss[2] = word_in(key, 2);
490
- cx->ks[v(56,(3))] = ss[3] = word_in(key, 3);
491
-
492
- #ifdef DEC_KS_UNROLL
493
- cx->ks[v(56,(4))] = ff(ss[4] = word_in(key, 4));
494
- cx->ks[v(56,(5))] = ff(ss[5] = word_in(key, 5));
495
- cx->ks[v(56,(6))] = ff(ss[6] = word_in(key, 6));
496
- cx->ks[v(56,(7))] = ff(ss[7] = word_in(key, 7));
497
- kdf8(cx->ks, 0); kd8(cx->ks, 1);
498
- kd8(cx->ks, 2); kd8(cx->ks, 3);
499
- kd8(cx->ks, 4); kd8(cx->ks, 5);
500
- kdl8(cx->ks, 6);
501
- #else
502
- cx->ks[v(56,(4))] = ss[4] = word_in(key, 4);
503
- cx->ks[v(56,(5))] = ss[5] = word_in(key, 5);
504
- cx->ks[v(56,(6))] = ss[6] = word_in(key, 6);
505
- cx->ks[v(56,(7))] = ss[7] = word_in(key, 7);
506
- { uint_32t i;
507
-
508
- for(i = 0; i < 6; ++i)
509
- k8e(cx->ks, i);
510
- k8ef(cx->ks, 6);
511
- #if !(DEC_ROUND == NO_TABLES)
512
- for(i = N_COLS; i < 14 * N_COLS; ++i)
513
- cx->ks[i] = inv_mcol(cx->ks[i]);
514
- #endif
515
- }
516
- #endif
517
- cx->inf.l = 0;
518
- cx->inf.b[0] = 14 * 16;
519
-
520
- #ifdef USE_VIA_ACE_IF_PRESENT
521
- if(VIA_ACE_AVAILABLE)
522
- cx->inf.b[1] = 0xff;
523
- #endif
524
- return EXIT_SUCCESS;
525
- }
526
-
527
- #endif
528
-
529
- #if defined( AES_VAR )
530
-
531
- AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1])
532
- {
533
- switch(key_len)
534
- {
535
- case 16: case 128: return aes_decrypt_key128(key, cx);
536
- case 24: case 192: return aes_decrypt_key192(key, cx);
537
- case 32: case 256: return aes_decrypt_key256(key, cx);
538
- default: return EXIT_FAILURE;
539
- }
540
- }
541
-
542
- #endif
543
-
544
- #endif
545
-
546
- #if defined(__cplusplus)
547
- }
548
- #endif