@appzung/react-native-code-push 7.1.1 → 9.0.2

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 (97) hide show
  1. package/.azurepipelines/build-rn-code-push-1es.yml +104 -0
  2. package/.azurepipelines/test-rn-code-push.yml +94 -0
  3. package/.config/CredScanSuppressions.json +14 -0
  4. package/CONTRIBUTING.md +3 -3
  5. package/CodePush.js +20 -21
  6. package/CodePush.podspec +3 -3
  7. package/README.md +7 -5
  8. package/android/app/build.gradle +3 -1
  9. package/android/app/src/main/AndroidManifest.xml +2 -7
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -5
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +1 -0
  12. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +9 -1
  13. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +18 -10
  14. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +3 -1
  15. package/android/build.gradle +6 -2
  16. package/android/codepush.gradle +72 -26
  17. package/docs/api-js.md +1 -1
  18. package/docs/setup-android.md +27 -3
  19. package/docs/setup-ios.md +1 -1
  20. package/docs/setup-windows.md +23 -0
  21. package/ios/CodePush/CodePush.m +2 -1
  22. package/ios/CodePush/CodePushPackage.m +4 -0
  23. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  24. package/ios/CodePush/SSZipArchive/README.md +1 -1
  25. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  26. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  27. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  28. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  29. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  30. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  31. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  32. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  33. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  34. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  35. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  36. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  37. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  38. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  39. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  40. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  41. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  42. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  43. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  44. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  45. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  46. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  47. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  48. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  49. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  50. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  51. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  52. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  53. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  54. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  55. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  56. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  57. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  58. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  59. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  60. package/ios/CodePush.xcodeproj/project.pbxproj +245 -130
  61. package/ios/PrivacyInfo.xcprivacy +31 -0
  62. package/package.json +2 -2
  63. package/typings/react-native-code-push.d.ts +1 -1
  64. package/windows/CodePush/CodePush.vcxproj +2 -3
  65. package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +2 -2
  66. package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +2 -2
  67. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  68. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  69. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  70. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  71. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  72. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  73. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  74. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  75. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  76. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  77. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  78. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  79. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  80. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  81. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  82. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  83. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  84. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  85. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  86. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  87. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  88. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  89. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  90. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  91. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  92. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  93. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  94. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  95. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  96. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  97. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
@@ -1,103 +0,0 @@
1
- /*
2
- ---------------------------------------------------------------------------
3
- Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
4
-
5
- LICENSE TERMS
6
-
7
- The free distribution and use of this software in both source and binary
8
- form is allowed (with or without changes) provided that:
9
-
10
- 1. distributions of this source code include the above copyright
11
- notice, this list of conditions and the following disclaimer;
12
-
13
- 2. distributions in binary form include the above copyright
14
- notice, this list of conditions and the following disclaimer
15
- in the documentation and/or other associated materials;
16
-
17
- 3. the copyright holder's name is not used to endorse products
18
- built using this software without specific written permission.
19
-
20
- ALTERNATIVELY, provided that this notice is retained in full, this product
21
- may be distributed under the terms of the GNU General Public License (GPL),
22
- in which case the provisions of the GPL apply INSTEAD OF those given above.
23
-
24
- DISCLAIMER
25
-
26
- This software is provided 'as is' with no explicit or implied warranties
27
- in respect of its properties, including, but not limited to, correctness
28
- and/or fitness for purpose.
29
- ---------------------------------------------------------------------------
30
- Issue Date: 26/08/2003
31
-
32
- This is an implementation of HMAC, the FIPS standard keyed hash function
33
- */
34
-
35
- #ifndef _HMAC_H
36
- #define _HMAC_H
37
-
38
- #include <memory.h>
39
-
40
- #if defined(__cplusplus)
41
- extern "C"
42
- {
43
- #endif
44
-
45
- #define USE_SHA1
46
-
47
- #if !defined(USE_SHA1) && !defined(USE_SHA256)
48
- #error define USE_SHA1 or USE_SHA256 to set the HMAC hash algorithm
49
- #endif
50
-
51
- #ifdef USE_SHA1
52
-
53
- #include "sha1.h"
54
-
55
- #define HASH_INPUT_SIZE SHA1_BLOCK_SIZE
56
- #define HASH_OUTPUT_SIZE SHA1_DIGEST_SIZE
57
- #define sha_ctx sha1_ctx
58
- #define sha_begin sha1_begin
59
- #define sha_hash sha1_hash
60
- #define sha_end sha1_end
61
-
62
- #endif
63
-
64
- #ifdef USE_SHA256
65
-
66
- #include "sha2.h"
67
-
68
- #define HASH_INPUT_SIZE SHA256_BLOCK_SIZE
69
- #define HASH_OUTPUT_SIZE SHA256_DIGEST_SIZE
70
- #define sha_ctx sha256_ctx
71
- #define sha_begin sha256_begin
72
- #define sha_hash sha256_hash
73
- #define sha_end sha256_end
74
-
75
- #endif
76
-
77
- #define HMAC_OK 0
78
- #define HMAC_BAD_MODE -1
79
- #define HMAC_IN_DATA 0xffffffff
80
-
81
- typedef struct
82
- { unsigned char key[HASH_INPUT_SIZE];
83
- sha_ctx ctx[1];
84
- unsigned long klen;
85
- } hmac_ctx;
86
-
87
- void hmac_sha_begin(hmac_ctx cx[1]);
88
-
89
- int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]);
90
-
91
- void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]);
92
-
93
- void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]);
94
-
95
- void hmac_sha(const unsigned char key[], unsigned long key_len,
96
- const unsigned char data[], unsigned long data_len,
97
- unsigned char mac[], unsigned long mac_len);
98
-
99
- #if defined(__cplusplus)
100
- }
101
- #endif
102
-
103
- #endif
@@ -1,155 +0,0 @@
1
- /*
2
- ---------------------------------------------------------------------------
3
- Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
4
- All rights reserved.
5
-
6
- LICENSE TERMS
7
-
8
- The free distribution and use of this software in both source and binary
9
- form is allowed (with or without changes) provided that:
10
-
11
- 1. distributions of this source code include the above copyright
12
- notice, this list of conditions and the following disclaimer;
13
-
14
- 2. distributions in binary form include the above copyright
15
- notice, this list of conditions and the following disclaimer
16
- in the documentation and/or other associated materials;
17
-
18
- 3. the copyright holder's name is not used to endorse products
19
- built using this software without specific written permission.
20
-
21
- ALTERNATIVELY, provided that this notice is retained in full, this product
22
- may be distributed under the terms of the GNU General Public License (GPL),
23
- in which case the provisions of the GPL apply INSTEAD OF those given above.
24
-
25
- DISCLAIMER
26
-
27
- This software is provided 'as is' with no explicit or implied warranties
28
- in respect of its properties, including, but not limited to, correctness
29
- and/or fitness for purpose.
30
- ---------------------------------------------------------------------------
31
- Issue Date: 24/01/2003
32
-
33
- This file implements a random data pool based on the use of an external
34
- entropy function. It is based on the ideas advocated by Peter Gutmann in
35
- his work on pseudo random sequence generators. It is not a 'paranoid'
36
- random sequence generator and no attempt is made to protect the pool
37
- from prying eyes either by memory locking or by techniques to obscure
38
- its location in memory.
39
- */
40
-
41
- #include <memory.h>
42
- #include "prng.h"
43
-
44
- #if defined(__cplusplus)
45
- extern "C"
46
- {
47
- #endif
48
-
49
- /* mix a random data pool using the SHA1 compression function (as */
50
- /* suggested by Peter Gutmann in his paper on random pools) */
51
-
52
- static void prng_mix(unsigned char buf[])
53
- { unsigned int i, len;
54
- sha1_ctx ctx[1];
55
-
56
- /*lint -e{663} unusual array to pointer conversion */
57
- for(i = 0; i < PRNG_POOL_SIZE; i += SHA1_DIGEST_SIZE)
58
- {
59
- /* copy digest size pool block into SHA1 hash block */
60
- memcpy(ctx->hash, buf + (i ? i : PRNG_POOL_SIZE)
61
- - SHA1_DIGEST_SIZE, SHA1_DIGEST_SIZE);
62
-
63
- /* copy data from pool into the SHA1 data buffer */
64
- len = PRNG_POOL_SIZE - i;
65
- memcpy(ctx->wbuf, buf + i, (len > SHA1_BLOCK_SIZE ? SHA1_BLOCK_SIZE : len));
66
-
67
- if(len < SHA1_BLOCK_SIZE)
68
- memcpy(((char*)ctx->wbuf) + len, buf, SHA1_BLOCK_SIZE - len);
69
-
70
- /* compress using the SHA1 compression function */
71
- sha1_compile(ctx);
72
-
73
- /* put digest size block back into the random pool */
74
- memcpy(buf + i, ctx->hash, SHA1_DIGEST_SIZE);
75
- }
76
- }
77
-
78
- /* refresh the output buffer and update the random pool by adding */
79
- /* entropy and remixing */
80
-
81
- static void update_pool(prng_ctx ctx[1])
82
- { unsigned int i = 0;
83
-
84
- /* transfer random pool data to the output buffer */
85
- memcpy(ctx->obuf, ctx->rbuf, PRNG_POOL_SIZE);
86
-
87
- /* enter entropy data into the pool */
88
- while(i < PRNG_POOL_SIZE)
89
- i += ctx->entropy(ctx->rbuf + i, PRNG_POOL_SIZE - i);
90
-
91
- /* invert and xor the original pool data into the pool */
92
- for(i = 0; i < PRNG_POOL_SIZE; ++i)
93
- ctx->rbuf[i] ^= ~ctx->obuf[i];
94
-
95
- /* mix the pool and the output buffer */
96
- prng_mix(ctx->rbuf);
97
- prng_mix(ctx->obuf);
98
- }
99
-
100
- void prng_init(prng_entropy_fn fun, prng_ctx ctx[1])
101
- { int i;
102
-
103
- /* clear the buffers and the counter in the context */
104
- memset(ctx, 0, sizeof(prng_ctx));
105
-
106
- /* set the pointer to the entropy collection function */
107
- ctx->entropy = fun;
108
-
109
- /* initialise the random data pool */
110
- update_pool(ctx);
111
-
112
- /* mix the pool a minimum number of times */
113
- for(i = 0; i < PRNG_MIN_MIX; ++i)
114
- prng_mix(ctx->rbuf);
115
-
116
- /* update the pool to prime the pool output buffer */
117
- update_pool(ctx);
118
- }
119
-
120
- /* provide random bytes from the random data pool */
121
-
122
- void prng_rand(unsigned char data[], unsigned int data_len, prng_ctx ctx[1])
123
- { unsigned char *rp = data;
124
- unsigned int len, pos = ctx->pos;
125
-
126
- while(data_len)
127
- {
128
- /* transfer 'data_len' bytes (or the number of bytes remaining */
129
- /* the pool output buffer if less) into the output */
130
- len = (data_len < PRNG_POOL_SIZE - pos ? data_len : PRNG_POOL_SIZE - pos);
131
- memcpy(rp, ctx->obuf + pos, len);
132
- rp += len; /* update ouput buffer position pointer */
133
- pos += len; /* update pool output buffer pointer */
134
- data_len -= len; /* update the remaining data count */
135
-
136
- /* refresh the random pool if necessary */
137
- if(pos == PRNG_POOL_SIZE)
138
- {
139
- update_pool(ctx); pos = 0;
140
- }
141
- }
142
-
143
- ctx->pos = pos;
144
- }
145
-
146
- void prng_end(prng_ctx ctx[1])
147
- {
148
- /* ensure the data in the context is destroyed */
149
- memset(ctx, 0, sizeof(prng_ctx));
150
- }
151
-
152
- #if defined(__cplusplus)
153
- }
154
- #endif
155
-
@@ -1,82 +0,0 @@
1
- /*
2
- ---------------------------------------------------------------------------
3
- Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
4
- All rights reserved.
5
-
6
- LICENSE TERMS
7
-
8
- The free distribution and use of this software in both source and binary
9
- form is allowed (with or without changes) provided that:
10
-
11
- 1. distributions of this source code include the above copyright
12
- notice, this list of conditions and the following disclaimer;
13
-
14
- 2. distributions in binary form include the above copyright
15
- notice, this list of conditions and the following disclaimer
16
- in the documentation and/or other associated materials;
17
-
18
- 3. the copyright holder's name is not used to endorse products
19
- built using this software without specific written permission.
20
-
21
- ALTERNATIVELY, provided that this notice is retained in full, this product
22
- may be distributed under the terms of the GNU General Public License (GPL),
23
- in which case the provisions of the GPL apply INSTEAD OF those given above.
24
-
25
- DISCLAIMER
26
-
27
- This software is provided 'as is' with no explicit or implied warranties
28
- in respect of its properties, including, but not limited to, correctness
29
- and/or fitness for purpose.
30
- ---------------------------------------------------------------------------
31
- Issue Date: 24/01/2003
32
-
33
- This is the header file for an implementation of a random data pool based on
34
- the use of an external entropy function (inspired by Peter Gutmann's work).
35
- */
36
-
37
- #ifndef _PRNG_H
38
- #define _PRNG_H
39
-
40
- #include "sha1.h"
41
-
42
- #define PRNG_POOL_LEN 256 /* minimum random pool size */
43
- #define PRNG_MIN_MIX 20 /* min initial pool mixing iterations */
44
-
45
- /* ensure that pool length is a multiple of the SHA1 digest size */
46
-
47
- #define PRNG_POOL_SIZE (SHA1_DIGEST_SIZE * (1 + (PRNG_POOL_LEN - 1) / SHA1_DIGEST_SIZE))
48
-
49
- #if defined(__cplusplus)
50
- extern "C"
51
- {
52
- #endif
53
-
54
- /* A function for providing entropy is a parameter in the prng_init() */
55
- /* call. This function has the following form and returns a maximum */
56
- /* of 'len' bytes of pseudo random data in the buffer 'buf'. It can */
57
- /* return less than 'len' bytes but will be repeatedly called for more */
58
- /* data in this case. */
59
-
60
- typedef int (*prng_entropy_fn)(unsigned char buf[], unsigned int len);
61
-
62
- typedef struct
63
- { unsigned char rbuf[PRNG_POOL_SIZE]; /* the random pool */
64
- unsigned char obuf[PRNG_POOL_SIZE]; /* pool output buffer */
65
- unsigned int pos; /* output buffer position */
66
- prng_entropy_fn entropy; /* entropy function pointer */
67
- } prng_ctx;
68
-
69
- /* initialise the random stream generator */
70
- void prng_init(prng_entropy_fn fun, prng_ctx ctx[1]);
71
-
72
- /* obtain random bytes from the generator */
73
- void prng_rand(unsigned char data[], unsigned int data_len, prng_ctx ctx[1]);
74
-
75
- /* close the random stream generator */
76
- void prng_end(prng_ctx ctx[1]);
77
-
78
- #if defined(__cplusplus)
79
- }
80
- #endif
81
-
82
- #endif
@@ -1,103 +0,0 @@
1
- /*
2
- ---------------------------------------------------------------------------
3
- Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
4
-
5
- LICENSE TERMS
6
-
7
- The free distribution and use of this software in both source and binary
8
- form is allowed (with or without changes) provided that:
9
-
10
- 1. distributions of this source code include the above copyright
11
- notice, this list of conditions and the following disclaimer;
12
-
13
- 2. distributions in binary form include the above copyright
14
- notice, this list of conditions and the following disclaimer
15
- in the documentation and/or other associated materials;
16
-
17
- 3. the copyright holder's name is not used to endorse products
18
- built using this software without specific written permission.
19
-
20
- ALTERNATIVELY, provided that this notice is retained in full, this product
21
- may be distributed under the terms of the GNU General Public License (GPL),
22
- in which case the provisions of the GPL apply INSTEAD OF those given above.
23
-
24
- DISCLAIMER
25
-
26
- This software is provided 'as is' with no explicit or implied warranties
27
- in respect of its properties, including, but not limited to, correctness
28
- and/or fitness for purpose.
29
- ---------------------------------------------------------------------------
30
- Issue Date: 26/08/2003
31
-
32
- This is an implementation of RFC2898, which specifies key derivation from
33
- a password and a salt value.
34
- */
35
-
36
- #include <memory.h>
37
- #include "hmac.h"
38
-
39
- #if defined(__cplusplus)
40
- extern "C"
41
- {
42
- #endif
43
-
44
- void derive_key(const unsigned char pwd[], /* the PASSWORD */
45
- unsigned int pwd_len, /* and its length */
46
- const unsigned char salt[], /* the SALT and its */
47
- unsigned int salt_len, /* length */
48
- unsigned int iter, /* the number of iterations */
49
- unsigned char key[], /* space for the output key */
50
- unsigned int key_len)/* and its required length */
51
- {
52
- unsigned int i, j, k, n_blk;
53
- unsigned char uu[HASH_OUTPUT_SIZE], ux[HASH_OUTPUT_SIZE];
54
- hmac_ctx c1[1], c2[1], c3[1];
55
-
56
- /* set HMAC context (c1) for password */
57
- hmac_sha_begin(c1);
58
- hmac_sha_key(pwd, pwd_len, c1);
59
-
60
- /* set HMAC context (c2) for password and salt */
61
- memcpy(c2, c1, sizeof(hmac_ctx));
62
- hmac_sha_data(salt, salt_len, c2);
63
-
64
- /* find the number of SHA blocks in the key */
65
- n_blk = 1 + (key_len - 1) / HASH_OUTPUT_SIZE;
66
-
67
- for(i = 0; i < n_blk; ++i) /* for each block in key */
68
- {
69
- /* ux[] holds the running xor value */
70
- memset(ux, 0, HASH_OUTPUT_SIZE);
71
-
72
- /* set HMAC context (c3) for password and salt */
73
- memcpy(c3, c2, sizeof(hmac_ctx));
74
-
75
- /* enter additional data for 1st block into uu */
76
- uu[0] = (unsigned char)((i + 1) >> 24);
77
- uu[1] = (unsigned char)((i + 1) >> 16);
78
- uu[2] = (unsigned char)((i + 1) >> 8);
79
- uu[3] = (unsigned char)(i + 1);
80
-
81
- /* this is the key mixing iteration */
82
- for(j = 0, k = 4; j < iter; ++j)
83
- {
84
- /* add previous round data to HMAC */
85
- hmac_sha_data(uu, k, c3);
86
-
87
- /* obtain HMAC for uu[] */
88
- hmac_sha_end(uu, HASH_OUTPUT_SIZE, c3);
89
-
90
- /* xor into the running xor block */
91
- for(k = 0; k < HASH_OUTPUT_SIZE; ++k)
92
- ux[k] ^= uu[k];
93
-
94
- /* set HMAC context (c3) for password */
95
- memcpy(c3, c1, sizeof(hmac_ctx));
96
- }
97
-
98
- /* compile key blocks into the key output */
99
- j = 0; k = i * HASH_OUTPUT_SIZE;
100
- while(j < HASH_OUTPUT_SIZE && k < key_len)
101
- key[k++] = ux[j++];
102
- }
103
- }
@@ -1,57 +0,0 @@
1
- /*
2
- ---------------------------------------------------------------------------
3
- Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
4
-
5
- LICENSE TERMS
6
-
7
- The free distribution and use of this software in both source and binary
8
- form is allowed (with or without changes) provided that:
9
-
10
- 1. distributions of this source code include the above copyright
11
- notice, this list of conditions and the following disclaimer;
12
-
13
- 2. distributions in binary form include the above copyright
14
- notice, this list of conditions and the following disclaimer
15
- in the documentation and/or other associated materials;
16
-
17
- 3. the copyright holder's name is not used to endorse products
18
- built using this software without specific written permission.
19
-
20
- ALTERNATIVELY, provided that this notice is retained in full, this product
21
- may be distributed under the terms of the GNU General Public License (GPL),
22
- in which case the provisions of the GPL apply INSTEAD OF those given above.
23
-
24
- DISCLAIMER
25
-
26
- This software is provided 'as is' with no explicit or implied warranties
27
- in respect of its properties, including, but not limited to, correctness
28
- and/or fitness for purpose.
29
- ---------------------------------------------------------------------------
30
- Issue Date: 26/08/2003
31
-
32
- This is an implementation of RFC2898, which specifies key derivation from
33
- a password and a salt value.
34
- */
35
-
36
- #ifndef PWD2KEY_H
37
- #define PWD2KEY_H
38
-
39
- #if defined(__cplusplus)
40
- extern "C"
41
- {
42
- #endif
43
-
44
- void derive_key(
45
- const unsigned char pwd[], /* the PASSWORD, and */
46
- unsigned int pwd_len, /* its length */
47
- const unsigned char salt[], /* the SALT and its */
48
- unsigned int salt_len, /* length */
49
- unsigned int iter, /* the number of iterations */
50
- unsigned char key[], /* space for the output key */
51
- unsigned int key_len); /* and its required length */
52
-
53
- #if defined(__cplusplus)
54
- }
55
- #endif
56
-
57
- #endif