Compare commits
857 Commits
inactive/z
...
mqtt_clien
| Author | SHA1 | Date | |
|---|---|---|---|
| a2f73d053c | |||
| 6a6cfe1efe | |||
| f52fd45936 | |||
| 88d4a8e74d | |||
| 6ddc7263e8 | |||
| a16f629dc5 | |||
| 5868e0ec9d | |||
| 3102b985d5 | |||
| 93547beb38 | |||
| 5794eac20a | |||
| edb7189013 | |||
| dc16a0c903 | |||
| 96c22e1184 | |||
| 4537e40832 | |||
| 6efe77a395 | |||
| 6cfc4524f0 | |||
| fe3b30bd49 | |||
|
a1be5be5a1
|
|||
|
99c99c39c2
|
|||
| ba63e72bfa | |||
| 79fa549201 | |||
| 35140ee002 | |||
| f0c8bfef0a | |||
| ba57aa0144 | |||
| ccbf86f781 | |||
| ac415ebbb6 | |||
| c02b627d47 | |||
| 9dc1af921c | |||
| e761625eab | |||
| 449978bda0 | |||
| fe01c353e6 | |||
| 9f57f0107e | |||
| ac877f1024 | |||
| 8ccc05ee78 | |||
| 2798d7de9c | |||
| feb86b15f8 | |||
| 767bb2b382 | |||
| 3e5714a5e1 | |||
| 6e4a64e64a | |||
| 40cdc90131 | |||
| d758cea974 | |||
| ed13838237 | |||
| 07ae277f9e | |||
| 46f86b6591 | |||
| 9588b48105 | |||
| 1739836a18 | |||
| 7195734765 | |||
| 8ecec6b914 | |||
| 9029bcf099 | |||
| 6f1660fd9e | |||
| f50a3abc8e | |||
| 8c15113cb0 | |||
| 4253acb72b | |||
| e22630b1bd | |||
| 563d9c5487 | |||
| 34bc322b9b | |||
| 6c3c763934 | |||
| 4d841787fc | |||
| 790246afea | |||
| 978e350722 | |||
| 1d76cacae2 | |||
| db954ffdaa | |||
| 8d6ae976a3 | |||
| e767fae934 | |||
| 5db97ca959 | |||
| daab41e41e | |||
| a61c8477c7 | |||
| 788ad8f2c0 | |||
| 78afc179c4 | |||
| 69ec4c9837 | |||
| 2368de6e93 | |||
| e5df76ab1d | |||
| fdec0e66a8 | |||
| 5f3baa5580 | |||
| 7083b2c32b | |||
| af02684dc5 | |||
| 2806086558 | |||
| ce962bfb40 | |||
| dcdd7db33d | |||
| 3c72db2de8 | |||
| 53faaeb396 | |||
| 2928a690b8 | |||
| 220ce225f8 | |||
| ac89c499ab | |||
| 8d1c97da04 | |||
| aa140fd4ec | |||
| 08161c9aad | |||
| 40cda7d988 | |||
| c05b8b4095 | |||
| 3d7ba1dee6 | |||
| a299ada873 | |||
| 91144ad338 | |||
| ef8b785ac6 | |||
| 27f37c9cc1 | |||
| f2464ed76b | |||
| a3615c5666 | |||
| 1b3f72d429 | |||
| 04152f05a9 | |||
| d95944dcfc | |||
| a17644a953 | |||
| 3426a3064e | |||
| a41379a40e | |||
| 39266f8c3c | |||
| 3bcb778628 | |||
| 781b430c33 | |||
| 0ac7ea3096 | |||
| d6a0ae6106 | |||
| 3625afa783 | |||
| 154cbd0160 | |||
| b6c5d65a8d | |||
| d4254121b8 | |||
| da30ae558f | |||
| 7a6936ccd9 | |||
| 58acf7a823 | |||
| d9719a7a50 | |||
| bf63365370 | |||
| 64e142b8c6 | |||
| be2d3c197c | |||
| 30c4f215a2 | |||
| 6ffbbbe636 | |||
| d62599fb8e | |||
| 7e371132ae | |||
| 3504c25f84 | |||
| 68615035aa | |||
| 654c0847b2 | |||
| 91955d44fa | |||
| a2c24c9f07 | |||
| cf25cacc17 | |||
| 19daab173c | |||
| 19f8f522b3 | |||
| 905d39c07b | |||
| 9504792586 | |||
| 1b51d09c58 | |||
| ed3d4c4217 | |||
| 7b52f6d70d | |||
| 19fe33383a | |||
| e57719c118 | |||
| edb077b400 | |||
| bad51db0c8 | |||
| 87ab4c4c28 | |||
| 8f3456a650 | |||
| ce1aee1553 | |||
| dfdc4b8bdc | |||
| 8a61cfe7ef | |||
| 78f79d92aa | |||
| f09fe03e0d | |||
| 8e18ec15c9 | |||
| 4340f5444d | |||
| 8e96750046 | |||
| d01baffb0b | |||
| 82cda42e75 | |||
| 5755d172cd | |||
| 0dd47f50a0 | |||
| 60d2a83df5 | |||
| 7757ac10ec | |||
| f334a6603f | |||
| 15548de79c | |||
| 49713ddc57 | |||
| 0973379f53 | |||
| a3004491d6 | |||
| 199a272eb8 | |||
| 855d1ca1b5 | |||
| 64025e0399 | |||
| 6e5556969d | |||
| b50eeaef46 | |||
| ffc471359a | |||
| 79007e7b4e | |||
| 9e08b6ffc5 | |||
| 9b8a1583c2 | |||
| cae264a77b | |||
| 4f934fef35 | |||
| 3a159b0553 | |||
| 0c973f0216 | |||
| 65d3168eb5 | |||
| 12114b3e77 | |||
| 6f6b717354 | |||
| 58b3fa64bc | |||
| 1acaf24df9 | |||
| c2c9822169 | |||
| dff4f2b3a0 | |||
| bf9ad65ff0 | |||
| 53ec75bf0c | |||
| f5270d75eb | |||
| 4aa596b179 | |||
| 002f21fc9e | |||
| 9ab46e4afc | |||
| caa7880cc4 | |||
| 24112498ce | |||
| c9a5ddd89f | |||
| 3483edbd76 | |||
| fe82c12d5b | |||
| d90c3f0991 | |||
| f6b9131f4a | |||
| c67f7a2b64 | |||
| 047d38ea59 | |||
| 3d07795515 | |||
| ee137b2820 | |||
| cdde340efe | |||
| ee34e8a72e | |||
| 0840d807a0 | |||
| 4655d72554 | |||
| 5b066cbc27 | |||
| 2247473959 | |||
| 57f8c1313e | |||
| 73ed51e3d4 | |||
| 1106cde3e4 | |||
| b43158d3a8 | |||
| 9a928f6feb | |||
| df75efe881 | |||
| 9f1d23ad8e | |||
| 7cd2f7a310 | |||
| 315966504e | |||
| 7209eec012 | |||
| 992f59904a | |||
| 9dbd7210cb | |||
| ac8efc9f88 | |||
| 92a0a9356c | |||
| 28f3471036 | |||
| d3d7235338 | |||
| 92a87a0c64 | |||
| cd7e053fc5 | |||
| 9eecbbab6e | |||
| 3641e636d2 | |||
| 4acab04895 | |||
| aa963a4bda | |||
| bdd18b614f | |||
| e186e0adff | |||
| f105f616f6 | |||
|
|
b99c51181d | ||
|
|
bc6b584480 | ||
| eb97de1413 | |||
| 97f1c25ff8 | |||
| 97aad47a21 | |||
| 43bd1d8550 | |||
|
|
3255199b3f | ||
| 224412e20a | |||
| 000ce2a54d | |||
|
|
f992bf4cbb | ||
|
|
96625bd93d | ||
| 9d4357c066 | |||
| 7a945f47b1 | |||
| 9a352bfc83 | |||
| aa2f117075 | |||
| bf5bb45771 | |||
| cdc966bd8c | |||
| 17b902ebcc | |||
| 996b7ea403 | |||
| da4b09be9e | |||
| b24b5a1346 | |||
| 0d94699206 | |||
| 16a818c95e | |||
| a0454b809d | |||
| af8c096c7a | |||
| 14cf81aed0 | |||
| c43b914fb3 | |||
| f002f6cedd | |||
| ce846eca51 | |||
| e6c8714857 | |||
| 33fc334077 | |||
| 6efc962923 | |||
| 7d02f710ea | |||
| c8876807ed | |||
| f43f834460 | |||
| ccf6b810b5 | |||
| a438c4249d | |||
| 1c7fc39b6c | |||
| f07c9cbce8 | |||
| abdba6d68b | |||
| 3db26a762c | |||
| b35561f74e | |||
| f041d1435e | |||
| b781bd5148 | |||
| a16e0b7659 | |||
| 0bafd3fa98 | |||
| 903b320629 | |||
| 9cd05996e7 | |||
| 15dc76c4a7 | |||
| d46b5e008a | |||
| af4b718053 | |||
| 7eae1e127c | |||
| f97fed7daa | |||
| d764171c82 | |||
| d4a024ea75 | |||
| 491d89f117 | |||
| a86e8f7b58 | |||
| d97798d063 | |||
| 247759b364 | |||
| a745f803b3 | |||
| 1b67000887 | |||
| 04d3e31dbc | |||
| 9f29155d07 | |||
| 021411defa | |||
| ee4d78d2e1 | |||
| 9283c88b4e | |||
| 8d585439bb | |||
| ebf2b08bb1 | |||
| eb21c85170 | |||
| fb68a9f9fe | |||
| c7c3852747 | |||
| c18d0c918e | |||
| 9c4fd41eef | |||
| 9173dc936d | |||
| 77c8681b43 | |||
| 2db9440a38 | |||
| 0d585cfebf | |||
| 02a9bfb76f | |||
| ad7385c21f | |||
| dd6d91ac1d | |||
| 576d9c79be | |||
| 3fa5d9d9df | |||
| b14d30108a | |||
| 2b738f6f43 | |||
| 263fa18726 | |||
| f47bc411bc | |||
| 154fb7d9fd | |||
| 9f09af9f27 | |||
| 960e4a7cce | |||
| 50bff12364 | |||
| 7297b9aee0 | |||
| 3652705784 | |||
| 851f101470 | |||
| 6b87536d8d | |||
| d299a1f386 | |||
| c8350d2f0a | |||
| 7efdacc979 | |||
| c77afcc374 | |||
| b8fc44714c | |||
| 49a5ed6aa3 | |||
| 76c76b48c5 | |||
| 03bd23a3b9 | |||
| 61e6edb4c8 | |||
| aa78e930be | |||
| bb668dab29 | |||
| d1662d3535 | |||
| 12b136a2f4 | |||
| aa69815a31 | |||
| 3afa0ce0ab | |||
| 64a474c343 | |||
| 0907a3eb13 | |||
| c86ec0ae82 | |||
| ac76e07d9d | |||
| 56aed70425 | |||
| 63321a4ce3 | |||
| 66fb93ba88 | |||
| 299a009d61 | |||
| 4d395f4487 | |||
| 2f82aaf97b | |||
| 13ececf370 | |||
| b19d50ba62 | |||
| b763f0e5cd | |||
| 27f6f5158d | |||
| 61f1a34c14 | |||
| 8ad2503c5a | |||
| 1a96dc0cb9 | |||
| de810b7bd6 | |||
| 35aadb0e78 | |||
| 3a6b3a4064 | |||
| 9e78546b7e | |||
| ccae1a7311 | |||
| 54d0ba1876 | |||
| d1193e7aa1 | |||
| 6c6437e980 | |||
| 17e75c2951 | |||
| c4766f8f5b | |||
| 1a214cff4e | |||
| dd56b1c142 | |||
| 0ae63fa9ad | |||
| 5e4c5b0d47 | |||
| 58dcf7ba69 | |||
| 1de4304e30 | |||
| 96e8ef2b23 | |||
| dea29429bf | |||
| f5392f8b63 | |||
| 3ab57eea88 | |||
| f503e85507 | |||
| 0f19719a98 | |||
| ee7251c17c | |||
| 2780dacb48 | |||
| dea469d85e | |||
| 254649aa10 | |||
| 7badc531ce | |||
| 6d3b7c8543 | |||
| 4af5886649 | |||
| 38bcb6c482 | |||
| eb91ee1b35 | |||
|
|
2d1c86bc83 | ||
|
d66f7efb3c
|
|||
|
20bdf3af61
|
|||
| 49f5de26eb | |||
| 0cd1206f94 | |||
|
df82102798
|
|||
|
650dadc347
|
|||
| 504fc5c896 | |||
| 162f8e25fd | |||
|
e0900b6bd5
|
|||
|
f3540d54b4
|
|||
| d743cc66d8 | |||
| df4dcd7f32 | |||
| 3391d88460 | |||
| 5d75f1d298 | |||
| 73d482ebe2 | |||
| 9ed66db515 | |||
| c64a1beefa | |||
| 677ae06df8 | |||
| 5cc5369d2a | |||
| 5c16953d95 | |||
| f355cfc05e | |||
| 81cbf905ba | |||
| 2732595efe | |||
| 2ac215c19e | |||
| 6c3f305562 | |||
| fd82f5316c | |||
| a98176f513 | |||
| 886eb06880 | |||
| 581c7c937a | |||
| 5836c64e5e | |||
| badcfac616 | |||
| c2b8a8d6da | |||
| 430a41fefc | |||
| c74ba871cd | |||
| 9d9357b0ca | |||
| c4cb81a104 | |||
| b609ce8027 | |||
| 0bd45ec49b | |||
| 3625627072 | |||
| 8e744249de | |||
| cf5284a244 | |||
| 74c20c37b7 | |||
| b25ecf42fb | |||
| 5bb9477b5b | |||
| a27353d42d | |||
| 1327e46f61 | |||
| a516acbd44 | |||
| d3d2b4281c | |||
| ab0b6a7649 | |||
| 6e13ee173e | |||
| a786c928e0 | |||
| f52fc5332c | |||
| dc6fbbf7ec | |||
| a2256a3872 | |||
| d45996af28 | |||
| 05dcbca894 | |||
| 57ed40912d | |||
| 46751ab977 | |||
| e9128771db | |||
|
|
7bbffef237 | ||
|
|
cb59017ebb | ||
| ec8fbcb112 | |||
| 4c909e692a | |||
|
|
cfc9ed131a | ||
|
|
39d81dd23b | ||
| 56fd6b921e | |||
| 0fed454bb7 | |||
| cbac9f4253 | |||
|
|
d46f1a137a | ||
| 3d7e845213 | |||
| e9a7eaa276 | |||
|
|
e6a5010023 | ||
| 4994d0bf66 | |||
|
|
15a9d68a87 | ||
|
|
16c09ae6e9 | ||
| 702d1642e0 | |||
| d34374d4e0 | |||
| 398d760ba9 | |||
|
|
d9eac06749 | ||
|
|
f9c1ef5ba4 | ||
|
|
8738043dce | ||
| db5c4dcf3f | |||
| d3dd3fb32b | |||
|
|
21fa3baf4e | ||
|
|
b17510218b | ||
|
|
897f03f3d0 | ||
|
|
36ff427e0d | ||
|
|
2e1179e2fa | ||
| fffaf0726d | |||
| 6da1ec5acf | |||
| 16a8d37a8f | |||
|
|
93a1bf4f6d | ||
|
|
f08a07cab0 | ||
| 8a5e72c723 | |||
| 2163deb7ea | |||
| 4219372e68 | |||
| e48d0ebaab | |||
| 591c92b4bb | |||
| 6e81a419fb | |||
| ca403ca2c7 | |||
| e46cfdc4bd | |||
| 609ff8e9c8 | |||
| ea0df21726 | |||
| 3a5050b028 | |||
| 2cf561767f | |||
| 638f0e0181 | |||
| 359c7816bc | |||
| 9438ab4e53 | |||
| e5777dde6c | |||
| 3c7e117661 | |||
| 0f48c206c3 | |||
| 4a7f009cc6 | |||
| 001812f3ce | |||
|
|
bf87f631f0 | ||
| 44876836c5 | |||
| 2d2f6b254b | |||
| 858b54ce64 | |||
| 38840c5b7d | |||
| 499ee386a7 | |||
|
|
eddef26b5e | ||
|
|
db3de9904a | ||
|
|
3511fee459 | ||
|
|
5a1a381a32 | ||
|
|
1bc9f5ed19 | ||
|
|
8370351ff3 | ||
|
|
952020a3e2 | ||
|
|
b35ec1f30a | ||
| 443eeed38b | |||
| d1abfe5213 | |||
|
|
29e34bdd60 | ||
|
|
4635e9ba4f | ||
|
|
49e553c551 | ||
| 1abcf06bf6 | |||
| 2550f76376 | |||
| 24da7aa644 | |||
| 494faf862b | |||
| 67561636e5 | |||
|
|
00f7a24d54 | ||
|
|
f07f814b08 | ||
| fed2c5991d | |||
| ed888324b2 | |||
| 79efd9e15d | |||
|
|
1acd29e474 | ||
|
|
cd7af5e9b7 | ||
|
|
adef5b6781 | ||
|
|
2e9acdb1ba | ||
| f0fee0d78f | |||
|
|
60f4db61eb | ||
|
|
724a2dffcf | ||
| 616b384ad6 | |||
| 8abc9777cc | |||
| 8551499a5e | |||
|
|
1eaecb288f | ||
|
|
170a713357 | ||
| 54cc6c55b2 | |||
| e6aa3c34d4 | |||
| bb40f69298 | |||
| af9a9e78b9 | |||
| af1264e42b | |||
| eb91fbfc45 | |||
| 4ea5465637 | |||
| ab7769dd5a | |||
| b1e220e454 | |||
| 1b499530c5 | |||
| b0d48caaad | |||
|
|
d6758a8562 | ||
| 97734953dd | |||
| bd98583116 | |||
|
|
ddba8f401b | ||
|
|
4725eb96d6 | ||
|
|
38fd1b5dc4 | ||
| 16c12a2756 | |||
|
|
1b09ad5c27 | ||
|
|
00d06f71ba | ||
|
|
3873f0b03b | ||
| 6ae6e9a540 | |||
|
|
bbc83128b0 | ||
|
|
d13e68c206 | ||
| a4882dc054 | |||
|
|
a1b9b7e1d6 | ||
|
|
e1b89aeca8 | ||
| 242abaaf59 | |||
|
|
0116387fe3 | ||
|
|
f5953a0ba7 | ||
|
|
7aa407264f | ||
|
|
59c7896577 | ||
|
|
a69de63db0 | ||
| e96b399da7 | |||
| 33eefd7453 | |||
| c7fffe1280 | |||
| 1b04d7ecce | |||
| b66272a68a | |||
| 12c032392c | |||
| ffa25c18f0 | |||
| f67e3030b9 | |||
| 1028233553 | |||
| ef8ffcd02f | |||
| 0897a8369f | |||
| fa19ad1093 | |||
| 8c6b3613b6 | |||
| a23eb341e2 | |||
| b2bc385397 | |||
| 0f9e592273 | |||
| cf4f58ed95 | |||
| 0243f588bc | |||
| af77974e91 | |||
| a502182eba | |||
| d219baee27 | |||
| 0ea1e2c856 | |||
| 3107949e6f | |||
| 460519c075 | |||
| 9347ed2e55 | |||
| 5770adfd34 | |||
| 9714d8ea42 | |||
| 0b3ee4bb6a | |||
| d1f7065c8a | |||
| 6995c25613 | |||
| 28ce6e8f3f | |||
| 8d5730f715 | |||
| 2bbdbc3ac9 | |||
| 19e4eee222 | |||
| 4139d88103 | |||
| 6881fd13b7 | |||
|
|
8c8553a6af | ||
| 97dd19f0c7 | |||
|
|
784c949b1a | ||
|
|
7325e12e30 | ||
| 019ddbb80b | |||
|
|
6322b248a8 | ||
| c1c47b4869 | |||
| 2f4e73ef13 | |||
| 5ae1cfae87 | |||
| 5d82caf889 | |||
| d3028a3ce8 | |||
| eef4573a68 | |||
| 48f3b62540 | |||
|
|
f7d6302572 | ||
|
|
7ad520a1c3 | ||
|
|
4bc12989ca | ||
|
|
186c71d973 | ||
|
|
06c8e6af10 | ||
|
|
69b9589e84 | ||
|
|
5c767c5e3e | ||
|
|
9cd0389a0b | ||
|
|
a7ffc85404 | ||
|
|
2e9c3a1dbf | ||
| 9f581335d3 | |||
| e70e1c0203 | |||
| cb179de856 | |||
| 0aaa5ba890 | |||
| 0cf7fb9f25 | |||
| a304997177 | |||
| d6ba51e4bc | |||
| 892edb7d5b | |||
| c3cf0f3586 | |||
| 2dec17e871 | |||
| 88ffd602d6 | |||
| a57e51bdf8 | |||
| 44c52c40f1 | |||
| 6ecd04b0d8 | |||
| 964823b332 | |||
| ca8839f097 | |||
| 546ad6a744 | |||
| bd9ad16074 | |||
| 23907c7043 | |||
| a6cea11911 | |||
| cea7a7c121 | |||
| 095ecd254f | |||
| 2246b8b5fd | |||
| 914ff5355d | |||
| 858269a46b | |||
| 5072d8c915 | |||
| 5f8c04a78e | |||
| 41fb7cc40d | |||
| 6a399c7d39 | |||
| 90afc369f0 | |||
|
|
765ef7368e | ||
| 03384d02a0 | |||
| cf48c9ebf7 | |||
| dd3d42944e | |||
| c2e44dc3ba | |||
| c1c324a5a8 | |||
| 7f93ba55b4 | |||
| fcd871c0fc | |||
| 0c54709414 | |||
| 7a458c5cbe | |||
| 8da0469dbf | |||
| 38b75c85d7 | |||
| 833d0333d7 | |||
| e67a426ff2 | |||
| 39e4d9a73c | |||
|
|
91216c4b17 | ||
|
|
416b142889 | ||
|
|
cb4df7dc42 | ||
|
|
99a4546775 | ||
|
|
8a9864a91c | ||
| 6485d81025 | |||
|
|
db54d0b052 | ||
|
|
87105cff21 | ||
|
|
a489daa475 | ||
| c476a06e8c | |||
| 9deae168a6 | |||
|
|
93b881da1b | ||
|
|
8beaac5193 | ||
|
|
d4294e3d95 | ||
|
|
8c6db321cf | ||
|
|
35e68bcd0e | ||
|
|
f01ca5e5bf | ||
| bef0ac1194 | |||
| 9fa78a1dbf | |||
| 4b32101de6 | |||
|
|
6abec38856 | ||
|
|
d22af96bea | ||
| 7b65a59a6e | |||
| 42e253adc7 | |||
|
|
bb45a60d94 | ||
|
|
fa93c8a486 | ||
| 77e0423375 | |||
| c7e67b309e | |||
|
|
2ab2614ab4 | ||
|
|
5ed900c46c | ||
|
|
fb104a9f24 | ||
|
|
42bfe7c587 | ||
| 4f2218619c | |||
|
|
e4e16764f3 | ||
| 00830958df | |||
|
|
486fdf3dcd | ||
|
|
7cd824f3ab | ||
|
|
60c9d60079 | ||
| 397d273802 | |||
| a117844233 | |||
| d5c27b1181 | |||
| c90d06871e | |||
| fb282d405d | |||
|
|
f83d08cf56 | ||
|
|
0194e3f6b6 | ||
|
|
1edd9e4c55 | ||
|
|
aa417be1d3 | ||
|
|
7ab16b641d | ||
|
|
42fd417e34 | ||
|
|
c2ceb710c5 | ||
|
|
288062cfd6 | ||
|
|
9f1ae76d1e | ||
| 7c927da979 | |||
|
|
7a9c3f72ca | ||
| 35d340aaab | |||
| 5d98a7dd3a | |||
| 5393225538 | |||
| 831f202536 | |||
| 81b749caa2 | |||
| a50953ae7c | |||
| 08c5d15e6a | |||
| ff70bf6a0e | |||
| a315f7af25 | |||
|
|
4c7df57e66 | ||
|
|
7dee8f6313 | ||
|
|
0ad6ca6602 | ||
|
|
649850a1ba | ||
|
|
8bb1af8d2a | ||
| 7a0adf5e28 | |||
|
|
6241795b60 | ||
|
|
9d0451455a | ||
|
|
9a8b9c7141 | ||
| 866f71edb5 | |||
|
|
4bae04feec | ||
|
|
415160387b | ||
|
|
3dd0d0b6cf | ||
|
|
2596b119ac | ||
| 20e0771331 | |||
| 7a26ae7292 | |||
| cc4e1f48aa | |||
|
|
6e6305d2ec | ||
|
|
3e9cb2481c | ||
|
|
ea624f1223 | ||
|
|
e4aec3f95e | ||
| 7d83c6fe19 | |||
| 7ef4321a3d | |||
| 54b5372356 | |||
|
|
9bf1a11701 | ||
|
|
99280a40ef | ||
|
|
99061f6e24 | ||
|
|
2fd139b1e3 | ||
| ae29b4514c | |||
| 58de1ceafc | |||
| 20e6d1be99 | |||
| 2a877fbb6b | |||
| 2a6ebc9d8d | |||
|
|
c3c98b9d78 | ||
|
|
443e8b46a6 | ||
|
|
fff2aa468a | ||
| 1918e55a97 | |||
| eb6d378de2 | |||
| b1b174ba64 | |||
|
|
4921a3b0fd | ||
|
|
8296e9a32b | ||
|
|
7403ee67be | ||
|
|
cde2341c1f | ||
|
|
542f180d9d | ||
| 86130d7105 | |||
|
|
c9e329d27d | ||
|
|
d4c6c410da | ||
|
|
a7df53fbfe | ||
|
|
0504fa187e | ||
| 1d9a39f792 | |||
| cbdaabee4a | |||
| 3c8ccf357b | |||
|
|
92b20f6f46 | ||
| 04d7ed77d9 | |||
| a2a205cfd2 | |||
| d3b6597042 | |||
|
|
48c885e12a | ||
|
|
6e5a5a6ade | ||
| 21e03fc8cb | |||
| b85de0d704 | |||
|
|
f781cc3846 | ||
|
|
1cb3d4ffe9 | ||
|
|
9293706634 | ||
|
|
fde6bdf17f | ||
|
|
a1c1fd8339 | ||
|
|
01b39dc75f | ||
| 07ec32c969 | |||
| 042366e19e | |||
| 948a90fcd9 | |||
| c404688bbd | |||
| aa76a15f40 | |||
|
|
ca20785b53 | ||
|
|
13d0b2f960 | ||
|
|
46571ac39f | ||
| 36d770ea2e | |||
|
|
bc7d129a9e | ||
| 8accc28804 | |||
|
|
62e130f91b | ||
| a009221092 | |||
| dedc35b466 | |||
| 5e33587703 | |||
| 950f6830da | |||
|
|
19a8ca84e6 | ||
|
|
ece3fb1536 | ||
| 0d119502a8 | |||
| cc5951cfc3 | |||
| 61d42e0ac5 | |||
| 127935086c | |||
| 76ed60edf3 | |||
| 3b0a1c70fe | |||
| 186e07e45d | |||
| 047cff7d6e | |||
| 305275e3ac | |||
| efb0d5f4f9 | |||
| 991a074538 | |||
| f82b6c12ee | |||
| 00edfa4ef0 | |||
| 35a3ce6402 | |||
| be3ce454a0 | |||
| 4c85206cfa | |||
| 5ecdcbe46e | |||
| c937d7251a | |||
| 1cc46468c1 | |||
| 5cc8ef1eb0 | |||
| 99e135caa2 | |||
| 9de7045d63 | |||
| 0e65151e9f | |||
| 3c20728210 | |||
| 4c0530d89a | |||
| f5af8a1da9 | |||
| 44b9c37391 | |||
| 97b0b6fc0c | |||
| 1a2e9afaef | |||
| 39a3a23a24 | |||
| ee131921a0 | |||
| f8818c8537 | |||
| b07242226e |
224
.clang-format
Normal file
224
.clang-format
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignArrayOfStructures: Left
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: true
|
||||||
|
AcrossComments: true
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: true
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: true
|
||||||
|
AcrossComments: true
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignEscapedNewlines: Left
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakInheritanceList: BeforeComma
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 140
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DeriveLineEnding: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: Always
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
PackConstructorInitializers: CurrentLine
|
||||||
|
BasedOnStyle: ''
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
- piForeach
|
||||||
|
- piForeachC
|
||||||
|
- piForeachR
|
||||||
|
- piForeachRC
|
||||||
|
- piForeachCR
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentGotoLabels: false
|
||||||
|
IndentPPDirectives: AfterHash
|
||||||
|
IndentExternBlock: NoIndent
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertTrailingCommas: Wrapped
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
MacroBlockBegin: "PRIVATE_DEFINITION_START|STATIC_INITIALIZER_BEGIN|DECLARE_UNIT_CLASS_BEGIN"
|
||||||
|
MacroBlockEnd: "PRIVATE_DEFINITION_END|PRIVATE_DEFINITION_END_NO_INITIALIZE|STATIC_INITIALIZER_END|DECLARE_UNIT_CLASS_END"
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PointerAlignment: Middle
|
||||||
|
PPIndentWidth: 2
|
||||||
|
ReferenceAlignment: Middle
|
||||||
|
ReflowComments: true
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: false
|
||||||
|
SpaceBeforeInheritanceColon: false
|
||||||
|
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: false
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: false
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceAroundPointerQualifiers: Both
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
BitFieldColonSpacing: After
|
||||||
|
Standard: c++11
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
- PIMETA
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
- PRIVATE_DECLARATION
|
||||||
|
- NO_COPY_CLASS
|
||||||
|
- FOREVER_WAIT
|
||||||
|
- WAIT_FOREVER
|
||||||
|
TabWidth: 4
|
||||||
|
UseCRLF: false
|
||||||
|
UseTab: AlignWithSpaces
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- STRINGIZE
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
- PIMETA
|
||||||
|
...
|
||||||
|
|
||||||
6
.editorconfig
Normal file
6
.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*.{h,c,cpp}]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = tab
|
||||||
|
tab_width = 4
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,5 +1,10 @@
|
|||||||
/src_main/piversion.h
|
/src_main/piversion.h
|
||||||
/.svn
|
/.*
|
||||||
/doc/rtf
|
/doc/rtf
|
||||||
_unsused
|
_unsused
|
||||||
CMakeLists.txt.user*
|
CMakeLists.txt.user*
|
||||||
|
/include
|
||||||
|
/release
|
||||||
|
/build*
|
||||||
|
/AGENTS.md
|
||||||
|
/plans
|
||||||
|
|||||||
121
3rd/BLAKE2/COPYING
Normal file
121
3rd/BLAKE2/COPYING
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||||
|
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||||
|
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||||
|
HEREUNDER.
|
||||||
|
|
||||||
|
Statement of Purpose
|
||||||
|
|
||||||
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
|
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||||
|
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
|
authorship and/or a database (each, a "Work").
|
||||||
|
|
||||||
|
Certain owners wish to permanently relinquish those rights to a Work for
|
||||||
|
the purpose of contributing to a commons of creative, cultural and
|
||||||
|
scientific works ("Commons") that the public can reliably and without fear
|
||||||
|
of later claims of infringement build upon, modify, incorporate in other
|
||||||
|
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||||
|
and for any purposes, including without limitation commercial purposes.
|
||||||
|
These owners may contribute to the Commons to promote the ideal of a free
|
||||||
|
culture and the further production of creative, cultural and scientific
|
||||||
|
works, or to gain reputation or greater distribution for their Work in
|
||||||
|
part through the use and efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any
|
||||||
|
expectation of additional consideration or compensation, the person
|
||||||
|
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||||
|
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||||
|
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||||
|
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||||
|
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not
|
||||||
|
limited to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display,
|
||||||
|
communicate, and translate a Work;
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or
|
||||||
|
likeness depicted in a Work;
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||||
|
in a Work;
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation
|
||||||
|
thereof, including any amended or successor version of such
|
||||||
|
directive); and
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the
|
||||||
|
world based on applicable law or treaty, and any national
|
||||||
|
implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||||
|
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||||
|
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||||
|
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||||
|
of action, whether now known or unknown (including existing as well as
|
||||||
|
future claims and causes of action), in the Work (i) in all territories
|
||||||
|
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||||
|
treaty (including future time extensions), (iii) in any current or future
|
||||||
|
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||||
|
including without limitation commercial, advertising or promotional
|
||||||
|
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||||
|
member of the public at large and to the detriment of Affirmer's heirs and
|
||||||
|
successors, fully intending that such Waiver shall not be subject to
|
||||||
|
revocation, rescission, cancellation, termination, or any other legal or
|
||||||
|
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||||
|
as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||||
|
be judged legally invalid or ineffective under applicable law, then the
|
||||||
|
Waiver shall be preserved to the maximum extent permitted taking into
|
||||||
|
account Affirmer's express Statement of Purpose. In addition, to the
|
||||||
|
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||||
|
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||||
|
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||||
|
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||||
|
maximum duration provided by applicable law or treaty (including future
|
||||||
|
time extensions), (iii) in any current or future medium and for any number
|
||||||
|
of copies, and (iv) for any purpose whatsoever, including without
|
||||||
|
limitation commercial, advertising or promotional purposes (the
|
||||||
|
"License"). The License shall be deemed effective as of the date CC0 was
|
||||||
|
applied by Affirmer to the Work. Should any part of the License for any
|
||||||
|
reason be judged legally invalid or ineffective under applicable law, such
|
||||||
|
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||||
|
of the License, and in such case Affirmer hereby affirms that he or she
|
||||||
|
will not (i) exercise any of his or her remaining Copyright and Related
|
||||||
|
Rights in the Work or (ii) assert any associated claims and causes of
|
||||||
|
action with respect to the Work, in either case contrary to Affirmer's
|
||||||
|
express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or
|
||||||
|
warranties of any kind concerning the Work, express, implied,
|
||||||
|
statutory or otherwise, including without limitation warranties of
|
||||||
|
title, merchantability, fitness for a particular purpose, non
|
||||||
|
infringement, or the absence of latent or other defects, accuracy, or
|
||||||
|
the present or absence of errors, whether or not discoverable, all to
|
||||||
|
the greatest extent permissible under applicable law.
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without
|
||||||
|
limitation any person's Copyright and Related Rights in the Work.
|
||||||
|
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||||
|
consents, permissions or other rights required for any use of the
|
||||||
|
Work.
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to
|
||||||
|
this CC0 or use of the Work.
|
||||||
160
3rd/BLAKE2/blake2-impl.h
Normal file
160
3rd/BLAKE2/blake2-impl.h
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
#ifndef BLAKE2_IMPL_H
|
||||||
|
#define BLAKE2_IMPL_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define BLAKE2_INLINE __inline
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define BLAKE2_INLINE __inline__
|
||||||
|
#else
|
||||||
|
#define BLAKE2_INLINE
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define BLAKE2_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static BLAKE2_INLINE uint32_t load32( const void *src )
|
||||||
|
{
|
||||||
|
#if defined(NATIVE_LITTLE_ENDIAN)
|
||||||
|
uint32_t w;
|
||||||
|
memcpy(&w, src, sizeof w);
|
||||||
|
return w;
|
||||||
|
#else
|
||||||
|
const uint8_t *p = ( const uint8_t * )src;
|
||||||
|
return (( uint32_t )( p[0] ) << 0) |
|
||||||
|
(( uint32_t )( p[1] ) << 8) |
|
||||||
|
(( uint32_t )( p[2] ) << 16) |
|
||||||
|
(( uint32_t )( p[3] ) << 24) ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE uint64_t load64( const void *src )
|
||||||
|
{
|
||||||
|
#if defined(NATIVE_LITTLE_ENDIAN)
|
||||||
|
uint64_t w;
|
||||||
|
memcpy(&w, src, sizeof w);
|
||||||
|
return w;
|
||||||
|
#else
|
||||||
|
const uint8_t *p = ( const uint8_t * )src;
|
||||||
|
return (( uint64_t )( p[0] ) << 0) |
|
||||||
|
(( uint64_t )( p[1] ) << 8) |
|
||||||
|
(( uint64_t )( p[2] ) << 16) |
|
||||||
|
(( uint64_t )( p[3] ) << 24) |
|
||||||
|
(( uint64_t )( p[4] ) << 32) |
|
||||||
|
(( uint64_t )( p[5] ) << 40) |
|
||||||
|
(( uint64_t )( p[6] ) << 48) |
|
||||||
|
(( uint64_t )( p[7] ) << 56) ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE uint16_t load16( const void *src )
|
||||||
|
{
|
||||||
|
#if defined(NATIVE_LITTLE_ENDIAN)
|
||||||
|
uint16_t w;
|
||||||
|
memcpy(&w, src, sizeof w);
|
||||||
|
return w;
|
||||||
|
#else
|
||||||
|
const uint8_t *p = ( const uint8_t * )src;
|
||||||
|
return ( uint16_t )((( uint32_t )( p[0] ) << 0) |
|
||||||
|
(( uint32_t )( p[1] ) << 8));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE void store16( void *dst, uint16_t w )
|
||||||
|
{
|
||||||
|
#if defined(NATIVE_LITTLE_ENDIAN)
|
||||||
|
memcpy(dst, &w, sizeof w);
|
||||||
|
#else
|
||||||
|
uint8_t *p = ( uint8_t * )dst;
|
||||||
|
*p++ = ( uint8_t )w; w >>= 8;
|
||||||
|
*p++ = ( uint8_t )w;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
|
||||||
|
{
|
||||||
|
#if defined(NATIVE_LITTLE_ENDIAN)
|
||||||
|
memcpy(dst, &w, sizeof w);
|
||||||
|
#else
|
||||||
|
uint8_t *p = ( uint8_t * )dst;
|
||||||
|
p[0] = (uint8_t)(w >> 0);
|
||||||
|
p[1] = (uint8_t)(w >> 8);
|
||||||
|
p[2] = (uint8_t)(w >> 16);
|
||||||
|
p[3] = (uint8_t)(w >> 24);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE void store64( void *dst, uint64_t w )
|
||||||
|
{
|
||||||
|
#if defined(NATIVE_LITTLE_ENDIAN)
|
||||||
|
memcpy(dst, &w, sizeof w);
|
||||||
|
#else
|
||||||
|
uint8_t *p = ( uint8_t * )dst;
|
||||||
|
p[0] = (uint8_t)(w >> 0);
|
||||||
|
p[1] = (uint8_t)(w >> 8);
|
||||||
|
p[2] = (uint8_t)(w >> 16);
|
||||||
|
p[3] = (uint8_t)(w >> 24);
|
||||||
|
p[4] = (uint8_t)(w >> 32);
|
||||||
|
p[5] = (uint8_t)(w >> 40);
|
||||||
|
p[6] = (uint8_t)(w >> 48);
|
||||||
|
p[7] = (uint8_t)(w >> 56);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE uint64_t load48( const void *src )
|
||||||
|
{
|
||||||
|
const uint8_t *p = ( const uint8_t * )src;
|
||||||
|
return (( uint64_t )( p[0] ) << 0) |
|
||||||
|
(( uint64_t )( p[1] ) << 8) |
|
||||||
|
(( uint64_t )( p[2] ) << 16) |
|
||||||
|
(( uint64_t )( p[3] ) << 24) |
|
||||||
|
(( uint64_t )( p[4] ) << 32) |
|
||||||
|
(( uint64_t )( p[5] ) << 40) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE void store48( void *dst, uint64_t w )
|
||||||
|
{
|
||||||
|
uint8_t *p = ( uint8_t * )dst;
|
||||||
|
p[0] = (uint8_t)(w >> 0);
|
||||||
|
p[1] = (uint8_t)(w >> 8);
|
||||||
|
p[2] = (uint8_t)(w >> 16);
|
||||||
|
p[3] = (uint8_t)(w >> 24);
|
||||||
|
p[4] = (uint8_t)(w >> 32);
|
||||||
|
p[5] = (uint8_t)(w >> 40);
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE uint32_t rotr32( const uint32_t w, const unsigned c )
|
||||||
|
{
|
||||||
|
return ( w >> c ) | ( w << ( 32 - c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static BLAKE2_INLINE uint64_t rotr64( const uint64_t w, const unsigned c )
|
||||||
|
{
|
||||||
|
return ( w >> c ) | ( w << ( 64 - c ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* prevents compiler optimizing out memset() */
|
||||||
|
static BLAKE2_INLINE void secure_zero_memory(void *v, size_t n)
|
||||||
|
{
|
||||||
|
static void *(*const volatile memset_v)(void *, int, size_t) = &memset;
|
||||||
|
memset_v(v, 0, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
195
3rd/BLAKE2/blake2.h
Normal file
195
3rd/BLAKE2/blake2.h
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
#ifndef BLAKE2_H
|
||||||
|
#define BLAKE2_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
|
||||||
|
#else
|
||||||
|
#define BLAKE2_PACKED(x) x __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum blake2s_constant
|
||||||
|
{
|
||||||
|
BLAKE2S_BLOCKBYTES = 64,
|
||||||
|
BLAKE2S_OUTBYTES = 32,
|
||||||
|
BLAKE2S_KEYBYTES = 32,
|
||||||
|
BLAKE2S_SALTBYTES = 8,
|
||||||
|
BLAKE2S_PERSONALBYTES = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
enum blake2b_constant
|
||||||
|
{
|
||||||
|
BLAKE2B_BLOCKBYTES = 128,
|
||||||
|
BLAKE2B_OUTBYTES = 64,
|
||||||
|
BLAKE2B_KEYBYTES = 64,
|
||||||
|
BLAKE2B_SALTBYTES = 16,
|
||||||
|
BLAKE2B_PERSONALBYTES = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct blake2s_state__
|
||||||
|
{
|
||||||
|
uint32_t h[8];
|
||||||
|
uint32_t t[2];
|
||||||
|
uint32_t f[2];
|
||||||
|
uint8_t buf[BLAKE2S_BLOCKBYTES];
|
||||||
|
size_t buflen;
|
||||||
|
size_t outlen;
|
||||||
|
uint8_t last_node;
|
||||||
|
} blake2s_state;
|
||||||
|
|
||||||
|
typedef struct blake2b_state__
|
||||||
|
{
|
||||||
|
uint64_t h[8];
|
||||||
|
uint64_t t[2];
|
||||||
|
uint64_t f[2];
|
||||||
|
uint8_t buf[BLAKE2B_BLOCKBYTES];
|
||||||
|
size_t buflen;
|
||||||
|
size_t outlen;
|
||||||
|
uint8_t last_node;
|
||||||
|
} blake2b_state;
|
||||||
|
|
||||||
|
typedef struct blake2sp_state__
|
||||||
|
{
|
||||||
|
blake2s_state S[8][1];
|
||||||
|
blake2s_state R[1];
|
||||||
|
uint8_t buf[8 * BLAKE2S_BLOCKBYTES];
|
||||||
|
size_t buflen;
|
||||||
|
size_t outlen;
|
||||||
|
} blake2sp_state;
|
||||||
|
|
||||||
|
typedef struct blake2bp_state__
|
||||||
|
{
|
||||||
|
blake2b_state S[4][1];
|
||||||
|
blake2b_state R[1];
|
||||||
|
uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
|
||||||
|
size_t buflen;
|
||||||
|
size_t outlen;
|
||||||
|
} blake2bp_state;
|
||||||
|
|
||||||
|
|
||||||
|
BLAKE2_PACKED(struct blake2s_param__
|
||||||
|
{
|
||||||
|
uint8_t digest_length; /* 1 */
|
||||||
|
uint8_t key_length; /* 2 */
|
||||||
|
uint8_t fanout; /* 3 */
|
||||||
|
uint8_t depth; /* 4 */
|
||||||
|
uint32_t leaf_length; /* 8 */
|
||||||
|
uint32_t node_offset; /* 12 */
|
||||||
|
uint16_t xof_length; /* 14 */
|
||||||
|
uint8_t node_depth; /* 15 */
|
||||||
|
uint8_t inner_length; /* 16 */
|
||||||
|
/* uint8_t reserved[0]; */
|
||||||
|
uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */
|
||||||
|
uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */
|
||||||
|
});
|
||||||
|
|
||||||
|
typedef struct blake2s_param__ blake2s_param;
|
||||||
|
|
||||||
|
BLAKE2_PACKED(struct blake2b_param__
|
||||||
|
{
|
||||||
|
uint8_t digest_length; /* 1 */
|
||||||
|
uint8_t key_length; /* 2 */
|
||||||
|
uint8_t fanout; /* 3 */
|
||||||
|
uint8_t depth; /* 4 */
|
||||||
|
uint32_t leaf_length; /* 8 */
|
||||||
|
uint32_t node_offset; /* 12 */
|
||||||
|
uint32_t xof_length; /* 16 */
|
||||||
|
uint8_t node_depth; /* 17 */
|
||||||
|
uint8_t inner_length; /* 18 */
|
||||||
|
uint8_t reserved[14]; /* 32 */
|
||||||
|
uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */
|
||||||
|
uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
|
||||||
|
});
|
||||||
|
|
||||||
|
typedef struct blake2b_param__ blake2b_param;
|
||||||
|
|
||||||
|
typedef struct blake2xs_state__
|
||||||
|
{
|
||||||
|
blake2s_state S[1];
|
||||||
|
blake2s_param P[1];
|
||||||
|
} blake2xs_state;
|
||||||
|
|
||||||
|
typedef struct blake2xb_state__
|
||||||
|
{
|
||||||
|
blake2b_state S[1];
|
||||||
|
blake2b_param P[1];
|
||||||
|
} blake2xb_state;
|
||||||
|
|
||||||
|
/* Padded structs result in a compile-time error */
|
||||||
|
enum {
|
||||||
|
BLAKE2_DUMMY_1 = 1/(int)(sizeof(blake2s_param) == BLAKE2S_OUTBYTES),
|
||||||
|
BLAKE2_DUMMY_2 = 1/(int)(sizeof(blake2b_param) == BLAKE2B_OUTBYTES)
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Streaming API */
|
||||||
|
int blake2s_init( blake2s_state *S, size_t outlen );
|
||||||
|
int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen );
|
||||||
|
int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
|
||||||
|
int blake2s_update( blake2s_state *S, const void *in, size_t inlen );
|
||||||
|
int blake2s_final( blake2s_state *S, void *out, size_t outlen );
|
||||||
|
|
||||||
|
int blake2b_init( blake2b_state *S, size_t outlen );
|
||||||
|
int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen );
|
||||||
|
int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
|
||||||
|
int blake2b_update( blake2b_state *S, const void *in, size_t inlen );
|
||||||
|
int blake2b_final( blake2b_state *S, void *out, size_t outlen );
|
||||||
|
|
||||||
|
int blake2sp_init( blake2sp_state *S, size_t outlen );
|
||||||
|
int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen );
|
||||||
|
int blake2sp_update( blake2sp_state *S, const void *in, size_t inlen );
|
||||||
|
int blake2sp_final( blake2sp_state *S, void *out, size_t outlen );
|
||||||
|
|
||||||
|
int blake2bp_init( blake2bp_state *S, size_t outlen );
|
||||||
|
int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen );
|
||||||
|
int blake2bp_update( blake2bp_state *S, const void *in, size_t inlen );
|
||||||
|
int blake2bp_final( blake2bp_state *S, void *out, size_t outlen );
|
||||||
|
|
||||||
|
/* Variable output length API */
|
||||||
|
int blake2xs_init( blake2xs_state *S, const size_t outlen );
|
||||||
|
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||||
|
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
|
||||||
|
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
|
||||||
|
|
||||||
|
int blake2xb_init( blake2xb_state *S, const size_t outlen );
|
||||||
|
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
|
||||||
|
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
|
||||||
|
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
|
||||||
|
|
||||||
|
/* Simple API */
|
||||||
|
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
|
||||||
|
int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
int blake2bp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
|
||||||
|
int blake2xs( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
int blake2xb( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
|
||||||
|
/* This is simply an alias for blake2b */
|
||||||
|
int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
379
3rd/BLAKE2/blake2b-ref.c
Normal file
379
3rd/BLAKE2/blake2b-ref.c
Normal file
@@ -0,0 +1,379 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
#include "blake2-impl.h"
|
||||||
|
|
||||||
|
static const uint64_t blake2b_IV[8] =
|
||||||
|
{
|
||||||
|
0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
|
||||||
|
0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
|
||||||
|
0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
|
||||||
|
0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t blake2b_sigma[12][16] =
|
||||||
|
{
|
||||||
|
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
|
||||||
|
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
|
||||||
|
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
|
||||||
|
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
|
||||||
|
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
|
||||||
|
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
|
||||||
|
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
|
||||||
|
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
|
||||||
|
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
|
||||||
|
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
|
||||||
|
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
|
||||||
|
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void blake2b_set_lastnode( blake2b_state *S )
|
||||||
|
{
|
||||||
|
S->f[1] = (uint64_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Some helper functions, not necessarily useful */
|
||||||
|
static int blake2b_is_lastblock( const blake2b_state *S )
|
||||||
|
{
|
||||||
|
return S->f[0] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blake2b_set_lastblock( blake2b_state *S )
|
||||||
|
{
|
||||||
|
if( S->last_node ) blake2b_set_lastnode( S );
|
||||||
|
|
||||||
|
S->f[0] = (uint64_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blake2b_increment_counter( blake2b_state *S, const uint64_t inc )
|
||||||
|
{
|
||||||
|
S->t[0] += inc;
|
||||||
|
S->t[1] += ( S->t[0] < inc );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blake2b_init0( blake2b_state *S )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
memset( S, 0, sizeof( blake2b_state ) );
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* init xors IV with input parameter block */
|
||||||
|
int blake2b_init_param( blake2b_state *S, const blake2b_param *P )
|
||||||
|
{
|
||||||
|
const uint8_t *p = ( const uint8_t * )( P );
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
blake2b_init0( S );
|
||||||
|
|
||||||
|
/* IV XOR ParamBlock */
|
||||||
|
for( i = 0; i < 8; ++i )
|
||||||
|
S->h[i] ^= load64( p + sizeof( S->h[i] ) * i );
|
||||||
|
|
||||||
|
S->outlen = P->digest_length;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int blake2b_init( blake2b_state *S, size_t outlen )
|
||||||
|
{
|
||||||
|
blake2b_param P[1];
|
||||||
|
|
||||||
|
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
|
||||||
|
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = 0;
|
||||||
|
P->fanout = 1;
|
||||||
|
P->depth = 1;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, 0 );
|
||||||
|
store32( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 0;
|
||||||
|
P->inner_length = 0;
|
||||||
|
memset( P->reserved, 0, sizeof( P->reserved ) );
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
return blake2b_init_param( S, P );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
blake2b_param P[1];
|
||||||
|
|
||||||
|
if ( ( !outlen ) || ( outlen > BLAKE2B_OUTBYTES ) ) return -1;
|
||||||
|
|
||||||
|
if ( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = (uint8_t)keylen;
|
||||||
|
P->fanout = 1;
|
||||||
|
P->depth = 1;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, 0 );
|
||||||
|
store32( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 0;
|
||||||
|
P->inner_length = 0;
|
||||||
|
memset( P->reserved, 0, sizeof( P->reserved ) );
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
|
||||||
|
if( blake2b_init_param( S, P ) < 0 ) return -1;
|
||||||
|
|
||||||
|
{
|
||||||
|
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||||
|
memset( block, 0, BLAKE2B_BLOCKBYTES );
|
||||||
|
memcpy( block, key, keylen );
|
||||||
|
blake2b_update( S, block, BLAKE2B_BLOCKBYTES );
|
||||||
|
secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define G(r,i,a,b,c,d) \
|
||||||
|
do { \
|
||||||
|
a = a + b + m[blake2b_sigma[r][2*i+0]]; \
|
||||||
|
d = rotr64(d ^ a, 32); \
|
||||||
|
c = c + d; \
|
||||||
|
b = rotr64(b ^ c, 24); \
|
||||||
|
a = a + b + m[blake2b_sigma[r][2*i+1]]; \
|
||||||
|
d = rotr64(d ^ a, 16); \
|
||||||
|
c = c + d; \
|
||||||
|
b = rotr64(b ^ c, 63); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define ROUND(r) \
|
||||||
|
do { \
|
||||||
|
G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
|
||||||
|
G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
|
||||||
|
G(r,2,v[ 2],v[ 6],v[10],v[14]); \
|
||||||
|
G(r,3,v[ 3],v[ 7],v[11],v[15]); \
|
||||||
|
G(r,4,v[ 0],v[ 5],v[10],v[15]); \
|
||||||
|
G(r,5,v[ 1],v[ 6],v[11],v[12]); \
|
||||||
|
G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
|
||||||
|
G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
static void blake2b_compress( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] )
|
||||||
|
{
|
||||||
|
uint64_t m[16];
|
||||||
|
uint64_t v[16];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for( i = 0; i < 16; ++i ) {
|
||||||
|
m[i] = load64( block + i * sizeof( m[i] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) {
|
||||||
|
v[i] = S->h[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
v[ 8] = blake2b_IV[0];
|
||||||
|
v[ 9] = blake2b_IV[1];
|
||||||
|
v[10] = blake2b_IV[2];
|
||||||
|
v[11] = blake2b_IV[3];
|
||||||
|
v[12] = blake2b_IV[4] ^ S->t[0];
|
||||||
|
v[13] = blake2b_IV[5] ^ S->t[1];
|
||||||
|
v[14] = blake2b_IV[6] ^ S->f[0];
|
||||||
|
v[15] = blake2b_IV[7] ^ S->f[1];
|
||||||
|
|
||||||
|
ROUND( 0 );
|
||||||
|
ROUND( 1 );
|
||||||
|
ROUND( 2 );
|
||||||
|
ROUND( 3 );
|
||||||
|
ROUND( 4 );
|
||||||
|
ROUND( 5 );
|
||||||
|
ROUND( 6 );
|
||||||
|
ROUND( 7 );
|
||||||
|
ROUND( 8 );
|
||||||
|
ROUND( 9 );
|
||||||
|
ROUND( 10 );
|
||||||
|
ROUND( 11 );
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) {
|
||||||
|
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef G
|
||||||
|
#undef ROUND
|
||||||
|
|
||||||
|
int blake2b_update( blake2b_state *S, const void *pin, size_t inlen )
|
||||||
|
{
|
||||||
|
const unsigned char * in = (const unsigned char *)pin;
|
||||||
|
if( inlen > 0 )
|
||||||
|
{
|
||||||
|
size_t left = S->buflen;
|
||||||
|
size_t fill = BLAKE2B_BLOCKBYTES - left;
|
||||||
|
if( inlen > fill )
|
||||||
|
{
|
||||||
|
S->buflen = 0;
|
||||||
|
memcpy( S->buf + left, in, fill ); /* Fill buffer */
|
||||||
|
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
|
||||||
|
blake2b_compress( S, S->buf ); /* Compress */
|
||||||
|
in += fill; inlen -= fill;
|
||||||
|
while(inlen > BLAKE2B_BLOCKBYTES) {
|
||||||
|
blake2b_increment_counter(S, BLAKE2B_BLOCKBYTES);
|
||||||
|
blake2b_compress( S, in );
|
||||||
|
in += BLAKE2B_BLOCKBYTES;
|
||||||
|
inlen -= BLAKE2B_BLOCKBYTES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy( S->buf + S->buflen, in, inlen );
|
||||||
|
S->buflen += inlen;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2b_final( blake2b_state *S, void *out, size_t outlen )
|
||||||
|
{
|
||||||
|
uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( out == NULL || outlen < S->outlen )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if( blake2b_is_lastblock( S ) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
blake2b_increment_counter( S, S->buflen );
|
||||||
|
blake2b_set_lastblock( S );
|
||||||
|
memset( S->buf + S->buflen, 0, BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
|
||||||
|
blake2b_compress( S, S->buf );
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
|
||||||
|
store64( buffer + sizeof( S->h[i] ) * i, S->h[i] );
|
||||||
|
|
||||||
|
memcpy( out, buffer, S->outlen );
|
||||||
|
secure_zero_memory(buffer, sizeof(buffer));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* inlen, at least, should be uint64_t. Others can be size_t. */
|
||||||
|
int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
blake2b_state S[1];
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if ( NULL == in && inlen > 0 ) return -1;
|
||||||
|
|
||||||
|
if ( NULL == out ) return -1;
|
||||||
|
|
||||||
|
if( NULL == key && keylen > 0 ) return -1;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
if( keylen > BLAKE2B_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
if( keylen > 0 )
|
||||||
|
{
|
||||||
|
if( blake2b_init_key( S, outlen, key, keylen ) < 0 ) return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( blake2b_init( S, outlen ) < 0 ) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
blake2b_update( S, ( const uint8_t * )in, inlen );
|
||||||
|
blake2b_final( S, out, outlen );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen ) {
|
||||||
|
return blake2b(out, outlen, in, inlen, key, keylen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(SUPERCOP)
|
||||||
|
int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )
|
||||||
|
{
|
||||||
|
return blake2b( out, BLAKE2B_OUTBYTES, in, inlen, NULL, 0 );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BLAKE2B_SELFTEST)
|
||||||
|
#include <string.h>
|
||||||
|
#include "blake2-kat.h"
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
uint8_t key[BLAKE2B_KEYBYTES];
|
||||||
|
uint8_t buf[BLAKE2_KAT_LENGTH];
|
||||||
|
size_t i, step;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2B_KEYBYTES; ++i )
|
||||||
|
key[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
buf[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
/* Test simple API */
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
{
|
||||||
|
uint8_t hash[BLAKE2B_OUTBYTES];
|
||||||
|
blake2b( hash, BLAKE2B_OUTBYTES, buf, i, key, BLAKE2B_KEYBYTES );
|
||||||
|
|
||||||
|
if( 0 != memcmp( hash, blake2b_keyed_kat[i], BLAKE2B_OUTBYTES ) )
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test streaming API */
|
||||||
|
for(step = 1; step < BLAKE2B_BLOCKBYTES; ++step) {
|
||||||
|
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
|
||||||
|
uint8_t hash[BLAKE2B_OUTBYTES];
|
||||||
|
blake2b_state S;
|
||||||
|
uint8_t * p = buf;
|
||||||
|
size_t mlen = i;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if( (err = blake2b_init_key(&S, BLAKE2B_OUTBYTES, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mlen >= step) {
|
||||||
|
if ( (err = blake2b_update(&S, p, step)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
mlen -= step;
|
||||||
|
p += step;
|
||||||
|
}
|
||||||
|
if ( (err = blake2b_update(&S, p, mlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ( (err = blake2b_final(&S, hash, BLAKE2B_OUTBYTES)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != memcmp(hash, blake2b_keyed_kat[i], BLAKE2B_OUTBYTES)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts( "ok" );
|
||||||
|
return 0;
|
||||||
|
fail:
|
||||||
|
puts("error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
359
3rd/BLAKE2/blake2bp-ref.c
Normal file
359
3rd/BLAKE2/blake2bp-ref.c
Normal file
@@ -0,0 +1,359 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
#include "blake2-impl.h"
|
||||||
|
|
||||||
|
#define PARALLELISM_DEGREE 4
|
||||||
|
|
||||||
|
/*
|
||||||
|
blake2b_init_param defaults to setting the expecting output length
|
||||||
|
from the digest_length parameter block field.
|
||||||
|
|
||||||
|
In some cases, however, we do not want this, as the output length
|
||||||
|
of these instances is given by inner_length instead.
|
||||||
|
*/
|
||||||
|
static int blake2bp_init_leaf_param( blake2b_state *S, const blake2b_param *P )
|
||||||
|
{
|
||||||
|
int err = blake2b_init_param(S, P);
|
||||||
|
S->outlen = P->inner_length;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int blake2bp_init_leaf( blake2b_state *S, size_t outlen, size_t keylen, uint64_t offset )
|
||||||
|
{
|
||||||
|
blake2b_param P[1];
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = (uint8_t)keylen;
|
||||||
|
P->fanout = PARALLELISM_DEGREE;
|
||||||
|
P->depth = 2;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, offset );
|
||||||
|
store32( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 0;
|
||||||
|
P->inner_length = BLAKE2B_OUTBYTES;
|
||||||
|
memset( P->reserved, 0, sizeof( P->reserved ) );
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
return blake2bp_init_leaf_param( S, P );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int blake2bp_init_root( blake2b_state *S, size_t outlen, size_t keylen )
|
||||||
|
{
|
||||||
|
blake2b_param P[1];
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = (uint8_t)keylen;
|
||||||
|
P->fanout = PARALLELISM_DEGREE;
|
||||||
|
P->depth = 2;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, 0 );
|
||||||
|
store32( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 1;
|
||||||
|
P->inner_length = BLAKE2B_OUTBYTES;
|
||||||
|
memset( P->reserved, 0, sizeof( P->reserved ) );
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
return blake2b_init_param( S, P );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2bp_init( blake2bp_state *S, size_t outlen )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
memset( S->buf, 0, sizeof( S->buf ) );
|
||||||
|
S->buflen = 0;
|
||||||
|
S->outlen = outlen;
|
||||||
|
|
||||||
|
if( blake2bp_init_root( S->R, outlen, 0 ) < 0 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
if( blake2bp_init_leaf( S->S[i], outlen, 0, i ) < 0 ) return -1;
|
||||||
|
|
||||||
|
S->R->last_node = 1;
|
||||||
|
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
if( !key || !keylen || keylen > BLAKE2B_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
memset( S->buf, 0, sizeof( S->buf ) );
|
||||||
|
S->buflen = 0;
|
||||||
|
S->outlen = outlen;
|
||||||
|
|
||||||
|
if( blake2bp_init_root( S->R, outlen, keylen ) < 0 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
if( blake2bp_init_leaf( S->S[i], outlen, keylen, i ) < 0 ) return -1;
|
||||||
|
|
||||||
|
S->R->last_node = 1;
|
||||||
|
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
|
||||||
|
{
|
||||||
|
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||||
|
memset( block, 0, BLAKE2B_BLOCKBYTES );
|
||||||
|
memcpy( block, key, keylen );
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2b_update( S->S[i], block, BLAKE2B_BLOCKBYTES );
|
||||||
|
|
||||||
|
secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2bp_update( blake2bp_state *S, const void *pin, size_t inlen )
|
||||||
|
{
|
||||||
|
const unsigned char * in = (const unsigned char *)pin;
|
||||||
|
size_t left = S->buflen;
|
||||||
|
size_t fill = sizeof( S->buf ) - left;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( left && inlen >= fill )
|
||||||
|
{
|
||||||
|
memcpy( S->buf + left, in, fill );
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2b_update( S->S[i], S->buf + i * BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES );
|
||||||
|
|
||||||
|
in += fill;
|
||||||
|
inlen -= fill;
|
||||||
|
left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#pragma omp parallel shared(S), num_threads(PARALLELISM_DEGREE)
|
||||||
|
#else
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
size_t i = omp_get_thread_num();
|
||||||
|
#endif
|
||||||
|
size_t inlen__ = inlen;
|
||||||
|
const unsigned char *in__ = ( const unsigned char * )in;
|
||||||
|
in__ += i * BLAKE2B_BLOCKBYTES;
|
||||||
|
|
||||||
|
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
blake2b_update( S->S[i], in__, BLAKE2B_BLOCKBYTES );
|
||||||
|
in__ += PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES;
|
||||||
|
inlen__ -= PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
in += inlen - inlen % ( PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES );
|
||||||
|
inlen %= PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES;
|
||||||
|
|
||||||
|
if( inlen > 0 )
|
||||||
|
memcpy( S->buf + left, in, inlen );
|
||||||
|
|
||||||
|
S->buflen = left + inlen;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2bp_final( blake2bp_state *S, void *out, size_t outlen )
|
||||||
|
{
|
||||||
|
uint8_t hash[PARALLELISM_DEGREE][BLAKE2B_OUTBYTES];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if(out == NULL || outlen < S->outlen) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
{
|
||||||
|
if( S->buflen > i * BLAKE2B_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
size_t left = S->buflen - i * BLAKE2B_BLOCKBYTES;
|
||||||
|
|
||||||
|
if( left > BLAKE2B_BLOCKBYTES ) left = BLAKE2B_BLOCKBYTES;
|
||||||
|
|
||||||
|
blake2b_update( S->S[i], S->buf + i * BLAKE2B_BLOCKBYTES, left );
|
||||||
|
}
|
||||||
|
|
||||||
|
blake2b_final( S->S[i], hash[i], BLAKE2B_OUTBYTES );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2b_update( S->R, hash[i], BLAKE2B_OUTBYTES );
|
||||||
|
|
||||||
|
return blake2b_final( S->R, out, S->outlen );
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2bp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
uint8_t hash[PARALLELISM_DEGREE][BLAKE2B_OUTBYTES];
|
||||||
|
blake2b_state S[PARALLELISM_DEGREE][1];
|
||||||
|
blake2b_state FS[1];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if ( NULL == in && inlen > 0 ) return -1;
|
||||||
|
|
||||||
|
if ( NULL == out ) return -1;
|
||||||
|
|
||||||
|
if( NULL == key && keylen > 0 ) return -1;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
if( keylen > BLAKE2B_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
if( blake2bp_init_leaf( S[i], outlen, keylen, i ) < 0 ) return -1;
|
||||||
|
|
||||||
|
S[PARALLELISM_DEGREE - 1]->last_node = 1; /* mark last node */
|
||||||
|
|
||||||
|
if( keylen > 0 )
|
||||||
|
{
|
||||||
|
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||||
|
memset( block, 0, BLAKE2B_BLOCKBYTES );
|
||||||
|
memcpy( block, key, keylen );
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2b_update( S[i], block, BLAKE2B_BLOCKBYTES );
|
||||||
|
|
||||||
|
secure_zero_memory( block, BLAKE2B_BLOCKBYTES ); /* Burn the key from stack */
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#pragma omp parallel shared(S,hash), num_threads(PARALLELISM_DEGREE)
|
||||||
|
#else
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
size_t i = omp_get_thread_num();
|
||||||
|
#endif
|
||||||
|
size_t inlen__ = inlen;
|
||||||
|
const unsigned char *in__ = ( const unsigned char * )in;
|
||||||
|
in__ += i * BLAKE2B_BLOCKBYTES;
|
||||||
|
|
||||||
|
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
blake2b_update( S[i], in__, BLAKE2B_BLOCKBYTES );
|
||||||
|
in__ += PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES;
|
||||||
|
inlen__ -= PARALLELISM_DEGREE * BLAKE2B_BLOCKBYTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( inlen__ > i * BLAKE2B_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
const size_t left = inlen__ - i * BLAKE2B_BLOCKBYTES;
|
||||||
|
const size_t len = left <= BLAKE2B_BLOCKBYTES ? left : BLAKE2B_BLOCKBYTES;
|
||||||
|
blake2b_update( S[i], in__, len );
|
||||||
|
}
|
||||||
|
|
||||||
|
blake2b_final( S[i], hash[i], BLAKE2B_OUTBYTES );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( blake2bp_init_root( FS, outlen, keylen ) < 0 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
FS->last_node = 1; /* Mark as last node */
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2b_update( FS, hash[i], BLAKE2B_OUTBYTES );
|
||||||
|
|
||||||
|
return blake2b_final( FS, out, outlen );;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(BLAKE2BP_SELFTEST)
|
||||||
|
#include <string.h>
|
||||||
|
#include "blake2-kat.h"
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
uint8_t key[BLAKE2B_KEYBYTES];
|
||||||
|
uint8_t buf[BLAKE2_KAT_LENGTH];
|
||||||
|
size_t i, step;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2B_KEYBYTES; ++i )
|
||||||
|
key[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
buf[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
/* Test simple API */
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
{
|
||||||
|
uint8_t hash[BLAKE2B_OUTBYTES];
|
||||||
|
blake2bp( hash, BLAKE2B_OUTBYTES, buf, i, key, BLAKE2B_KEYBYTES );
|
||||||
|
|
||||||
|
if( 0 != memcmp( hash, blake2bp_keyed_kat[i], BLAKE2B_OUTBYTES ) )
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test streaming API */
|
||||||
|
for(step = 1; step < BLAKE2B_BLOCKBYTES; ++step) {
|
||||||
|
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
|
||||||
|
uint8_t hash[BLAKE2B_OUTBYTES];
|
||||||
|
blake2bp_state S;
|
||||||
|
uint8_t * p = buf;
|
||||||
|
size_t mlen = i;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if( (err = blake2bp_init_key(&S, BLAKE2B_OUTBYTES, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mlen >= step) {
|
||||||
|
if ( (err = blake2bp_update(&S, p, step)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
mlen -= step;
|
||||||
|
p += step;
|
||||||
|
}
|
||||||
|
if ( (err = blake2bp_update(&S, p, mlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ( (err = blake2bp_final(&S, hash, BLAKE2B_OUTBYTES)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != memcmp(hash, blake2bp_keyed_kat[i], BLAKE2B_OUTBYTES)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts( "ok" );
|
||||||
|
return 0;
|
||||||
|
fail:
|
||||||
|
puts("error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
367
3rd/BLAKE2/blake2s-ref.c
Normal file
367
3rd/BLAKE2/blake2s-ref.c
Normal file
@@ -0,0 +1,367 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
#include "blake2-impl.h"
|
||||||
|
|
||||||
|
static const uint32_t blake2s_IV[8] =
|
||||||
|
{
|
||||||
|
0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
|
||||||
|
0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t blake2s_sigma[10][16] =
|
||||||
|
{
|
||||||
|
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
|
||||||
|
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
|
||||||
|
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
|
||||||
|
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
|
||||||
|
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
|
||||||
|
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
|
||||||
|
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
|
||||||
|
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
|
||||||
|
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
|
||||||
|
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void blake2s_set_lastnode( blake2s_state *S )
|
||||||
|
{
|
||||||
|
S->f[1] = (uint32_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Some helper functions, not necessarily useful */
|
||||||
|
static int blake2s_is_lastblock( const blake2s_state *S )
|
||||||
|
{
|
||||||
|
return S->f[0] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blake2s_set_lastblock( blake2s_state *S )
|
||||||
|
{
|
||||||
|
if( S->last_node ) blake2s_set_lastnode( S );
|
||||||
|
|
||||||
|
S->f[0] = (uint32_t)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blake2s_increment_counter( blake2s_state *S, const uint32_t inc )
|
||||||
|
{
|
||||||
|
S->t[0] += inc;
|
||||||
|
S->t[1] += ( S->t[0] < inc );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blake2s_init0( blake2s_state *S )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
memset( S, 0, sizeof( blake2s_state ) );
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* init2 xors IV with input parameter block */
|
||||||
|
int blake2s_init_param( blake2s_state *S, const blake2s_param *P )
|
||||||
|
{
|
||||||
|
const unsigned char *p = ( const unsigned char * )( P );
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
blake2s_init0( S );
|
||||||
|
|
||||||
|
/* IV XOR ParamBlock */
|
||||||
|
for( i = 0; i < 8; ++i )
|
||||||
|
S->h[i] ^= load32( &p[i * 4] );
|
||||||
|
|
||||||
|
S->outlen = P->digest_length;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Sequential blake2s initialization */
|
||||||
|
int blake2s_init( blake2s_state *S, size_t outlen )
|
||||||
|
{
|
||||||
|
blake2s_param P[1];
|
||||||
|
|
||||||
|
/* Move interval verification here? */
|
||||||
|
if ( ( !outlen ) || ( outlen > BLAKE2S_OUTBYTES ) ) return -1;
|
||||||
|
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = 0;
|
||||||
|
P->fanout = 1;
|
||||||
|
P->depth = 1;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, 0 );
|
||||||
|
store16( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 0;
|
||||||
|
P->inner_length = 0;
|
||||||
|
/* memset(P->reserved, 0, sizeof(P->reserved) ); */
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
return blake2s_init_param( S, P );
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
blake2s_param P[1];
|
||||||
|
|
||||||
|
if ( ( !outlen ) || ( outlen > BLAKE2S_OUTBYTES ) ) return -1;
|
||||||
|
|
||||||
|
if ( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = (uint8_t)keylen;
|
||||||
|
P->fanout = 1;
|
||||||
|
P->depth = 1;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, 0 );
|
||||||
|
store16( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 0;
|
||||||
|
P->inner_length = 0;
|
||||||
|
/* memset(P->reserved, 0, sizeof(P->reserved) ); */
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
|
||||||
|
if( blake2s_init_param( S, P ) < 0 ) return -1;
|
||||||
|
|
||||||
|
{
|
||||||
|
uint8_t block[BLAKE2S_BLOCKBYTES];
|
||||||
|
memset( block, 0, BLAKE2S_BLOCKBYTES );
|
||||||
|
memcpy( block, key, keylen );
|
||||||
|
blake2s_update( S, block, BLAKE2S_BLOCKBYTES );
|
||||||
|
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define G(r,i,a,b,c,d) \
|
||||||
|
do { \
|
||||||
|
a = a + b + m[blake2s_sigma[r][2*i+0]]; \
|
||||||
|
d = rotr32(d ^ a, 16); \
|
||||||
|
c = c + d; \
|
||||||
|
b = rotr32(b ^ c, 12); \
|
||||||
|
a = a + b + m[blake2s_sigma[r][2*i+1]]; \
|
||||||
|
d = rotr32(d ^ a, 8); \
|
||||||
|
c = c + d; \
|
||||||
|
b = rotr32(b ^ c, 7); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define ROUND(r) \
|
||||||
|
do { \
|
||||||
|
G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
|
||||||
|
G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
|
||||||
|
G(r,2,v[ 2],v[ 6],v[10],v[14]); \
|
||||||
|
G(r,3,v[ 3],v[ 7],v[11],v[15]); \
|
||||||
|
G(r,4,v[ 0],v[ 5],v[10],v[15]); \
|
||||||
|
G(r,5,v[ 1],v[ 6],v[11],v[12]); \
|
||||||
|
G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
|
||||||
|
G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
static void blake2s_compress( blake2s_state *S, const uint8_t in[BLAKE2S_BLOCKBYTES] )
|
||||||
|
{
|
||||||
|
uint32_t m[16];
|
||||||
|
uint32_t v[16];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for( i = 0; i < 16; ++i ) {
|
||||||
|
m[i] = load32( in + i * sizeof( m[i] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) {
|
||||||
|
v[i] = S->h[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
v[ 8] = blake2s_IV[0];
|
||||||
|
v[ 9] = blake2s_IV[1];
|
||||||
|
v[10] = blake2s_IV[2];
|
||||||
|
v[11] = blake2s_IV[3];
|
||||||
|
v[12] = S->t[0] ^ blake2s_IV[4];
|
||||||
|
v[13] = S->t[1] ^ blake2s_IV[5];
|
||||||
|
v[14] = S->f[0] ^ blake2s_IV[6];
|
||||||
|
v[15] = S->f[1] ^ blake2s_IV[7];
|
||||||
|
|
||||||
|
ROUND( 0 );
|
||||||
|
ROUND( 1 );
|
||||||
|
ROUND( 2 );
|
||||||
|
ROUND( 3 );
|
||||||
|
ROUND( 4 );
|
||||||
|
ROUND( 5 );
|
||||||
|
ROUND( 6 );
|
||||||
|
ROUND( 7 );
|
||||||
|
ROUND( 8 );
|
||||||
|
ROUND( 9 );
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) {
|
||||||
|
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef G
|
||||||
|
#undef ROUND
|
||||||
|
|
||||||
|
int blake2s_update( blake2s_state *S, const void *pin, size_t inlen )
|
||||||
|
{
|
||||||
|
const unsigned char * in = (const unsigned char *)pin;
|
||||||
|
if( inlen > 0 )
|
||||||
|
{
|
||||||
|
size_t left = S->buflen;
|
||||||
|
size_t fill = BLAKE2S_BLOCKBYTES - left;
|
||||||
|
if( inlen > fill )
|
||||||
|
{
|
||||||
|
S->buflen = 0;
|
||||||
|
memcpy( S->buf + left, in, fill ); /* Fill buffer */
|
||||||
|
blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
|
||||||
|
blake2s_compress( S, S->buf ); /* Compress */
|
||||||
|
in += fill; inlen -= fill;
|
||||||
|
while(inlen > BLAKE2S_BLOCKBYTES) {
|
||||||
|
blake2s_increment_counter(S, BLAKE2S_BLOCKBYTES);
|
||||||
|
blake2s_compress( S, in );
|
||||||
|
in += BLAKE2S_BLOCKBYTES;
|
||||||
|
inlen -= BLAKE2S_BLOCKBYTES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memcpy( S->buf + S->buflen, in, inlen );
|
||||||
|
S->buflen += inlen;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2s_final( blake2s_state *S, void *out, size_t outlen )
|
||||||
|
{
|
||||||
|
uint8_t buffer[BLAKE2S_OUTBYTES] = {0};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( out == NULL || outlen < S->outlen )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if( blake2s_is_lastblock( S ) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
blake2s_increment_counter( S, ( uint32_t )S->buflen );
|
||||||
|
blake2s_set_lastblock( S );
|
||||||
|
memset( S->buf + S->buflen, 0, BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
|
||||||
|
blake2s_compress( S, S->buf );
|
||||||
|
|
||||||
|
for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
|
||||||
|
store32( buffer + sizeof( S->h[i] ) * i, S->h[i] );
|
||||||
|
|
||||||
|
memcpy( out, buffer, outlen );
|
||||||
|
secure_zero_memory(buffer, sizeof(buffer));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
blake2s_state S[1];
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if ( NULL == in && inlen > 0 ) return -1;
|
||||||
|
|
||||||
|
if ( NULL == out ) return -1;
|
||||||
|
|
||||||
|
if ( NULL == key && keylen > 0) return -1;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
if( keylen > BLAKE2S_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
if( keylen > 0 )
|
||||||
|
{
|
||||||
|
if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( blake2s_init( S, outlen ) < 0 ) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
blake2s_update( S, ( const uint8_t * )in, inlen );
|
||||||
|
blake2s_final( S, out, outlen );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(SUPERCOP)
|
||||||
|
int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )
|
||||||
|
{
|
||||||
|
return blake2s( out, BLAKE2S_OUTBYTES, in, inlen, NULL, 0 );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BLAKE2S_SELFTEST)
|
||||||
|
#include <string.h>
|
||||||
|
#include "blake2-kat.h"
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
uint8_t key[BLAKE2S_KEYBYTES];
|
||||||
|
uint8_t buf[BLAKE2_KAT_LENGTH];
|
||||||
|
size_t i, step;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2S_KEYBYTES; ++i )
|
||||||
|
key[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
buf[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
/* Test simple API */
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
{
|
||||||
|
uint8_t hash[BLAKE2S_OUTBYTES];
|
||||||
|
blake2s( hash, BLAKE2S_OUTBYTES, buf, i, key, BLAKE2S_KEYBYTES );
|
||||||
|
|
||||||
|
if( 0 != memcmp( hash, blake2s_keyed_kat[i], BLAKE2S_OUTBYTES ) )
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test streaming API */
|
||||||
|
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
|
||||||
|
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
|
||||||
|
uint8_t hash[BLAKE2S_OUTBYTES];
|
||||||
|
blake2s_state S;
|
||||||
|
uint8_t * p = buf;
|
||||||
|
size_t mlen = i;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if( (err = blake2s_init_key(&S, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mlen >= step) {
|
||||||
|
if ( (err = blake2s_update(&S, p, step)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
mlen -= step;
|
||||||
|
p += step;
|
||||||
|
}
|
||||||
|
if ( (err = blake2s_update(&S, p, mlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ( (err = blake2s_final(&S, hash, BLAKE2S_OUTBYTES)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != memcmp(hash, blake2s_keyed_kat[i], BLAKE2S_OUTBYTES)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts( "ok" );
|
||||||
|
return 0;
|
||||||
|
fail:
|
||||||
|
puts("error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
359
3rd/BLAKE2/blake2sp-ref.c
Normal file
359
3rd/BLAKE2/blake2sp-ref.c
Normal file
@@ -0,0 +1,359 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
||||||
|
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
||||||
|
your option. The terms of these licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
#include "blake2-impl.h"
|
||||||
|
|
||||||
|
#define PARALLELISM_DEGREE 8
|
||||||
|
|
||||||
|
/*
|
||||||
|
blake2sp_init_param defaults to setting the expecting output length
|
||||||
|
from the digest_length parameter block field.
|
||||||
|
|
||||||
|
In some cases, however, we do not want this, as the output length
|
||||||
|
of these instances is given by inner_length instead.
|
||||||
|
*/
|
||||||
|
static int blake2sp_init_leaf_param( blake2s_state *S, const blake2s_param *P )
|
||||||
|
{
|
||||||
|
int err = blake2s_init_param(S, P);
|
||||||
|
S->outlen = P->inner_length;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int blake2sp_init_leaf( blake2s_state *S, size_t outlen, size_t keylen, uint64_t offset )
|
||||||
|
{
|
||||||
|
blake2s_param P[1];
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = (uint8_t)keylen;
|
||||||
|
P->fanout = PARALLELISM_DEGREE;
|
||||||
|
P->depth = 2;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, offset );
|
||||||
|
store16( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 0;
|
||||||
|
P->inner_length = BLAKE2S_OUTBYTES;
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
return blake2sp_init_leaf_param( S, P );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int blake2sp_init_root( blake2s_state *S, size_t outlen, size_t keylen )
|
||||||
|
{
|
||||||
|
blake2s_param P[1];
|
||||||
|
P->digest_length = (uint8_t)outlen;
|
||||||
|
P->key_length = (uint8_t)keylen;
|
||||||
|
P->fanout = PARALLELISM_DEGREE;
|
||||||
|
P->depth = 2;
|
||||||
|
store32( &P->leaf_length, 0 );
|
||||||
|
store32( &P->node_offset, 0 );
|
||||||
|
store16( &P->xof_length, 0 );
|
||||||
|
P->node_depth = 1;
|
||||||
|
P->inner_length = BLAKE2S_OUTBYTES;
|
||||||
|
memset( P->salt, 0, sizeof( P->salt ) );
|
||||||
|
memset( P->personal, 0, sizeof( P->personal ) );
|
||||||
|
return blake2s_init_param( S, P );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2sp_init( blake2sp_state *S, size_t outlen )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
memset( S->buf, 0, sizeof( S->buf ) );
|
||||||
|
S->buflen = 0;
|
||||||
|
S->outlen = outlen;
|
||||||
|
|
||||||
|
if( blake2sp_init_root( S->R, outlen, 0 ) < 0 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
if( blake2sp_init_leaf( S->S[i], outlen, 0, i ) < 0 ) return -1;
|
||||||
|
|
||||||
|
S->R->last_node = 1;
|
||||||
|
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
if( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
memset( S->buf, 0, sizeof( S->buf ) );
|
||||||
|
S->buflen = 0;
|
||||||
|
S->outlen = outlen;
|
||||||
|
|
||||||
|
if( blake2sp_init_root( S->R, outlen, keylen ) < 0 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
if( blake2sp_init_leaf( S->S[i], outlen, keylen, i ) < 0 ) return -1;
|
||||||
|
|
||||||
|
S->R->last_node = 1;
|
||||||
|
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
|
||||||
|
{
|
||||||
|
uint8_t block[BLAKE2S_BLOCKBYTES];
|
||||||
|
memset( block, 0, BLAKE2S_BLOCKBYTES );
|
||||||
|
memcpy( block, key, keylen );
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2s_update( S->S[i], block, BLAKE2S_BLOCKBYTES );
|
||||||
|
|
||||||
|
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2sp_update( blake2sp_state *S, const void *pin, size_t inlen )
|
||||||
|
{
|
||||||
|
const unsigned char * in = (const unsigned char *)pin;
|
||||||
|
size_t left = S->buflen;
|
||||||
|
size_t fill = sizeof( S->buf ) - left;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if( left && inlen >= fill )
|
||||||
|
{
|
||||||
|
memcpy( S->buf + left, in, fill );
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2s_update( S->S[i], S->buf + i * BLAKE2S_BLOCKBYTES, BLAKE2S_BLOCKBYTES );
|
||||||
|
|
||||||
|
in += fill;
|
||||||
|
inlen -= fill;
|
||||||
|
left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#pragma omp parallel shared(S), num_threads(PARALLELISM_DEGREE)
|
||||||
|
#else
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
size_t i = omp_get_thread_num();
|
||||||
|
#endif
|
||||||
|
size_t inlen__ = inlen;
|
||||||
|
const unsigned char *in__ = ( const unsigned char * )in;
|
||||||
|
in__ += i * BLAKE2S_BLOCKBYTES;
|
||||||
|
|
||||||
|
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
blake2s_update( S->S[i], in__, BLAKE2S_BLOCKBYTES );
|
||||||
|
in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
||||||
|
inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
in += inlen - inlen % ( PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES );
|
||||||
|
inlen %= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
||||||
|
|
||||||
|
if( inlen > 0 )
|
||||||
|
memcpy( S->buf + left, in, inlen );
|
||||||
|
|
||||||
|
S->buflen = left + inlen;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2sp_final( blake2sp_state *S, void *out, size_t outlen )
|
||||||
|
{
|
||||||
|
uint8_t hash[PARALLELISM_DEGREE][BLAKE2S_OUTBYTES];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if(out == NULL || outlen < S->outlen) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
{
|
||||||
|
if( S->buflen > i * BLAKE2S_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
size_t left = S->buflen - i * BLAKE2S_BLOCKBYTES;
|
||||||
|
|
||||||
|
if( left > BLAKE2S_BLOCKBYTES ) left = BLAKE2S_BLOCKBYTES;
|
||||||
|
|
||||||
|
blake2s_update( S->S[i], S->buf + i * BLAKE2S_BLOCKBYTES, left );
|
||||||
|
}
|
||||||
|
|
||||||
|
blake2s_final( S->S[i], hash[i], BLAKE2S_OUTBYTES );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2s_update( S->R, hash[i], BLAKE2S_OUTBYTES );
|
||||||
|
|
||||||
|
return blake2s_final( S->R, out, S->outlen );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
uint8_t hash[PARALLELISM_DEGREE][BLAKE2S_OUTBYTES];
|
||||||
|
blake2s_state S[PARALLELISM_DEGREE][1];
|
||||||
|
blake2s_state FS[1];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if ( NULL == in && inlen > 0 ) return -1;
|
||||||
|
|
||||||
|
if ( NULL == out ) return -1;
|
||||||
|
|
||||||
|
if ( NULL == key && keylen > 0) return -1;
|
||||||
|
|
||||||
|
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
||||||
|
|
||||||
|
if( keylen > BLAKE2S_KEYBYTES ) return -1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
if( blake2sp_init_leaf( S[i], outlen, keylen, i ) < 0 ) return -1;
|
||||||
|
|
||||||
|
S[PARALLELISM_DEGREE - 1]->last_node = 1; /* mark last node */
|
||||||
|
|
||||||
|
if( keylen > 0 )
|
||||||
|
{
|
||||||
|
uint8_t block[BLAKE2S_BLOCKBYTES];
|
||||||
|
memset( block, 0, BLAKE2S_BLOCKBYTES );
|
||||||
|
memcpy( block, key, keylen );
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2s_update( S[i], block, BLAKE2S_BLOCKBYTES );
|
||||||
|
|
||||||
|
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
#pragma omp parallel shared(S,hash), num_threads(PARALLELISM_DEGREE)
|
||||||
|
#else
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if defined(_OPENMP)
|
||||||
|
size_t i = omp_get_thread_num();
|
||||||
|
#endif
|
||||||
|
size_t inlen__ = inlen;
|
||||||
|
const unsigned char *in__ = ( const unsigned char * )in;
|
||||||
|
in__ += i * BLAKE2S_BLOCKBYTES;
|
||||||
|
|
||||||
|
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
blake2s_update( S[i], in__, BLAKE2S_BLOCKBYTES );
|
||||||
|
in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
||||||
|
inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( inlen__ > i * BLAKE2S_BLOCKBYTES )
|
||||||
|
{
|
||||||
|
const size_t left = inlen__ - i * BLAKE2S_BLOCKBYTES;
|
||||||
|
const size_t len = left <= BLAKE2S_BLOCKBYTES ? left : BLAKE2S_BLOCKBYTES;
|
||||||
|
blake2s_update( S[i], in__, len );
|
||||||
|
}
|
||||||
|
|
||||||
|
blake2s_final( S[i], hash[i], BLAKE2S_OUTBYTES );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( blake2sp_init_root( FS, outlen, keylen ) < 0 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
FS->last_node = 1;
|
||||||
|
|
||||||
|
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
||||||
|
blake2s_update( FS, hash[i], BLAKE2S_OUTBYTES );
|
||||||
|
|
||||||
|
return blake2s_final( FS, out, outlen );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(BLAKE2SP_SELFTEST)
|
||||||
|
#include <string.h>
|
||||||
|
#include "blake2-kat.h"
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
uint8_t key[BLAKE2S_KEYBYTES];
|
||||||
|
uint8_t buf[BLAKE2_KAT_LENGTH];
|
||||||
|
size_t i, step;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2S_KEYBYTES; ++i )
|
||||||
|
key[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
buf[i] = ( uint8_t )i;
|
||||||
|
|
||||||
|
/* Test simple API */
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
||||||
|
{
|
||||||
|
uint8_t hash[BLAKE2S_OUTBYTES];
|
||||||
|
blake2sp( hash, BLAKE2S_OUTBYTES, buf, i, key, BLAKE2S_KEYBYTES );
|
||||||
|
|
||||||
|
if( 0 != memcmp( hash, blake2sp_keyed_kat[i], BLAKE2S_OUTBYTES ) )
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test streaming API */
|
||||||
|
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
|
||||||
|
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
|
||||||
|
uint8_t hash[BLAKE2S_OUTBYTES];
|
||||||
|
blake2sp_state S;
|
||||||
|
uint8_t * p = buf;
|
||||||
|
size_t mlen = i;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if( (err = blake2sp_init_key(&S, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mlen >= step) {
|
||||||
|
if ( (err = blake2sp_update(&S, p, step)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
mlen -= step;
|
||||||
|
p += step;
|
||||||
|
}
|
||||||
|
if ( (err = blake2sp_update(&S, p, mlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ( (err = blake2sp_final(&S, hash, BLAKE2S_OUTBYTES)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != memcmp(hash, blake2sp_keyed_kat[i], BLAKE2S_OUTBYTES)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts( "ok" );
|
||||||
|
return 0;
|
||||||
|
fail:
|
||||||
|
puts("error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
241
3rd/BLAKE2/blake2xb-ref.c
Normal file
241
3rd/BLAKE2/blake2xb-ref.c
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||||
|
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||||
|
|
||||||
|
You may use this under the terms of the CC0, the OpenSSL Licence, or
|
||||||
|
the Apache Public License 2.0, at your option. The terms of these
|
||||||
|
licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
#include "blake2-impl.h"
|
||||||
|
|
||||||
|
int blake2xb_init( blake2xb_state *S, const size_t outlen ) {
|
||||||
|
return blake2xb_init_key(S, outlen, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen)
|
||||||
|
{
|
||||||
|
if ( outlen == 0 || outlen > 0xFFFFFFFFUL ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != key && keylen > BLAKE2B_KEYBYTES) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == key && keylen > 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize parameter block */
|
||||||
|
S->P->digest_length = BLAKE2B_OUTBYTES;
|
||||||
|
S->P->key_length = keylen;
|
||||||
|
S->P->fanout = 1;
|
||||||
|
S->P->depth = 1;
|
||||||
|
store32( &S->P->leaf_length, 0 );
|
||||||
|
store32( &S->P->node_offset, 0 );
|
||||||
|
store32( &S->P->xof_length, outlen );
|
||||||
|
S->P->node_depth = 0;
|
||||||
|
S->P->inner_length = 0;
|
||||||
|
memset( S->P->reserved, 0, sizeof( S->P->reserved ) );
|
||||||
|
memset( S->P->salt, 0, sizeof( S->P->salt ) );
|
||||||
|
memset( S->P->personal, 0, sizeof( S->P->personal ) );
|
||||||
|
|
||||||
|
if( blake2b_init_param( S->S, S->P ) < 0 ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keylen > 0) {
|
||||||
|
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||||
|
memset(block, 0, BLAKE2B_BLOCKBYTES);
|
||||||
|
memcpy(block, key, keylen);
|
||||||
|
blake2b_update(S->S, block, BLAKE2B_BLOCKBYTES);
|
||||||
|
secure_zero_memory(block, BLAKE2B_BLOCKBYTES);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen ) {
|
||||||
|
return blake2b_update( S->S, in, inlen );
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xb_final( blake2xb_state *S, void *out, size_t outlen) {
|
||||||
|
|
||||||
|
blake2b_state C[1];
|
||||||
|
blake2b_param P[1];
|
||||||
|
uint32_t xof_length = load32(&S->P->xof_length);
|
||||||
|
uint8_t root[BLAKE2B_BLOCKBYTES];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (NULL == out) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* outlen must match the output size defined in xof_length, */
|
||||||
|
/* unless it was -1, in which case anything goes except 0. */
|
||||||
|
if(xof_length == 0xFFFFFFFFUL) {
|
||||||
|
if(outlen == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(outlen != xof_length) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finalize the root hash */
|
||||||
|
if (blake2b_final(S->S, root, BLAKE2B_OUTBYTES) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set common block structure values */
|
||||||
|
/* Copy values from parent instance, and only change the ones below */
|
||||||
|
memcpy(P, S->P, sizeof(blake2b_param));
|
||||||
|
P->key_length = 0;
|
||||||
|
P->fanout = 0;
|
||||||
|
P->depth = 0;
|
||||||
|
store32(&P->leaf_length, BLAKE2B_OUTBYTES);
|
||||||
|
P->inner_length = BLAKE2B_OUTBYTES;
|
||||||
|
P->node_depth = 0;
|
||||||
|
|
||||||
|
for (i = 0; outlen > 0; ++i) {
|
||||||
|
const size_t block_size = (outlen < BLAKE2B_OUTBYTES) ? outlen : BLAKE2B_OUTBYTES;
|
||||||
|
/* Initialize state */
|
||||||
|
P->digest_length = block_size;
|
||||||
|
store32(&P->node_offset, i);
|
||||||
|
blake2b_init_param(C, P);
|
||||||
|
/* Process key if needed */
|
||||||
|
blake2b_update(C, root, BLAKE2B_OUTBYTES);
|
||||||
|
if (blake2b_final(C, (uint8_t *)out + i * BLAKE2B_OUTBYTES, block_size) < 0 ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
outlen -= block_size;
|
||||||
|
}
|
||||||
|
secure_zero_memory(root, sizeof(root));
|
||||||
|
secure_zero_memory(P, sizeof(P));
|
||||||
|
secure_zero_memory(C, sizeof(C));
|
||||||
|
/* Put blake2xb in an invalid state? cf. blake2s_is_lastblock */
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xb(void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen)
|
||||||
|
{
|
||||||
|
blake2xb_state S[1];
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if (NULL == in && inlen > 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (NULL == out)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (NULL == key && keylen > 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (keylen > BLAKE2B_KEYBYTES)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (outlen == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* Initialize the root block structure */
|
||||||
|
if (blake2xb_init_key(S, outlen, key, keylen) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Absorb the input message */
|
||||||
|
blake2xb_update(S, in, inlen);
|
||||||
|
|
||||||
|
/* Compute the root node of the tree and the final hash using the counter construction */
|
||||||
|
return blake2xb_final(S, out, outlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(BLAKE2XB_SELFTEST)
|
||||||
|
#include <string.h>
|
||||||
|
#include "blake2-kat.h"
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
uint8_t key[BLAKE2B_KEYBYTES];
|
||||||
|
uint8_t buf[BLAKE2_KAT_LENGTH];
|
||||||
|
size_t i, step, outlen;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2B_KEYBYTES; ++i ) {
|
||||||
|
key[i] = ( uint8_t )i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i ) {
|
||||||
|
buf[i] = ( uint8_t )i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Testing length of outputs rather than inputs */
|
||||||
|
/* (Test of input lengths mostly covered by blake2b tests) */
|
||||||
|
|
||||||
|
/* Test simple API */
|
||||||
|
for( outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
|
||||||
|
{
|
||||||
|
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
|
||||||
|
if( blake2xb( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2B_KEYBYTES ) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( 0 != memcmp( hash, blake2xb_keyed_kat[outlen-1], outlen ) )
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test streaming API */
|
||||||
|
for(step = 1; step < BLAKE2B_BLOCKBYTES; ++step) {
|
||||||
|
for (outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
|
||||||
|
uint8_t hash[BLAKE2_KAT_LENGTH];
|
||||||
|
blake2xb_state S;
|
||||||
|
uint8_t * p = buf;
|
||||||
|
size_t mlen = BLAKE2_KAT_LENGTH;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if( (err = blake2xb_init_key(&S, outlen, key, BLAKE2B_KEYBYTES)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mlen >= step) {
|
||||||
|
if ( (err = blake2xb_update(&S, p, step)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
mlen -= step;
|
||||||
|
p += step;
|
||||||
|
}
|
||||||
|
if ( (err = blake2xb_update(&S, p, mlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ( (err = blake2xb_final(&S, hash, outlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != memcmp(hash, blake2xb_keyed_kat[outlen-1], outlen)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts( "ok" );
|
||||||
|
return 0;
|
||||||
|
fail:
|
||||||
|
puts("error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
239
3rd/BLAKE2/blake2xs-ref.c
Normal file
239
3rd/BLAKE2/blake2xs-ref.c
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
/*
|
||||||
|
BLAKE2 reference source code package - reference C implementations
|
||||||
|
|
||||||
|
Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
|
||||||
|
Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
|
||||||
|
|
||||||
|
You may use this under the terms of the CC0, the OpenSSL Licence, or
|
||||||
|
the Apache Public License 2.0, at your option. The terms of these
|
||||||
|
licenses can be found at:
|
||||||
|
|
||||||
|
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
||||||
|
- OpenSSL license : https://www.openssl.org/source/license.html
|
||||||
|
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
More information about the BLAKE2 hash function can be found at
|
||||||
|
https://blake2.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "blake2.h"
|
||||||
|
#include "blake2-impl.h"
|
||||||
|
|
||||||
|
int blake2xs_init( blake2xs_state *S, const size_t outlen ) {
|
||||||
|
return blake2xs_init_key(S, outlen, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen )
|
||||||
|
{
|
||||||
|
if ( outlen == 0 || outlen > 0xFFFFUL ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != key && keylen > BLAKE2S_KEYBYTES) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL == key && keylen > 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize parameter block */
|
||||||
|
S->P->digest_length = BLAKE2S_OUTBYTES;
|
||||||
|
S->P->key_length = keylen;
|
||||||
|
S->P->fanout = 1;
|
||||||
|
S->P->depth = 1;
|
||||||
|
store32( &S->P->leaf_length, 0 );
|
||||||
|
store32( &S->P->node_offset, 0 );
|
||||||
|
store16( &S->P->xof_length, outlen );
|
||||||
|
S->P->node_depth = 0;
|
||||||
|
S->P->inner_length = 0;
|
||||||
|
memset( S->P->salt, 0, sizeof( S->P->salt ) );
|
||||||
|
memset( S->P->personal, 0, sizeof( S->P->personal ) );
|
||||||
|
|
||||||
|
if( blake2s_init_param( S->S, S->P ) < 0 ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keylen > 0) {
|
||||||
|
uint8_t block[BLAKE2S_BLOCKBYTES];
|
||||||
|
memset(block, 0, BLAKE2S_BLOCKBYTES);
|
||||||
|
memcpy(block, key, keylen);
|
||||||
|
blake2s_update(S->S, block, BLAKE2S_BLOCKBYTES);
|
||||||
|
secure_zero_memory(block, BLAKE2S_BLOCKBYTES);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen ) {
|
||||||
|
return blake2s_update( S->S, in, inlen );
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen) {
|
||||||
|
|
||||||
|
blake2s_state C[1];
|
||||||
|
blake2s_param P[1];
|
||||||
|
uint16_t xof_length = load16(&S->P->xof_length);
|
||||||
|
uint8_t root[BLAKE2S_BLOCKBYTES];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (NULL == out) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* outlen must match the output size defined in xof_length, */
|
||||||
|
/* unless it was -1, in which case anything goes except 0. */
|
||||||
|
if(xof_length == 0xFFFFUL) {
|
||||||
|
if(outlen == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(outlen != xof_length) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finalize the root hash */
|
||||||
|
if (blake2s_final(S->S, root, BLAKE2S_OUTBYTES) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set common block structure values */
|
||||||
|
/* Copy values from parent instance, and only change the ones below */
|
||||||
|
memcpy(P, S->P, sizeof(blake2s_param));
|
||||||
|
P->key_length = 0;
|
||||||
|
P->fanout = 0;
|
||||||
|
P->depth = 0;
|
||||||
|
store32(&P->leaf_length, BLAKE2S_OUTBYTES);
|
||||||
|
P->inner_length = BLAKE2S_OUTBYTES;
|
||||||
|
P->node_depth = 0;
|
||||||
|
|
||||||
|
for (i = 0; outlen > 0; ++i) {
|
||||||
|
const size_t block_size = (outlen < BLAKE2S_OUTBYTES) ? outlen : BLAKE2S_OUTBYTES;
|
||||||
|
/* Initialize state */
|
||||||
|
P->digest_length = block_size;
|
||||||
|
store32(&P->node_offset, i);
|
||||||
|
blake2s_init_param(C, P);
|
||||||
|
/* Process key if needed */
|
||||||
|
blake2s_update(C, root, BLAKE2S_OUTBYTES);
|
||||||
|
if (blake2s_final(C, (uint8_t *)out + i * BLAKE2S_OUTBYTES, block_size) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
outlen -= block_size;
|
||||||
|
}
|
||||||
|
secure_zero_memory(root, sizeof(root));
|
||||||
|
secure_zero_memory(P, sizeof(P));
|
||||||
|
secure_zero_memory(C, sizeof(C));
|
||||||
|
/* Put blake2xs in an invalid state? cf. blake2s_is_lastblock */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blake2xs(void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen)
|
||||||
|
{
|
||||||
|
blake2xs_state S[1];
|
||||||
|
|
||||||
|
/* Verify parameters */
|
||||||
|
if (NULL == in && inlen > 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (NULL == out)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (NULL == key && keylen > 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (keylen > BLAKE2S_KEYBYTES)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (outlen == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* Initialize the root block structure */
|
||||||
|
if (blake2xs_init_key(S, outlen, key, keylen) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Absorb the input message */
|
||||||
|
blake2xs_update(S, in, inlen);
|
||||||
|
|
||||||
|
/* Compute the root node of the tree and the final hash using the counter construction */
|
||||||
|
return blake2xs_final(S, out, outlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(BLAKE2XS_SELFTEST)
|
||||||
|
#include <string.h>
|
||||||
|
#include "blake2-kat.h"
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
uint8_t key[BLAKE2S_KEYBYTES];
|
||||||
|
uint8_t buf[BLAKE2_KAT_LENGTH];
|
||||||
|
size_t i, step, outlen;
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2S_KEYBYTES; ++i ) {
|
||||||
|
key[i] = ( uint8_t )i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i ) {
|
||||||
|
buf[i] = ( uint8_t )i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Testing length of outputs rather than inputs */
|
||||||
|
/* (Test of input lengths mostly covered by blake2s tests) */
|
||||||
|
|
||||||
|
/* Test simple API */
|
||||||
|
for( outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
|
||||||
|
{
|
||||||
|
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
|
||||||
|
if( blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES ) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( 0 != memcmp( hash, blake2xs_keyed_kat[outlen-1], outlen ) )
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test streaming API */
|
||||||
|
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
|
||||||
|
for (outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
|
||||||
|
uint8_t hash[BLAKE2_KAT_LENGTH];
|
||||||
|
blake2xs_state S;
|
||||||
|
uint8_t * p = buf;
|
||||||
|
size_t mlen = BLAKE2_KAT_LENGTH;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
if( (err = blake2xs_init_key(&S, outlen, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mlen >= step) {
|
||||||
|
if ( (err = blake2xs_update(&S, p, step)) < 0 ) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
mlen -= step;
|
||||||
|
p += step;
|
||||||
|
}
|
||||||
|
if ( (err = blake2xs_update(&S, p, mlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
if ( (err = blake2xs_final(&S, hash, outlen)) < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != memcmp(hash, blake2xs_keyed_kat[outlen-1], outlen)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
puts( "ok" );
|
||||||
|
return 0;
|
||||||
|
fail:
|
||||||
|
puts("error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -97,8 +97,10 @@ public:
|
|||||||
{
|
{
|
||||||
int code = lua_pcall (L, nargs, nresults, msgh);
|
int code = lua_pcall (L, nargs, nresults, msgh);
|
||||||
|
|
||||||
if (code != LUABRIDGE_LUA_OK)
|
if (code != LUABRIDGE_LUA_OK) {
|
||||||
Throw (LuaException (L, code));
|
// Throw (LuaException (L, code));
|
||||||
|
assert(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -128,7 +130,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
static int throwAtPanic (lua_State* L)
|
static int throwAtPanic (lua_State* L)
|
||||||
{
|
{
|
||||||
throw LuaException (L, -1);
|
// throw LuaException (L, -1);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,7 +101,8 @@ protected:
|
|||||||
{
|
{
|
||||||
if (m_stackSize == 0)
|
if (m_stackSize == 0)
|
||||||
{
|
{
|
||||||
throw std::logic_error ("Unable to continue registration");
|
std::cerr << ("Unable to continue registration");
|
||||||
|
assert(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1054,7 +1055,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_stackSize == 1)
|
if (m_stackSize == 1)
|
||||||
{
|
{
|
||||||
throw std::logic_error ("endNamespace () called on global namespace");
|
std::cerr << ("endNamespace () called on global namespace");
|
||||||
|
assert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (m_stackSize > 1);
|
assert (m_stackSize > 1);
|
||||||
@@ -1150,7 +1152,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_stackSize == 1)
|
if (m_stackSize == 1)
|
||||||
{
|
{
|
||||||
throw std::logic_error ("addProperty () called on global namespace");
|
std::cerr << ("addProperty () called on global namespace");
|
||||||
|
assert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (lua_istable (L, -1)); // Stack: namespace table (ns)
|
assert (lua_istable (L, -1)); // Stack: namespace table (ns)
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace luabridge {
|
namespace luabridge {
|
||||||
@@ -320,7 +321,8 @@ public:
|
|||||||
lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo <T>::getClassKey ());
|
lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo <T>::getClassKey ());
|
||||||
if (!lua_istable (L, -1))
|
if (!lua_istable (L, -1))
|
||||||
{
|
{
|
||||||
throw std::logic_error ("The class is not registered in LuaBridge");
|
std::cerr << ("The class is not registered in LuaBridge");
|
||||||
|
assert(true);
|
||||||
}
|
}
|
||||||
lua_setmetatable (L, -2);
|
lua_setmetatable (L, -2);
|
||||||
return ud;
|
return ud;
|
||||||
@@ -375,7 +377,8 @@ private:
|
|||||||
lua_rawgetp (L, LUA_REGISTRYINDEX, key);
|
lua_rawgetp (L, LUA_REGISTRYINDEX, key);
|
||||||
if (!lua_istable (L, -1))
|
if (!lua_istable (L, -1))
|
||||||
{
|
{
|
||||||
throw std::logic_error ("The class is not registered in LuaBridge");
|
std::cerr << ("The class is not registered in LuaBridge");
|
||||||
|
assert(true);
|
||||||
}
|
}
|
||||||
lua_setmetatable (L, -2);
|
lua_setmetatable (L, -2);
|
||||||
}
|
}
|
||||||
219
3rd/SipHash/LICENSE_A2LLVM
Normal file
219
3rd/SipHash/LICENSE_A2LLVM
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
---- LLVM Exceptions to the Apache 2.0 License ----
|
||||||
|
|
||||||
|
As an exception, if, as a result of your compiling your source code, portions
|
||||||
|
of this Software are embedded into an Object form of such source code, you
|
||||||
|
may redistribute such embedded portions in such Object form without complying
|
||||||
|
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||||
|
|
||||||
|
In addition, if you combine or link compiled forms of this Software with
|
||||||
|
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||||
|
court of competent jurisdiction determines that the patent provision (Section
|
||||||
|
3), the indemnity provision (Section 9) or other Section of the License
|
||||||
|
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||||
|
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||||
|
the License, but only in their entirety and only with respect to the Combined
|
||||||
|
Software.
|
||||||
|
|
||||||
116
3rd/SipHash/LICENSE_CC0
Normal file
116
3rd/SipHash/LICENSE_CC0
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
Statement of Purpose
|
||||||
|
|
||||||
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
|
exclusive Copyright and Related Rights (defined below) upon the creator and
|
||||||
|
subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
|
authorship and/or a database (each, a "Work").
|
||||||
|
|
||||||
|
Certain owners wish to permanently relinquish those rights to a Work for the
|
||||||
|
purpose of contributing to a commons of creative, cultural and scientific
|
||||||
|
works ("Commons") that the public can reliably and without fear of later
|
||||||
|
claims of infringement build upon, modify, incorporate in other works, reuse
|
||||||
|
and redistribute as freely as possible in any form whatsoever and for any
|
||||||
|
purposes, including without limitation commercial purposes. These owners may
|
||||||
|
contribute to the Commons to promote the ideal of a free culture and the
|
||||||
|
further production of creative, cultural and scientific works, or to gain
|
||||||
|
reputation or greater distribution for their Work in part through the use and
|
||||||
|
efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any expectation
|
||||||
|
of additional consideration or compensation, the person associating CC0 with a
|
||||||
|
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
||||||
|
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
||||||
|
and publicly distribute the Work under its terms, with knowledge of his or her
|
||||||
|
Copyright and Related Rights in the Work and the meaning and intended legal
|
||||||
|
effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not limited
|
||||||
|
to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
||||||
|
and translate a Work;
|
||||||
|
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or likeness
|
||||||
|
depicted in a Work;
|
||||||
|
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data in
|
||||||
|
a Work;
|
||||||
|
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation thereof,
|
||||||
|
including any amended or successor version of such directive); and
|
||||||
|
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the world
|
||||||
|
based on applicable law or treaty, and any national implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
||||||
|
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
||||||
|
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
||||||
|
and Related Rights and associated claims and causes of action, whether now
|
||||||
|
known or unknown (including existing as well as future claims and causes of
|
||||||
|
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
||||||
|
duration provided by applicable law or treaty (including future time
|
||||||
|
extensions), (iii) in any current or future medium and for any number of
|
||||||
|
copies, and (iv) for any purpose whatsoever, including without limitation
|
||||||
|
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
||||||
|
the Waiver for the benefit of each member of the public at large and to the
|
||||||
|
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
||||||
|
shall not be subject to revocation, rescission, cancellation, termination, or
|
||||||
|
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
||||||
|
by the public as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason be
|
||||||
|
judged legally invalid or ineffective under applicable law, then the Waiver
|
||||||
|
shall be preserved to the maximum extent permitted taking into account
|
||||||
|
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
||||||
|
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
||||||
|
non transferable, non sublicensable, non exclusive, irrevocable and
|
||||||
|
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
||||||
|
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
||||||
|
provided by applicable law or treaty (including future time extensions), (iii)
|
||||||
|
in any current or future medium and for any number of copies, and (iv) for any
|
||||||
|
purpose whatsoever, including without limitation commercial, advertising or
|
||||||
|
promotional purposes (the "License"). The License shall be deemed effective as
|
||||||
|
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
||||||
|
License for any reason be judged legally invalid or ineffective under
|
||||||
|
applicable law, such partial invalidity or ineffectiveness shall not
|
||||||
|
invalidate the remainder of the License, and in such case Affirmer hereby
|
||||||
|
affirms that he or she will not (i) exercise any of his or her remaining
|
||||||
|
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
||||||
|
and causes of action with respect to the Work, in either case contrary to
|
||||||
|
Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or warranties
|
||||||
|
of any kind concerning the Work, express, implied, statutory or otherwise,
|
||||||
|
including without limitation warranties of title, merchantability, fitness
|
||||||
|
for a particular purpose, non infringement, or the absence of latent or
|
||||||
|
other defects, accuracy, or the present or absence of errors, whether or not
|
||||||
|
discoverable, all to the greatest extent permissible under applicable law.
|
||||||
|
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without limitation
|
||||||
|
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
||||||
|
disclaims responsibility for obtaining any necessary consents, permissions
|
||||||
|
or other rights required for any use of the Work.
|
||||||
|
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to this
|
||||||
|
CC0 or use of the Work.
|
||||||
|
|
||||||
|
For more information, please see
|
||||||
|
<http://creativecommons.org/publicdomain/zero/1.0/>
|
||||||
7
3rd/SipHash/LICENSE_MIT
Normal file
7
3rd/SipHash/LICENSE_MIT
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2012-2024 JP Aumasson
|
||||||
|
|
||||||
|
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.
|
||||||
166
3rd/SipHash/halfsiphash.c
Normal file
166
3rd/SipHash/halfsiphash.c
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
SipHash reference C implementation
|
||||||
|
|
||||||
|
Copyright (c) 2016 Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
|
||||||
|
|
||||||
|
To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
|
and related and neighboring rights to this software to the public domain
|
||||||
|
worldwide. This software is distributed without any warranty.
|
||||||
|
|
||||||
|
You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
|
with
|
||||||
|
this software. If not, see
|
||||||
|
<http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
*/
|
||||||
|
#include "halfsiphash.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* default: SipHash-2-4 */
|
||||||
|
#ifndef cROUNDS
|
||||||
|
#define cROUNDS 2
|
||||||
|
#endif
|
||||||
|
#ifndef dROUNDS
|
||||||
|
#define dROUNDS 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ROTL(x, b) (uint32_t)(((x) << (b)) | ((x) >> (32 - (b))))
|
||||||
|
|
||||||
|
#define U32TO8_LE(p, v) \
|
||||||
|
(p)[0] = (uint8_t)((v)); \
|
||||||
|
(p)[1] = (uint8_t)((v) >> 8); \
|
||||||
|
(p)[2] = (uint8_t)((v) >> 16); \
|
||||||
|
(p)[3] = (uint8_t)((v) >> 24);
|
||||||
|
|
||||||
|
#define U8TO32_LE(p) \
|
||||||
|
(((uint32_t)((p)[0])) | ((uint32_t)((p)[1]) << 8) | \
|
||||||
|
((uint32_t)((p)[2]) << 16) | ((uint32_t)((p)[3]) << 24))
|
||||||
|
|
||||||
|
#define SIPROUND \
|
||||||
|
do { \
|
||||||
|
v0 += v1; \
|
||||||
|
v1 = ROTL(v1, 5); \
|
||||||
|
v1 ^= v0; \
|
||||||
|
v0 = ROTL(v0, 16); \
|
||||||
|
v2 += v3; \
|
||||||
|
v3 = ROTL(v3, 8); \
|
||||||
|
v3 ^= v2; \
|
||||||
|
v0 += v3; \
|
||||||
|
v3 = ROTL(v3, 7); \
|
||||||
|
v3 ^= v0; \
|
||||||
|
v2 += v1; \
|
||||||
|
v1 = ROTL(v1, 13); \
|
||||||
|
v1 ^= v2; \
|
||||||
|
v2 = ROTL(v2, 16); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG_SIPHASH
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define TRACE \
|
||||||
|
do { \
|
||||||
|
printf("(%3zu) v0 %08" PRIx32 "\n", inlen, v0); \
|
||||||
|
printf("(%3zu) v1 %08" PRIx32 "\n", inlen, v1); \
|
||||||
|
printf("(%3zu) v2 %08" PRIx32 "\n", inlen, v2); \
|
||||||
|
printf("(%3zu) v3 %08" PRIx32 "\n", inlen, v3); \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define TRACE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
Computes a SipHash value
|
||||||
|
*in: pointer to input data (read-only)
|
||||||
|
inlen: input data length in bytes (any size_t value)
|
||||||
|
*k: pointer to the key data (read-only), must be 8 bytes
|
||||||
|
*out: pointer to output data (write-only), outlen bytes must be allocated
|
||||||
|
outlen: length of the output in bytes, must be 4 or 8
|
||||||
|
*/
|
||||||
|
int halfsiphash(const void *in, const size_t inlen, const void *k, uint8_t *out,
|
||||||
|
const size_t outlen) {
|
||||||
|
|
||||||
|
const unsigned char *ni = (const unsigned char *)in;
|
||||||
|
const unsigned char *kk = (const unsigned char *)k;
|
||||||
|
|
||||||
|
assert((outlen == 4) || (outlen == 8));
|
||||||
|
uint32_t v0 = 0;
|
||||||
|
uint32_t v1 = 0;
|
||||||
|
uint32_t v2 = UINT32_C(0x6c796765);
|
||||||
|
uint32_t v3 = UINT32_C(0x74656462);
|
||||||
|
uint32_t k0 = U8TO32_LE(kk);
|
||||||
|
uint32_t k1 = U8TO32_LE(kk + 4);
|
||||||
|
uint32_t m;
|
||||||
|
int i;
|
||||||
|
const unsigned char *end = ni + inlen - (inlen % sizeof(uint32_t));
|
||||||
|
const int left = inlen & 3;
|
||||||
|
uint32_t b = ((uint32_t)inlen) << 24;
|
||||||
|
v3 ^= k1;
|
||||||
|
v2 ^= k0;
|
||||||
|
v1 ^= k1;
|
||||||
|
v0 ^= k0;
|
||||||
|
|
||||||
|
if (outlen == 8)
|
||||||
|
v1 ^= 0xee;
|
||||||
|
|
||||||
|
for (; ni != end; ni += 4) {
|
||||||
|
m = U8TO32_LE(ni);
|
||||||
|
v3 ^= m;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < cROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
v0 ^= m;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (left) {
|
||||||
|
case 3:
|
||||||
|
b |= ((uint32_t)ni[2]) << 16;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 2:
|
||||||
|
b |= ((uint32_t)ni[1]) << 8;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 1:
|
||||||
|
b |= ((uint32_t)ni[0]);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
v3 ^= b;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < cROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
v0 ^= b;
|
||||||
|
|
||||||
|
if (outlen == 8)
|
||||||
|
v2 ^= 0xee;
|
||||||
|
else
|
||||||
|
v2 ^= 0xff;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < dROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
b = v1 ^ v3;
|
||||||
|
U32TO8_LE(out, b);
|
||||||
|
|
||||||
|
if (outlen == 4)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
v1 ^= 0xdd;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < dROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
b = v1 ^ v3;
|
||||||
|
U32TO8_LE(out + 4, b);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
34
3rd/SipHash/halfsiphash.h
Normal file
34
3rd/SipHash/halfsiphash.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
SipHash reference C implementation
|
||||||
|
|
||||||
|
Copyright (c) 2012-2021 Jean-Philippe Aumasson
|
||||||
|
<jeanphilippe.aumasson@gmail.com>
|
||||||
|
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
|
||||||
|
|
||||||
|
To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
|
and related and neighboring rights to this software to the public domain
|
||||||
|
worldwide. This software is distributed without any warranty.
|
||||||
|
|
||||||
|
You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
|
with
|
||||||
|
this software. If not, see
|
||||||
|
<http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HALFSIPHASH_H
|
||||||
|
#define HALFSIPHASH_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int halfsiphash(const void * in, const size_t inlen, const void * k, uint8_t * out, const size_t outlen);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
185
3rd/SipHash/siphash.c
Normal file
185
3rd/SipHash/siphash.c
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
SipHash reference C implementation
|
||||||
|
|
||||||
|
Copyright (c) 2012-2022 Jean-Philippe Aumasson
|
||||||
|
<jeanphilippe.aumasson@gmail.com>
|
||||||
|
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
|
||||||
|
|
||||||
|
To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
|
and related and neighboring rights to this software to the public domain
|
||||||
|
worldwide. This software is distributed without any warranty.
|
||||||
|
|
||||||
|
You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
|
with
|
||||||
|
this software. If not, see
|
||||||
|
<http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "siphash.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* default: SipHash-2-4 */
|
||||||
|
#ifndef cROUNDS
|
||||||
|
#define cROUNDS 2
|
||||||
|
#endif
|
||||||
|
#ifndef dROUNDS
|
||||||
|
#define dROUNDS 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
|
||||||
|
|
||||||
|
#define U32TO8_LE(p, v) \
|
||||||
|
(p)[0] = (uint8_t)((v)); \
|
||||||
|
(p)[1] = (uint8_t)((v) >> 8); \
|
||||||
|
(p)[2] = (uint8_t)((v) >> 16); \
|
||||||
|
(p)[3] = (uint8_t)((v) >> 24);
|
||||||
|
|
||||||
|
#define U64TO8_LE(p, v) \
|
||||||
|
U32TO8_LE((p), (uint32_t)((v))); \
|
||||||
|
U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));
|
||||||
|
|
||||||
|
#define U8TO64_LE(p) \
|
||||||
|
(((uint64_t)((p)[0])) | ((uint64_t)((p)[1]) << 8) | \
|
||||||
|
((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) | \
|
||||||
|
((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) | \
|
||||||
|
((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))
|
||||||
|
|
||||||
|
#define SIPROUND \
|
||||||
|
do { \
|
||||||
|
v0 += v1; \
|
||||||
|
v1 = ROTL(v1, 13); \
|
||||||
|
v1 ^= v0; \
|
||||||
|
v0 = ROTL(v0, 32); \
|
||||||
|
v2 += v3; \
|
||||||
|
v3 = ROTL(v3, 16); \
|
||||||
|
v3 ^= v2; \
|
||||||
|
v0 += v3; \
|
||||||
|
v3 = ROTL(v3, 21); \
|
||||||
|
v3 ^= v0; \
|
||||||
|
v2 += v1; \
|
||||||
|
v1 = ROTL(v1, 17); \
|
||||||
|
v1 ^= v2; \
|
||||||
|
v2 = ROTL(v2, 32); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#ifdef DEBUG_SIPHASH
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define TRACE \
|
||||||
|
do { \
|
||||||
|
printf("(%3zu) v0 %016" PRIx64 "\n", inlen, v0); \
|
||||||
|
printf("(%3zu) v1 %016" PRIx64 "\n", inlen, v1); \
|
||||||
|
printf("(%3zu) v2 %016" PRIx64 "\n", inlen, v2); \
|
||||||
|
printf("(%3zu) v3 %016" PRIx64 "\n", inlen, v3); \
|
||||||
|
} while (0)
|
||||||
|
#else
|
||||||
|
#define TRACE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
Computes a SipHash value
|
||||||
|
*in: pointer to input data (read-only)
|
||||||
|
inlen: input data length in bytes (any size_t value)
|
||||||
|
*k: pointer to the key data (read-only), must be 16 bytes
|
||||||
|
*out: pointer to output data (write-only), outlen bytes must be allocated
|
||||||
|
outlen: length of the output in bytes, must be 8 or 16
|
||||||
|
*/
|
||||||
|
int siphash(const void *in, const size_t inlen, const void *k, uint8_t *out,
|
||||||
|
const size_t outlen) {
|
||||||
|
|
||||||
|
const unsigned char *ni = (const unsigned char *)in;
|
||||||
|
const unsigned char *kk = (const unsigned char *)k;
|
||||||
|
|
||||||
|
assert((outlen == 8) || (outlen == 16));
|
||||||
|
uint64_t v0 = UINT64_C(0x736f6d6570736575);
|
||||||
|
uint64_t v1 = UINT64_C(0x646f72616e646f6d);
|
||||||
|
uint64_t v2 = UINT64_C(0x6c7967656e657261);
|
||||||
|
uint64_t v3 = UINT64_C(0x7465646279746573);
|
||||||
|
uint64_t k0 = U8TO64_LE(kk);
|
||||||
|
uint64_t k1 = U8TO64_LE(kk + 8);
|
||||||
|
uint64_t m;
|
||||||
|
int i;
|
||||||
|
const unsigned char *end = ni + inlen - (inlen % sizeof(uint64_t));
|
||||||
|
const int left = inlen & 7;
|
||||||
|
uint64_t b = ((uint64_t)inlen) << 56;
|
||||||
|
v3 ^= k1;
|
||||||
|
v2 ^= k0;
|
||||||
|
v1 ^= k1;
|
||||||
|
v0 ^= k0;
|
||||||
|
|
||||||
|
if (outlen == 16)
|
||||||
|
v1 ^= 0xee;
|
||||||
|
|
||||||
|
for (; ni != end; ni += 8) {
|
||||||
|
m = U8TO64_LE(ni);
|
||||||
|
v3 ^= m;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < cROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
v0 ^= m;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (left) {
|
||||||
|
case 7:
|
||||||
|
b |= ((uint64_t)ni[6]) << 48;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 6:
|
||||||
|
b |= ((uint64_t)ni[5]) << 40;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 5:
|
||||||
|
b |= ((uint64_t)ni[4]) << 32;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 4:
|
||||||
|
b |= ((uint64_t)ni[3]) << 24;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 3:
|
||||||
|
b |= ((uint64_t)ni[2]) << 16;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 2:
|
||||||
|
b |= ((uint64_t)ni[1]) << 8;
|
||||||
|
/* FALLTHRU */
|
||||||
|
case 1:
|
||||||
|
b |= ((uint64_t)ni[0]);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
v3 ^= b;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < cROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
v0 ^= b;
|
||||||
|
|
||||||
|
if (outlen == 16)
|
||||||
|
v2 ^= 0xee;
|
||||||
|
else
|
||||||
|
v2 ^= 0xff;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < dROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
b = v0 ^ v1 ^ v2 ^ v3;
|
||||||
|
U64TO8_LE(out, b);
|
||||||
|
|
||||||
|
if (outlen == 8)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
v1 ^= 0xdd;
|
||||||
|
|
||||||
|
TRACE;
|
||||||
|
for (i = 0; i < dROUNDS; ++i)
|
||||||
|
SIPROUND;
|
||||||
|
|
||||||
|
b = v0 ^ v1 ^ v2 ^ v3;
|
||||||
|
U64TO8_LE(out + 8, b);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
34
3rd/SipHash/siphash.h
Normal file
34
3rd/SipHash/siphash.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
SipHash reference C implementation
|
||||||
|
|
||||||
|
Copyright (c) 2012-2021 Jean-Philippe Aumasson
|
||||||
|
<jeanphilippe.aumasson@gmail.com>
|
||||||
|
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
|
||||||
|
|
||||||
|
To the extent possible under law, the author(s) have dedicated all copyright
|
||||||
|
and related and neighboring rights to this software to the public domain
|
||||||
|
worldwide. This software is distributed without any warranty.
|
||||||
|
|
||||||
|
You should have received a copy of the CC0 Public Domain Dedication along
|
||||||
|
with
|
||||||
|
this software. If not, see
|
||||||
|
<http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SIPHASH_H
|
||||||
|
#define SIPHASH_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int siphash(const void * in, const size_t inlen, const void * k, uint8_t * out, const size_t outlen);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
2826
3rd/SipHash/vectors.h
Normal file
2826
3rd/SipHash/vectors.h
Normal file
@@ -0,0 +1,2826 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
const uint8_t vectors_sip64[64][8] = {
|
||||||
|
{
|
||||||
|
0x31,
|
||||||
|
0x0e,
|
||||||
|
0x0e,
|
||||||
|
0xdd,
|
||||||
|
0x47,
|
||||||
|
0xdb,
|
||||||
|
0x6f,
|
||||||
|
0x72,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xfd,
|
||||||
|
0x67,
|
||||||
|
0xdc,
|
||||||
|
0x93,
|
||||||
|
0xc5,
|
||||||
|
0x39,
|
||||||
|
0xf8,
|
||||||
|
0x74,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5a,
|
||||||
|
0x4f,
|
||||||
|
0xa9,
|
||||||
|
0xd9,
|
||||||
|
0x09,
|
||||||
|
0x80,
|
||||||
|
0x6c,
|
||||||
|
0x0d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x2d,
|
||||||
|
0x7e,
|
||||||
|
0xfb,
|
||||||
|
0xd7,
|
||||||
|
0x96,
|
||||||
|
0x66,
|
||||||
|
0x67,
|
||||||
|
0x85,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb7,
|
||||||
|
0x87,
|
||||||
|
0x71,
|
||||||
|
0x27,
|
||||||
|
0xe0,
|
||||||
|
0x94,
|
||||||
|
0x27,
|
||||||
|
0xcf,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x8d,
|
||||||
|
0xa6,
|
||||||
|
0x99,
|
||||||
|
0xcd,
|
||||||
|
0x64,
|
||||||
|
0x55,
|
||||||
|
0x76,
|
||||||
|
0x18,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xce,
|
||||||
|
0xe3,
|
||||||
|
0xfe,
|
||||||
|
0x58,
|
||||||
|
0x6e,
|
||||||
|
0x46,
|
||||||
|
0xc9,
|
||||||
|
0xcb,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x37,
|
||||||
|
0xd1,
|
||||||
|
0x01,
|
||||||
|
0x8b,
|
||||||
|
0xf5,
|
||||||
|
0x00,
|
||||||
|
0x02,
|
||||||
|
0xab,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x62,
|
||||||
|
0x24,
|
||||||
|
0x93,
|
||||||
|
0x9a,
|
||||||
|
0x79,
|
||||||
|
0xf5,
|
||||||
|
0xf5,
|
||||||
|
0x93,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb0,
|
||||||
|
0xe4,
|
||||||
|
0xa9,
|
||||||
|
0x0b,
|
||||||
|
0xdf,
|
||||||
|
0x82,
|
||||||
|
0x00,
|
||||||
|
0x9e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf3,
|
||||||
|
0xb9,
|
||||||
|
0xdd,
|
||||||
|
0x94,
|
||||||
|
0xc5,
|
||||||
|
0xbb,
|
||||||
|
0x5d,
|
||||||
|
0x7a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa7,
|
||||||
|
0xad,
|
||||||
|
0x6b,
|
||||||
|
0x22,
|
||||||
|
0x46,
|
||||||
|
0x2f,
|
||||||
|
0xb3,
|
||||||
|
0xf4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xfb,
|
||||||
|
0xe5,
|
||||||
|
0x0e,
|
||||||
|
0x86,
|
||||||
|
0xbc,
|
||||||
|
0x8f,
|
||||||
|
0x1e,
|
||||||
|
0x75,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x90,
|
||||||
|
0x3d,
|
||||||
|
0x84,
|
||||||
|
0xc0,
|
||||||
|
0x27,
|
||||||
|
0x56,
|
||||||
|
0xea,
|
||||||
|
0x14,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xee,
|
||||||
|
0xf2,
|
||||||
|
0x7a,
|
||||||
|
0x8e,
|
||||||
|
0x90,
|
||||||
|
0xca,
|
||||||
|
0x23,
|
||||||
|
0xf7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe5,
|
||||||
|
0x45,
|
||||||
|
0xbe,
|
||||||
|
0x49,
|
||||||
|
0x61,
|
||||||
|
0xca,
|
||||||
|
0x29,
|
||||||
|
0xa1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xdb,
|
||||||
|
0x9b,
|
||||||
|
0xc2,
|
||||||
|
0x57,
|
||||||
|
0x7f,
|
||||||
|
0xcc,
|
||||||
|
0x2a,
|
||||||
|
0x3f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x94,
|
||||||
|
0x47,
|
||||||
|
0xbe,
|
||||||
|
0x2c,
|
||||||
|
0xf5,
|
||||||
|
0xe9,
|
||||||
|
0x9a,
|
||||||
|
0x69,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x9c,
|
||||||
|
0xd3,
|
||||||
|
0x8d,
|
||||||
|
0x96,
|
||||||
|
0xf0,
|
||||||
|
0xb3,
|
||||||
|
0xc1,
|
||||||
|
0x4b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xbd,
|
||||||
|
0x61,
|
||||||
|
0x79,
|
||||||
|
0xa7,
|
||||||
|
0x1d,
|
||||||
|
0xc9,
|
||||||
|
0x6d,
|
||||||
|
0xbb,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x98,
|
||||||
|
0xee,
|
||||||
|
0xa2,
|
||||||
|
0x1a,
|
||||||
|
0xf2,
|
||||||
|
0x5c,
|
||||||
|
0xd6,
|
||||||
|
0xbe,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc7,
|
||||||
|
0x67,
|
||||||
|
0x3b,
|
||||||
|
0x2e,
|
||||||
|
0xb0,
|
||||||
|
0xcb,
|
||||||
|
0xf2,
|
||||||
|
0xd0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x88,
|
||||||
|
0x3e,
|
||||||
|
0xa3,
|
||||||
|
0xe3,
|
||||||
|
0x95,
|
||||||
|
0x67,
|
||||||
|
0x53,
|
||||||
|
0x93,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc8,
|
||||||
|
0xce,
|
||||||
|
0x5c,
|
||||||
|
0xcd,
|
||||||
|
0x8c,
|
||||||
|
0x03,
|
||||||
|
0x0c,
|
||||||
|
0xa8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x94,
|
||||||
|
0xaf,
|
||||||
|
0x49,
|
||||||
|
0xf6,
|
||||||
|
0xc6,
|
||||||
|
0x50,
|
||||||
|
0xad,
|
||||||
|
0xb8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xea,
|
||||||
|
0xb8,
|
||||||
|
0x85,
|
||||||
|
0x8a,
|
||||||
|
0xde,
|
||||||
|
0x92,
|
||||||
|
0xe1,
|
||||||
|
0xbc,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf3,
|
||||||
|
0x15,
|
||||||
|
0xbb,
|
||||||
|
0x5b,
|
||||||
|
0xb8,
|
||||||
|
0x35,
|
||||||
|
0xd8,
|
||||||
|
0x17,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xad,
|
||||||
|
0xcf,
|
||||||
|
0x6b,
|
||||||
|
0x07,
|
||||||
|
0x63,
|
||||||
|
0x61,
|
||||||
|
0x2e,
|
||||||
|
0x2f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa5,
|
||||||
|
0xc9,
|
||||||
|
0x1d,
|
||||||
|
0xa7,
|
||||||
|
0xac,
|
||||||
|
0xaa,
|
||||||
|
0x4d,
|
||||||
|
0xde,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x71,
|
||||||
|
0x65,
|
||||||
|
0x95,
|
||||||
|
0x87,
|
||||||
|
0x66,
|
||||||
|
0x50,
|
||||||
|
0xa2,
|
||||||
|
0xa6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x28,
|
||||||
|
0xef,
|
||||||
|
0x49,
|
||||||
|
0x5c,
|
||||||
|
0x53,
|
||||||
|
0xa3,
|
||||||
|
0x87,
|
||||||
|
0xad,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x42,
|
||||||
|
0xc3,
|
||||||
|
0x41,
|
||||||
|
0xd8,
|
||||||
|
0xfa,
|
||||||
|
0x92,
|
||||||
|
0xd8,
|
||||||
|
0x32,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xce,
|
||||||
|
0x7c,
|
||||||
|
0xf2,
|
||||||
|
0x72,
|
||||||
|
0x2f,
|
||||||
|
0x51,
|
||||||
|
0x27,
|
||||||
|
0x71,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe3,
|
||||||
|
0x78,
|
||||||
|
0x59,
|
||||||
|
0xf9,
|
||||||
|
0x46,
|
||||||
|
0x23,
|
||||||
|
0xf3,
|
||||||
|
0xa7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x38,
|
||||||
|
0x12,
|
||||||
|
0x05,
|
||||||
|
0xbb,
|
||||||
|
0x1a,
|
||||||
|
0xb0,
|
||||||
|
0xe0,
|
||||||
|
0x12,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xae,
|
||||||
|
0x97,
|
||||||
|
0xa1,
|
||||||
|
0x0f,
|
||||||
|
0xd4,
|
||||||
|
0x34,
|
||||||
|
0xe0,
|
||||||
|
0x15,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb4,
|
||||||
|
0xa3,
|
||||||
|
0x15,
|
||||||
|
0x08,
|
||||||
|
0xbe,
|
||||||
|
0xff,
|
||||||
|
0x4d,
|
||||||
|
0x31,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x81,
|
||||||
|
0x39,
|
||||||
|
0x62,
|
||||||
|
0x29,
|
||||||
|
0xf0,
|
||||||
|
0x90,
|
||||||
|
0x79,
|
||||||
|
0x02,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x4d,
|
||||||
|
0x0c,
|
||||||
|
0xf4,
|
||||||
|
0x9e,
|
||||||
|
0xe5,
|
||||||
|
0xd4,
|
||||||
|
0xdc,
|
||||||
|
0xca,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5c,
|
||||||
|
0x73,
|
||||||
|
0x33,
|
||||||
|
0x6a,
|
||||||
|
0x76,
|
||||||
|
0xd8,
|
||||||
|
0xbf,
|
||||||
|
0x9a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd0,
|
||||||
|
0xa7,
|
||||||
|
0x04,
|
||||||
|
0x53,
|
||||||
|
0x6b,
|
||||||
|
0xa9,
|
||||||
|
0x3e,
|
||||||
|
0x0e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x92,
|
||||||
|
0x59,
|
||||||
|
0x58,
|
||||||
|
0xfc,
|
||||||
|
0xd6,
|
||||||
|
0x42,
|
||||||
|
0x0c,
|
||||||
|
0xad,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa9,
|
||||||
|
0x15,
|
||||||
|
0xc2,
|
||||||
|
0x9b,
|
||||||
|
0xc8,
|
||||||
|
0x06,
|
||||||
|
0x73,
|
||||||
|
0x18,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x95,
|
||||||
|
0x2b,
|
||||||
|
0x79,
|
||||||
|
0xf3,
|
||||||
|
0xbc,
|
||||||
|
0x0a,
|
||||||
|
0xa6,
|
||||||
|
0xd4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf2,
|
||||||
|
0x1d,
|
||||||
|
0xf2,
|
||||||
|
0xe4,
|
||||||
|
0x1d,
|
||||||
|
0x45,
|
||||||
|
0x35,
|
||||||
|
0xf9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x87,
|
||||||
|
0x57,
|
||||||
|
0x75,
|
||||||
|
0x19,
|
||||||
|
0x04,
|
||||||
|
0x8f,
|
||||||
|
0x53,
|
||||||
|
0xa9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x10,
|
||||||
|
0xa5,
|
||||||
|
0x6c,
|
||||||
|
0xf5,
|
||||||
|
0xdf,
|
||||||
|
0xcd,
|
||||||
|
0x9a,
|
||||||
|
0xdb,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xeb,
|
||||||
|
0x75,
|
||||||
|
0x09,
|
||||||
|
0x5c,
|
||||||
|
0xcd,
|
||||||
|
0x98,
|
||||||
|
0x6c,
|
||||||
|
0xd0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x51,
|
||||||
|
0xa9,
|
||||||
|
0xcb,
|
||||||
|
0x9e,
|
||||||
|
0xcb,
|
||||||
|
0xa3,
|
||||||
|
0x12,
|
||||||
|
0xe6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x96,
|
||||||
|
0xaf,
|
||||||
|
0xad,
|
||||||
|
0xfc,
|
||||||
|
0x2c,
|
||||||
|
0xe6,
|
||||||
|
0x66,
|
||||||
|
0xc7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x72,
|
||||||
|
0xfe,
|
||||||
|
0x52,
|
||||||
|
0x97,
|
||||||
|
0x5a,
|
||||||
|
0x43,
|
||||||
|
0x64,
|
||||||
|
0xee,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5a,
|
||||||
|
0x16,
|
||||||
|
0x45,
|
||||||
|
0xb2,
|
||||||
|
0x76,
|
||||||
|
0xd5,
|
||||||
|
0x92,
|
||||||
|
0xa1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb2,
|
||||||
|
0x74,
|
||||||
|
0xcb,
|
||||||
|
0x8e,
|
||||||
|
0xbf,
|
||||||
|
0x87,
|
||||||
|
0x87,
|
||||||
|
0x0a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x6f,
|
||||||
|
0x9b,
|
||||||
|
0xb4,
|
||||||
|
0x20,
|
||||||
|
0x3d,
|
||||||
|
0xe7,
|
||||||
|
0xb3,
|
||||||
|
0x81,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xea,
|
||||||
|
0xec,
|
||||||
|
0xb2,
|
||||||
|
0xa3,
|
||||||
|
0x0b,
|
||||||
|
0x22,
|
||||||
|
0xa8,
|
||||||
|
0x7f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x99,
|
||||||
|
0x24,
|
||||||
|
0xa4,
|
||||||
|
0x3c,
|
||||||
|
0xc1,
|
||||||
|
0x31,
|
||||||
|
0x57,
|
||||||
|
0x24,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xbd,
|
||||||
|
0x83,
|
||||||
|
0x8d,
|
||||||
|
0x3a,
|
||||||
|
0xaf,
|
||||||
|
0xbf,
|
||||||
|
0x8d,
|
||||||
|
0xb7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0b,
|
||||||
|
0x1a,
|
||||||
|
0x2a,
|
||||||
|
0x32,
|
||||||
|
0x65,
|
||||||
|
0xd5,
|
||||||
|
0x1a,
|
||||||
|
0xea,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x13,
|
||||||
|
0x50,
|
||||||
|
0x79,
|
||||||
|
0xa3,
|
||||||
|
0x23,
|
||||||
|
0x1c,
|
||||||
|
0xe6,
|
||||||
|
0x60,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x93,
|
||||||
|
0x2b,
|
||||||
|
0x28,
|
||||||
|
0x46,
|
||||||
|
0xe4,
|
||||||
|
0xd7,
|
||||||
|
0x06,
|
||||||
|
0x66,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe1,
|
||||||
|
0x91,
|
||||||
|
0x5f,
|
||||||
|
0x5c,
|
||||||
|
0xb1,
|
||||||
|
0xec,
|
||||||
|
0xa4,
|
||||||
|
0x6c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf3,
|
||||||
|
0x25,
|
||||||
|
0x96,
|
||||||
|
0x5c,
|
||||||
|
0xa1,
|
||||||
|
0x6d,
|
||||||
|
0x62,
|
||||||
|
0x9f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x57,
|
||||||
|
0x5f,
|
||||||
|
0xf2,
|
||||||
|
0x8e,
|
||||||
|
0x60,
|
||||||
|
0x38,
|
||||||
|
0x1b,
|
||||||
|
0xe5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x72,
|
||||||
|
0x45,
|
||||||
|
0x06,
|
||||||
|
0xeb,
|
||||||
|
0x4c,
|
||||||
|
0x32,
|
||||||
|
0x8a,
|
||||||
|
0x95,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const uint8_t vectors_sip128[64][16] = {
|
||||||
|
{
|
||||||
|
0xa3,
|
||||||
|
0x81,
|
||||||
|
0x7f,
|
||||||
|
0x04,
|
||||||
|
0xba,
|
||||||
|
0x25,
|
||||||
|
0xa8,
|
||||||
|
0xe6,
|
||||||
|
0x6d,
|
||||||
|
0xf6,
|
||||||
|
0x72,
|
||||||
|
0x14,
|
||||||
|
0xc7,
|
||||||
|
0x55,
|
||||||
|
0x02,
|
||||||
|
0x93,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xda,
|
||||||
|
0x87,
|
||||||
|
0xc1,
|
||||||
|
0xd8,
|
||||||
|
0x6b,
|
||||||
|
0x99,
|
||||||
|
0xaf,
|
||||||
|
0x44,
|
||||||
|
0x34,
|
||||||
|
0x76,
|
||||||
|
0x59,
|
||||||
|
0x11,
|
||||||
|
0x9b,
|
||||||
|
0x22,
|
||||||
|
0xfc,
|
||||||
|
0x45,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x81,
|
||||||
|
0x77,
|
||||||
|
0x22,
|
||||||
|
0x8d,
|
||||||
|
0xa4,
|
||||||
|
0xa4,
|
||||||
|
0x5d,
|
||||||
|
0xc7,
|
||||||
|
0xfc,
|
||||||
|
0xa3,
|
||||||
|
0x8b,
|
||||||
|
0xde,
|
||||||
|
0xf6,
|
||||||
|
0x0a,
|
||||||
|
0xff,
|
||||||
|
0xe4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x9c,
|
||||||
|
0x70,
|
||||||
|
0xb6,
|
||||||
|
0x0c,
|
||||||
|
0x52,
|
||||||
|
0x67,
|
||||||
|
0xa9,
|
||||||
|
0x4e,
|
||||||
|
0x5f,
|
||||||
|
0x33,
|
||||||
|
0xb6,
|
||||||
|
0xb0,
|
||||||
|
0x29,
|
||||||
|
0x85,
|
||||||
|
0xed,
|
||||||
|
0x51,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf8,
|
||||||
|
0x81,
|
||||||
|
0x64,
|
||||||
|
0xc1,
|
||||||
|
0x2d,
|
||||||
|
0x9c,
|
||||||
|
0x8f,
|
||||||
|
0xaf,
|
||||||
|
0x7d,
|
||||||
|
0x0f,
|
||||||
|
0x6e,
|
||||||
|
0x7c,
|
||||||
|
0x7b,
|
||||||
|
0xcd,
|
||||||
|
0x55,
|
||||||
|
0x79,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x13,
|
||||||
|
0x68,
|
||||||
|
0x87,
|
||||||
|
0x59,
|
||||||
|
0x80,
|
||||||
|
0x77,
|
||||||
|
0x6f,
|
||||||
|
0x88,
|
||||||
|
0x54,
|
||||||
|
0x52,
|
||||||
|
0x7a,
|
||||||
|
0x07,
|
||||||
|
0x69,
|
||||||
|
0x0e,
|
||||||
|
0x96,
|
||||||
|
0x27,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x14,
|
||||||
|
0xee,
|
||||||
|
0xca,
|
||||||
|
0x33,
|
||||||
|
0x8b,
|
||||||
|
0x20,
|
||||||
|
0x86,
|
||||||
|
0x13,
|
||||||
|
0x48,
|
||||||
|
0x5e,
|
||||||
|
0xa0,
|
||||||
|
0x30,
|
||||||
|
0x8f,
|
||||||
|
0xd7,
|
||||||
|
0xa1,
|
||||||
|
0x5e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa1,
|
||||||
|
0xf1,
|
||||||
|
0xeb,
|
||||||
|
0xbe,
|
||||||
|
0xd8,
|
||||||
|
0xdb,
|
||||||
|
0xc1,
|
||||||
|
0x53,
|
||||||
|
0xc0,
|
||||||
|
0xb8,
|
||||||
|
0x4a,
|
||||||
|
0xa6,
|
||||||
|
0x1f,
|
||||||
|
0xf0,
|
||||||
|
0x82,
|
||||||
|
0x39,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x3b,
|
||||||
|
0x62,
|
||||||
|
0xa9,
|
||||||
|
0xba,
|
||||||
|
0x62,
|
||||||
|
0x58,
|
||||||
|
0xf5,
|
||||||
|
0x61,
|
||||||
|
0x0f,
|
||||||
|
0x83,
|
||||||
|
0xe2,
|
||||||
|
0x64,
|
||||||
|
0xf3,
|
||||||
|
0x14,
|
||||||
|
0x97,
|
||||||
|
0xb4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x26,
|
||||||
|
0x44,
|
||||||
|
0x99,
|
||||||
|
0x06,
|
||||||
|
0x0a,
|
||||||
|
0xd9,
|
||||||
|
0xba,
|
||||||
|
0xab,
|
||||||
|
0xc4,
|
||||||
|
0x7f,
|
||||||
|
0x8b,
|
||||||
|
0x02,
|
||||||
|
0xbb,
|
||||||
|
0x6d,
|
||||||
|
0x71,
|
||||||
|
0xed,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00,
|
||||||
|
0x11,
|
||||||
|
0x0d,
|
||||||
|
0xc3,
|
||||||
|
0x78,
|
||||||
|
0x14,
|
||||||
|
0x69,
|
||||||
|
0x56,
|
||||||
|
0xc9,
|
||||||
|
0x54,
|
||||||
|
0x47,
|
||||||
|
0xd3,
|
||||||
|
0xf3,
|
||||||
|
0xd0,
|
||||||
|
0xfb,
|
||||||
|
0xba,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x01,
|
||||||
|
0x51,
|
||||||
|
0xc5,
|
||||||
|
0x68,
|
||||||
|
0x38,
|
||||||
|
0x6b,
|
||||||
|
0x66,
|
||||||
|
0x77,
|
||||||
|
0xa2,
|
||||||
|
0xb4,
|
||||||
|
0xdc,
|
||||||
|
0x6f,
|
||||||
|
0x81,
|
||||||
|
0xe5,
|
||||||
|
0xdc,
|
||||||
|
0x18,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd6,
|
||||||
|
0x26,
|
||||||
|
0xb2,
|
||||||
|
0x66,
|
||||||
|
0x90,
|
||||||
|
0x5e,
|
||||||
|
0xf3,
|
||||||
|
0x58,
|
||||||
|
0x82,
|
||||||
|
0x63,
|
||||||
|
0x4d,
|
||||||
|
0xf6,
|
||||||
|
0x85,
|
||||||
|
0x32,
|
||||||
|
0xc1,
|
||||||
|
0x25,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x98,
|
||||||
|
0x69,
|
||||||
|
0xe2,
|
||||||
|
0x47,
|
||||||
|
0xe9,
|
||||||
|
0xc0,
|
||||||
|
0x8b,
|
||||||
|
0x10,
|
||||||
|
0xd0,
|
||||||
|
0x29,
|
||||||
|
0x93,
|
||||||
|
0x4f,
|
||||||
|
0xc4,
|
||||||
|
0xb9,
|
||||||
|
0x52,
|
||||||
|
0xf7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x31,
|
||||||
|
0xfc,
|
||||||
|
0xef,
|
||||||
|
0xac,
|
||||||
|
0x66,
|
||||||
|
0xd7,
|
||||||
|
0xde,
|
||||||
|
0x9c,
|
||||||
|
0x7e,
|
||||||
|
0xc7,
|
||||||
|
0x48,
|
||||||
|
0x5f,
|
||||||
|
0xe4,
|
||||||
|
0x49,
|
||||||
|
0x49,
|
||||||
|
0x02,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x54,
|
||||||
|
0x93,
|
||||||
|
0xe9,
|
||||||
|
0x99,
|
||||||
|
0x33,
|
||||||
|
0xb0,
|
||||||
|
0xa8,
|
||||||
|
0x11,
|
||||||
|
0x7e,
|
||||||
|
0x08,
|
||||||
|
0xec,
|
||||||
|
0x0f,
|
||||||
|
0x97,
|
||||||
|
0xcf,
|
||||||
|
0xc3,
|
||||||
|
0xd9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x6e,
|
||||||
|
0xe2,
|
||||||
|
0xa4,
|
||||||
|
0xca,
|
||||||
|
0x67,
|
||||||
|
0xb0,
|
||||||
|
0x54,
|
||||||
|
0xbb,
|
||||||
|
0xfd,
|
||||||
|
0x33,
|
||||||
|
0x15,
|
||||||
|
0xbf,
|
||||||
|
0x85,
|
||||||
|
0x23,
|
||||||
|
0x05,
|
||||||
|
0x77,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x47,
|
||||||
|
0x3d,
|
||||||
|
0x06,
|
||||||
|
0xe8,
|
||||||
|
0x73,
|
||||||
|
0x8d,
|
||||||
|
0xb8,
|
||||||
|
0x98,
|
||||||
|
0x54,
|
||||||
|
0xc0,
|
||||||
|
0x66,
|
||||||
|
0xc4,
|
||||||
|
0x7a,
|
||||||
|
0xe4,
|
||||||
|
0x77,
|
||||||
|
0x40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa4,
|
||||||
|
0x26,
|
||||||
|
0xe5,
|
||||||
|
0xe4,
|
||||||
|
0x23,
|
||||||
|
0xbf,
|
||||||
|
0x48,
|
||||||
|
0x85,
|
||||||
|
0x29,
|
||||||
|
0x4d,
|
||||||
|
0xa4,
|
||||||
|
0x81,
|
||||||
|
0xfe,
|
||||||
|
0xae,
|
||||||
|
0xf7,
|
||||||
|
0x23,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x78,
|
||||||
|
0x01,
|
||||||
|
0x77,
|
||||||
|
0x31,
|
||||||
|
0xcf,
|
||||||
|
0x65,
|
||||||
|
0xfa,
|
||||||
|
0xb0,
|
||||||
|
0x74,
|
||||||
|
0xd5,
|
||||||
|
0x20,
|
||||||
|
0x89,
|
||||||
|
0x52,
|
||||||
|
0x51,
|
||||||
|
0x2e,
|
||||||
|
0xb1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x9e,
|
||||||
|
0x25,
|
||||||
|
0xfc,
|
||||||
|
0x83,
|
||||||
|
0x3f,
|
||||||
|
0x22,
|
||||||
|
0x90,
|
||||||
|
0x73,
|
||||||
|
0x3e,
|
||||||
|
0x93,
|
||||||
|
0x44,
|
||||||
|
0xa5,
|
||||||
|
0xe8,
|
||||||
|
0x38,
|
||||||
|
0x39,
|
||||||
|
0xeb,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x56,
|
||||||
|
0x8e,
|
||||||
|
0x49,
|
||||||
|
0x5a,
|
||||||
|
0xbe,
|
||||||
|
0x52,
|
||||||
|
0x5a,
|
||||||
|
0x21,
|
||||||
|
0x8a,
|
||||||
|
0x22,
|
||||||
|
0x14,
|
||||||
|
0xcd,
|
||||||
|
0x3e,
|
||||||
|
0x07,
|
||||||
|
0x1d,
|
||||||
|
0x12,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x4a,
|
||||||
|
0x29,
|
||||||
|
0xb5,
|
||||||
|
0x45,
|
||||||
|
0x52,
|
||||||
|
0xd1,
|
||||||
|
0x6b,
|
||||||
|
0x9a,
|
||||||
|
0x46,
|
||||||
|
0x9c,
|
||||||
|
0x10,
|
||||||
|
0x52,
|
||||||
|
0x8e,
|
||||||
|
0xff,
|
||||||
|
0x0a,
|
||||||
|
0xae,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc9,
|
||||||
|
0xd1,
|
||||||
|
0x84,
|
||||||
|
0xdd,
|
||||||
|
0xd5,
|
||||||
|
0xa9,
|
||||||
|
0xf5,
|
||||||
|
0xe0,
|
||||||
|
0xcf,
|
||||||
|
0x8c,
|
||||||
|
0xe2,
|
||||||
|
0x9a,
|
||||||
|
0x9a,
|
||||||
|
0xbf,
|
||||||
|
0x69,
|
||||||
|
0x1c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x2d,
|
||||||
|
0xb4,
|
||||||
|
0x79,
|
||||||
|
0xae,
|
||||||
|
0x78,
|
||||||
|
0xbd,
|
||||||
|
0x50,
|
||||||
|
0xd8,
|
||||||
|
0x88,
|
||||||
|
0x2a,
|
||||||
|
0x8a,
|
||||||
|
0x17,
|
||||||
|
0x8a,
|
||||||
|
0x61,
|
||||||
|
0x32,
|
||||||
|
0xad,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x8e,
|
||||||
|
0xce,
|
||||||
|
0x5f,
|
||||||
|
0x04,
|
||||||
|
0x2d,
|
||||||
|
0x5e,
|
||||||
|
0x44,
|
||||||
|
0x7b,
|
||||||
|
0x50,
|
||||||
|
0x51,
|
||||||
|
0xb9,
|
||||||
|
0xea,
|
||||||
|
0xcb,
|
||||||
|
0x8d,
|
||||||
|
0x8f,
|
||||||
|
0x6f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x9c,
|
||||||
|
0x0b,
|
||||||
|
0x53,
|
||||||
|
0xb4,
|
||||||
|
0xb3,
|
||||||
|
0xc3,
|
||||||
|
0x07,
|
||||||
|
0xe8,
|
||||||
|
0x7e,
|
||||||
|
0xae,
|
||||||
|
0xe0,
|
||||||
|
0x86,
|
||||||
|
0x78,
|
||||||
|
0x14,
|
||||||
|
0x1f,
|
||||||
|
0x66,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xab,
|
||||||
|
0xf2,
|
||||||
|
0x48,
|
||||||
|
0xaf,
|
||||||
|
0x69,
|
||||||
|
0xa6,
|
||||||
|
0xea,
|
||||||
|
0xe4,
|
||||||
|
0xbf,
|
||||||
|
0xd3,
|
||||||
|
0xeb,
|
||||||
|
0x2f,
|
||||||
|
0x12,
|
||||||
|
0x9e,
|
||||||
|
0xeb,
|
||||||
|
0x94,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x06,
|
||||||
|
0x64,
|
||||||
|
0xda,
|
||||||
|
0x16,
|
||||||
|
0x68,
|
||||||
|
0x57,
|
||||||
|
0x4b,
|
||||||
|
0x88,
|
||||||
|
0xb9,
|
||||||
|
0x35,
|
||||||
|
0xf3,
|
||||||
|
0x02,
|
||||||
|
0x73,
|
||||||
|
0x58,
|
||||||
|
0xae,
|
||||||
|
0xf4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xaa,
|
||||||
|
0x4b,
|
||||||
|
0x9d,
|
||||||
|
0xc4,
|
||||||
|
0xbf,
|
||||||
|
0x33,
|
||||||
|
0x7d,
|
||||||
|
0xe9,
|
||||||
|
0x0c,
|
||||||
|
0xd4,
|
||||||
|
0xfd,
|
||||||
|
0x3c,
|
||||||
|
0x46,
|
||||||
|
0x7c,
|
||||||
|
0x6a,
|
||||||
|
0xb7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xea,
|
||||||
|
0x5c,
|
||||||
|
0x7f,
|
||||||
|
0x47,
|
||||||
|
0x1f,
|
||||||
|
0xaf,
|
||||||
|
0x6b,
|
||||||
|
0xde,
|
||||||
|
0x2b,
|
||||||
|
0x1a,
|
||||||
|
0xd7,
|
||||||
|
0xd4,
|
||||||
|
0x68,
|
||||||
|
0x6d,
|
||||||
|
0x22,
|
||||||
|
0x87,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x29,
|
||||||
|
0x39,
|
||||||
|
0xb0,
|
||||||
|
0x18,
|
||||||
|
0x32,
|
||||||
|
0x23,
|
||||||
|
0xfa,
|
||||||
|
0xfc,
|
||||||
|
0x17,
|
||||||
|
0x23,
|
||||||
|
0xde,
|
||||||
|
0x4f,
|
||||||
|
0x52,
|
||||||
|
0xc4,
|
||||||
|
0x3d,
|
||||||
|
0x35,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x7c,
|
||||||
|
0x39,
|
||||||
|
0x56,
|
||||||
|
0xca,
|
||||||
|
0x5e,
|
||||||
|
0xea,
|
||||||
|
0xfc,
|
||||||
|
0x3e,
|
||||||
|
0x36,
|
||||||
|
0x3e,
|
||||||
|
0x9d,
|
||||||
|
0x55,
|
||||||
|
0x65,
|
||||||
|
0x46,
|
||||||
|
0xeb,
|
||||||
|
0x68,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x77,
|
||||||
|
0xc6,
|
||||||
|
0x07,
|
||||||
|
0x71,
|
||||||
|
0x46,
|
||||||
|
0xf0,
|
||||||
|
0x1c,
|
||||||
|
0x32,
|
||||||
|
0xb6,
|
||||||
|
0xb6,
|
||||||
|
0x9d,
|
||||||
|
0x5f,
|
||||||
|
0x4e,
|
||||||
|
0xa9,
|
||||||
|
0xff,
|
||||||
|
0xcf,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x37,
|
||||||
|
0xa6,
|
||||||
|
0x98,
|
||||||
|
0x6c,
|
||||||
|
0xb8,
|
||||||
|
0x84,
|
||||||
|
0x7e,
|
||||||
|
0xdf,
|
||||||
|
0x09,
|
||||||
|
0x25,
|
||||||
|
0xf0,
|
||||||
|
0xf1,
|
||||||
|
0x30,
|
||||||
|
0x9b,
|
||||||
|
0x54,
|
||||||
|
0xde,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa7,
|
||||||
|
0x05,
|
||||||
|
0xf0,
|
||||||
|
0xe6,
|
||||||
|
0x9d,
|
||||||
|
0xa9,
|
||||||
|
0xa8,
|
||||||
|
0xf9,
|
||||||
|
0x07,
|
||||||
|
0x24,
|
||||||
|
0x1a,
|
||||||
|
0x2e,
|
||||||
|
0x92,
|
||||||
|
0x3c,
|
||||||
|
0x8c,
|
||||||
|
0xc8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x3d,
|
||||||
|
0xc4,
|
||||||
|
0x7d,
|
||||||
|
0x1f,
|
||||||
|
0x29,
|
||||||
|
0xc4,
|
||||||
|
0x48,
|
||||||
|
0x46,
|
||||||
|
0x1e,
|
||||||
|
0x9e,
|
||||||
|
0x76,
|
||||||
|
0xed,
|
||||||
|
0x90,
|
||||||
|
0x4f,
|
||||||
|
0x67,
|
||||||
|
0x11,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0d,
|
||||||
|
0x62,
|
||||||
|
0xbf,
|
||||||
|
0x01,
|
||||||
|
0xe6,
|
||||||
|
0xfc,
|
||||||
|
0x0e,
|
||||||
|
0x1a,
|
||||||
|
0x0d,
|
||||||
|
0x3c,
|
||||||
|
0x47,
|
||||||
|
0x51,
|
||||||
|
0xc5,
|
||||||
|
0xd3,
|
||||||
|
0x69,
|
||||||
|
0x2b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x8c,
|
||||||
|
0x03,
|
||||||
|
0x46,
|
||||||
|
0x8b,
|
||||||
|
0xca,
|
||||||
|
0x7c,
|
||||||
|
0x66,
|
||||||
|
0x9e,
|
||||||
|
0xe4,
|
||||||
|
0xfd,
|
||||||
|
0x5e,
|
||||||
|
0x08,
|
||||||
|
0x4b,
|
||||||
|
0xbe,
|
||||||
|
0xe7,
|
||||||
|
0xb5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x52,
|
||||||
|
0x8a,
|
||||||
|
0x5b,
|
||||||
|
0xb9,
|
||||||
|
0x3b,
|
||||||
|
0xaf,
|
||||||
|
0x2c,
|
||||||
|
0x9c,
|
||||||
|
0x44,
|
||||||
|
0x73,
|
||||||
|
0xcc,
|
||||||
|
0xe5,
|
||||||
|
0xd0,
|
||||||
|
0xd2,
|
||||||
|
0x2b,
|
||||||
|
0xd9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xdf,
|
||||||
|
0x6a,
|
||||||
|
0x30,
|
||||||
|
0x1e,
|
||||||
|
0x95,
|
||||||
|
0xc9,
|
||||||
|
0x5d,
|
||||||
|
0xad,
|
||||||
|
0x97,
|
||||||
|
0xae,
|
||||||
|
0x0c,
|
||||||
|
0xc8,
|
||||||
|
0xc6,
|
||||||
|
0x91,
|
||||||
|
0x3b,
|
||||||
|
0xd8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x80,
|
||||||
|
0x11,
|
||||||
|
0x89,
|
||||||
|
0x90,
|
||||||
|
0x2c,
|
||||||
|
0x85,
|
||||||
|
0x7f,
|
||||||
|
0x39,
|
||||||
|
0xe7,
|
||||||
|
0x35,
|
||||||
|
0x91,
|
||||||
|
0x28,
|
||||||
|
0x5e,
|
||||||
|
0x70,
|
||||||
|
0xb6,
|
||||||
|
0xdb,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe6,
|
||||||
|
0x17,
|
||||||
|
0x34,
|
||||||
|
0x6a,
|
||||||
|
0xc9,
|
||||||
|
0xc2,
|
||||||
|
0x31,
|
||||||
|
0xbb,
|
||||||
|
0x36,
|
||||||
|
0x50,
|
||||||
|
0xae,
|
||||||
|
0x34,
|
||||||
|
0xcc,
|
||||||
|
0xca,
|
||||||
|
0x0c,
|
||||||
|
0x5b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x27,
|
||||||
|
0xd9,
|
||||||
|
0x34,
|
||||||
|
0x37,
|
||||||
|
0xef,
|
||||||
|
0xb7,
|
||||||
|
0x21,
|
||||||
|
0xaa,
|
||||||
|
0x40,
|
||||||
|
0x18,
|
||||||
|
0x21,
|
||||||
|
0xdc,
|
||||||
|
0xec,
|
||||||
|
0x5a,
|
||||||
|
0xdf,
|
||||||
|
0x89,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x89,
|
||||||
|
0x23,
|
||||||
|
0x7d,
|
||||||
|
0x9d,
|
||||||
|
0xed,
|
||||||
|
0x9c,
|
||||||
|
0x5e,
|
||||||
|
0x78,
|
||||||
|
0xd8,
|
||||||
|
0xb1,
|
||||||
|
0xc9,
|
||||||
|
0xb1,
|
||||||
|
0x66,
|
||||||
|
0xcc,
|
||||||
|
0x73,
|
||||||
|
0x42,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x4a,
|
||||||
|
0x6d,
|
||||||
|
0x80,
|
||||||
|
0x91,
|
||||||
|
0xbf,
|
||||||
|
0x5e,
|
||||||
|
0x7d,
|
||||||
|
0x65,
|
||||||
|
0x11,
|
||||||
|
0x89,
|
||||||
|
0xfa,
|
||||||
|
0x94,
|
||||||
|
0xa2,
|
||||||
|
0x50,
|
||||||
|
0xb1,
|
||||||
|
0x4c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0e,
|
||||||
|
0x33,
|
||||||
|
0xf9,
|
||||||
|
0x60,
|
||||||
|
0x55,
|
||||||
|
0xe7,
|
||||||
|
0xae,
|
||||||
|
0x89,
|
||||||
|
0x3f,
|
||||||
|
0xfc,
|
||||||
|
0x0e,
|
||||||
|
0x3d,
|
||||||
|
0xcf,
|
||||||
|
0x49,
|
||||||
|
0x29,
|
||||||
|
0x02,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe6,
|
||||||
|
0x1c,
|
||||||
|
0x43,
|
||||||
|
0x2b,
|
||||||
|
0x72,
|
||||||
|
0x0b,
|
||||||
|
0x19,
|
||||||
|
0xd1,
|
||||||
|
0x8e,
|
||||||
|
0xc8,
|
||||||
|
0xd8,
|
||||||
|
0x4b,
|
||||||
|
0xdc,
|
||||||
|
0x63,
|
||||||
|
0x15,
|
||||||
|
0x1b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf7,
|
||||||
|
0xe5,
|
||||||
|
0xae,
|
||||||
|
0xf5,
|
||||||
|
0x49,
|
||||||
|
0xf7,
|
||||||
|
0x82,
|
||||||
|
0xcf,
|
||||||
|
0x37,
|
||||||
|
0x90,
|
||||||
|
0x55,
|
||||||
|
0xa6,
|
||||||
|
0x08,
|
||||||
|
0x26,
|
||||||
|
0x9b,
|
||||||
|
0x16,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x43,
|
||||||
|
0x8d,
|
||||||
|
0x03,
|
||||||
|
0x0f,
|
||||||
|
0xd0,
|
||||||
|
0xb7,
|
||||||
|
0xa5,
|
||||||
|
0x4f,
|
||||||
|
0xa8,
|
||||||
|
0x37,
|
||||||
|
0xf2,
|
||||||
|
0xad,
|
||||||
|
0x20,
|
||||||
|
0x1a,
|
||||||
|
0x64,
|
||||||
|
0x03,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa5,
|
||||||
|
0x90,
|
||||||
|
0xd3,
|
||||||
|
0xee,
|
||||||
|
0x4f,
|
||||||
|
0xbf,
|
||||||
|
0x04,
|
||||||
|
0xe3,
|
||||||
|
0x24,
|
||||||
|
0x7e,
|
||||||
|
0x0d,
|
||||||
|
0x27,
|
||||||
|
0xf2,
|
||||||
|
0x86,
|
||||||
|
0x42,
|
||||||
|
0x3f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5f,
|
||||||
|
0xe2,
|
||||||
|
0xc1,
|
||||||
|
0xa1,
|
||||||
|
0x72,
|
||||||
|
0xfe,
|
||||||
|
0x93,
|
||||||
|
0xc4,
|
||||||
|
0xb1,
|
||||||
|
0x5c,
|
||||||
|
0xd3,
|
||||||
|
0x7c,
|
||||||
|
0xae,
|
||||||
|
0xf9,
|
||||||
|
0xf5,
|
||||||
|
0x38,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x2c,
|
||||||
|
0x97,
|
||||||
|
0x32,
|
||||||
|
0x5c,
|
||||||
|
0xbd,
|
||||||
|
0x06,
|
||||||
|
0xb3,
|
||||||
|
0x6e,
|
||||||
|
0xb2,
|
||||||
|
0x13,
|
||||||
|
0x3d,
|
||||||
|
0xd0,
|
||||||
|
0x8b,
|
||||||
|
0x3a,
|
||||||
|
0x01,
|
||||||
|
0x7c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x92,
|
||||||
|
0xc8,
|
||||||
|
0x14,
|
||||||
|
0x22,
|
||||||
|
0x7a,
|
||||||
|
0x6b,
|
||||||
|
0xca,
|
||||||
|
0x94,
|
||||||
|
0x9f,
|
||||||
|
0xf0,
|
||||||
|
0x65,
|
||||||
|
0x9f,
|
||||||
|
0x00,
|
||||||
|
0x2a,
|
||||||
|
0xd3,
|
||||||
|
0x9e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xdc,
|
||||||
|
0xe8,
|
||||||
|
0x50,
|
||||||
|
0x11,
|
||||||
|
0x0b,
|
||||||
|
0xd8,
|
||||||
|
0x32,
|
||||||
|
0x8c,
|
||||||
|
0xfb,
|
||||||
|
0xd5,
|
||||||
|
0x08,
|
||||||
|
0x41,
|
||||||
|
0xd6,
|
||||||
|
0x91,
|
||||||
|
0x1d,
|
||||||
|
0x87,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x67,
|
||||||
|
0xf1,
|
||||||
|
0x49,
|
||||||
|
0x84,
|
||||||
|
0xc7,
|
||||||
|
0xda,
|
||||||
|
0x79,
|
||||||
|
0x12,
|
||||||
|
0x48,
|
||||||
|
0xe3,
|
||||||
|
0x2b,
|
||||||
|
0xb5,
|
||||||
|
0x92,
|
||||||
|
0x25,
|
||||||
|
0x83,
|
||||||
|
0xda,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x19,
|
||||||
|
0x38,
|
||||||
|
0xf2,
|
||||||
|
0xcf,
|
||||||
|
0x72,
|
||||||
|
0xd5,
|
||||||
|
0x4e,
|
||||||
|
0xe9,
|
||||||
|
0x7e,
|
||||||
|
0x94,
|
||||||
|
0x16,
|
||||||
|
0x6f,
|
||||||
|
0xa9,
|
||||||
|
0x1d,
|
||||||
|
0x2a,
|
||||||
|
0x36,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x74,
|
||||||
|
0x48,
|
||||||
|
0x1e,
|
||||||
|
0x96,
|
||||||
|
0x46,
|
||||||
|
0xed,
|
||||||
|
0x49,
|
||||||
|
0xfe,
|
||||||
|
0x0f,
|
||||||
|
0x62,
|
||||||
|
0x24,
|
||||||
|
0x30,
|
||||||
|
0x16,
|
||||||
|
0x04,
|
||||||
|
0x69,
|
||||||
|
0x8e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x57,
|
||||||
|
0xfc,
|
||||||
|
0xa5,
|
||||||
|
0xde,
|
||||||
|
0x98,
|
||||||
|
0xa9,
|
||||||
|
0xd6,
|
||||||
|
0xd8,
|
||||||
|
0x00,
|
||||||
|
0x64,
|
||||||
|
0x38,
|
||||||
|
0xd0,
|
||||||
|
0x58,
|
||||||
|
0x3d,
|
||||||
|
0x8a,
|
||||||
|
0x1d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x9f,
|
||||||
|
0xec,
|
||||||
|
0xde,
|
||||||
|
0x1c,
|
||||||
|
0xef,
|
||||||
|
0xdc,
|
||||||
|
0x1c,
|
||||||
|
0xbe,
|
||||||
|
0xd4,
|
||||||
|
0x76,
|
||||||
|
0x36,
|
||||||
|
0x74,
|
||||||
|
0xd9,
|
||||||
|
0x57,
|
||||||
|
0x53,
|
||||||
|
0x59,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe3,
|
||||||
|
0x04,
|
||||||
|
0x0c,
|
||||||
|
0x00,
|
||||||
|
0xeb,
|
||||||
|
0x28,
|
||||||
|
0xf1,
|
||||||
|
0x53,
|
||||||
|
0x66,
|
||||||
|
0xca,
|
||||||
|
0x73,
|
||||||
|
0xcb,
|
||||||
|
0xd8,
|
||||||
|
0x72,
|
||||||
|
0xe7,
|
||||||
|
0x40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x76,
|
||||||
|
0x97,
|
||||||
|
0x00,
|
||||||
|
0x9a,
|
||||||
|
0x6a,
|
||||||
|
0x83,
|
||||||
|
0x1d,
|
||||||
|
0xfe,
|
||||||
|
0xcc,
|
||||||
|
0xa9,
|
||||||
|
0x1c,
|
||||||
|
0x59,
|
||||||
|
0x93,
|
||||||
|
0x67,
|
||||||
|
0x0f,
|
||||||
|
0x7a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x58,
|
||||||
|
0x53,
|
||||||
|
0x54,
|
||||||
|
0x23,
|
||||||
|
0x21,
|
||||||
|
0xf5,
|
||||||
|
0x67,
|
||||||
|
0xa0,
|
||||||
|
0x05,
|
||||||
|
0xd5,
|
||||||
|
0x47,
|
||||||
|
0xa4,
|
||||||
|
0xf0,
|
||||||
|
0x47,
|
||||||
|
0x59,
|
||||||
|
0xbd,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x51,
|
||||||
|
0x50,
|
||||||
|
0xd1,
|
||||||
|
0x77,
|
||||||
|
0x2f,
|
||||||
|
0x50,
|
||||||
|
0x83,
|
||||||
|
0x4a,
|
||||||
|
0x50,
|
||||||
|
0x3e,
|
||||||
|
0x06,
|
||||||
|
0x9a,
|
||||||
|
0x97,
|
||||||
|
0x3f,
|
||||||
|
0xbd,
|
||||||
|
0x7c,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const uint8_t vectors_hsip32[64][4] = {
|
||||||
|
{
|
||||||
|
0xa9,
|
||||||
|
0x35,
|
||||||
|
0x9f,
|
||||||
|
0x5b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x27,
|
||||||
|
0x47,
|
||||||
|
0x5a,
|
||||||
|
0xb8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xfa,
|
||||||
|
0x62,
|
||||||
|
0xa6,
|
||||||
|
0x03,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x8a,
|
||||||
|
0xfe,
|
||||||
|
0xe7,
|
||||||
|
0x04,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x2a,
|
||||||
|
0x6e,
|
||||||
|
0x46,
|
||||||
|
0x89,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc5,
|
||||||
|
0xfa,
|
||||||
|
0xb6,
|
||||||
|
0x69,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x58,
|
||||||
|
0x63,
|
||||||
|
0xfc,
|
||||||
|
0x23,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x8b,
|
||||||
|
0xcf,
|
||||||
|
0x63,
|
||||||
|
0xc5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd0,
|
||||||
|
0xb8,
|
||||||
|
0x84,
|
||||||
|
0x8f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf8,
|
||||||
|
0x06,
|
||||||
|
0xe7,
|
||||||
|
0x79,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x94,
|
||||||
|
0xb0,
|
||||||
|
0x79,
|
||||||
|
0x34,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x08,
|
||||||
|
0x08,
|
||||||
|
0x30,
|
||||||
|
0x50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x57,
|
||||||
|
0xf0,
|
||||||
|
0x87,
|
||||||
|
0x2f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x77,
|
||||||
|
0xe6,
|
||||||
|
0x63,
|
||||||
|
0xff,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd6,
|
||||||
|
0xff,
|
||||||
|
0xf8,
|
||||||
|
0x7c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x74,
|
||||||
|
0xfe,
|
||||||
|
0x2b,
|
||||||
|
0x97,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd9,
|
||||||
|
0xb5,
|
||||||
|
0xac,
|
||||||
|
0x84,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc4,
|
||||||
|
0x74,
|
||||||
|
0x64,
|
||||||
|
0x5b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x46,
|
||||||
|
0x5b,
|
||||||
|
0x8d,
|
||||||
|
0x9b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x7b,
|
||||||
|
0xef,
|
||||||
|
0xe3,
|
||||||
|
0x87,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe3,
|
||||||
|
0x4d,
|
||||||
|
0x10,
|
||||||
|
0x45,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x61,
|
||||||
|
0x3f,
|
||||||
|
0x62,
|
||||||
|
0xb3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x70,
|
||||||
|
0xf3,
|
||||||
|
0x67,
|
||||||
|
0xfe,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe6,
|
||||||
|
0xad,
|
||||||
|
0xb8,
|
||||||
|
0xbd,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x27,
|
||||||
|
0x40,
|
||||||
|
0x0c,
|
||||||
|
0x63,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x26,
|
||||||
|
0x78,
|
||||||
|
0x78,
|
||||||
|
0x75,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x4f,
|
||||||
|
0x56,
|
||||||
|
0x7b,
|
||||||
|
0x5f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x3a,
|
||||||
|
0xb0,
|
||||||
|
0xe6,
|
||||||
|
0x69,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb0,
|
||||||
|
0x64,
|
||||||
|
0x40,
|
||||||
|
0x00,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xff,
|
||||||
|
0x67,
|
||||||
|
0x0f,
|
||||||
|
0xb4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x50,
|
||||||
|
0x9e,
|
||||||
|
0x33,
|
||||||
|
0x8b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5d,
|
||||||
|
0x58,
|
||||||
|
0x9f,
|
||||||
|
0x1a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xfe,
|
||||||
|
0xe7,
|
||||||
|
0x21,
|
||||||
|
0x12,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x33,
|
||||||
|
0x75,
|
||||||
|
0x32,
|
||||||
|
0x59,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x6a,
|
||||||
|
0x43,
|
||||||
|
0x4f,
|
||||||
|
0x8c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xfe,
|
||||||
|
0x28,
|
||||||
|
0xb7,
|
||||||
|
0x29,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe7,
|
||||||
|
0x5c,
|
||||||
|
0xc6,
|
||||||
|
0xec,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x69,
|
||||||
|
0x7e,
|
||||||
|
0x8d,
|
||||||
|
0x54,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x63,
|
||||||
|
0x68,
|
||||||
|
0x8b,
|
||||||
|
0x0f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x65,
|
||||||
|
0x0b,
|
||||||
|
0x62,
|
||||||
|
0xb4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb6,
|
||||||
|
0xbc,
|
||||||
|
0x18,
|
||||||
|
0x40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5d,
|
||||||
|
0x07,
|
||||||
|
0x45,
|
||||||
|
0x05,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x24,
|
||||||
|
0x42,
|
||||||
|
0xfd,
|
||||||
|
0x2e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x7b,
|
||||||
|
0xb7,
|
||||||
|
0x86,
|
||||||
|
0x3a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x77,
|
||||||
|
0x05,
|
||||||
|
0xd5,
|
||||||
|
0x48,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd7,
|
||||||
|
0x52,
|
||||||
|
0x08,
|
||||||
|
0xb1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xb6,
|
||||||
|
0xd4,
|
||||||
|
0x99,
|
||||||
|
0xc8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x08,
|
||||||
|
0x92,
|
||||||
|
0x20,
|
||||||
|
0x2e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x69,
|
||||||
|
0xe1,
|
||||||
|
0x2c,
|
||||||
|
0xe3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x8d,
|
||||||
|
0xb5,
|
||||||
|
0x80,
|
||||||
|
0xe5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x36,
|
||||||
|
0x97,
|
||||||
|
0x64,
|
||||||
|
0xc6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x01,
|
||||||
|
0x6e,
|
||||||
|
0x02,
|
||||||
|
0x04,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x3b,
|
||||||
|
0x85,
|
||||||
|
0xf3,
|
||||||
|
0xd4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xfe,
|
||||||
|
0xdb,
|
||||||
|
0x66,
|
||||||
|
0xbe,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x1e,
|
||||||
|
0x69,
|
||||||
|
0x2a,
|
||||||
|
0x3a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc6,
|
||||||
|
0x89,
|
||||||
|
0x84,
|
||||||
|
0xc0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa5,
|
||||||
|
0xc5,
|
||||||
|
0xb9,
|
||||||
|
0x40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x9b,
|
||||||
|
0xe9,
|
||||||
|
0xe8,
|
||||||
|
0x8c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x7d,
|
||||||
|
0xbc,
|
||||||
|
0x81,
|
||||||
|
0x40,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x7c,
|
||||||
|
0x07,
|
||||||
|
0x8e,
|
||||||
|
0xc5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd4,
|
||||||
|
0xe7,
|
||||||
|
0x6c,
|
||||||
|
0x73,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x42,
|
||||||
|
0x8f,
|
||||||
|
0xcb,
|
||||||
|
0xb9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xbd,
|
||||||
|
0x83,
|
||||||
|
0x99,
|
||||||
|
0x7a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x59,
|
||||||
|
0xea,
|
||||||
|
0x4a,
|
||||||
|
0x74,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const uint8_t vectors_hsip64[64][8] = {
|
||||||
|
{
|
||||||
|
0x21,
|
||||||
|
0x8d,
|
||||||
|
0x1f,
|
||||||
|
0x59,
|
||||||
|
0xb9,
|
||||||
|
0xb8,
|
||||||
|
0x3c,
|
||||||
|
0xc8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xbe,
|
||||||
|
0x55,
|
||||||
|
0x24,
|
||||||
|
0x12,
|
||||||
|
0xf8,
|
||||||
|
0x38,
|
||||||
|
0x73,
|
||||||
|
0x15,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x06,
|
||||||
|
0x4f,
|
||||||
|
0x39,
|
||||||
|
0xef,
|
||||||
|
0x7c,
|
||||||
|
0x50,
|
||||||
|
0xeb,
|
||||||
|
0x57,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xce,
|
||||||
|
0x0f,
|
||||||
|
0x1a,
|
||||||
|
0x45,
|
||||||
|
0xf7,
|
||||||
|
0x06,
|
||||||
|
0x06,
|
||||||
|
0x79,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd5,
|
||||||
|
0xe7,
|
||||||
|
0x8a,
|
||||||
|
0x17,
|
||||||
|
0x5b,
|
||||||
|
0xe5,
|
||||||
|
0x2e,
|
||||||
|
0xa1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xcb,
|
||||||
|
0x9d,
|
||||||
|
0x7c,
|
||||||
|
0x3f,
|
||||||
|
0x2f,
|
||||||
|
0x3d,
|
||||||
|
0xb5,
|
||||||
|
0x80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xce,
|
||||||
|
0x3e,
|
||||||
|
0x91,
|
||||||
|
0x35,
|
||||||
|
0x8a,
|
||||||
|
0xa2,
|
||||||
|
0xbc,
|
||||||
|
0x25,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xff,
|
||||||
|
0x20,
|
||||||
|
0x27,
|
||||||
|
0x28,
|
||||||
|
0xb0,
|
||||||
|
0x7b,
|
||||||
|
0xc6,
|
||||||
|
0x84,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xed,
|
||||||
|
0xfe,
|
||||||
|
0xe8,
|
||||||
|
0x20,
|
||||||
|
0xbc,
|
||||||
|
0xe4,
|
||||||
|
0x85,
|
||||||
|
0x8c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5b,
|
||||||
|
0x51,
|
||||||
|
0xcc,
|
||||||
|
0xcc,
|
||||||
|
0x13,
|
||||||
|
0x88,
|
||||||
|
0x83,
|
||||||
|
0x07,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x95,
|
||||||
|
0xb0,
|
||||||
|
0x46,
|
||||||
|
0x9f,
|
||||||
|
0x06,
|
||||||
|
0xa6,
|
||||||
|
0xf2,
|
||||||
|
0xee,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xae,
|
||||||
|
0x26,
|
||||||
|
0x33,
|
||||||
|
0x39,
|
||||||
|
0x94,
|
||||||
|
0xdd,
|
||||||
|
0xcd,
|
||||||
|
0x48,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x7b,
|
||||||
|
0xc7,
|
||||||
|
0x1f,
|
||||||
|
0x9f,
|
||||||
|
0xae,
|
||||||
|
0xf5,
|
||||||
|
0xc7,
|
||||||
|
0x99,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5a,
|
||||||
|
0x23,
|
||||||
|
0x52,
|
||||||
|
0xd7,
|
||||||
|
0x5a,
|
||||||
|
0x0c,
|
||||||
|
0x37,
|
||||||
|
0x44,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x3b,
|
||||||
|
0xb1,
|
||||||
|
0xa8,
|
||||||
|
0x70,
|
||||||
|
0xea,
|
||||||
|
0xe8,
|
||||||
|
0xe6,
|
||||||
|
0x58,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x21,
|
||||||
|
0x7d,
|
||||||
|
0x0b,
|
||||||
|
0xcb,
|
||||||
|
0x4e,
|
||||||
|
0x81,
|
||||||
|
0xc9,
|
||||||
|
0x02,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x73,
|
||||||
|
0x36,
|
||||||
|
0xaa,
|
||||||
|
0xd2,
|
||||||
|
0x5f,
|
||||||
|
0x7b,
|
||||||
|
0xf3,
|
||||||
|
0xb5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x37,
|
||||||
|
0xad,
|
||||||
|
0xc0,
|
||||||
|
0x64,
|
||||||
|
0x1c,
|
||||||
|
0x4c,
|
||||||
|
0x4f,
|
||||||
|
0x6a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xc9,
|
||||||
|
0xb2,
|
||||||
|
0xdb,
|
||||||
|
0x2b,
|
||||||
|
0x9a,
|
||||||
|
0x3e,
|
||||||
|
0x42,
|
||||||
|
0xf9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf9,
|
||||||
|
0x10,
|
||||||
|
0xe4,
|
||||||
|
0x80,
|
||||||
|
0x20,
|
||||||
|
0xab,
|
||||||
|
0x36,
|
||||||
|
0x3c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x1b,
|
||||||
|
0xf5,
|
||||||
|
0x2b,
|
||||||
|
0x0a,
|
||||||
|
0x6f,
|
||||||
|
0xee,
|
||||||
|
0xa7,
|
||||||
|
0xdb,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x00,
|
||||||
|
0x74,
|
||||||
|
0x1d,
|
||||||
|
0xc2,
|
||||||
|
0x69,
|
||||||
|
0xe8,
|
||||||
|
0xb3,
|
||||||
|
0xef,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xe2,
|
||||||
|
0x01,
|
||||||
|
0x03,
|
||||||
|
0xfa,
|
||||||
|
0x1b,
|
||||||
|
0xa7,
|
||||||
|
0x76,
|
||||||
|
0xef,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x4c,
|
||||||
|
0x22,
|
||||||
|
0x10,
|
||||||
|
0xe5,
|
||||||
|
0x4b,
|
||||||
|
0x68,
|
||||||
|
0x1d,
|
||||||
|
0x73,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x70,
|
||||||
|
0x74,
|
||||||
|
0x10,
|
||||||
|
0x45,
|
||||||
|
0xae,
|
||||||
|
0x3f,
|
||||||
|
0xa6,
|
||||||
|
0xf1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0c,
|
||||||
|
0x86,
|
||||||
|
0x40,
|
||||||
|
0x37,
|
||||||
|
0x39,
|
||||||
|
0x71,
|
||||||
|
0x40,
|
||||||
|
0x38,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x0d,
|
||||||
|
0x89,
|
||||||
|
0x9e,
|
||||||
|
0xd8,
|
||||||
|
0x11,
|
||||||
|
0x29,
|
||||||
|
0x23,
|
||||||
|
0xf0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x22,
|
||||||
|
0x6b,
|
||||||
|
0xf5,
|
||||||
|
0xfa,
|
||||||
|
0xb8,
|
||||||
|
0x1e,
|
||||||
|
0xe1,
|
||||||
|
0xb8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x2d,
|
||||||
|
0x92,
|
||||||
|
0x5f,
|
||||||
|
0xfb,
|
||||||
|
0x1e,
|
||||||
|
0x00,
|
||||||
|
0x16,
|
||||||
|
0xb5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x36,
|
||||||
|
0x19,
|
||||||
|
0x58,
|
||||||
|
0xd5,
|
||||||
|
0x2c,
|
||||||
|
0xee,
|
||||||
|
0x10,
|
||||||
|
0xf1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x29,
|
||||||
|
0x1a,
|
||||||
|
0xaf,
|
||||||
|
0x86,
|
||||||
|
0x48,
|
||||||
|
0x98,
|
||||||
|
0x17,
|
||||||
|
0x9d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x86,
|
||||||
|
0x3c,
|
||||||
|
0x7f,
|
||||||
|
0x15,
|
||||||
|
0x5c,
|
||||||
|
0x34,
|
||||||
|
0x11,
|
||||||
|
0x7c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x28,
|
||||||
|
0x70,
|
||||||
|
0x9d,
|
||||||
|
0x46,
|
||||||
|
0xd8,
|
||||||
|
0x11,
|
||||||
|
0x62,
|
||||||
|
0x6c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x24,
|
||||||
|
0x84,
|
||||||
|
0x77,
|
||||||
|
0x68,
|
||||||
|
0x1d,
|
||||||
|
0x28,
|
||||||
|
0xf8,
|
||||||
|
0x9c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x83,
|
||||||
|
0x24,
|
||||||
|
0xe4,
|
||||||
|
0xd7,
|
||||||
|
0x52,
|
||||||
|
0x8f,
|
||||||
|
0x98,
|
||||||
|
0x30,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf9,
|
||||||
|
0xef,
|
||||||
|
0xd4,
|
||||||
|
0xe1,
|
||||||
|
0x3a,
|
||||||
|
0xea,
|
||||||
|
0x6b,
|
||||||
|
0xd8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x86,
|
||||||
|
0xd6,
|
||||||
|
0x7a,
|
||||||
|
0x40,
|
||||||
|
0xec,
|
||||||
|
0x42,
|
||||||
|
0x76,
|
||||||
|
0xdc,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x3f,
|
||||||
|
0x62,
|
||||||
|
0x92,
|
||||||
|
0xec,
|
||||||
|
0xcc,
|
||||||
|
0xa9,
|
||||||
|
0x7e,
|
||||||
|
0x35,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xcb,
|
||||||
|
0xd9,
|
||||||
|
0x2e,
|
||||||
|
0xe7,
|
||||||
|
0x24,
|
||||||
|
0xd4,
|
||||||
|
0x21,
|
||||||
|
0x09,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x36,
|
||||||
|
0x8d,
|
||||||
|
0xf6,
|
||||||
|
0x80,
|
||||||
|
0x8d,
|
||||||
|
0x40,
|
||||||
|
0x3d,
|
||||||
|
0x79,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5b,
|
||||||
|
0x38,
|
||||||
|
0xc8,
|
||||||
|
0x1c,
|
||||||
|
0x67,
|
||||||
|
0xc8,
|
||||||
|
0xae,
|
||||||
|
0x4c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x95,
|
||||||
|
0xab,
|
||||||
|
0x71,
|
||||||
|
0x89,
|
||||||
|
0xd4,
|
||||||
|
0x39,
|
||||||
|
0xac,
|
||||||
|
0xb3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa9,
|
||||||
|
0x1a,
|
||||||
|
0x52,
|
||||||
|
0xc0,
|
||||||
|
0x25,
|
||||||
|
0x32,
|
||||||
|
0x70,
|
||||||
|
0x24,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5b,
|
||||||
|
0x00,
|
||||||
|
0x87,
|
||||||
|
0xc6,
|
||||||
|
0x95,
|
||||||
|
0x28,
|
||||||
|
0xac,
|
||||||
|
0xea,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x1e,
|
||||||
|
0x30,
|
||||||
|
0xf3,
|
||||||
|
0xad,
|
||||||
|
0x27,
|
||||||
|
0xdc,
|
||||||
|
0xb1,
|
||||||
|
0x5a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x69,
|
||||||
|
0x7f,
|
||||||
|
0x5c,
|
||||||
|
0x9a,
|
||||||
|
0x90,
|
||||||
|
0x32,
|
||||||
|
0x4e,
|
||||||
|
0xd4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x49,
|
||||||
|
0x5c,
|
||||||
|
0x0f,
|
||||||
|
0x99,
|
||||||
|
0x55,
|
||||||
|
0x57,
|
||||||
|
0xdc,
|
||||||
|
0x38,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x94,
|
||||||
|
0x27,
|
||||||
|
0x20,
|
||||||
|
0x2a,
|
||||||
|
0x3c,
|
||||||
|
0x29,
|
||||||
|
0xf9,
|
||||||
|
0x4d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa9,
|
||||||
|
0xea,
|
||||||
|
0xa8,
|
||||||
|
0xc0,
|
||||||
|
0x4b,
|
||||||
|
0xa9,
|
||||||
|
0x3e,
|
||||||
|
0x3e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xee,
|
||||||
|
0xa4,
|
||||||
|
0xc1,
|
||||||
|
0x73,
|
||||||
|
0x7d,
|
||||||
|
0x01,
|
||||||
|
0x12,
|
||||||
|
0x18,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x91,
|
||||||
|
0x2d,
|
||||||
|
0x56,
|
||||||
|
0x8f,
|
||||||
|
0xd8,
|
||||||
|
0xf6,
|
||||||
|
0x5a,
|
||||||
|
0x49,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x56,
|
||||||
|
0x91,
|
||||||
|
0x95,
|
||||||
|
0x96,
|
||||||
|
0xb0,
|
||||||
|
0xff,
|
||||||
|
0x5c,
|
||||||
|
0x97,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x02,
|
||||||
|
0x44,
|
||||||
|
0x5a,
|
||||||
|
0x79,
|
||||||
|
0x98,
|
||||||
|
0xf5,
|
||||||
|
0x50,
|
||||||
|
0xe1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x86,
|
||||||
|
0xec,
|
||||||
|
0x46,
|
||||||
|
0x6c,
|
||||||
|
0xe7,
|
||||||
|
0x1d,
|
||||||
|
0x1f,
|
||||||
|
0xb2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x35,
|
||||||
|
0x95,
|
||||||
|
0x69,
|
||||||
|
0xe7,
|
||||||
|
0xd2,
|
||||||
|
0x89,
|
||||||
|
0xe3,
|
||||||
|
0xbc,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x87,
|
||||||
|
0x1b,
|
||||||
|
0x05,
|
||||||
|
0xca,
|
||||||
|
0x62,
|
||||||
|
0xbb,
|
||||||
|
0x7c,
|
||||||
|
0x96,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xa1,
|
||||||
|
0xa4,
|
||||||
|
0x92,
|
||||||
|
0xf9,
|
||||||
|
0x42,
|
||||||
|
0xf1,
|
||||||
|
0x5f,
|
||||||
|
0x1d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x12,
|
||||||
|
0xec,
|
||||||
|
0x26,
|
||||||
|
0x7f,
|
||||||
|
0xf6,
|
||||||
|
0x09,
|
||||||
|
0x5b,
|
||||||
|
0x6e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x5d,
|
||||||
|
0x1b,
|
||||||
|
0x5e,
|
||||||
|
0xa1,
|
||||||
|
0xb2,
|
||||||
|
0x31,
|
||||||
|
0xd8,
|
||||||
|
0x9d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd8,
|
||||||
|
0xcf,
|
||||||
|
0xb4,
|
||||||
|
0x45,
|
||||||
|
0x3f,
|
||||||
|
0x92,
|
||||||
|
0xee,
|
||||||
|
0x54,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xd6,
|
||||||
|
0x76,
|
||||||
|
0x28,
|
||||||
|
0x90,
|
||||||
|
0xbf,
|
||||||
|
0x26,
|
||||||
|
0xe4,
|
||||||
|
0x60,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x31,
|
||||||
|
0x35,
|
||||||
|
0x63,
|
||||||
|
0xa4,
|
||||||
|
0xb7,
|
||||||
|
0xed,
|
||||||
|
0x5c,
|
||||||
|
0xf3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0xf9,
|
||||||
|
0x0b,
|
||||||
|
0x3a,
|
||||||
|
0xb5,
|
||||||
|
0x72,
|
||||||
|
0xd4,
|
||||||
|
0x66,
|
||||||
|
0x93,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
0x2e,
|
||||||
|
0xa6,
|
||||||
|
0x3c,
|
||||||
|
0x71,
|
||||||
|
0xbf,
|
||||||
|
0x32,
|
||||||
|
0x60,
|
||||||
|
0x87,
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lapi_c
|
#define lapi_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lcode_c
|
#define lcode_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lctype_c
|
#define lctype_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define ldebug_c
|
#define ldebug_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define ldo_c
|
#define ldo_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define ldump_c
|
#define ldump_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lfunc_c
|
#define lfunc_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lgc_c
|
#define lgc_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define llex_c
|
#define llex_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lmem_c
|
#define lmem_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lobject_c
|
#define lobject_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lopcodes_c
|
#define lopcodes_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lparser_c
|
#define lparser_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lstate_c
|
#define lstate_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lstring_c
|
#define lstring_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define ltable_c
|
#define ltable_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define ltm_c
|
#define ltm_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lundump_c
|
#define lundump_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lvm_c
|
#define lvm_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define lzio_c
|
#define lzio_c
|
||||||
#define LUA_CORE
|
|
||||||
|
|
||||||
#include "lprefix.h"
|
#include "lprefix.h"
|
||||||
|
|
||||||
|
|||||||
156
3rd/paho.mqtt.c/CMakeLists.txt
Normal file
156
3rd/paho.mqtt.c/CMakeLists.txt
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
#*******************************************************************************
|
||||||
|
# Copyright (c) 2015, 2026 logi.cals GmbH, Frank Pagliughi <fpagliughi@mindspring.com> and others
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
# and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
#
|
||||||
|
# The Eclipse Public License is available at
|
||||||
|
# https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
# and the Eclipse Distribution License is available at
|
||||||
|
# http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Rainer Poisel - initial version
|
||||||
|
# Genis Riera Perez - Add support for building debian package
|
||||||
|
#*******************************************************************************/
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
|
project("Eclipse Paho C"
|
||||||
|
VERSION 1.3.16
|
||||||
|
LANGUAGES C
|
||||||
|
)
|
||||||
|
|
||||||
|
message(STATUS "CMake version: " ${CMAKE_VERSION})
|
||||||
|
message(STATUS "CMake system name: " ${CMAKE_SYSTEM_NAME})
|
||||||
|
|
||||||
|
set(CMAKE_SCRIPTS "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
|
||||||
|
|
||||||
|
## Project Version
|
||||||
|
## Previously we read in the version from these files, but now we use the
|
||||||
|
## CMake project setting. We just make sure the files and CMake match.
|
||||||
|
file(READ version.major PAHO_VERSION_MAJOR)
|
||||||
|
file(READ version.minor PAHO_VERSION_MINOR)
|
||||||
|
file(READ version.patch PAHO_VERSION_PATCH)
|
||||||
|
set(CLIENT_VERSION ${PAHO_VERSION_MAJOR}.${PAHO_VERSION_MINOR}.${PAHO_VERSION_PATCH})
|
||||||
|
|
||||||
|
if(NOT (CLIENT_VERSION VERSION_EQUAL PROJECT_VERSION))
|
||||||
|
message(FATAL_ERROR "CMake project version does NOT match. CMake: ${PROJECT_VERSION}, Files: ${CLIENT_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
string(TIMESTAMP BUILD_TIMESTAMP UTC)
|
||||||
|
message(STATUS "Timestamp is ${BUILD_TIMESTAMP}")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -DWIN32_LEAN_AND_MEAN)
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
add_definitions(-DOSX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## build options
|
||||||
|
option(PAHO_WITH_SSL "Flag that defines whether to build ssl-enabled binaries too. " FALSE)
|
||||||
|
option(PAHO_WITH_LIBRESSL "Flag that defines whether to build ssl-enabled binaries with LibreSSL instead of OpenSSL. " FALSE)
|
||||||
|
option(PAHO_WITH_LIBUUID "Flag that defines whether libuuid or a custom uuid implementation should be used" FALSE)
|
||||||
|
option(PAHO_BUILD_SHARED "Build shared library" TRUE)
|
||||||
|
option(PAHO_BUILD_STATIC "Build static library" FALSE)
|
||||||
|
option(PAHO_BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" FALSE)
|
||||||
|
option(PAHO_BUILD_SAMPLES "Build sample programs" FALSE)
|
||||||
|
option(PAHO_BUILD_DEB_PACKAGE "Build debian package" FALSE)
|
||||||
|
option(PAHO_ENABLE_TESTING "Build tests and run" TRUE)
|
||||||
|
option(PAHO_ENABLE_CPACK "Enable CPack" TRUE)
|
||||||
|
option(PAHO_HIGH_PERFORMANCE "Disable tracing and heap tracking" FALSE)
|
||||||
|
option(PAHO_USE_SELECT "Revert to select system call instead of poll" FALSE)
|
||||||
|
option(PAHO_NO_TCP_NODELAY "Don't disable Nagle's algorithm on TCP sockets" FALSE)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
option(PAHO_WITH_UNIX_SOCKETS "Flag that defines whether to enable Unix-domain sockets" FALSE)
|
||||||
|
|
||||||
|
if(PAHO_WITH_UNIX_SOCKETS)
|
||||||
|
add_definitions(-DUNIXSOCK=1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_HIGH_PERFORMANCE)
|
||||||
|
add_definitions(-DHIGH_PERFORMANCE=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_USE_SELECT)
|
||||||
|
add_definitions(-DUSE_SELECT=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_WITH_LIBUUID)
|
||||||
|
add_definitions(-DUSE_LIBUUID=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_NO_TCP_NODELAY)
|
||||||
|
add_definitions(-DNO_TCP_NODELAY=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT PAHO_BUILD_SHARED AND NOT PAHO_BUILD_STATIC)
|
||||||
|
message(FATAL_ERROR "You must set either PAHO_BUILD_SHARED, PAHO_BUILD_STATIC, or both")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_SAMPLES AND NOT (PAHO_WITH_SSL OR PAHO_WITH_LIBRESSL))
|
||||||
|
message(WARNING "You must build with SSL to build the full set of samples")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_DEB_PACKAGE)
|
||||||
|
set(CMAKE_INSTALL_DOCDIR share/doc/libpaho-mqtt)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
if(PAHO_BUILD_SAMPLES)
|
||||||
|
add_subdirectory(src/samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_DOCUMENTATION)
|
||||||
|
add_subdirectory(doc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_ENABLE_CPACK)
|
||||||
|
### packaging settings
|
||||||
|
file(GLOB samples "src/samples/*.c")
|
||||||
|
install(FILES ${samples} DESTINATION ${CMAKE_INSTALL_DOCDIR}/samples)
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_VENDOR "Eclipse Paho")
|
||||||
|
set(CPACK_PACKAGE_NAME "Eclipse-Paho-MQTT-C")
|
||||||
|
install(FILES CONTRIBUTING.md epl-v20 edl-v10 README.md notice.html DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(CPACK_GENERATOR "ZIP")
|
||||||
|
elseif(PAHO_BUILD_DEB_PACKAGE)
|
||||||
|
install(FILES CONTRIBUTING.md epl-v20 edl-v10 README.md notice.html DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||||
|
|
||||||
|
set(CPACK_GENERATOR "DEB")
|
||||||
|
configure_file(${CMAKE_SCRIPTS}/CPackDebConfig.cmake.in
|
||||||
|
${CMAKE_BINARY_DIR}/CPackDebConfig.cmake @ONLY
|
||||||
|
)
|
||||||
|
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackDebConfig.cmake)
|
||||||
|
else()
|
||||||
|
set(CPACK_GENERATOR "TGZ")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
file(GLOB samples "src/samples/*.c")
|
||||||
|
install(FILES ${samples} DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
|
include(CPack)
|
||||||
|
|
||||||
|
if(PAHO_ENABLE_TESTING)
|
||||||
|
enable_testing()
|
||||||
|
include_directories(test src)
|
||||||
|
add_subdirectory(test)
|
||||||
|
else()
|
||||||
|
include_directories(src)
|
||||||
|
endif()
|
||||||
47
3rd/paho.mqtt.c/CODE_OF_CONDUCT.md
Normal file
47
3rd/paho.mqtt.c/CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Community Code of Conduct
|
||||||
|
|
||||||
|
**Version 1.2
|
||||||
|
August 19, 2020**
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as community members, contributors, committers, and project leaders pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
With the support of the Eclipse Foundation staff (the “Staff”), project committers and leaders are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project committers and leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the Eclipse Foundation project or its community in public spaces. Examples of representing a project or community include posting via an official social media account, or acting as a project representative at an online or offline event. Representation of a project may be further defined and clarified by project committers, leaders, or the EMO.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Staff at codeofconduct@eclipse.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The Staff is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project committers or leaders who do not follow the Code of Conduct in good faith may face temporary or permanent repercussions as determined by the Staff.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org) , version 1.4, available at [https://www.contributor-covenant.org/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/version/1/4/code-of-conduct/)
|
||||||
|
|
||||||
63
3rd/paho.mqtt.c/CONTRIBUTING.md
Normal file
63
3rd/paho.mqtt.c/CONTRIBUTING.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# Contributing to Paho
|
||||||
|
|
||||||
|
Thanks for your interest in this project!
|
||||||
|
|
||||||
|
You can contribute bugfixes and new features by sending pull requests through GitHub.
|
||||||
|
|
||||||
|
## Legal
|
||||||
|
|
||||||
|
In order for your contribution to be accepted, it must comply with the Eclipse Foundation IP policy.
|
||||||
|
|
||||||
|
Please read the [Eclipse Foundation policy on accepting contributions via Git](http://wiki.eclipse.org/Development_Resources/Contributing_via_Git).
|
||||||
|
|
||||||
|
1. Sign the [Eclipse ECA](http://www.eclipse.org/legal/ECA.php)
|
||||||
|
1. Register for an Eclipse Foundation User ID. You can register [here](https://dev.eclipse.org/site_login/createaccount.php).
|
||||||
|
2. Log into the [Eclipse projects forge](https://www.eclipse.org/contribute/cla), and click on 'Eclipse Contributor Agreement'.
|
||||||
|
2. Go to your [account settings](https://dev.eclipse.org/site_login/myaccount.php#open_tab_accountsettings) and add your GitHub username to your account.
|
||||||
|
3. Make sure that you _sign-off_ your Git commits in the following format:
|
||||||
|
``` Signed-off-by: Alex Smith <alexsmith@nowhere.com> ``` This is usually at the bottom of the commit message. You can automate this by adding the '-s' flag when you make the commits. e.g. ```git commit -s -m "Adding a cool feature"```
|
||||||
|
4. Ensure that the email address that you make your commits with is the same one you used to sign up to the Eclipse Foundation website with.
|
||||||
|
|
||||||
|
## Contributing a change
|
||||||
|
|
||||||
|
1. [Fork the repository on GitHub](https://github.com/eclipse/paho.mqtt.c/fork)
|
||||||
|
2. Clone the forked repository onto your computer: ``` git clone https://github.com/<your username>/paho.mqtt.c.git ```
|
||||||
|
3. Create a new branch from the latest ```develop``` branch with ```git checkout -b YOUR_BRANCH_NAME origin/develop```
|
||||||
|
4. Make your changes
|
||||||
|
5. If developing a new feature, make sure to include JUnit tests.
|
||||||
|
6. Ensure that all new and existing tests pass.
|
||||||
|
7. Commit the changes into the branch: ``` git commit -s ``` Make sure that your commit message is meaningful and describes your changes correctly.
|
||||||
|
8. If you have a lot of commits for the change, squash them into a single / few commits.
|
||||||
|
9. Push the changes in your branch to your forked repository.
|
||||||
|
10. Finally, go to [https://github.com/eclipse/paho.mqtt.c](https://github.com/eclipse/paho.mqtt.c) and create a pull request from your "YOUR_BRANCH_NAME" branch to the ```develop``` one to request review and merge of the commits in your pushed branch.
|
||||||
|
|
||||||
|
What happens next depends on the content of the patch.
|
||||||
|
If it is 100% authored by the contributor with less than 1000 lines of new product code that meets
|
||||||
|
the needs of the project (refactored, test code and sample code is excluded from the count), then it
|
||||||
|
can be pulled into the main repository. When there are more than 1000 lines of new product code,
|
||||||
|
more steps are required. More details are provided in the [handbook](https://www.eclipse.org/projects/handbook/#ip).
|
||||||
|
|
||||||
|
## Developer resources:
|
||||||
|
|
||||||
|
|
||||||
|
Information regarding source code management, builds, coding standards, and more.
|
||||||
|
|
||||||
|
- [https://projects.eclipse.org/projects/iot.paho/developer](https://projects.eclipse.org/projects/iot.paho/developer)
|
||||||
|
|
||||||
|
Contact:
|
||||||
|
--------
|
||||||
|
|
||||||
|
Contact the project developers via the project's development
|
||||||
|
[mailing list](https://dev.eclipse.org/mailman/listinfo/paho-dev).
|
||||||
|
|
||||||
|
Search for bugs:
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This project uses GitHub Issues here: [github.com/eclipse/paho.mqtt.c/issues](https://github.com/eclipse/paho.mqtt.c/issues) to track ongoing development and issues.
|
||||||
|
|
||||||
|
Create a new bug:
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!
|
||||||
|
|
||||||
|
- [Create new Paho bug](https://github.com/eclipse/paho.mqtt.c/issues/new)
|
||||||
13
3rd/paho.mqtt.c/LICENSE
Normal file
13
3rd/paho.mqtt.c/LICENSE
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Eclipse Public License - v 2.0
|
||||||
|
|
||||||
|
This program and the accompanying materials
|
||||||
|
are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
|
||||||
|
The Eclipse Public License is available at
|
||||||
|
https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
and the Eclipse Distribution License is available at
|
||||||
|
http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
|
||||||
|
For an explanation of what dual-licensing means to you, see:
|
||||||
|
https://www.eclipse.org/legal/eplfaq.php#DUALLIC
|
||||||
373
3rd/paho.mqtt.c/Makefile
Normal file
373
3rd/paho.mqtt.c/Makefile
Normal file
@@ -0,0 +1,373 @@
|
|||||||
|
#*******************************************************************************
|
||||||
|
# Copyright (c) 2009, 2021 IBM Corp.
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
# and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
#
|
||||||
|
# The Eclipse Public License is available at
|
||||||
|
# https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
# and the Eclipse Distribution License is available at
|
||||||
|
# http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
# Allan Stockdill-Mander - SSL updates
|
||||||
|
# Andy Piper - various fixes
|
||||||
|
# Ian Craggs - OSX build
|
||||||
|
# Rainer Poisel - support for multi-core builds and cross-compilation
|
||||||
|
#*******************************************************************************/
|
||||||
|
|
||||||
|
# Note: on OS X you should install XCode and the associated command-line tools
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
.PHONY: clean mkdir install install-strip uninstall html strip-options
|
||||||
|
|
||||||
|
MAJOR_VERSION := $(shell cat version.major)
|
||||||
|
MINOR_VERSION := $(shell cat version.minor)
|
||||||
|
PATCH_VERSION := $(shell cat version.patch)
|
||||||
|
|
||||||
|
ifndef release.version
|
||||||
|
release.version = $(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# determine current platform
|
||||||
|
BUILD_TYPE ?= debug
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
OSTYPE ?= $(OS)
|
||||||
|
MACHINETYPE ?= $(PROCESSOR_ARCHITECTURE)
|
||||||
|
else
|
||||||
|
OSTYPE ?= $(shell uname -s)
|
||||||
|
MACHINETYPE ?= $(shell uname -m)
|
||||||
|
build.level = $(shell date)
|
||||||
|
endif # OS
|
||||||
|
ifeq ($(OSTYPE),linux)
|
||||||
|
OSTYPE = Linux
|
||||||
|
endif
|
||||||
|
|
||||||
|
# assume this is normally run in the main Paho directory
|
||||||
|
ifndef srcdir
|
||||||
|
srcdir = src
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef blddir
|
||||||
|
blddir = build/output
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef blddir_work
|
||||||
|
blddir_work = build
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef docdir
|
||||||
|
docdir = $(blddir)/doc
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef docdir_work
|
||||||
|
docdir_work = $(blddir)/../doc
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef prefix
|
||||||
|
prefix = /usr/local
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef exec_prefix
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
endif
|
||||||
|
|
||||||
|
bindir = $(exec_prefix)/bin
|
||||||
|
includedir = $(prefix)/include
|
||||||
|
libdir = $(exec_prefix)/lib
|
||||||
|
datarootdir = $(prefix)/share
|
||||||
|
mandir = $(datarootdir)/man
|
||||||
|
man1dir = $(mandir)/man1
|
||||||
|
man2dir = $(mandir)/man2
|
||||||
|
man3dir = $(mandir)/man3
|
||||||
|
|
||||||
|
SOURCE_FILES = $(wildcard $(srcdir)/*.c)
|
||||||
|
SOURCE_FILES_C = $(filter-out $(srcdir)/MQTTAsync.c $(srcdir)/MQTTAsyncUtils.c $(srcdir)/MQTTVersion.c $(srcdir)/SSLSocket.c, $(SOURCE_FILES))
|
||||||
|
SOURCE_FILES_CS = $(filter-out $(srcdir)/MQTTAsync.c $(srcdir)/MQTTAsyncUtils.c $(srcdir)/MQTTVersion.c, $(SOURCE_FILES))
|
||||||
|
SOURCE_FILES_A = $(filter-out $(srcdir)/MQTTClient.c $(srcdir)/MQTTVersion.c $(srcdir)/SSLSocket.c, $(SOURCE_FILES))
|
||||||
|
SOURCE_FILES_AS = $(filter-out $(srcdir)/MQTTClient.c $(srcdir)/MQTTVersion.c, $(SOURCE_FILES))
|
||||||
|
|
||||||
|
HEADERS = $(srcdir)/*.h
|
||||||
|
HEADERS_C = $(filter-out $(srcdir)/MQTTAsync.h, $(HEADERS))
|
||||||
|
HEADERS_A = $(HEADERS)
|
||||||
|
|
||||||
|
SAMPLE_FILES_C = MQTTClient_publish MQTTClient_publish_async MQTTClient_subscribe
|
||||||
|
SYNC_SAMPLES = ${addprefix ${blddir}/samples/,${SAMPLE_FILES_C}}
|
||||||
|
|
||||||
|
UTIL_FILES_CS = paho_cs_pub paho_cs_sub
|
||||||
|
SYNC_UTILS = ${addprefix ${blddir}/samples/,${UTIL_FILES_CS}}
|
||||||
|
|
||||||
|
SAMPLE_FILES_A = MQTTAsync_subscribe MQTTAsync_publish
|
||||||
|
ASYNC_SAMPLES = ${addprefix ${blddir}/samples/,${SAMPLE_FILES_A}}
|
||||||
|
|
||||||
|
UTIL_FILES_AS = paho_c_pub paho_c_sub
|
||||||
|
ASYNC_UTILS = ${addprefix ${blddir}/samples/,${UTIL_FILES_AS}}
|
||||||
|
|
||||||
|
TEST_FILES_C = test1 test15 test2 sync_client_test test_mqtt4sync test10
|
||||||
|
SYNC_TESTS = ${addprefix ${blddir}/test/,${TEST_FILES_C}}
|
||||||
|
|
||||||
|
TEST_FILES_CS = test3
|
||||||
|
SYNC_SSL_TESTS = ${addprefix ${blddir}/test/,${TEST_FILES_CS}}
|
||||||
|
|
||||||
|
TEST_FILES_A = test4 test45 test6 test9 test95 test_mqtt4async test11
|
||||||
|
ASYNC_TESTS = ${addprefix ${blddir}/test/,${TEST_FILES_A}}
|
||||||
|
|
||||||
|
TEST_FILES_AS = test5
|
||||||
|
ASYNC_SSL_TESTS = ${addprefix ${blddir}/test/,${TEST_FILES_AS}}
|
||||||
|
|
||||||
|
# The names of the four different libraries to be built
|
||||||
|
MQTTLIB_C = paho-mqtt3c
|
||||||
|
MQTTLIB_CS = paho-mqtt3cs
|
||||||
|
MQTTLIB_A = paho-mqtt3a
|
||||||
|
MQTTLIB_AS = paho-mqtt3as
|
||||||
|
|
||||||
|
CC ?= gcc
|
||||||
|
|
||||||
|
ifndef INSTALL
|
||||||
|
INSTALL = install
|
||||||
|
endif
|
||||||
|
INSTALL_PROGRAM = $(INSTALL)
|
||||||
|
INSTALL_DATA = $(INSTALL) -m 644
|
||||||
|
DOXYGEN_COMMAND = doxygen
|
||||||
|
|
||||||
|
VERSION = ${MAJOR_VERSION}.${MINOR_VERSION}
|
||||||
|
|
||||||
|
MQTTLIB_C_NAME = lib${MQTTLIB_C}.so.${VERSION}
|
||||||
|
MQTTLIB_CS_NAME = lib${MQTTLIB_CS}.so.${VERSION}
|
||||||
|
MQTTLIB_A_NAME = lib${MQTTLIB_A}.so.${VERSION}
|
||||||
|
MQTTLIB_AS_NAME = lib${MQTTLIB_AS}.so.${VERSION}
|
||||||
|
MQTTVERSION_NAME = paho_c_version
|
||||||
|
PAHO_C_PUB_NAME = paho_c_pub
|
||||||
|
PAHO_C_SUB_NAME = paho_c_sub
|
||||||
|
PAHO_CS_PUB_NAME = paho_cs_pub
|
||||||
|
PAHO_CS_SUB_NAME = paho_cs_sub
|
||||||
|
|
||||||
|
MQTTLIB_C_TARGET = ${blddir}/${MQTTLIB_C_NAME}
|
||||||
|
MQTTLIB_CS_TARGET = ${blddir}/${MQTTLIB_CS_NAME}
|
||||||
|
MQTTLIB_A_TARGET = ${blddir}/${MQTTLIB_A_NAME}
|
||||||
|
MQTTLIB_AS_TARGET = ${blddir}/${MQTTLIB_AS_NAME}
|
||||||
|
MQTTVERSION_TARGET = ${blddir}/${MQTTVERSION_NAME}
|
||||||
|
PAHO_C_PUB_TARGET = ${blddir}/samples/${PAHO_C_PUB_NAME}
|
||||||
|
PAHO_C_SUB_TARGET = ${blddir}/samples/${PAHO_C_SUB_NAME}
|
||||||
|
PAHO_CS_PUB_TARGET = ${blddir}/samples/${PAHO_CS_PUB_NAME}
|
||||||
|
PAHO_CS_SUB_TARGET = ${blddir}/samples/${PAHO_CS_SUB_NAME}
|
||||||
|
|
||||||
|
#CCFLAGS_SO = -g -fPIC $(CFLAGS) -Os -Wall -fvisibility=hidden -I$(blddir_work)
|
||||||
|
#FLAGS_EXE = $(LDFLAGS) -I ${srcdir} -pthread -L ${blddir}
|
||||||
|
#FLAGS_EXES = $(LDFLAGS) -I ${srcdir} ${START_GROUP} -pthread -lssl -lcrypto ${END_GROUP} -L ${blddir}
|
||||||
|
|
||||||
|
CCFLAGS_SO = -g -fPIC $(CFLAGS) -D_GNU_SOURCE -Os -Wall -fvisibility=hidden -I$(blddir_work) -DPAHO_MQTT_EXPORTS=1
|
||||||
|
FLAGS_EXE = $(LDFLAGS) -I ${srcdir} ${START_GROUP} -pthread ${GAI_LIB} ${END_GROUP} -L ${blddir}
|
||||||
|
FLAGS_EXES = $(LDFLAGS) -I ${srcdir} ${START_GROUP} -pthread ${GAI_LIB} -lssl -lcrypto ${END_GROUP} -L ${blddir}
|
||||||
|
|
||||||
|
LDCONFIG ?= /sbin/ldconfig
|
||||||
|
LDFLAGS_C = $(LDFLAGS) -shared -Wl,-init,$(MQTTCLIENT_INIT) $(START_GROUP) -pthread $(GAI_LIB) $(END_GROUP)
|
||||||
|
LDFLAGS_CS = $(LDFLAGS) -shared $(START_GROUP) -pthread $(GAI_LIB) $(EXTRA_LIB) -lssl -lcrypto $(END_GROUP) -Wl,-init,$(MQTTCLIENT_INIT)
|
||||||
|
LDFLAGS_A = $(LDFLAGS) -shared -Wl,-init,$(MQTTASYNC_INIT) $(START_GROUP) -pthread $(GAI_LIB) $(END_GROUP)
|
||||||
|
LDFLAGS_AS = $(LDFLAGS) -shared $(START_GROUP) -pthread $(GAI_LIB) $(EXTRA_LIB) -lssl -lcrypto $(END_GROUP) -Wl,-init,$(MQTTASYNC_INIT)
|
||||||
|
|
||||||
|
SED_COMMAND = sed \
|
||||||
|
-e "s/@CLIENT_VERSION@/${release.version}/g" \
|
||||||
|
-e "s/@BUILD_TIMESTAMP@/${build.level}/g"
|
||||||
|
|
||||||
|
ifeq ($(OSTYPE),Linux)
|
||||||
|
|
||||||
|
MQTTCLIENT_INIT = MQTTClient_init
|
||||||
|
MQTTASYNC_INIT = MQTTAsync_init
|
||||||
|
START_GROUP = -Wl,--start-group
|
||||||
|
END_GROUP = -Wl,--end-group
|
||||||
|
|
||||||
|
GAI_LIB = -lanl
|
||||||
|
EXTRA_LIB = -ldl
|
||||||
|
|
||||||
|
LDFLAGS_C += -Wl,-soname,lib$(MQTTLIB_C).so.${MAJOR_VERSION}
|
||||||
|
LDFLAGS_CS += -Wl,-soname,lib$(MQTTLIB_CS).so.${MAJOR_VERSION} -Wl,-no-whole-archive
|
||||||
|
LDFLAGS_A += -Wl,-soname,lib${MQTTLIB_A}.so.${MAJOR_VERSION}
|
||||||
|
LDFLAGS_AS += -Wl,-soname,lib${MQTTLIB_AS}.so.${MAJOR_VERSION} -Wl,-no-whole-archive
|
||||||
|
|
||||||
|
else ifeq ($(OSTYPE),Darwin)
|
||||||
|
|
||||||
|
MQTTCLIENT_INIT = _MQTTClient_init
|
||||||
|
MQTTASYNC_INIT = _MQTTAsync_init
|
||||||
|
START_GROUP =
|
||||||
|
END_GROUP =
|
||||||
|
|
||||||
|
GAI_LIB =
|
||||||
|
EXTRA_LIB = -ldl
|
||||||
|
|
||||||
|
CCFLAGS_SO += -Wno-deprecated-declarations -DOSX -I /usr/local/opt/openssl/include
|
||||||
|
LDFLAGS_C += -Wl,-install_name,lib$(MQTTLIB_C).so.${MAJOR_VERSION}
|
||||||
|
LDFLAGS_CS += -Wl,-install_name,lib$(MQTTLIB_CS).so.${MAJOR_VERSION} -L /usr/local/opt/openssl/lib
|
||||||
|
LDFLAGS_A += -Wl,-install_name,lib${MQTTLIB_A}.so.${MAJOR_VERSION}
|
||||||
|
LDFLAGS_AS += -Wl,-install_name,lib${MQTTLIB_AS}.so.${MAJOR_VERSION} -L /usr/local/opt/openssl/lib
|
||||||
|
FLAGS_EXE += -DOSX
|
||||||
|
FLAGS_EXES += -L /usr/local/opt/openssl/lib
|
||||||
|
|
||||||
|
LDCONFIG = echo
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build: | mkdir ${MQTTLIB_C_TARGET} ${MQTTLIB_CS_TARGET} ${MQTTLIB_A_TARGET} ${MQTTLIB_AS_TARGET} ${MQTTVERSION_TARGET} ${SYNC_SAMPLES} ${SYNC_UTILS} ${ASYNC_SAMPLES} ${ASYNC_UTILS} ${SYNC_TESTS} ${SYNC_SSL_TESTS} ${ASYNC_TESTS} ${ASYNC_SSL_TESTS}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf ${blddir}/*
|
||||||
|
rm -rf ${blddir_work}/*
|
||||||
|
|
||||||
|
mkdir:
|
||||||
|
-mkdir -p ${blddir}/samples
|
||||||
|
-mkdir -p ${blddir}/test
|
||||||
|
echo OSTYPE is $(OSTYPE)
|
||||||
|
|
||||||
|
${SYNC_TESTS}: ${blddir}/test/%: ${srcdir}/../test/%.c $(MQTTLIB_C_TARGET)
|
||||||
|
${CC} -DNOSTACKTRACE -DNOLOG_MESSAGES $(srcdir)/Thread.c -g -o $@ $< -l${MQTTLIB_C} ${FLAGS_EXE}
|
||||||
|
|
||||||
|
${SYNC_SSL_TESTS}: ${blddir}/test/%: ${srcdir}/../test/%.c $(MQTTLIB_CS_TARGET)
|
||||||
|
${CC} -g -o $@ $< -l${MQTTLIB_CS} ${FLAGS_EXES}
|
||||||
|
|
||||||
|
${ASYNC_TESTS}: ${blddir}/test/%: ${srcdir}/../test/%.c $(MQTTLIB_A_TARGET)
|
||||||
|
${CC} -g -o $@ $< -l${MQTTLIB_A} ${FLAGS_EXE}
|
||||||
|
|
||||||
|
${ASYNC_SSL_TESTS}: ${blddir}/test/%: ${srcdir}/../test/%.c $(MQTTLIB_AS_TARGET)
|
||||||
|
${CC} -g -o $@ $< -l${MQTTLIB_AS} ${FLAGS_EXES}
|
||||||
|
|
||||||
|
${SYNC_SAMPLES}: ${blddir}/samples/%: ${srcdir}/samples/%.c $(MQTTLIB_CS_TARGET)
|
||||||
|
${CC} -o $@ $< -l${MQTTLIB_CS} ${FLAGS_EXES}
|
||||||
|
|
||||||
|
${SYNC_UTILS}: ${blddir}/samples/%: ${srcdir}/samples/%.c ${srcdir}/samples/pubsub_opts.c $(MQTTLIB_CS_TARGET)
|
||||||
|
${CC} -o $@ $< -l${MQTTLIB_CS} ${FLAGS_EXES} ${srcdir}/samples/pubsub_opts.c
|
||||||
|
|
||||||
|
${ASYNC_SAMPLES}: ${blddir}/samples/%: ${srcdir}/samples/%.c $(MQTTLIB_AS_TARGET)
|
||||||
|
${CC} -o $@ $< -l${MQTTLIB_AS} ${FLAGS_EXES}
|
||||||
|
|
||||||
|
${ASYNC_UTILS}: ${blddir}/samples/%: ${srcdir}/samples/%.c ${srcdir}/samples/pubsub_opts.c $(MQTTLIB_AS_TARGET)
|
||||||
|
${CC} -o $@ $< -l${MQTTLIB_AS} ${FLAGS_EXES} ${srcdir}/samples/pubsub_opts.c
|
||||||
|
|
||||||
|
$(blddir_work)/VersionInfo.h: $(srcdir)/VersionInfo.h.in
|
||||||
|
-mkdir -p $(blddir_work)
|
||||||
|
$(SED_COMMAND) $< > $@
|
||||||
|
|
||||||
|
${MQTTLIB_C_TARGET}: ${SOURCE_FILES_C} ${HEADERS_C} $(blddir_work)/VersionInfo.h
|
||||||
|
${CC} ${CCFLAGS_SO} -o $@ ${SOURCE_FILES_C} ${LDFLAGS_C}
|
||||||
|
-ln -s lib$(MQTTLIB_C).so.${VERSION} ${blddir}/lib$(MQTTLIB_C).so.${MAJOR_VERSION}
|
||||||
|
-ln -s lib$(MQTTLIB_C).so.${MAJOR_VERSION} ${blddir}/lib$(MQTTLIB_C).so
|
||||||
|
|
||||||
|
${MQTTLIB_CS_TARGET}: ${SOURCE_FILES_CS} ${HEADERS_C} $(blddir_work)/VersionInfo.h
|
||||||
|
${CC} ${CCFLAGS_SO} -o $@ ${SOURCE_FILES_CS} -DOPENSSL ${LDFLAGS_CS}
|
||||||
|
-ln -s lib$(MQTTLIB_CS).so.${VERSION} ${blddir}/lib$(MQTTLIB_CS).so.${MAJOR_VERSION}
|
||||||
|
-ln -s lib$(MQTTLIB_CS).so.${MAJOR_VERSION} ${blddir}/lib$(MQTTLIB_CS).so
|
||||||
|
|
||||||
|
${MQTTLIB_A_TARGET}: ${SOURCE_FILES_A} ${HEADERS_A} $(blddir_work)/VersionInfo.h
|
||||||
|
${CC} ${CCFLAGS_SO} -o $@ ${SOURCE_FILES_A} ${LDFLAGS_A}
|
||||||
|
-ln -s lib$(MQTTLIB_A).so.${VERSION} ${blddir}/lib$(MQTTLIB_A).so.${MAJOR_VERSION}
|
||||||
|
-ln -s lib$(MQTTLIB_A).so.${MAJOR_VERSION} ${blddir}/lib$(MQTTLIB_A).so
|
||||||
|
|
||||||
|
${MQTTLIB_AS_TARGET}: ${SOURCE_FILES_AS} ${HEADERS_A} $(blddir_work)/VersionInfo.h
|
||||||
|
${CC} ${CCFLAGS_SO} -o $@ ${SOURCE_FILES_AS} -DOPENSSL ${LDFLAGS_AS}
|
||||||
|
-ln -s lib$(MQTTLIB_AS).so.${VERSION} ${blddir}/lib$(MQTTLIB_AS).so.${MAJOR_VERSION}
|
||||||
|
-ln -s lib$(MQTTLIB_AS).so.${MAJOR_VERSION} ${blddir}/lib$(MQTTLIB_AS).so
|
||||||
|
|
||||||
|
${MQTTVERSION_TARGET}: $(srcdir)/MQTTVersion.c $(srcdir)/MQTTAsync.h $(MQTTLIB_A_TARGET)
|
||||||
|
${CC} ${FLAGS_EXE} -o $@ -l${MQTTLIB_A} $(srcdir)/MQTTVersion.c -ldl
|
||||||
|
|
||||||
|
strip_options:
|
||||||
|
$(eval INSTALL_OPTS := -s)
|
||||||
|
|
||||||
|
install-strip: build strip_options install
|
||||||
|
|
||||||
|
install: build
|
||||||
|
mkdir -p $(DESTDIR)$(PREFIX)${includedir}
|
||||||
|
$(INSTALL_DATA) ${INSTALL_OPTS} ${MQTTLIB_C_TARGET} $(DESTDIR)${libdir}
|
||||||
|
$(INSTALL_DATA) ${INSTALL_OPTS} ${MQTTLIB_CS_TARGET} $(DESTDIR)${libdir}
|
||||||
|
$(INSTALL_DATA) ${INSTALL_OPTS} ${MQTTLIB_A_TARGET} $(DESTDIR)${libdir}
|
||||||
|
$(INSTALL_DATA) ${INSTALL_OPTS} ${MQTTLIB_AS_TARGET} $(DESTDIR)${libdir}
|
||||||
|
$(INSTALL_PROGRAM) ${INSTALL_OPTS} ${MQTTVERSION_TARGET} $(DESTDIR)${bindir}
|
||||||
|
$(INSTALL_PROGRAM) ${INSTALL_OPTS} ${PAHO_C_PUB_TARGET} $(DESTDIR)${bindir}
|
||||||
|
$(INSTALL_PROGRAM) ${INSTALL_OPTS} ${PAHO_C_SUB_TARGET} $(DESTDIR)${bindir}
|
||||||
|
$(INSTALL_PROGRAM) ${INSTALL_OPTS} ${PAHO_CS_PUB_TARGET} $(DESTDIR)${bindir}
|
||||||
|
$(INSTALL_PROGRAM) ${INSTALL_OPTS} ${PAHO_CS_SUB_TARGET} $(DESTDIR)${bindir}
|
||||||
|
$(LDCONFIG) $(DESTDIR)${libdir}
|
||||||
|
ln -s lib$(MQTTLIB_C).so.${MAJOR_VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_C).so
|
||||||
|
ln -s lib$(MQTTLIB_CS).so.${MAJOR_VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_CS).so
|
||||||
|
ln -s lib$(MQTTLIB_A).so.${MAJOR_VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_A).so
|
||||||
|
ln -s lib$(MQTTLIB_AS).so.${MAJOR_VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_AS).so
|
||||||
|
@if test ! -f $(DESTDIR)${libdir}/lib$(MQTTLIB_C).so.${MAJOR_VERSION}; then ln -s lib$(MQTTLIB_C).so.${VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_C).so.${MAJOR_VERSION}; fi
|
||||||
|
@if test ! -f $(DESTDIR)${libdir}/lib$(MQTTLIB_CS).so.${MAJOR_VERSION}; then ln -s lib$(MQTTLIB_CS).so.${VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_CS).so.${MAJOR_VERSION}; fi
|
||||||
|
@if test ! -f $(DESTDIR)${libdir}/lib$(MQTTLIB_A).so.${MAJOR_VERSION}; then ln -s lib$(MQTTLIB_A).so.${VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_A).so.${MAJOR_VERSION}; fi
|
||||||
|
@if test ! -f $(DESTDIR)${libdir}/lib$(MQTTLIB_AS).so.${MAJOR_VERSION}; then ln -s lib$(MQTTLIB_AS).so.${VERSION} $(DESTDIR)${libdir}/lib$(MQTTLIB_AS).so.${MAJOR_VERSION}; fi
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTAsync.h $(DESTDIR)${includedir}
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTClient.h $(DESTDIR)${includedir}
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTClientPersistence.h $(DESTDIR)${includedir}
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTProperties.h $(DESTDIR)${includedir}
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTReasonCodes.h $(DESTDIR)${includedir}
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTSubscribeOpts.h $(DESTDIR)${includedir}
|
||||||
|
$(INSTALL_DATA) ${srcdir}/MQTTExportDeclarations.h $(DESTDIR)${includedir}
|
||||||
|
- $(INSTALL_DATA) doc/man/man1/paho_c_pub.1 $(DESTDIR)${man1dir}
|
||||||
|
- $(INSTALL_DATA) doc/man/man1/paho_c_sub.1 $(DESTDIR)${man1dir}
|
||||||
|
- $(INSTALL_DATA) doc/man/man1/paho_cs_pub.1 $(DESTDIR)${man1dir}
|
||||||
|
- $(INSTALL_DATA) doc/man/man1/paho_cs_sub.1 $(DESTDIR)${man1dir}
|
||||||
|
|
||||||
|
ifneq ("$(wildcard ${blddir}/doc/MQTTClient/man/man3/MQTTClient.h.3)","")
|
||||||
|
- $(INSTALL_DATA) ${blddir}/doc/MQTTClient/man/man3/MQTTClient.h.3 $(DESTDIR)${man3dir}
|
||||||
|
endif
|
||||||
|
ifneq ("$(wildcard ${blddir}/doc/MQTTAsync/man/man3/MQTTAsync.h.3)","")
|
||||||
|
- $(INSTALL_DATA) ${blddir}/doc/MQTTAsync/man/man3/MQTTAsync.h.3 $(DESTDIR)${man3dir}
|
||||||
|
endif
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
- rm $(DESTDIR)${libdir}/${MQTTLIB_C_NAME}
|
||||||
|
- rm $(DESTDIR)${libdir}/${MQTTLIB_CS_NAME}
|
||||||
|
- rm $(DESTDIR)${libdir}/${MQTTLIB_A_NAME}
|
||||||
|
- rm $(DESTDIR)${libdir}/${MQTTLIB_AS_NAME}
|
||||||
|
- rm $(DESTDIR)${bindir}/${MQTTVERSION_NAME}
|
||||||
|
- rm $(DESTDIR)${bindir}/${PAHO_C_PUB_NAME}
|
||||||
|
- rm $(DESTDIR)${bindir}/${PAHO_C_SUB_NAME}
|
||||||
|
- rm $(DESTDIR)${bindir}/${PAHO_CS_PUB_NAME}
|
||||||
|
- rm $(DESTDIR)${bindir}/${PAHO_CS_SUB_NAME}
|
||||||
|
$(LDCONFIG) $(DESTDIR)${libdir}
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_C).so
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_CS).so
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_A).so
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_AS).so
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_C).so.${MAJOR_VERSION}
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_CS).so.${MAJOR_VERSION}
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_A).so.${MAJOR_VERSION}
|
||||||
|
- rm $(DESTDIR)${libdir}/lib$(MQTTLIB_AS).so.${MAJOR_VERSION}
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTAsync.h
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTClient.h
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTClientPersistence.h
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTProperties.h
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTReasonCodes.h
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTSubscribeOpts.h
|
||||||
|
- rm $(DESTDIR)${includedir}/MQTTExportDeclarations.h
|
||||||
|
|
||||||
|
- rm $(DESTDIR)${man1dir}/paho_c_pub.1
|
||||||
|
- rm $(DESTDIR)${man1dir}/paho_c_sub.1
|
||||||
|
- rm $(DESTDIR)${man1dir}/paho_cs_pub.1
|
||||||
|
- rm $(DESTDIR)${man1dir}/paho_cs_sub.1
|
||||||
|
|
||||||
|
ifneq ("$(wildcard $(DESTDIR)${man3dir}/MQTTClient.h.3)","")
|
||||||
|
- rm $(DESTDIR)${man3dir}/MQTTClient.h.3
|
||||||
|
endif
|
||||||
|
ifneq ("$(wildcard $(DESTDIR)${man3dir}/MQTTAsync.h.3)","")
|
||||||
|
- rm $(DESTDIR)${man3dir}/MQTTAsync.h.3
|
||||||
|
endif
|
||||||
|
|
||||||
|
REGEX_DOXYGEN := \
|
||||||
|
's;@PROJECT_SOURCE_DIR@/src/\?;;' \
|
||||||
|
's;@PROJECT_SOURCE_DIR@;..;' \
|
||||||
|
's;@CMAKE_CURRENT_BINARY_DIR@;../build/output;'
|
||||||
|
SED_DOXYGEN := $(foreach sed_exp,$(REGEX_DOXYGEN),-e $(sed_exp))
|
||||||
|
define process_doxygen
|
||||||
|
cd ${srcdir}; sed $(SED_DOXYGEN) ../doc/${1}.in > ../$(docdir_work)/${1}
|
||||||
|
cd ${srcdir}; $(DOXYGEN_COMMAND) ../$(docdir_work)/${1}
|
||||||
|
endef
|
||||||
|
html:
|
||||||
|
-mkdir -p $(docdir_work)
|
||||||
|
-mkdir -p ${docdir}
|
||||||
|
$(call process_doxygen,DoxyfileV3ClientAPI)
|
||||||
|
$(call process_doxygen,DoxyfileV3AsyncAPI)
|
||||||
|
$(call process_doxygen,DoxyfileV3ClientInternal)
|
||||||
55
3rd/paho.mqtt.c/NOTICE
Normal file
55
3rd/paho.mqtt.c/NOTICE
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Notices for Eclipse Paho
|
||||||
|
|
||||||
|
This content is produced and maintained by the Eclipse Paho project.
|
||||||
|
|
||||||
|
* Project home: https://projects.eclipse.org/projects/iot.paho
|
||||||
|
|
||||||
|
## Trademarks
|
||||||
|
|
||||||
|
Paho™ is a trademark of the Eclipse Foundation.
|
||||||
|
|
||||||
|
## Copyright
|
||||||
|
|
||||||
|
All content is the property of the respective authors or their employers. For
|
||||||
|
more information regarding authorship of content, please consult the listed
|
||||||
|
source code repository logs.
|
||||||
|
|
||||||
|
## Declared Project Licenses
|
||||||
|
|
||||||
|
This program and the accompanying materials are made available under the terms
|
||||||
|
of the Eclipse Public License v2.0 which is available at
|
||||||
|
https://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||||
|
v1.0 which is available at https://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||||
|
|
||||||
|
## Source Code
|
||||||
|
|
||||||
|
The project maintains the following source code repositories:
|
||||||
|
|
||||||
|
* https://github.com/eclipse/paho-website
|
||||||
|
* https://github.com/eclipse/paho.golang
|
||||||
|
* https://github.com/eclipse/paho.mqtt-sn.embedded-c
|
||||||
|
* https://github.com/eclipse/paho.mqtt-spy
|
||||||
|
* https://github.com/eclipse/paho.mqtt.android
|
||||||
|
* https://github.com/eclipse/paho.mqtt.c
|
||||||
|
* https://github.com/eclipse/paho.mqtt.cpp
|
||||||
|
* https://github.com/eclipse/paho.mqtt.d
|
||||||
|
* https://github.com/eclipse/paho.mqtt.embedded-c
|
||||||
|
* https://github.com/eclipse/paho.mqtt.golang
|
||||||
|
* https://github.com/eclipse/paho.mqtt.java
|
||||||
|
* https://github.com/eclipse/paho.mqtt.javascript
|
||||||
|
* https://github.com/eclipse/paho.mqtt.m2mqtt
|
||||||
|
* https://github.com/eclipse/paho.mqtt.python
|
||||||
|
* https://github.com/eclipse/paho.mqtt.ruby
|
||||||
|
* https://github.com/eclipse/paho.mqtt.rust
|
||||||
|
* https://github.com/eclipse/paho.mqtt.testing
|
||||||
|
|
||||||
|
## Cryptography
|
||||||
|
|
||||||
|
Content may contain encryption software. The country in which you are currently
|
||||||
|
may have restrictions on the import, possession, and use, and/or re-export to
|
||||||
|
another country, of encryption software. BEFORE using any encryption software,
|
||||||
|
please check the country's laws, regulations and policies concerning the import,
|
||||||
|
possession, or use, and re-export of encryption software, to see if this is
|
||||||
|
permitted.
|
||||||
13
3rd/paho.mqtt.c/PULL_REQUEST_TEMPLATE.md
Normal file
13
3rd/paho.mqtt.c/PULL_REQUEST_TEMPLATE.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
Thank you for your interest in this project managed by the Eclipse Foundation.
|
||||||
|
|
||||||
|
The guidelines for contributions can be found in the CONTRIBUTING.md file.
|
||||||
|
|
||||||
|
At a minimum, you must sign the Eclipse ECA, and sign off each commit.
|
||||||
|
|
||||||
|
To complete and submit a ECA, log into the Eclipse projects forge
|
||||||
|
You will need to create an account with the Eclipse Foundation if you have not already done so.
|
||||||
|
Be sure to use the same email address when you register for the account that you intend to use when you commit to Git.
|
||||||
|
Go to https://accounts.eclipse.org/user/eca to sign the Eclipse ECA.
|
||||||
|
|
||||||
|
|
||||||
358
3rd/paho.mqtt.c/README.md
Normal file
358
3rd/paho.mqtt.c/README.md
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
[](https://travis-ci.org/eclipse/paho.mqtt.c)
|
||||||
|
[](https://lgtm.com/projects/g/eclipse/paho.mqtt.c/alerts/)
|
||||||
|
[](https://scan.coverity.com/projects/paho-c)
|
||||||
|
|
||||||
|
# Eclipse Paho C Client Library for the MQTT Protocol
|
||||||
|
|
||||||
|
This repository contains the source code for the [Eclipse Paho](http://eclipse.org/paho) MQTT C client library.
|
||||||
|
|
||||||
|
This code builds libraries which enable applications to connect to an [MQTT](http://mqtt.org) broker to publish messages, and to subscribe to topics and receive published messages.
|
||||||
|
|
||||||
|
Synchronous and various asynchronous programming models are supported.
|
||||||
|
|
||||||
|
## Information About MQTT
|
||||||
|
|
||||||
|
* [MQTT website](http://mqtt.org)
|
||||||
|
* [The MQTT 3.1.1 standard](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html)
|
||||||
|
* [The MQTT 5.0 standard](https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html)
|
||||||
|
* [HiveMQ introduction to MQTT](https://www.hivemq.com/mqtt/)
|
||||||
|
* [OASIS Introduction to MQTT presentation](https://www.oasis-open.org/committees/download.php/49205/MQTT-OASIS-Webinar.pdf)
|
||||||
|
|
||||||
|
## Libraries
|
||||||
|
|
||||||
|
The Paho C client comprises four variant libraries, shared or static:
|
||||||
|
|
||||||
|
* paho-mqtt3a - asynchronous (MQTTAsync)
|
||||||
|
* paho-mqtt3as - asynchronous with SSL/TLS (MQTTAsync)
|
||||||
|
* paho-mqtt3c - "classic" / synchronous (MQTTClient)
|
||||||
|
* paho-mqtt3cs - "classic" / synchronous with SSL/TLS (MQTTClient)
|
||||||
|
|
||||||
|
[Which Paho C API to use, with some history, for context](https://modelbasedtesting.co.uk/2013/10/13/which-paho-mqtt-c-api-to-use-and-some-history/)
|
||||||
|
|
||||||
|
## Usage and API
|
||||||
|
|
||||||
|
Detailed API documentation [is available online](https://eclipse-paho.github.io/paho.mqtt.c/MQTTClient/html/). It is also available by building the Doxygen docs in the ``doc`` directory.
|
||||||
|
|
||||||
|
Samples are available in the Doxygen docs and also in `src/samples` for reference. These are:
|
||||||
|
|
||||||
|
- *paho_c_pub.c* and *paho_c_sub.c:* command line utilities to publish and subscribe, -h will give help
|
||||||
|
- *paho_cs_pub.c* and *paho_cs_sub.c:* command line utilities using MQTTClient to publish and subscribe
|
||||||
|
- *MQTTClient_publish.c, MQTTClient_subscribe.c* and *MQTTClient_publish_async.c:* MQTTClient simple code examples
|
||||||
|
- *MQTTAsync_publish.c* and *MQTTAsync_subscribe.c:* MQTTAsync simple code examples
|
||||||
|
|
||||||
|
Some potentially useful blog posts:
|
||||||
|
|
||||||
|
- [Paho client MQTT 5.0 support and command line utilities](https://modelbasedtesting.co.uk/2018/08/08/paho-c-client-mqtt-5-0-and-command-line-utilities/)
|
||||||
|
- [MQTT, QoS and persistence](https://modelbasedtesting.co.uk/2013/11/24/mqtt-qos-and-persistence/)
|
||||||
|
- [A story of MQTT 5.0](https://modelbasedtesting.co.uk/2018/04/09/a-story-of-mqtt-5-0/)
|
||||||
|
|
||||||
|
[Various MQTT and MQTT-SN talks I've given.](https://modelbasedtesting.co.uk/talks-ive-given/)
|
||||||
|
|
||||||
|
### Supported Network Protocols
|
||||||
|
|
||||||
|
The library supports connecting to an MQTT server using TCP, SSL/TLS, Unix-domain sockets, and websockets (secure and insecure). This is chosen by the client using the URI supplied in the connect options. It can be specified as:
|
||||||
|
|
||||||
|
"mqtt://<host>:<port>" - TCP, unsecure
|
||||||
|
"tcp://<host>:<port>" (same)
|
||||||
|
|
||||||
|
"mqtts://<host>:<port>" - SSL/TLS
|
||||||
|
"ssl://<host>:<port>" (same)
|
||||||
|
|
||||||
|
"unix:///path/to/socket - UNIX-domain socket (*nix systems only)
|
||||||
|
|
||||||
|
"ws://<host>:<port>[/path]" - Websockets, unsecure
|
||||||
|
"wss://<host>:<port>[/path]" - Websockets, secure
|
||||||
|
|
||||||
|
The "mqtt://" and "tcp://" schemas are identical. They indicate an insecure connection over TCP. The "mqtt://" variation is new for the library, but becoming more common across different MQTT libraries.
|
||||||
|
|
||||||
|
Similarly, the "mqtts://" and "ssl://" schemas are identical. They specify a secure connection over SSL/TLS sockets. The use any of the secure connect options requires that you compile the library with the `PAHO_WITH_SSL=TRUE` CMake option to include OpenSSL. In addition, you _must_ specify `ssl_options` when you connect to the broker - i.e. you must add an instance of `ssl_options` to the `connect_options` when calling `connect()`.
|
||||||
|
|
||||||
|
The use of Unix-domain sockets requires the build option of `PAHO_WITH_UNIX_SOCKETS=TRUE` is required. This is only available on *nix-style systems like Linux and macOS. It is not vailable on Windows.
|
||||||
|
|
||||||
|
## Runtime tracing
|
||||||
|
|
||||||
|
A number of environment variables control runtime tracing of the C library.
|
||||||
|
|
||||||
|
Tracing is switched on using `MQTT_C_CLIENT_TRACE` (a value of ON traces to stdout, any other value should specify a file to trace to).
|
||||||
|
|
||||||
|
The verbosity of the output is controlled using the `MQTT_C_CLIENT_TRACE_LEVEL` environment variable - valid values are ERROR, PROTOCOL, MINIMUM, MEDIUM and MAXIMUM (from least to most verbose).
|
||||||
|
|
||||||
|
The variable `MQTT_C_CLIENT_TRACE_MAX_LINES` limits the number of lines of trace that are output.
|
||||||
|
|
||||||
|
```
|
||||||
|
export MQTT_C_CLIENT_TRACE=ON
|
||||||
|
export MQTT_C_CLIENT_TRACE_LEVEL=PROTOCOL
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reporting bugs
|
||||||
|
|
||||||
|
Please open issues in the Github project: https://github.com/eclipse-paho/paho.mqtt.c/issues.
|
||||||
|
|
||||||
|
## More information
|
||||||
|
|
||||||
|
Discussion of the Paho clients takes place on the [Eclipse paho-dev mailing list](https://dev.eclipse.org/mailman/listinfo/paho-dev).
|
||||||
|
|
||||||
|
## Follow Eclipse Paho on Twitter: [@eclipsepaho](https://twitter.com/eclipsepaho)
|
||||||
|
|
||||||
|
General questions about the MQTT protocol are discussed in the [MQTT Google Group](https://groups.google.com/forum/?hl=en-US&fromgroups#!forum/mqtt).
|
||||||
|
|
||||||
|
There is more information available via the [MQTT community site](http://mqtt.org).
|
||||||
|
|
||||||
|
|
||||||
|
## Building with CMake
|
||||||
|
|
||||||
|
The build process currently supports a number of Linux "flavors" including ARM and s390, OS X, AIX and Solaris as well as the Windows operating system. The build process requires the following tools:
|
||||||
|
* [CMake](http://cmake.org)
|
||||||
|
* [GNU Make](https://www.gnu.org/software/make/) or [Ninja](https://martine.github.io/ninja/)
|
||||||
|
* A conforming C compiler, such as [gcc](https://gcc.gnu.org/), [Clang](https://clang.llvm.org/), etc
|
||||||
|
|
||||||
|
On Debian based systems this would mean that the following packages have to be installed:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, in order to build a debian package from the source code, the following packages have to be installed
|
||||||
|
|
||||||
|
```
|
||||||
|
$ apt-get install fakeroot devscripts dh-make lsb-release
|
||||||
|
```
|
||||||
|
|
||||||
|
Ninja can be downloaded from its github project page in the "releases" section. Optionally it is possible to build binaries with SSL/TLS support. This requires the OpenSSL libraries and includes to be available. E. g. on Debian:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ apt-get install libssl-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
The documentation requires doxygen and optionally graphviz:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ apt-get install doxygen graphviz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building your application with CMake
|
||||||
|
|
||||||
|
If the Paho C library was built with CMake and is already installed on the system, it is relatively easy to set up a CMake build for your application. (If it's not already built and installed read the next section).
|
||||||
|
|
||||||
|
The library can be built with several options which create variations of the library for asynchronous or synchronous use; encryption (SSL/TLS) support or not; and whether the library is shared or static. CMake exports all of the libraries that were built as targets, and the user can chose which is best suited for an application.
|
||||||
|
|
||||||
|
The package is named: **eclipse-paho-mqtt-c**
|
||||||
|
|
||||||
|
The namespace for all the targets is also: **eclipse-paho-mqtt-c**
|
||||||
|
|
||||||
|
The target names are the same as the library names. The static libraries append *-static* to the target name even for platforms that use the same base name for shared and static libraries. So:
|
||||||
|
|
||||||
|
Target|Description
|
||||||
|
------|-----------
|
||||||
|
paho-mqtt3a | asynchronous, no encryption
|
||||||
|
paho-mqtt3as | asynchronous with SSL/TLS support
|
||||||
|
paho-mqtt3c | synchronous, no encryption
|
||||||
|
paho-mqtt3cs | synchronous with SSL/TLS support
|
||||||
|
paho-mqtt3a-static | asynchronous, no encryption, static linkage
|
||||||
|
paho-mqtt3as-static | asynchronous with SSL/TLS support, static linkage
|
||||||
|
paho-mqtt3c-static | synchronous, no encryption, static linkage
|
||||||
|
paho-mqtt3cs-static | synchronous with SSL/TLS support, static linkage
|
||||||
|
|
||||||
|
Remember, though, that not all of these targets may be available. It depends on how the library was built.
|
||||||
|
|
||||||
|
A sample *CMakeLists.txt* for an application that uses the asynchronous library with encryption support *(paho-mqtt3as)* might look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
project(MyMQTTApp VERSION 1.0.0 LANGUAGES C)
|
||||||
|
|
||||||
|
find_package(eclipse-paho-mqtt-c REQUIRED)
|
||||||
|
|
||||||
|
add_executable(MyMQTTApp MyMQTTApp.c)
|
||||||
|
target_link_libraries(MQTTVersion eclipse-paho-mqtt-c::paho-mqtt3as)
|
||||||
|
```
|
||||||
|
|
||||||
|
If the library was installed to a non-traditional location, you may need to tell CMake where to find it using `CMAKE_PREFIX_PATH`. For example, if you installed it in */opt/mqtt/paho.mqtt.c*
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cmake -DCMAKE_PREFIX_PATH=/opt/mqtt/paho.mqtt.c ..
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building the Paho C library with CMake
|
||||||
|
|
||||||
|
Before compiling, determine the value of some variables in order to configure features, library locations, and other options:
|
||||||
|
|
||||||
|
Variable | Default Value | Description
|
||||||
|
------------ | ------------- | -------------
|
||||||
|
PAHO_BUILD_SHARED | TRUE | Build a shared version of the libraries
|
||||||
|
PAHO_BUILD_STATIC | FALSE | Build a static version of the libraries
|
||||||
|
PAHO_HIGH_PERFORMANCE | FALSE | When set to true, the debugging aids internal tracing and heap tracking are not included.
|
||||||
|
PAHO_WITH_SSL | FALSE | Flag that defines whether to build ssl-enabled binaries too.
|
||||||
|
OPENSSL_ROOT_DIR | "" (system default) | Directory containing your OpenSSL installation (i.e. `/usr/local` when headers are in `/usr/local/include` and libraries are in `/usr/local/lib`)
|
||||||
|
PAHO_WITH_LIBRESSL | FALSE | Flag that defines whether to build ssl-enabled binaries with LibreSSL instead of OpenSSL.
|
||||||
|
LIBRESSL_ROOT_DIR | "" (system default) | Directory containing your LibreSSL installation (i.e. `/usr/local` when headers are in `/usr/local/include` and libraries are in `/usr/local/lib`)
|
||||||
|
PAHO_WITH_UNIX_SOCKETS | FALSE | (*nix systems only) Flag to enable support for UNIX-domain sockets
|
||||||
|
PAHO_BUILD_DOCUMENTATION | FALSE | Create and install the HTML based API documentation (requires Doxygen)
|
||||||
|
PAHO_BUILD_SAMPLES | FALSE | Build sample programs
|
||||||
|
PAHO_ENABLE_TESTING | TRUE | Build test and run
|
||||||
|
MQTT_TEST_BROKER | tcp://localhost:1883 | MQTT connection URL for a broker to use during test execution
|
||||||
|
MQTT_TEST_PROXY | tcp://localhost:1883 | Hostname of the test proxy to use
|
||||||
|
MQTT_SSL_HOSTNAME | localhost | Hostname of a test SSL MQTT broker to use
|
||||||
|
PAHO_BUILD_DEB_PACKAGE | FALSE | Build debian package
|
||||||
|
|
||||||
|
Using these variables CMake can be used to generate your Ninja or Make files. Using CMake, building out-of-source is the default. Therefore it is recommended to invoke all build commands inside your chosen build directory but outside of the source tree.
|
||||||
|
|
||||||
|
An example build session targeting the build platform could look like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkdir /tmp/build.paho ; cd /tmp/build.paho
|
||||||
|
$ cmake -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=TRUE \
|
||||||
|
-DPAHO_BUILD_SAMPLES=TRUE ~/paho.mqtt.c
|
||||||
|
```
|
||||||
|
|
||||||
|
Invoking cmake and specifying build options can also be performed using cmake-gui or ccmake (see https://cmake.org/runningcmake/). For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ccmake ~/paho.mqtt.c
|
||||||
|
```
|
||||||
|
|
||||||
|
To compile/link the binaries, to install, or to generate packages, use these commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cmake --build .
|
||||||
|
|
||||||
|
$ cmake --build . --target install
|
||||||
|
|
||||||
|
$ cmake --build . --target package
|
||||||
|
```
|
||||||
|
|
||||||
|
To build, install, or generate packages, you can also use the generated builder like _ninja_ or _make_ directly after invoking the initial CMake configuration step, such as `ninja package` or `make -j <number-of-jpbs> package`.
|
||||||
|
|
||||||
|
### Debug builds
|
||||||
|
|
||||||
|
Debug builds can be performed by defining the value of the `CMAKE_BUILD_TYPE` option to `Debug`. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cmake -DCMAKE_BUILD_TYPE=Debug ~/paho.mqtt.c
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running the tests
|
||||||
|
|
||||||
|
Test code is available in the `test` directory. The tests can be built and executed with the CMake build system. The test execution requires a MQTT broker running. By default, the build system uses `localhost`, however it is possible to configure the build to use an external broker. These parameters are documented in the Build Requirements section above.
|
||||||
|
|
||||||
|
After ensuring a MQTT broker is available, it is possible to execute the tests by starting the proxy and running `ctest` as described below:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ python ../test/mqttsas.py &
|
||||||
|
$ ctest -VV
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cross compilation
|
||||||
|
|
||||||
|
Cross compilation using CMake is performed by using so called "toolchain files" (see: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html).
|
||||||
|
|
||||||
|
The path to the toolchain file can be specified by using CMake's `-DCMAKE_TOOLCHAIN_FILE` option. In case no toolchain file is specified, the build is performed for the native build platform.
|
||||||
|
|
||||||
|
For your convenience toolchain files for the following platforms can be found in the `cmake` directory of Eclipse Paho:
|
||||||
|
* Linux x86
|
||||||
|
* Linux ARM11 (a.k.a. the Raspberry Pi)
|
||||||
|
* Windows x86_64
|
||||||
|
* Windows x86
|
||||||
|
|
||||||
|
The provided toolchain files assume that required compilers/linkers are to be found in the environment, i. e. the PATH-Variable of your user or system. If you prefer, you can also specify the absolute location of your compilers in the toolchain files.
|
||||||
|
|
||||||
|
Example invocation for the Raspberry Pi:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cmake -GNinja -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_SAMPLES=TRUE \
|
||||||
|
-DPAHO_BUILD_DOCUMENTATION=TRUE \
|
||||||
|
-DOPENSSL_LIB_SEARCH_PATH=/tmp/libssl-dev/usr/lib/arm-linux-gnueabihf \
|
||||||
|
-DOPENSSL_INC_SEARCH_PATH="/tmp/libssl-dev/usr/include/openssl;/tmp/libssl-dev/usr/include/arm-linux-gnueabihf" \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=~/paho.mqtt.c/cmake/toolchain.linux-arm11.cmake \
|
||||||
|
~/paho.mqtt.c
|
||||||
|
```
|
||||||
|
|
||||||
|
Compilers for the Raspberry Pi and other ARM targets can be obtained from ARM (https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads)
|
||||||
|
|
||||||
|
This example assumes that OpenSSL-libraries and includes have been installed in the `/tmp/libssl-dev` directory.
|
||||||
|
|
||||||
|
Example invocation for Windows 64 bit:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ cmake -DPAHO_BUILD_SAMPLES=TRUE \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=~/paho.mqtt.c/cmake/toolchain.win64.cmake \
|
||||||
|
~/paho.mqtt.c
|
||||||
|
```
|
||||||
|
|
||||||
|
In this case the libraries and executable are not linked against OpenSSL Libraries. Cross compilers for the Windows platform can be installed on Debian like systems like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ apt-get install gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build instructions for GNU Make
|
||||||
|
|
||||||
|
Ensure the OpenSSL development package is installed. Then from the client library base directory run:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
This will build and install the libraries. To uninstall:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo make uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
To build the documentation requires doxygen and optionally graphviz.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make html
|
||||||
|
```
|
||||||
|
|
||||||
|
The provided GNU Makefile is intended to perform all build steps in the ```build``` directory within the source-tree of Eclipse Paho. Generated binares, libraries, and the documentation can be found in the ```build/output``` directory after completion.
|
||||||
|
|
||||||
|
Options that are passed to the compiler/linker can be specified by typical Unix build variables:
|
||||||
|
|
||||||
|
Variable | Description
|
||||||
|
------------ | -------------
|
||||||
|
CC | Path to the C compiler
|
||||||
|
CFLAGS | Flags passed to compiler calls
|
||||||
|
LDFLAGS | Flags passed to linker calls
|
||||||
|
|
||||||
|
## Building paho-mqtt - Using vcpkg
|
||||||
|
|
||||||
|
You can download and install paho-mqtt using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||||
|
|
||||||
|
git clone https://github.com/Microsoft/vcpkg.git
|
||||||
|
cd vcpkg
|
||||||
|
./bootstrap-vcpkg.sh
|
||||||
|
./vcpkg integrate install
|
||||||
|
./vcpkg install paho-mqtt
|
||||||
|
|
||||||
|
The paho-mqtt port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||||
|
|
||||||
|
## Fully static builds with musl libc
|
||||||
|
|
||||||
|
(By Frank Pagliughi)
|
||||||
|
|
||||||
|
[musl libc](https://musl.libc.org/) is is an implementation of the C standard library built on top of the Linux system call API, including interfaces defined in the base language standard, POSIX, and widely agreed-upon extensions.
|
||||||
|
|
||||||
|
Users of the Rust library, which wraps this one, had been complaining that they could not compile using the musl build tools. Musl is a small std C lib that can be statically linked. With the latest Paho C library (and a very minor tweak to the build), we're now able to build Rust apps using musl and Paho C that are fully static; no runtime dependencies on the platform; not even on the standard C lib.
|
||||||
|
|
||||||
|
$ ./async_publish
|
||||||
|
Publishing a message on the 'test' topic
|
||||||
|
|
||||||
|
$ ldd async_publish
|
||||||
|
not a dynamic executable
|
||||||
|
|
||||||
|
So, for example, if maintaining a suite of apps for some newer and older embedded Linux boards, the same executables could be deployed without worry about the C ABI on the particular boards.
|
||||||
|
|
||||||
|
Certainly C apps using the Paho library could do this also.
|
||||||
|
|
||||||
|
## Microsoft Windows
|
||||||
|
|
||||||
|
### Calling convention
|
||||||
|
|
||||||
|
As is normal for C programs on Windows, the calling convention is __cdecl. See the Microsoft documentation here:
|
||||||
|
|
||||||
|
https://docs.microsoft.com/en-us/cpp/cpp/cdecl?view=vs-2019
|
||||||
|
|
||||||
|
If you call this library from another language, you may need to take this into account.
|
||||||
|
|
||||||
16
3rd/paho.mqtt.c/SECURITY.md
Normal file
16
3rd/paho.mqtt.c/SECURITY.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
This project follows the [Eclipse Vulnerability Reporting Policy](https://www.eclipse.org/security/policy.php).
|
||||||
|
Vulnerabilities are tracked by the Eclipse security team, in cooperation with the project lead.
|
||||||
|
Fixing vulnerabilities is taken care of by the project committers, with assistance and guidance of the security
|
||||||
|
team.
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
Eclipse Paho provides security updates for the most recent version only.
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
We recommend that in case of suspected vulnerabilities you do not create a GitHub issue, but instead contact the
|
||||||
|
Eclipse Security Team directly sending an email to security@eclipse.org.
|
||||||
|
|
||||||
28
3rd/paho.mqtt.c/about.html
Normal file
28
3rd/paho.mqtt.c/about.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
|
<title>About</title>
|
||||||
|
</head>
|
||||||
|
<body lang="EN-US">
|
||||||
|
<h2>About This Content</h2>
|
||||||
|
|
||||||
|
<p><em>April 6, 2020</em></p>
|
||||||
|
<h3>License</h3>
|
||||||
|
|
||||||
|
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
|
||||||
|
indicated below, the Content is provided to you under the terms and conditions of the
|
||||||
|
Eclipse Public License Version 2.0 ("EPL") and Eclipse Distribution License Version 1.0 ("EDL").
|
||||||
|
A copy of the EPL is available at
|
||||||
|
<a href="https://www.eclipse.org/legal/epl-2.0/">https://www.eclipse.org/legal/epl-2.0/</a>
|
||||||
|
and a copy of the EDL is available at
|
||||||
|
<a href="http://www.eclipse.org/org/documents/edl-v10.php">http://www.eclipse.org/org/documents/edl-v10.php</a>.
|
||||||
|
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||||
|
|
||||||
|
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
|
||||||
|
being redistributed by another party ("Redistributor") and different terms and conditions may
|
||||||
|
apply to your use of any object code in the Content. Check the Redistributor's license that was
|
||||||
|
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
|
||||||
|
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
|
||||||
|
and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
|
||||||
|
|
||||||
|
</body></html>
|
||||||
140
3rd/paho.mqtt.c/android/Android.mk
Normal file
140
3rd/paho.mqtt.c/android/Android.mk
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
# Example: Android Native Library makefile for paho.mqtt.c
|
||||||
|
# contributed by Bin Li <bin.li@windriver.com>
|
||||||
|
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
libpaho-mqtt3_lib_path := ../src
|
||||||
|
libpaho-mqtt3_c_includes := $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path) \
|
||||||
|
external/hdc/android-ifaddrs \
|
||||||
|
external/openssl/include \
|
||||||
|
external/zlib
|
||||||
|
|
||||||
|
# build sample util
|
||||||
|
define build_sample_util
|
||||||
|
__sample_module:= $1
|
||||||
|
__sample_lib:= $2
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_C_INCLUDES := $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SHARED_LIBRARIES := $$(__sample_lib)
|
||||||
|
LOCAL_MODULE := $$(__sample_module)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_lib_path)/samples/$$(__sample_module).c
|
||||||
|
include $(BUILD_EXECUTABLE)
|
||||||
|
endef
|
||||||
|
|
||||||
|
libpaho-mqtt3_local_src_c_files_common := \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTProtocolClient.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Tree.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Heap.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTPacket.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Clients.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Thread.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/utf-8.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/StackTrace.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTProtocolOut.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Socket.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Log.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/Messages.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/LinkedList.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTPersistence.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTPacketOut.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/SocketBuffer.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTPersistenceDefault.c \
|
||||||
|
|
||||||
|
libpaho-mqtt3_local_src_c_files_c := \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTClient.c \
|
||||||
|
|
||||||
|
libpaho-mqtt3_local_src_c_files_cs := \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTClient.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/SSLSocket.c \
|
||||||
|
|
||||||
|
libpaho-mqtt3_local_src_c_files_a := \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTAsync.c \
|
||||||
|
|
||||||
|
libpaho-mqtt3_local_src_c_files_as := \
|
||||||
|
$(libpaho-mqtt3_lib_path)/MQTTAsync.c \
|
||||||
|
$(libpaho-mqtt3_lib_path)/SSLSocket.c \
|
||||||
|
|
||||||
|
# update the header file which normally generated by cmake
|
||||||
|
$(shell (cp -f $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)/VersionInfo.h.in $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)/VersionInfo.h))
|
||||||
|
$(shell (sed -i "s/@CLIENT_VERSION@/1.2.0/g" $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)/VersionInfo.h))
|
||||||
|
$(shell ( sed -i "s/@BUILD_TIMESTAMP@/$(shell date)/g" $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)/VersionInfo.h))
|
||||||
|
|
||||||
|
# building static libraries
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3c
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_c)
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3cs
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_CFLAGS += -DOPENSSL
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_cs)
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3a
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/${libpaho-mqtt3_lib_path}
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_a)
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3as
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/${libpaho-mqtt3_lib_path}
|
||||||
|
LOCAL_CFLAGS += -DOPENSSL
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_as)
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
# building shared libraries
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3c
|
||||||
|
LOCAL_SHARED_LIBRARIES := libdl
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_c)
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3cs
|
||||||
|
LOCAL_SHARED_LIBRARIES := libcrypto libssl libdl
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/$(libpaho-mqtt3_lib_path)
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_CFLAGS += -DOPENSSL
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_cs)
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3a
|
||||||
|
LOCAL_SHARED_LIBRARIES := libdl
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/${libpaho-mqtt3_lib_path}
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_a)
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libpaho-mqtt3as
|
||||||
|
LOCAL_SHARED_LIBRARIES := libcrypto libssl libdl
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/${libpaho-mqtt3_lib_path}
|
||||||
|
LOCAL_CFLAGS += -DOPENSSL
|
||||||
|
LOCAL_C_INCLUDES:= $(libpaho-mqtt3_c_includes)
|
||||||
|
LOCAL_SRC_FILES := $(libpaho-mqtt3_local_src_c_files_common) $(libpaho-mqtt3_local_src_c_files_as)
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
# building samples
|
||||||
|
|
||||||
|
$(eval $(call build_sample_util, MQTTAsync_subscribe, libpaho-mqtt3a ) )
|
||||||
|
$(eval $(call build_sample_util, MQTTAsync_publish, libpaho-mqtt3a ) )
|
||||||
|
$(eval $(call build_sample_util, MQTTClient_publish, libpaho-mqtt3c ) )
|
||||||
|
$(eval $(call build_sample_util, MQTTClient_publish_async, libpaho-mqtt3c ) )
|
||||||
|
$(eval $(call build_sample_util, MQTTClient_subscribe, libpaho-mqtt3c ) )
|
||||||
|
$(eval $(call build_sample_util, paho_c_pub, libpaho-mqtt3a ) )
|
||||||
|
$(eval $(call build_sample_util, paho_c_sub, libpaho-mqtt3a ) )
|
||||||
|
$(eval $(call build_sample_util, paho_cs_pub, libpaho-mqtt3c ) )
|
||||||
|
$(eval $(call build_sample_util, paho_cs_sub, libpaho-mqtt3c ) )
|
||||||
|
|
||||||
100
3rd/paho.mqtt.c/appveyor.yml
Normal file
100
3rd/paho.mqtt.c/appveyor.yml
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
version: 1.3.{build}
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
PAHO_WINDOWS_BUILD_BIT: x64
|
||||||
|
OPENSSL_ROOT_DIR: "C:/OpenSSL-v111-Win64"
|
||||||
|
PAHO_BUILD_STATIC: FALSE
|
||||||
|
PAHO_BUILD_SHARED: TRUE
|
||||||
|
PAHO_HIGH_PERFORMANCE: FALSE
|
||||||
|
PYTHON_VERSION: Python36
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
PAHO_WINDOWS_BUILD_BIT: x64
|
||||||
|
OPENSSL_ROOT_DIR: "C:/OpenSSL-Win64"
|
||||||
|
PAHO_BUILD_STATIC: TRUE
|
||||||
|
PAHO_BUILD_SHARED: FALSE
|
||||||
|
PAHO_HIGH_PERFORMANCE: TRUE
|
||||||
|
PYTHON_VERSION: Python36
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
PAHO_WINDOWS_BUILD_BIT: x86
|
||||||
|
OPENSSL_ROOT_DIR: "C:/OpenSSL-Win32"
|
||||||
|
PAHO_BUILD_STATIC: FALSE
|
||||||
|
PAHO_BUILD_SHARED: TRUE
|
||||||
|
PAHO_HIGH_PERFORMANCE: TRUE
|
||||||
|
PYTHON_VERSION: Python313
|
||||||
|
|
||||||
|
configuration: Debug
|
||||||
|
install:
|
||||||
|
- cmd: ver
|
||||||
|
- cmd: openssl version
|
||||||
|
- cmd: C:\%PYTHON_VERSION%\python --version
|
||||||
|
- cmd: netsh advfirewall firewall add rule name="Python 3" dir=in action=allow program="C:\%PYTHON_VERSION%\python.exe" enable=yes
|
||||||
|
- cmd: netsh advfirewall firewall add rule name="Open Port 1883" dir=in action=allow protocol=TCP localport=1883
|
||||||
|
- cmd: netsh advfirewall set allprofiles state off
|
||||||
|
- ps: Start-Process C:\$Env:PYTHON_VERSION\python -ArgumentList 'test\mqttsas.py'
|
||||||
|
- cmd: git clone https://github.com/eclipse/paho.mqtt.testing.git
|
||||||
|
- cmd: cd paho.mqtt.testing\interoperability
|
||||||
|
- ps: Start-Process C:\$Env:PYTHON_VERSION\python -ArgumentList 'startbroker.py -c localhost_testing.conf'
|
||||||
|
- cmd: cd ..\..
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- cmd: >-
|
||||||
|
mkdir build.paho
|
||||||
|
|
||||||
|
cd build.paho
|
||||||
|
|
||||||
|
echo %APPVEYOR_BUILD_WORKER_IMAGE%
|
||||||
|
|
||||||
|
if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2019" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %PAHO_WINDOWS_BUILD_BIT%
|
||||||
|
|
||||||
|
if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PAHO_WINDOWS_BUILD_BIT%
|
||||||
|
|
||||||
|
if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2013" call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %PAHO_WINDOWS_BUILD_BIT%
|
||||||
|
|
||||||
|
cmake -G "NMake Makefiles" -DPAHO_WITH_SSL=TRUE -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_DIR% -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE -DPAHO_BUILD_STATIC=%PAHO_BUILD_STATIC% -DPAHO_BUILD_SHARED=%PAHO_BUILD_SHARED% -DPAHO_HIGH_PERFORMANCE=%PAHO_HIGH_PERFORMANCE% ..
|
||||||
|
|
||||||
|
nmake
|
||||||
|
|
||||||
|
ctest -T test -VV
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
after_build:
|
||||||
|
- cmd: >-
|
||||||
|
set ZIPNAME=eclipse-paho-mqtt-c-windows.zip
|
||||||
|
|
||||||
|
7z a %ZIPNAME% %APPVEYOR_BUILD_FOLDER%\*.html
|
||||||
|
|
||||||
|
7z a %ZIPNAME% %APPVEYOR_BUILD_FOLDER%\*.md
|
||||||
|
|
||||||
|
7z a %ZIPNAME% %APPVEYOR_BUILD_FOLDER%\*-v10
|
||||||
|
|
||||||
|
7z a %ZIPNAME% build.paho\src\*.dll
|
||||||
|
|
||||||
|
7z a %ZIPNAME% build.paho\src\*.lib
|
||||||
|
|
||||||
|
7z rn %ZIPNAME% build.paho\src lib
|
||||||
|
|
||||||
|
7z a %ZIPNAME% build.paho\src\samples\*.exe
|
||||||
|
|
||||||
|
7z rn %ZIPNAME% build.paho\src\samples bin
|
||||||
|
|
||||||
|
if "%PAHO_BUILD_SHARED%" == "TRUE" 7z a %ZIPNAME% "%APPVEYOR_BUILD_FOLDER%\build.paho\src\MQTTVersion.exe"
|
||||||
|
|
||||||
|
7z rn %ZIPNAME% MQTTVersion.exe bin\MQTTVersion.exe
|
||||||
|
|
||||||
|
7z a %ZIPNAME% src\MQTTClient.h src\MQTTAsync.h src\MQTTClientPersistence.h src\MQTTProperties.h src\MQTTReasonCodes.h src\MQTTSubscribeOpts.h src\MQTTExportDeclarations.h
|
||||||
|
|
||||||
|
7z rn %ZIPNAME% src include
|
||||||
|
|
||||||
|
7z a %ZIPNAME% src\samples\*.c
|
||||||
|
|
||||||
|
7z rn %ZIPNAME% src\samples samples
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: eclipse-paho-mqtt-c-windows.zip
|
||||||
|
name: paho-mqtt-c
|
||||||
|
|
||||||
|
test:
|
||||||
|
assemblies: build/Testing/*/Test.xml
|
||||||
319
3rd/paho.mqtt.c/build.xml
Normal file
319
3rd/paho.mqtt.c/build.xml
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
<!--****************************************************************************
|
||||||
|
Copyright (c) 2012, 2020 IBM Corp.
|
||||||
|
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
|
||||||
|
The Eclipse Public License is available at
|
||||||
|
https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
and the Eclipse Distribution License is available at
|
||||||
|
http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
*******************************************************************************-->
|
||||||
|
|
||||||
|
<project name="MQTT C Client" default="full">
|
||||||
|
|
||||||
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
||||||
|
<classpath>
|
||||||
|
<pathelement location="/opt/public/cbi/build/3rdPartyJars/ant-contrib.jar" />
|
||||||
|
<pathelement location="/usr/share/java/ant-contrib.jar" />
|
||||||
|
</classpath>
|
||||||
|
</taskdef>
|
||||||
|
|
||||||
|
<property name="output.folder" value="build/output" />
|
||||||
|
<loadfile property="version.major" srcFile="version.major"/>
|
||||||
|
<loadfile property="version.minor" srcFile="version.minor"/>
|
||||||
|
<loadfile property="version.patch" srcFile="version.patch"/>
|
||||||
|
<property name="release.version" value="${version.major}.${version.minor}.${version.patch}" />
|
||||||
|
|
||||||
|
<property name="libname" value="mqttv3c" />
|
||||||
|
<property name="libname.ssl" value="mqttv3cs" />
|
||||||
|
<property name="libname.async" value="mqttv3a" />
|
||||||
|
<property name="libname.async.ssl" value="mqttv3as" />
|
||||||
|
<property name="ssl" value="yes" />
|
||||||
|
<property name="windows.openssl.folder" value="c:\openssl\bin" />
|
||||||
|
<property name="test.hostname" value="iot.eclipse.org"/>
|
||||||
|
<property name="test.port" value="1883"/>
|
||||||
|
<property name="proxy.port" value="18883"/>
|
||||||
|
<if>
|
||||||
|
<os family="windows"/>
|
||||||
|
<then>
|
||||||
|
<property name="os.family" value="windows" />
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<if>
|
||||||
|
<os family="mac"/>
|
||||||
|
<then>
|
||||||
|
<property name="os.family" value="mac" />
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<property name="os.family" value="unix" />
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
<echo message="os.family is '${os.family}'" />
|
||||||
|
|
||||||
|
<target name="init">
|
||||||
|
<tstamp>
|
||||||
|
<format property="buildTimestamp" pattern="yyyyMMddHHmm" />
|
||||||
|
</tstamp>
|
||||||
|
|
||||||
|
<fileset id="sync.source.fileset" dir="src">
|
||||||
|
<include name="*.c"/>
|
||||||
|
<exclude name="MQTTAsync.c"/>
|
||||||
|
<exclude name="MQTTVersion.c"/>
|
||||||
|
</fileset>
|
||||||
|
<pathconvert refid="sync.source.fileset" property="sync.source.files" pathsep=" "/>
|
||||||
|
|
||||||
|
<fileset id="async.source.fileset" dir="src">
|
||||||
|
<include name="*.c"/>
|
||||||
|
<exclude name="MQTTClient.c"/>
|
||||||
|
<exclude name="MQTTVersion.c"/>
|
||||||
|
</fileset>
|
||||||
|
<pathconvert refid="async.source.fileset" property="async.source.files" pathsep=" "/>
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="version" depends="init" description="replace tags with the right levels">
|
||||||
|
<property name="build.level" value="${DSTAMP}${TSTAMP}" />
|
||||||
|
<copy file="src/VersionInfo.h.in" tofile="src/VersionInfo.h" overwrite="true"/>
|
||||||
|
<replace file="src/VersionInfo.h" token="@BUILD_TIMESTAMP@" value="${build.level}" />
|
||||||
|
<replace file="src/VersionInfo.h" token="@CLIENT_VERSION@" value="${release.version}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="test" >
|
||||||
|
<!-- display Python version -->
|
||||||
|
<exec executable="python" failonerror="true">
|
||||||
|
<arg line="-V"/>
|
||||||
|
</exec>
|
||||||
|
<exec executable="python" dir="test" spawn="true">
|
||||||
|
<arg value="mqttsas2.py" />
|
||||||
|
<arg value="${test.hostname}" />
|
||||||
|
<arg value="${test.port}" />
|
||||||
|
<arg value="${proxy.port}" />
|
||||||
|
</exec>
|
||||||
|
<if>
|
||||||
|
<os family="windows"/>
|
||||||
|
<then>
|
||||||
|
<foreach target="runAtest" param="aTest" list="test1,test2,test4,test9"/>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<foreach target="runAtest" param="aTest" list="test1,test2,test4,test9"/>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
<foreach target="runSSLtest" param="aTest" list="test3,test5"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="runAtest">
|
||||||
|
<if>
|
||||||
|
<os family="windows"/>
|
||||||
|
<then>
|
||||||
|
<exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" >
|
||||||
|
<arg value="/c" />
|
||||||
|
<arg value="${aTest}.exe" />
|
||||||
|
<arg value="--connection" />
|
||||||
|
<arg value="tcp://${test.hostname}:${test.port}" />
|
||||||
|
<arg value="--proxy_connection" />
|
||||||
|
<arg value="tcp://localhost:${proxy.port}" />
|
||||||
|
<env key="PATH" path="${output.folder}" />
|
||||||
|
</exec>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" >
|
||||||
|
<arg value="--connection" />
|
||||||
|
<arg value="tcp://${test.hostname}:${test.port}" />
|
||||||
|
<arg value="--proxy_connection" />
|
||||||
|
<arg value="tcp://localhost:${proxy.port}" />
|
||||||
|
<env key="LD_LIBRARY_PATH" path="${output.folder}" />
|
||||||
|
<env key="DYLD_LIBRARY_PATH" path="${output.folder}" />
|
||||||
|
</exec>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="runSSLtest">
|
||||||
|
<if>
|
||||||
|
<os family="windows"/>
|
||||||
|
<then>
|
||||||
|
<exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" >
|
||||||
|
<arg value="/c" />
|
||||||
|
<arg value="${aTest}.exe" />
|
||||||
|
<arg value="--hostname" />
|
||||||
|
<arg value="${test.hostname}" />
|
||||||
|
<env key="PATH" path="${output.folder};${windows.openssl.folder}" />
|
||||||
|
</exec>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" >
|
||||||
|
<arg value="--hostname" />
|
||||||
|
<arg value="${test.hostname}" />
|
||||||
|
<env key="LD_LIBRARY_PATH" path="${output.folder}" />
|
||||||
|
<env key="DYLD_LIBRARY_PATH" path="${output.folder}" />
|
||||||
|
</exec>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="doc" >
|
||||||
|
<if>
|
||||||
|
<available file="/usr/bin/doxygen"/>
|
||||||
|
<then>
|
||||||
|
<mkdir dir="${output.folder}/doc"/>
|
||||||
|
<exec executable="doxygen" dir="src">
|
||||||
|
<arg value="../doc/DoxyfileV3ClientAPI"/>
|
||||||
|
</exec>
|
||||||
|
<exec executable="doxygen" dir="src">
|
||||||
|
<arg value="../doc/DoxyfileV3AsyncAPI"/>
|
||||||
|
</exec>
|
||||||
|
<zip destfile="${output.folder}/MQTTClient_doc.zip">
|
||||||
|
<zipfileset dir="${output.folder}/doc/MQTTClient" />
|
||||||
|
</zip>
|
||||||
|
<zip destfile="${output.folder}/MQTTAsync_doc.zip">
|
||||||
|
<zipfileset dir="${output.folder}/doc/MQTTAsync" prefix="MQTTAsync/"/>
|
||||||
|
</zip>
|
||||||
|
<delete dir="${output.folder}/doc" />
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<echo message="doxygen is not available" />
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build" >
|
||||||
|
<if>
|
||||||
|
<os family="unix"/>
|
||||||
|
<then>
|
||||||
|
<delete dir="${output.folder}" />
|
||||||
|
<!-- display gcc version -->
|
||||||
|
<exec executable="gcc" failonerror="true">
|
||||||
|
<arg line="-v"/>
|
||||||
|
</exec>
|
||||||
|
<if>
|
||||||
|
<available file="/usr/bin/make"/>
|
||||||
|
<then>
|
||||||
|
<exec executable="make" dir="."/>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
<if>
|
||||||
|
<os family="windows"/>
|
||||||
|
<then>
|
||||||
|
<delete dir="${output.folder}" />
|
||||||
|
<!-- display gcc version -->
|
||||||
|
<exec executable="cl" failonerror="true">
|
||||||
|
</exec>
|
||||||
|
<exec executable="msbuild" dir=".">
|
||||||
|
<arg line='"Windows Build\Paho C MQTT APIs.sln"'/>
|
||||||
|
<arg line="/p:Configuration=Release"/>
|
||||||
|
</exec>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="package">
|
||||||
|
<mkdir dir="${output.folder}/include"/>
|
||||||
|
<copy overwrite="true" todir="${output.folder}/include">
|
||||||
|
<fileset dir="src" includes="MQTTClient.h,MQTTAsync.h,MQTTClientPersistence.h"/>
|
||||||
|
</copy>
|
||||||
|
<copy overwrite="true" todir="${output.folder}">
|
||||||
|
<fileset dir="." includes="README.md,CONTRIBUTING.md,about.html,notice.html,edl-v10,epl-v20"/>
|
||||||
|
</copy>
|
||||||
|
<mkdir dir="${output.folder}/lib"/>
|
||||||
|
<move overwrite="true" todir="${output.folder}/lib">
|
||||||
|
<fileset dir="${output.folder}" includes="*paho*"/>
|
||||||
|
</move>
|
||||||
|
<mkdir dir="${output.folder}/bin"/>
|
||||||
|
<move overwrite="true" todir="${output.folder}/bin">
|
||||||
|
<fileset dir="${output.folder}/samples" includes="*"/>
|
||||||
|
<fileset dir="${output.folder}" includes="MQTTVersion"/>
|
||||||
|
</move>
|
||||||
|
<copy overwrite="true" todir="${output.folder}/samples">
|
||||||
|
<fileset dir="src/samples" includes="*"/>
|
||||||
|
</copy>
|
||||||
|
<delete>
|
||||||
|
<fileset dir="." includes="eclipse-paho-mqtt-c-windows-${release.version}.zip"/>
|
||||||
|
<fileset dir="." includes="eclipse-paho-mqtt-c-${os.family}-${release.version}.tar.gz"/>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<if>
|
||||||
|
<os family="windows"/>
|
||||||
|
<then>
|
||||||
|
<exec executable="c:\cygwin\bin\zip.exe" failonerror="true" dir="${output.folder}">
|
||||||
|
<arg value="-r"/>
|
||||||
|
<arg value="eclipse-paho-mqtt-c-windows-${release.version}.zip"/>
|
||||||
|
<arg value="about.html"/>
|
||||||
|
<arg value="notice.html"/>
|
||||||
|
<arg value="README.md"/>
|
||||||
|
<arg value="CONTRIBUTING.md"/>
|
||||||
|
<arg value="epl-v20"/>
|
||||||
|
<arg value="edl-v10"/>
|
||||||
|
<arg value="include"/>
|
||||||
|
<arg value="samples"/>
|
||||||
|
<arg value="lib"/>
|
||||||
|
<arg value="bin"/>
|
||||||
|
</exec>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<exec executable="tar" failonerror="true" dir="${output.folder}">
|
||||||
|
<arg value="czf"/>
|
||||||
|
<arg value="eclipse-paho-mqtt-c-${os.family}-${release.version}.tar.gz"/>
|
||||||
|
<arg value="about.html"/>
|
||||||
|
<arg value="notice.html"/>
|
||||||
|
<arg value="README.md"/>
|
||||||
|
<arg value="CONTRIBUTING.md"/>
|
||||||
|
<arg value="epl-v20"/>
|
||||||
|
<arg value="edl-v10"/>
|
||||||
|
<arg value="include"/>
|
||||||
|
<arg value="samples"/>
|
||||||
|
<arg value="lib"/>
|
||||||
|
<arg value="bin"/>
|
||||||
|
</exec>
|
||||||
|
</else>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if>
|
||||||
|
<os family="unix"/>
|
||||||
|
<then>
|
||||||
|
<exec executable="tar" failonerror="true" dir=".">
|
||||||
|
<arg value="czf"/>
|
||||||
|
<arg value="${output.folder}/eclipse-paho-mqtt-c-src-${release.version}.tar.gz"/>
|
||||||
|
<arg value="about.html"/>
|
||||||
|
<arg value="notice.html"/>
|
||||||
|
<arg value="README.md"/>
|
||||||
|
<arg value="CONTRIBUTING.md"/>
|
||||||
|
<arg value="epl-v20"/>
|
||||||
|
<arg value="edl-v10"/>
|
||||||
|
<arg value="Makefile"/>
|
||||||
|
<arg value="build.xml"/>
|
||||||
|
<arg value="src"/>
|
||||||
|
<arg value="test"/>
|
||||||
|
<arg value="Windows Build"/>
|
||||||
|
</exec>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="copy">
|
||||||
|
<if>
|
||||||
|
<available file="/shared/technology"/>
|
||||||
|
<then>
|
||||||
|
<mkdir dir="/shared/technology/paho/C/${release.version}/${build.level}"/>
|
||||||
|
<echo message="Copying the build output to /shared" />
|
||||||
|
<copy overwrite="true" todir="/shared/technology/paho/C/${release.version}/${build.level}">
|
||||||
|
<fileset dir="${output.folder}">
|
||||||
|
<include name="*.gz"/>
|
||||||
|
<include name="*.zip"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="full" depends="init, version, build, test, doc, package, copy" />
|
||||||
|
|
||||||
|
</project>
|
||||||
24
3rd/paho.mqtt.c/cbuild.bat
Normal file
24
3rd/paho.mqtt.c/cbuild.bat
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
REM start broker and proxy
|
||||||
|
REM Start-Process C:\Python36\python -ArgumentList 'test\mqttsas.py'
|
||||||
|
REM Start-Process C:\Python36\python -ArgumentList 'startbroker.py -c localhost_testing.conf'
|
||||||
|
|
||||||
|
setlocal
|
||||||
|
set APPVEYOR_BUILD_FOLDER=%cd%
|
||||||
|
|
||||||
|
rmdir /s /q build.paho
|
||||||
|
mkdir build.paho
|
||||||
|
|
||||||
|
cd build.paho
|
||||||
|
|
||||||
|
REM call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
|
||||||
|
call "j:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
|
|
||||||
|
cmake -G "NMake Makefiles" -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE ..
|
||||||
|
|
||||||
|
nmake
|
||||||
|
|
||||||
|
ctest -T test -VV
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
endlocal
|
||||||
17
3rd/paho.mqtt.c/cmake-build.sh
Normal file
17
3rd/paho.mqtt.c/cmake-build.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rm -rf build.paho
|
||||||
|
mkdir build.paho
|
||||||
|
cd build.paho
|
||||||
|
echo "travis build dir $TRAVIS_BUILD_DIR pwd $PWD with OpenSSL root $OPENSSL_ROOT_DIR"
|
||||||
|
cmake -DPAHO_BUILD_STATIC=$PAHO_BUILD_STATIC -DPAHO_BUILD_SHARED=$PAHO_BUILD_SHARED -DCMAKE_BUILD_TYPE=Debug -DPAHO_WITH_SSL=TRUE -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DPAHO_HIGH_PERFORMANCE=$PAHO_HIGH_PERFORMANCE -DPAHO_USE_SELECT=$PAHO_USE_SELECT ..
|
||||||
|
cmake --build .
|
||||||
|
python3 ../test/mqttsas.py &
|
||||||
|
ctest -VV --timeout 600
|
||||||
|
killall python3 || true
|
||||||
|
sleep 3 # allow broker time to terminate and report
|
||||||
|
#killall mosquitto
|
||||||
|
cpack --verbose
|
||||||
|
|
||||||
88
3rd/paho.mqtt.c/cmake/CPackDebConfig.cmake.in
Normal file
88
3rd/paho.mqtt.c/cmake/CPackDebConfig.cmake.in
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
IF (CPACK_GENERATOR MATCHES "DEB")
|
||||||
|
FIND_PROGRAM(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||||
|
IF (DPKG_PROGRAM)
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND ${DPKG_PROGRAM} --print-architecture
|
||||||
|
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
ELSE (DPKG_PROGRAM)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find an architecture for the package")
|
||||||
|
ENDIF (DPKG_PROGRAM)
|
||||||
|
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND lsb_release -si
|
||||||
|
OUTPUT_VARIABLE CPACK_DEBIAN_DIST_NAME
|
||||||
|
RESULT_VARIABLE DIST_NAME_STATUS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (DIST_NAME_STATUS)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find a GNU/Linux distribution name")
|
||||||
|
ENDIF (DIST_NAME_STATUS)
|
||||||
|
|
||||||
|
IF (CPACK_DEBIAN_DIST_NAME STREQUAL "")
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find a GNU/Linux distribution name")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND lsb_release -sc
|
||||||
|
OUTPUT_VARIABLE CPACK_DEBIAN_DIST_CODE
|
||||||
|
RESULT_VARIABLE DIST_CODE_STATUS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (DIST_NAME_STATUS)
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find a GNU/Linux distribution codename")
|
||||||
|
ENDIF (DIST_NAME_STATUS)
|
||||||
|
|
||||||
|
IF (CPACK_DEBIAN_DIST_CODE STREQUAL "")
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find a GNU/Linux distribution codename")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MAJOR @PAHO_VERSION_MAJOR@)
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MINOR @PAHO_VERSION_MINOR@)
|
||||||
|
SET(CPACK_PACKAGE_VERSION_PATCH @PAHO_VERSION_PATCH@)
|
||||||
|
SET(PACKAGE_VERSION
|
||||||
|
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||||
|
|
||||||
|
IF (PACKAGE_VERSION STREQUAL "")
|
||||||
|
MESSAGE(FATAL_ERROR "Could not find a version number for the package")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
SET(PAHO_WITH_SSL @PAHO_WITH_SSL@)
|
||||||
|
|
||||||
|
MESSAGE("Package version: ${PACKAGE_VERSION}")
|
||||||
|
MESSAGE("Package built for: ${CPACK_DEBIAN_DIST_NAME} ${CPACK_DEBIAN_DIST_CODE}")
|
||||||
|
IF(PAHO_WITH_SSL)
|
||||||
|
MESSAGE("Package built with ssl-enabled binaries too")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Additional lines to a paragraph should start with " "; paragraphs should
|
||||||
|
# be separated with a " ." line
|
||||||
|
SET(CPACK_PACKAGE_NAME "libpaho-mqtt")
|
||||||
|
SET(CPACK_PACKAGE_CONTACT "Eclipse")
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Eclipse Paho MQTT C client")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER
|
||||||
|
"Genis Riera Perez <genis.riera.perez@gmail.com>")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Eclipse Paho MQTT C client library")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_VERSION ${PACKAGE_VERSION})
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_SECTION "net")
|
||||||
|
SET(CPACK_DEBIAN_PACKAGE_CONFLICTS ${CPACK_PACKAGE_NAME})
|
||||||
|
SET(CPACK_PACKAGE_FILE_NAME
|
||||||
|
"${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||||
|
|
||||||
|
UNSET(PACKAGE_VERSION CACHE)
|
||||||
|
UNSET(CPACK_DEBIAN_PACKAGE_VERSION CACHE)
|
||||||
|
|
||||||
|
#
|
||||||
|
# From CMakeDebHelper
|
||||||
|
# See http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29
|
||||||
|
#
|
||||||
|
|
||||||
|
# When the DEB-generator runs, we want him to run our install-script
|
||||||
|
#set( CPACK_INSTALL_SCRIPT ${CPACK_DEBIAN_INSTALL_SCRIPT} )
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
227
3rd/paho.mqtt.c/cmake/modules/FindLibreSSL.cmake
Normal file
227
3rd/paho.mqtt.c/cmake/modules/FindLibreSSL.cmake
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
#[=======================================================================[
|
||||||
|
|
||||||
|
Copyright (c) 2019 John Norrbin <jlnorrbin@johnex.se>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
FindLibreSSL
|
||||||
|
------------
|
||||||
|
|
||||||
|
Find the LibreSSL encryption library.
|
||||||
|
|
||||||
|
Optional Components
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module supports two optional components: SSL and TLS. Both
|
||||||
|
components have associated imported targets, as described below.
|
||||||
|
|
||||||
|
Imported Targets
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module defines the following imported targets:
|
||||||
|
|
||||||
|
LibreSSL::Crypto
|
||||||
|
The LibreSSL crypto library, if found.
|
||||||
|
|
||||||
|
LibreSSL::SSL
|
||||||
|
The LibreSSL ssl library, if found. Requires and includes LibreSSL::Crypto automatically.
|
||||||
|
|
||||||
|
LibreSSL::TLS
|
||||||
|
The LibreSSL tls library, if found. Requires and includes LibreSSL::SSL and LibreSSL::Crypto automatically.
|
||||||
|
|
||||||
|
Result Variables
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module will set the following variables in your project:
|
||||||
|
|
||||||
|
LIBRESSL_FOUND
|
||||||
|
System has the LibreSSL library. If no components are requested it only requires the crypto library.
|
||||||
|
LIBRESSL_INCLUDE_DIR
|
||||||
|
The LibreSSL include directory.
|
||||||
|
LIBRESSL_CRYPTO_LIBRARY
|
||||||
|
The LibreSSL crypto library.
|
||||||
|
LIBRESSL_SSL_LIBRARY
|
||||||
|
The LibreSSL SSL library.
|
||||||
|
LIBRESSL_TLS_LIBRARY
|
||||||
|
The LibreSSL TLS library.
|
||||||
|
LIBRESSL_LIBRARIES
|
||||||
|
All LibreSSL libraries.
|
||||||
|
LIBRESSL_VERSION
|
||||||
|
This is set to $major.$minor.$revision (e.g. 2.6.8).
|
||||||
|
|
||||||
|
Hints
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
Set LIBRESSL_ROOT_DIR to the root directory of an LibreSSL installation.
|
||||||
|
|
||||||
|
]=======================================================================]
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
# Set Hints
|
||||||
|
set(_LIBRESSL_ROOT_HINTS
|
||||||
|
${LIBRESSL_ROOT_DIR}
|
||||||
|
ENV LIBRESSL_ROOT_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set Paths
|
||||||
|
if (WIN32)
|
||||||
|
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||||
|
set(_LIBRESSL_ROOT_PATHS
|
||||||
|
"${_programfiles}/LibreSSL"
|
||||||
|
)
|
||||||
|
unset(_programfiles)
|
||||||
|
else()
|
||||||
|
set(_LIBRESSL_ROOT_PATHS
|
||||||
|
"/usr/local/"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Combine
|
||||||
|
set(_LIBRESSL_ROOT_HINTS_AND_PATHS
|
||||||
|
HINTS ${_LIBRESSL_ROOT_HINTS}
|
||||||
|
PATHS ${_LIBRESSL_ROOT_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find Include Path
|
||||||
|
find_path(LIBRESSL_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
tls.h
|
||||||
|
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find Crypto Library
|
||||||
|
find_library(LIBRESSL_CRYPTO_LIBRARY
|
||||||
|
NAMES
|
||||||
|
libcrypto
|
||||||
|
crypto
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find SSL Library
|
||||||
|
find_library(LIBRESSL_SSL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
libssl
|
||||||
|
ssl
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find TLS Library
|
||||||
|
find_library(LIBRESSL_TLS_LIBRARY
|
||||||
|
NAMES
|
||||||
|
libtls
|
||||||
|
tls
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set Libraries
|
||||||
|
set(LIBRESSL_LIBRARIES ${LIBRESSL_CRYPTO_LIBRARY} ${LIBRESSL_SSL_LIBRARY} ${LIBRESSL_TLS_LIBRARY})
|
||||||
|
|
||||||
|
# Mark Variables As Advanced
|
||||||
|
mark_as_advanced(LIBRESSL_INCLUDE_DIR LIBRESSL_LIBRARIES LIBRESSL_CRYPTO_LIBRARY LIBRESSL_SSL_LIBRARY LIBRESSL_TLS_LIBRARY)
|
||||||
|
|
||||||
|
# Find Version File
|
||||||
|
if(LIBRESSL_INCLUDE_DIR AND EXISTS "${LIBRESSL_INCLUDE_DIR}/openssl/opensslv.h")
|
||||||
|
|
||||||
|
# Get Version From File
|
||||||
|
file(STRINGS "${LIBRESSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSLV.H REGEX "#define LIBRESSL_VERSION_TEXT[ ]+\".*\"")
|
||||||
|
|
||||||
|
# Match Version String
|
||||||
|
string(REGEX REPLACE ".*\".*([0-9]+)\\.([0-9]+)\\.([0-9]+)\"" "\\1;\\2;\\3" LIBRESSL_VERSION_LIST "${OPENSSLV.H}")
|
||||||
|
|
||||||
|
# Split Parts
|
||||||
|
list(GET LIBRESSL_VERSION_LIST 0 LIBRESSL_VERSION_MAJOR)
|
||||||
|
list(GET LIBRESSL_VERSION_LIST 1 LIBRESSL_VERSION_MINOR)
|
||||||
|
list(GET LIBRESSL_VERSION_LIST 2 LIBRESSL_VERSION_REVISION)
|
||||||
|
|
||||||
|
# Set Version String
|
||||||
|
set(LIBRESSL_VERSION "${LIBRESSL_VERSION_MAJOR}.${LIBRESSL_VERSION_MINOR}.${LIBRESSL_VERSION_REVISION}")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set Find Package Arguments
|
||||||
|
find_package_handle_standard_args(LibreSSL
|
||||||
|
REQUIRED_VARS
|
||||||
|
LIBRESSL_CRYPTO_LIBRARY
|
||||||
|
LIBRESSL_INCLUDE_DIR
|
||||||
|
VERSION_VAR
|
||||||
|
LIBRESSL_VERSION
|
||||||
|
HANDLE_COMPONENTS
|
||||||
|
FAIL_MESSAGE
|
||||||
|
"Could NOT find LibreSSL, try setting the path to LibreSSL using the LIBRESSL_ROOT_DIR environment variable"
|
||||||
|
)
|
||||||
|
|
||||||
|
# LibreSSL Found
|
||||||
|
if(LIBRESSL_FOUND)
|
||||||
|
|
||||||
|
# Set LibreSSL::Crypto
|
||||||
|
if(NOT TARGET LibreSSL::Crypto AND EXISTS "${LIBRESSL_CRYPTO_LIBRARY}")
|
||||||
|
|
||||||
|
# Add Library
|
||||||
|
add_library(LibreSSL::Crypto UNKNOWN IMPORTED)
|
||||||
|
|
||||||
|
# Set Properties
|
||||||
|
set_target_properties(
|
||||||
|
LibreSSL::Crypto
|
||||||
|
PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${LIBRESSL_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${LIBRESSL_CRYPTO_LIBRARY}"
|
||||||
|
)
|
||||||
|
|
||||||
|
endif() # LibreSSL::Crypto
|
||||||
|
|
||||||
|
# Set LibreSSL::SSL
|
||||||
|
if(NOT TARGET LibreSSL::SSL AND EXISTS "${LIBRESSL_SSL_LIBRARY}")
|
||||||
|
|
||||||
|
# Add Library
|
||||||
|
add_library(LibreSSL::SSL UNKNOWN IMPORTED)
|
||||||
|
|
||||||
|
# Set Properties
|
||||||
|
set_target_properties(
|
||||||
|
LibreSSL::SSL
|
||||||
|
PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${LIBRESSL_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${LIBRESSL_SSL_LIBRARY}"
|
||||||
|
INTERFACE_LINK_LIBRARIES LibreSSL::Crypto
|
||||||
|
)
|
||||||
|
|
||||||
|
endif() # LibreSSL::SSL
|
||||||
|
|
||||||
|
# Set LibreSSL::TLS
|
||||||
|
if(NOT TARGET LibreSSL::TLS AND EXISTS "${LIBRESSL_TLS_LIBRARY}")
|
||||||
|
add_library(LibreSSL::TLS UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(
|
||||||
|
LibreSSL::TLS
|
||||||
|
PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${LIBRESSL_INCLUDE_DIR}"
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${LIBRESSL_TLS_LIBRARY}"
|
||||||
|
INTERFACE_LINK_LIBRARIES LibreSSL::SSL
|
||||||
|
)
|
||||||
|
|
||||||
|
endif() # LibreSSL::TLS
|
||||||
|
|
||||||
|
endif(LIBRESSL_FOUND)
|
||||||
10
3rd/paho.mqtt.c/cmake/toolchain.linux-arm11.cmake
Normal file
10
3rd/paho.mqtt.c/cmake/toolchain.linux-arm11.cmake
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# path to compiler and utilities
|
||||||
|
# specify the cross compiler
|
||||||
|
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
|
||||||
|
|
||||||
|
# Name of the target platform
|
||||||
|
SET(CMAKE_SYSTEM_NAME Linux)
|
||||||
|
SET(CMAKE_SYSTEM_PROCESSOR arm)
|
||||||
|
|
||||||
|
# Version of the system
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
15
3rd/paho.mqtt.c/cmake/toolchain.win32.cmake
Normal file
15
3rd/paho.mqtt.c/cmake/toolchain.win32.cmake
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Name of the target platform
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
|
||||||
|
# Version of the system
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
|
||||||
|
# specify the cross compiler
|
||||||
|
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
|
||||||
|
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
|
||||||
|
SET(CMAKE_RC_COMPILER_ENV_VAR "RC")
|
||||||
|
SET(CMAKE_RC_COMPILER "")
|
||||||
|
SET(CMAKE_SHARED_LINKER_FLAGS
|
||||||
|
"-fdata-sections -ffunction-sections -Wl,--enable-stdcall-fixup -static-libgcc -static -lpthread" CACHE STRING "" FORCE)
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS
|
||||||
|
"-fdata-sections -ffunction-sections -Wl,--enable-stdcall-fixup -static-libgcc -static -lpthread" CACHE STRING "" FORCE)
|
||||||
15
3rd/paho.mqtt.c/cmake/toolchain.win64.cmake
Normal file
15
3rd/paho.mqtt.c/cmake/toolchain.win64.cmake
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Name of the target platform
|
||||||
|
SET(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
|
||||||
|
# Version of the system
|
||||||
|
SET(CMAKE_SYSTEM_VERSION 1)
|
||||||
|
|
||||||
|
# specify the cross compiler
|
||||||
|
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||||
|
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||||
|
SET(CMAKE_RC_COMPILER_ENV_VAR "RC")
|
||||||
|
SET(CMAKE_RC_COMPILER "")
|
||||||
|
SET(CMAKE_SHARED_LINKER_FLAGS
|
||||||
|
"-fdata-sections -ffunction-sections -Wl,--enable-stdcall-fixup -static-libgcc -static -lpthread" CACHE STRING "" FORCE)
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS
|
||||||
|
"-fdata-sections -ffunction-sections -Wl,--enable-stdcall-fixup -static-libgcc -static -lpthread" CACHE STRING "" FORCE)
|
||||||
BIN
3rd/paho.mqtt.c/deploy_rsa.enc
Normal file
BIN
3rd/paho.mqtt.c/deploy_rsa.enc
Normal file
Binary file not shown.
11
3rd/paho.mqtt.c/dist/Makefile
vendored
Normal file
11
3rd/paho.mqtt.c/dist/Makefile
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
VERSION=1.3.0
|
||||||
|
|
||||||
|
check:
|
||||||
|
rpmlint -i dist/paho-c.spec
|
||||||
|
|
||||||
|
rpm-prep:
|
||||||
|
mkdir -p ${HOME}/rpmbuild/SOURCES/
|
||||||
|
tar --transform="s/\./paho-c-${VERSION}/" -cf ${HOME}/rpmbuild/SOURCES/v${VERSION}.tar.gz --exclude=./build.paho --exclude=.git --exclude=*.bz ./ --gzip
|
||||||
|
|
||||||
|
rpm: rpm-prep
|
||||||
|
rpmbuild -ba dist/paho-c.spec
|
||||||
78
3rd/paho.mqtt.c/dist/paho-c.spec
vendored
Normal file
78
3rd/paho.mqtt.c/dist/paho-c.spec
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
Summary: MQTT C Client
|
||||||
|
Name: paho-c
|
||||||
|
Version: 1.3.2
|
||||||
|
Release: 3%{?dist}
|
||||||
|
License: Eclipse Distribution License 1.0 and Eclipse Public License 2.0
|
||||||
|
Group: Development/Tools
|
||||||
|
Source: https://github.com/eclipse/paho.mqtt.c/archive/v%{version}.tar.gz
|
||||||
|
URL: https://eclipse.org/paho/clients/c/
|
||||||
|
BuildRequires: cmake
|
||||||
|
BuildRequires: gcc
|
||||||
|
BuildRequires: graphviz
|
||||||
|
BuildRequires: doxygen
|
||||||
|
BuildRequires: openssl-devel
|
||||||
|
Requires: openssl
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
The Paho MQTT C Client is a fully fledged MQTT client written in ANSI standard C.
|
||||||
|
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: MQTT C Client development kit
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: paho-c
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
Development files and samples for the the Paho MQTT C Client.
|
||||||
|
|
||||||
|
|
||||||
|
%package devel-docs
|
||||||
|
Summary: MQTT C Client development kit documentation
|
||||||
|
Group: Development/Libraries
|
||||||
|
|
||||||
|
%description devel-docs
|
||||||
|
Development documentation files for the the Paho MQTT C Client.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n paho-c-%{version}
|
||||||
|
|
||||||
|
%build
|
||||||
|
mkdir build.paho && cd build.paho
|
||||||
|
%cmake -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=TRUE -DPAHO_BUILD_SAMPLES=TRUE ..
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%install
|
||||||
|
cd build.paho
|
||||||
|
make install DESTDIR=%{buildroot}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc edl-v10 epl-v20
|
||||||
|
%{_libdir}/*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%{_bindir}/*
|
||||||
|
%{_includedir}/*
|
||||||
|
|
||||||
|
%files devel-docs
|
||||||
|
%{_datadir}/*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Thu Jul 27 2017 Otavio R. Piske <opiske@redhat.com> - 1.2.0-4
|
||||||
|
- Enabled generation of debuginfo package
|
||||||
|
|
||||||
|
* Thu Jul 27 2017 Otavio R. Piske <opiske@redhat.com> - 1.2.0-3
|
||||||
|
- Fixed changelog issues pointed by rpmlint
|
||||||
|
|
||||||
|
* Thu Jul 27 2017 Otavio R. Piske <opiske@redhat.com> - 1.2.0-2
|
||||||
|
- Updated changelog to comply with Fedora packaging guidelines
|
||||||
|
|
||||||
|
* Wed Jul 26 2017 Otavio R. Piske <opiske@redhat.com> - 1.2.0-1
|
||||||
|
- Fixed rpmlint warnings: replaced cmake call with builtin macro
|
||||||
|
- Fixed rpmlint warnings: removed buildroot reference from build section
|
||||||
|
|
||||||
|
* Fri Jun 30 2017 Otavio R. Piske <opiske@redhat.com> - 1.2.0
|
||||||
|
- Updated package to version 1.2.0
|
||||||
|
|
||||||
|
* Sat Dec 31 2016 Otavio R. Piske <opiske@redhat.com> - 1.1.0
|
||||||
|
- Initial packaging
|
||||||
15
3rd/paho.mqtt.c/edl-v10
Normal file
15
3rd/paho.mqtt.c/edl-v10
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
Eclipse Distribution License - v 1.0
|
||||||
|
|
||||||
|
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 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.
|
||||||
|
|
||||||
277
3rd/paho.mqtt.c/epl-v20
Normal file
277
3rd/paho.mqtt.c/epl-v20
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
Eclipse Public License - v 2.0
|
||||||
|
|
||||||
|
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
|
||||||
|
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
|
||||||
|
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||||
|
|
||||||
|
1. DEFINITIONS
|
||||||
|
|
||||||
|
"Contribution" means:
|
||||||
|
|
||||||
|
a) in the case of the initial Contributor, the initial content
|
||||||
|
Distributed under this Agreement, and
|
||||||
|
|
||||||
|
b) in the case of each subsequent Contributor:
|
||||||
|
i) changes to the Program, and
|
||||||
|
ii) additions to the Program;
|
||||||
|
where such changes and/or additions to the Program originate from
|
||||||
|
and are Distributed by that particular Contributor. A Contribution
|
||||||
|
"originates" from a Contributor if it was added to the Program by
|
||||||
|
such Contributor itself or anyone acting on such Contributor's behalf.
|
||||||
|
Contributions do not include changes or additions to the Program that
|
||||||
|
are not Modified Works.
|
||||||
|
|
||||||
|
"Contributor" means any person or entity that Distributes the Program.
|
||||||
|
|
||||||
|
"Licensed Patents" mean patent claims licensable by a Contributor which
|
||||||
|
are necessarily infringed by the use or sale of its Contribution alone
|
||||||
|
or when combined with the Program.
|
||||||
|
|
||||||
|
"Program" means the Contributions Distributed in accordance with this
|
||||||
|
Agreement.
|
||||||
|
|
||||||
|
"Recipient" means anyone who receives the Program under this Agreement
|
||||||
|
or any Secondary License (as applicable), including Contributors.
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source Code or other
|
||||||
|
form, that is based on (or derived from) the Program and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship.
|
||||||
|
|
||||||
|
"Modified Works" shall mean any work in Source Code or other form that
|
||||||
|
results from an addition to, deletion from, or modification of the
|
||||||
|
contents of the Program, including, for purposes of clarity any new file
|
||||||
|
in Source Code form that contains any contents of the Program. Modified
|
||||||
|
Works shall not include works that contain only declarations,
|
||||||
|
interfaces, types, classes, structures, or files of the Program solely
|
||||||
|
in each case in order to link to, bind by name, or subclass the Program
|
||||||
|
or Modified Works thereof.
|
||||||
|
|
||||||
|
"Distribute" means the acts of a) distributing or b) making available
|
||||||
|
in any manner that enables the transfer of a copy.
|
||||||
|
|
||||||
|
"Source Code" means the form of a Program preferred for making
|
||||||
|
modifications, including but not limited to software source code,
|
||||||
|
documentation source, and configuration files.
|
||||||
|
|
||||||
|
"Secondary License" means either the GNU General Public License,
|
||||||
|
Version 2.0, or any later versions of that license, including any
|
||||||
|
exceptions or additional permissions as identified by the initial
|
||||||
|
Contributor.
|
||||||
|
|
||||||
|
2. GRANT OF RIGHTS
|
||||||
|
|
||||||
|
a) Subject to the terms of this Agreement, each Contributor hereby
|
||||||
|
grants Recipient a non-exclusive, worldwide, royalty-free copyright
|
||||||
|
license to reproduce, prepare Derivative Works of, publicly display,
|
||||||
|
publicly perform, Distribute and sublicense the Contribution of such
|
||||||
|
Contributor, if any, and such Derivative Works.
|
||||||
|
|
||||||
|
b) Subject to the terms of this Agreement, each Contributor hereby
|
||||||
|
grants Recipient a non-exclusive, worldwide, royalty-free patent
|
||||||
|
license under Licensed Patents to make, use, sell, offer to sell,
|
||||||
|
import and otherwise transfer the Contribution of such Contributor,
|
||||||
|
if any, in Source Code or other form. This patent license shall
|
||||||
|
apply to the combination of the Contribution and the Program if, at
|
||||||
|
the time the Contribution is added by the Contributor, such addition
|
||||||
|
of the Contribution causes such combination to be covered by the
|
||||||
|
Licensed Patents. The patent license shall not apply to any other
|
||||||
|
combinations which include the Contribution. No hardware per se is
|
||||||
|
licensed hereunder.
|
||||||
|
|
||||||
|
c) Recipient understands that although each Contributor grants the
|
||||||
|
licenses to its Contributions set forth herein, no assurances are
|
||||||
|
provided by any Contributor that the Program does not infringe the
|
||||||
|
patent or other intellectual property rights of any other entity.
|
||||||
|
Each Contributor disclaims any liability to Recipient for claims
|
||||||
|
brought by any other entity based on infringement of intellectual
|
||||||
|
property rights or otherwise. As a condition to exercising the
|
||||||
|
rights and licenses granted hereunder, each Recipient hereby
|
||||||
|
assumes sole responsibility to secure any other intellectual
|
||||||
|
property rights needed, if any. For example, if a third party
|
||||||
|
patent license is required to allow Recipient to Distribute the
|
||||||
|
Program, it is Recipient's responsibility to acquire that license
|
||||||
|
before distributing the Program.
|
||||||
|
|
||||||
|
d) Each Contributor represents that to its knowledge it has
|
||||||
|
sufficient copyright rights in its Contribution, if any, to grant
|
||||||
|
the copyright license set forth in this Agreement.
|
||||||
|
|
||||||
|
e) Notwithstanding the terms of any Secondary License, no
|
||||||
|
Contributor makes additional grants to any Recipient (other than
|
||||||
|
those set forth in this Agreement) as a result of such Recipient's
|
||||||
|
receipt of the Program under the terms of a Secondary License
|
||||||
|
(if permitted under the terms of Section 3).
|
||||||
|
|
||||||
|
3. REQUIREMENTS
|
||||||
|
|
||||||
|
3.1 If a Contributor Distributes the Program in any form, then:
|
||||||
|
|
||||||
|
a) the Program must also be made available as Source Code, in
|
||||||
|
accordance with section 3.2, and the Contributor must accompany
|
||||||
|
the Program with a statement that the Source Code for the Program
|
||||||
|
is available under this Agreement, and informs Recipients how to
|
||||||
|
obtain it in a reasonable manner on or through a medium customarily
|
||||||
|
used for software exchange; and
|
||||||
|
|
||||||
|
b) the Contributor may Distribute the Program under a license
|
||||||
|
different than this Agreement, provided that such license:
|
||||||
|
i) effectively disclaims on behalf of all other Contributors all
|
||||||
|
warranties and conditions, express and implied, including
|
||||||
|
warranties or conditions of title and non-infringement, and
|
||||||
|
implied warranties or conditions of merchantability and fitness
|
||||||
|
for a particular purpose;
|
||||||
|
|
||||||
|
ii) effectively excludes on behalf of all other Contributors all
|
||||||
|
liability for damages, including direct, indirect, special,
|
||||||
|
incidental and consequential damages, such as lost profits;
|
||||||
|
|
||||||
|
iii) does not attempt to limit or alter the recipients' rights
|
||||||
|
in the Source Code under section 3.2; and
|
||||||
|
|
||||||
|
iv) requires any subsequent distribution of the Program by any
|
||||||
|
party to be under a license that satisfies the requirements
|
||||||
|
of this section 3.
|
||||||
|
|
||||||
|
3.2 When the Program is Distributed as Source Code:
|
||||||
|
|
||||||
|
a) it must be made available under this Agreement, or if the
|
||||||
|
Program (i) is combined with other material in a separate file or
|
||||||
|
files made available under a Secondary License, and (ii) the initial
|
||||||
|
Contributor attached to the Source Code the notice described in
|
||||||
|
Exhibit A of this Agreement, then the Program may be made available
|
||||||
|
under the terms of such Secondary Licenses, and
|
||||||
|
|
||||||
|
b) a copy of this Agreement must be included with each copy of
|
||||||
|
the Program.
|
||||||
|
|
||||||
|
3.3 Contributors may not remove or alter any copyright, patent,
|
||||||
|
trademark, attribution notices, disclaimers of warranty, or limitations
|
||||||
|
of liability ("notices") contained within the Program from any copy of
|
||||||
|
the Program which they Distribute, provided that Contributors may add
|
||||||
|
their own appropriate notices.
|
||||||
|
|
||||||
|
4. COMMERCIAL DISTRIBUTION
|
||||||
|
|
||||||
|
Commercial distributors of software may accept certain responsibilities
|
||||||
|
with respect to end users, business partners and the like. While this
|
||||||
|
license is intended to facilitate the commercial use of the Program,
|
||||||
|
the Contributor who includes the Program in a commercial product
|
||||||
|
offering should do so in a manner which does not create potential
|
||||||
|
liability for other Contributors. Therefore, if a Contributor includes
|
||||||
|
the Program in a commercial product offering, such Contributor
|
||||||
|
("Commercial Contributor") hereby agrees to defend and indemnify every
|
||||||
|
other Contributor ("Indemnified Contributor") against any losses,
|
||||||
|
damages and costs (collectively "Losses") arising from claims, lawsuits
|
||||||
|
and other legal actions brought by a third party against the Indemnified
|
||||||
|
Contributor to the extent caused by the acts or omissions of such
|
||||||
|
Commercial Contributor in connection with its distribution of the Program
|
||||||
|
in a commercial product offering. The obligations in this section do not
|
||||||
|
apply to any claims or Losses relating to any actual or alleged
|
||||||
|
intellectual property infringement. In order to qualify, an Indemnified
|
||||||
|
Contributor must: a) promptly notify the Commercial Contributor in
|
||||||
|
writing of such claim, and b) allow the Commercial Contributor to control,
|
||||||
|
and cooperate with the Commercial Contributor in, the defense and any
|
||||||
|
related settlement negotiations. The Indemnified Contributor may
|
||||||
|
participate in any such claim at its own expense.
|
||||||
|
|
||||||
|
For example, a Contributor might include the Program in a commercial
|
||||||
|
product offering, Product X. That Contributor is then a Commercial
|
||||||
|
Contributor. If that Commercial Contributor then makes performance
|
||||||
|
claims, or offers warranties related to Product X, those performance
|
||||||
|
claims and warranties are such Commercial Contributor's responsibility
|
||||||
|
alone. Under this section, the Commercial Contributor would have to
|
||||||
|
defend claims against the other Contributors related to those performance
|
||||||
|
claims and warranties, and if a court requires any other Contributor to
|
||||||
|
pay any damages as a result, the Commercial Contributor must pay
|
||||||
|
those damages.
|
||||||
|
|
||||||
|
5. NO WARRANTY
|
||||||
|
|
||||||
|
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
|
||||||
|
PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
|
||||||
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
|
||||||
|
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
|
||||||
|
TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. Each Recipient is solely responsible for determining the
|
||||||
|
appropriateness of using and distributing the Program and assumes all
|
||||||
|
risks associated with its exercise of rights under this Agreement,
|
||||||
|
including but not limited to the risks and costs of program errors,
|
||||||
|
compliance with applicable laws, damage to or loss of data, programs
|
||||||
|
or equipment, and unavailability or interruption of operations.
|
||||||
|
|
||||||
|
6. DISCLAIMER OF LIABILITY
|
||||||
|
|
||||||
|
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
|
||||||
|
PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
|
||||||
|
SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
|
||||||
|
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
|
||||||
|
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
7. GENERAL
|
||||||
|
|
||||||
|
If any provision of this Agreement is invalid or unenforceable under
|
||||||
|
applicable law, it shall not affect the validity or enforceability of
|
||||||
|
the remainder of the terms of this Agreement, and without further
|
||||||
|
action by the parties hereto, such provision shall be reformed to the
|
||||||
|
minimum extent necessary to make such provision valid and enforceable.
|
||||||
|
|
||||||
|
If Recipient institutes patent litigation against any entity
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that the
|
||||||
|
Program itself (excluding combinations of the Program with other software
|
||||||
|
or hardware) infringes such Recipient's patent(s), then such Recipient's
|
||||||
|
rights granted under Section 2(b) shall terminate as of the date such
|
||||||
|
litigation is filed.
|
||||||
|
|
||||||
|
All Recipient's rights under this Agreement shall terminate if it
|
||||||
|
fails to comply with any of the material terms or conditions of this
|
||||||
|
Agreement and does not cure such failure in a reasonable period of
|
||||||
|
time after becoming aware of such noncompliance. If all Recipient's
|
||||||
|
rights under this Agreement terminate, Recipient agrees to cease use
|
||||||
|
and distribution of the Program as soon as reasonably practicable.
|
||||||
|
However, Recipient's obligations under this Agreement and any licenses
|
||||||
|
granted by Recipient relating to the Program shall continue and survive.
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute copies of this Agreement,
|
||||||
|
but in order to avoid inconsistency the Agreement is copyrighted and
|
||||||
|
may only be modified in the following manner. The Agreement Steward
|
||||||
|
reserves the right to publish new versions (including revisions) of
|
||||||
|
this Agreement from time to time. No one other than the Agreement
|
||||||
|
Steward has the right to modify this Agreement. The Eclipse Foundation
|
||||||
|
is the initial Agreement Steward. The Eclipse Foundation may assign the
|
||||||
|
responsibility to serve as the Agreement Steward to a suitable separate
|
||||||
|
entity. Each new version of the Agreement will be given a distinguishing
|
||||||
|
version number. The Program (including Contributions) may always be
|
||||||
|
Distributed subject to the version of the Agreement under which it was
|
||||||
|
received. In addition, after a new version of the Agreement is published,
|
||||||
|
Contributor may elect to Distribute the Program (including its
|
||||||
|
Contributions) under the new version.
|
||||||
|
|
||||||
|
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
|
||||||
|
receives no rights or licenses to the intellectual property of any
|
||||||
|
Contributor under this Agreement, whether expressly, by implication,
|
||||||
|
estoppel or otherwise. All rights in the Program not expressly granted
|
||||||
|
under this Agreement are reserved. Nothing in this Agreement is intended
|
||||||
|
to be enforceable by any entity that is not a Contributor or Recipient.
|
||||||
|
No third-party beneficiary rights are created under this Agreement.
|
||||||
|
|
||||||
|
Exhibit A - Form of Secondary Licenses Notice
|
||||||
|
|
||||||
|
"This Source Code may also be made available under the following
|
||||||
|
Secondary Licenses when the conditions for such availability set forth
|
||||||
|
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
|
||||||
|
version(s), and exceptions or additional permissions here}."
|
||||||
|
|
||||||
|
Simply including a copy of this Agreement, including this Exhibit A
|
||||||
|
is not sufficient to license the Source Code under Secondary Licenses.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to
|
||||||
|
look for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
7
3rd/paho.mqtt.c/fmt.sh
Normal file
7
3rd/paho.mqtt.c/fmt.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Runs clang format over the whole project tree, excluding the 'build/' directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
find . -type d \( -path './build' \) -prune -iname '*.h' -o -iname '*.c' | xargs clang-format -i
|
||||||
|
|
||||||
108
3rd/paho.mqtt.c/notice.html
Normal file
108
3rd/paho.mqtt.c/notice.html
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||||
|
<title>Eclipse Foundation Software User Agreement</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang="EN-US">
|
||||||
|
<h2>Eclipse Foundation Software User Agreement</h2>
|
||||||
|
<p>April 6, 2020</p>
|
||||||
|
|
||||||
|
<h3>Usage Of Content</h3>
|
||||||
|
|
||||||
|
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
|
||||||
|
(COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
|
||||||
|
CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
|
||||||
|
OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
|
||||||
|
NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
|
||||||
|
CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
|
||||||
|
|
||||||
|
<h3>Applicable Licenses</h3>
|
||||||
|
|
||||||
|
<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 2.0
|
||||||
|
("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="https://www.eclipse.org/legal/epl-2.0/">https://www.eclipse.org/legal/epl-2.0/</a>.
|
||||||
|
For purposes of the EPL, "Program" will mean the Content.</p>
|
||||||
|
|
||||||
|
<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
|
||||||
|
repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
|
||||||
|
<li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
|
||||||
|
<li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
|
||||||
|
and/or Fragments associated with that Feature.</li>
|
||||||
|
<li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
|
||||||
|
Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
|
||||||
|
including, but not limited to the following locations:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>The top-level (root) directory</li>
|
||||||
|
<li>Plug-in and Fragment directories</li>
|
||||||
|
<li>Inside Plug-ins and Fragments packaged as JARs</li>
|
||||||
|
<li>Sub-directories of the directory named "src" of certain Plug-ins</li>
|
||||||
|
<li>Feature directories</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
|
||||||
|
installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
|
||||||
|
inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
|
||||||
|
Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
|
||||||
|
that directory.</p>
|
||||||
|
|
||||||
|
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
|
||||||
|
OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
|
||||||
|
<li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
|
||||||
|
<li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
|
||||||
|
<li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
|
||||||
|
<li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
|
||||||
|
<li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
|
||||||
|
contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Use of Provisioning Technology</h3>
|
||||||
|
|
||||||
|
<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
|
||||||
|
Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
|
||||||
|
other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
|
||||||
|
install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
|
||||||
|
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
|
||||||
|
("Specification").</p>
|
||||||
|
|
||||||
|
<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
|
||||||
|
applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
|
||||||
|
in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
|
||||||
|
Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
|
||||||
|
on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
|
||||||
|
product.</li>
|
||||||
|
<li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
|
||||||
|
accessed and copied to the Target Machine.</li>
|
||||||
|
<li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
|
||||||
|
Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
|
||||||
|
Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
|
||||||
|
the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
|
||||||
|
indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<h3>Cryptography</h3>
|
||||||
|
|
||||||
|
<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
|
||||||
|
another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
|
||||||
|
possession, or use, and re-export of encryption software, to see if this is permitted.</p>
|
||||||
|
|
||||||
|
<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
357
3rd/paho.mqtt.c/src/Base64.c
Normal file
357
3rd/paho.mqtt.c/src/Base64.c
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2018, 2026 Wind River Systems, Inc., and others
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Keith Holman - initial implementation and documentation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "Base64.h"
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#pragma comment(lib, "crypt32.lib")
|
||||||
|
#include <windows.h>
|
||||||
|
#include <wincrypt.h>
|
||||||
|
b64_size_t Base64_decode( b64_data_t *out, b64_size_t out_len, const char *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
b64_size_t ret = 0u;
|
||||||
|
DWORD dw_out_len = (DWORD)out_len;
|
||||||
|
if ( CryptStringToBinaryA( in, in_len, CRYPT_STRING_BASE64, out, &dw_out_len, NULL, NULL ) )
|
||||||
|
ret = (b64_size_t)dw_out_len;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
b64_size_t Base64_encode( char *out, b64_size_t out_len, const b64_data_t *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
b64_size_t ret = 0u;
|
||||||
|
DWORD dw_out_len = (DWORD)out_len;
|
||||||
|
if ( CryptBinaryToStringA( in, in_len, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, out, &dw_out_len ) )
|
||||||
|
ret = (b64_size_t)dw_out_len;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else /* if defined(_WIN32) */
|
||||||
|
|
||||||
|
#if defined(OPENSSL)
|
||||||
|
#include <openssl/bio.h>
|
||||||
|
#include <openssl/evp.h>
|
||||||
|
static b64_size_t Base64_encodeDecode(
|
||||||
|
char *out, b64_size_t out_len, const char *in, b64_size_t in_len, int encode )
|
||||||
|
{
|
||||||
|
b64_size_t ret = 0u;
|
||||||
|
if ( in_len > 0u )
|
||||||
|
{
|
||||||
|
if ( encode )
|
||||||
|
{
|
||||||
|
/* For encoding: output length is 4 * (input_length / 3) rounded up to nearest multiple of 4 */
|
||||||
|
b64_size_t required_len = ((in_len + 2) / 3) * 4;
|
||||||
|
if (out_len >= required_len + 1) /* +1 for null terminator */
|
||||||
|
{
|
||||||
|
int encoded_len = EVP_EncodeBlock((unsigned char*)out, (const unsigned char*)in, (int)in_len);
|
||||||
|
if (encoded_len > 0)
|
||||||
|
{
|
||||||
|
ret = (b64_size_t)encoded_len;
|
||||||
|
if (out_len > ret)
|
||||||
|
out[ret] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For decoding: output length is at most 3 * (input_length / 4) */
|
||||||
|
b64_size_t max_out_len = (in_len / 4) * 3;
|
||||||
|
if (out_len >= max_out_len + 1) /* +1 for null terminator */
|
||||||
|
{
|
||||||
|
EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new();
|
||||||
|
if (ctx)
|
||||||
|
{
|
||||||
|
int decoded_len = 0;
|
||||||
|
int final_len = 0;
|
||||||
|
unsigned char *temp_out = (unsigned char*)out;
|
||||||
|
|
||||||
|
EVP_DecodeInit(ctx);
|
||||||
|
EVP_DecodeUpdate(ctx, temp_out, &decoded_len, (const unsigned char*)in, (int)in_len);
|
||||||
|
EVP_DecodeFinal(ctx, temp_out + decoded_len, &final_len);
|
||||||
|
EVP_ENCODE_CTX_free(ctx);
|
||||||
|
|
||||||
|
ret = (b64_size_t)(decoded_len + final_len);
|
||||||
|
if (out_len > ret)
|
||||||
|
out[ret] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
b64_size_t Base64_decode( b64_data_t *out, b64_size_t out_len, const char *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
return Base64_encodeDecode( (char*)out, out_len, in, in_len, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
b64_size_t Base64_encode( char *out, b64_size_t out_len, const b64_data_t *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
return Base64_encodeDecode( out, out_len, (const char*)in, in_len, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* if defined(OPENSSL) */
|
||||||
|
b64_size_t Base64_decode( b64_data_t *out, b64_size_t out_len, const char *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
#define NV 64
|
||||||
|
static const unsigned char BASE64_DECODE_TABLE[] =
|
||||||
|
{
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 0-15 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 16-31 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, 62, NV, NV, NV, 63, /* 32-47 */
|
||||||
|
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, NV, NV, NV, NV, NV, NV, /* 48-63 */
|
||||||
|
NV, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, /* 64-79 */
|
||||||
|
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, NV, NV, NV, NV, NV, /* 80-95 */
|
||||||
|
NV, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 96-111 */
|
||||||
|
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, NV, NV, NV, NV, NV, /* 112-127 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 128-143 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 144-159 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 160-175 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 176-191 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 192-207 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 208-223 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, /* 224-239 */
|
||||||
|
NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV, NV /* 240-255 */
|
||||||
|
};
|
||||||
|
|
||||||
|
b64_size_t ret = 0u;
|
||||||
|
b64_size_t out_count = 0u;
|
||||||
|
|
||||||
|
/* in valid base64, length must be multiple of 4's: 0, 4, 8, 12, etc */
|
||||||
|
while ( in_len > 3u && out_count < out_len )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned char c[4];
|
||||||
|
for ( i = 0; i < 4; ++i, ++in )
|
||||||
|
c[i] = BASE64_DECODE_TABLE[(int)(*in)];
|
||||||
|
in_len -= 4u;
|
||||||
|
|
||||||
|
/* first byte */
|
||||||
|
*out = c[0] << 2;
|
||||||
|
*out |= (c[1] & ~0xF) >> 4;
|
||||||
|
++out;
|
||||||
|
++out_count;
|
||||||
|
|
||||||
|
if ( out_count < out_len )
|
||||||
|
{
|
||||||
|
/* second byte */
|
||||||
|
*out = (c[1] & 0xF) << 4;
|
||||||
|
if ( c[2] < NV )
|
||||||
|
{
|
||||||
|
*out |= (c[2] & ~0x3) >> 2;
|
||||||
|
++out;
|
||||||
|
++out_count;
|
||||||
|
|
||||||
|
if ( out_count < out_len )
|
||||||
|
{
|
||||||
|
/* third byte */
|
||||||
|
*out = (c[2] & 0x3) << 6;
|
||||||
|
if ( c[3] < NV )
|
||||||
|
{
|
||||||
|
*out |= c[3];
|
||||||
|
++out;
|
||||||
|
++out_count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
in_len = 0u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
in_len = 0u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( out_count <= out_len )
|
||||||
|
{
|
||||||
|
ret = out_count;
|
||||||
|
if ( out_count < out_len )
|
||||||
|
*out = '\0';
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
b64_size_t Base64_encode( char *out, b64_size_t out_len, const b64_data_t *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
static const char BASE64_ENCODE_TABLE[] =
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"0123456789+/=";
|
||||||
|
b64_size_t ret = 0u;
|
||||||
|
b64_size_t out_count = 0u;
|
||||||
|
|
||||||
|
while ( in_len > 0u && out_count < out_len )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned char c[] = { 0, 0, 64, 64 }; /* index of '=' char */
|
||||||
|
|
||||||
|
/* first character */
|
||||||
|
i = *in;
|
||||||
|
c[0] = (i & ~0x3) >> 2;
|
||||||
|
|
||||||
|
/* second character */
|
||||||
|
c[1] = (i & 0x3) << 4;
|
||||||
|
--in_len;
|
||||||
|
if ( in_len > 0u )
|
||||||
|
{
|
||||||
|
++in;
|
||||||
|
i = *in;
|
||||||
|
c[1] |= (i & ~0xF) >> 4;
|
||||||
|
|
||||||
|
/* third character */
|
||||||
|
c[2] = (i & 0xF) << 2;
|
||||||
|
--in_len;
|
||||||
|
if ( in_len > 0u )
|
||||||
|
{
|
||||||
|
++in;
|
||||||
|
i = *in;
|
||||||
|
c[2] |= (i & ~0x3F) >> 6;
|
||||||
|
|
||||||
|
/* fourth character */
|
||||||
|
c[3] = (i & 0x3F);
|
||||||
|
--in_len;
|
||||||
|
++in;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encode the characters */
|
||||||
|
out_count += 4u;
|
||||||
|
for ( i = 0; i < 4 && out_count <= out_len; ++i, ++out )
|
||||||
|
*out = BASE64_ENCODE_TABLE[c[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( out_count <= out_len )
|
||||||
|
{
|
||||||
|
if ( out_count < out_len )
|
||||||
|
*out = '\0';
|
||||||
|
ret = out_count;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif /* else if defined(OPENSSL) */
|
||||||
|
#endif /* if else defined(_WIN32) */
|
||||||
|
|
||||||
|
b64_size_t Base64_decodeLength( const char *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
b64_size_t pad = 0u;
|
||||||
|
|
||||||
|
if ( in && in_len > 1u )
|
||||||
|
pad += ( in[in_len - 2u] == '=' ? 1u : 0u );
|
||||||
|
if ( in && in_len > 0u )
|
||||||
|
pad += ( in[in_len - 1u] == '=' ? 1u : 0u );
|
||||||
|
return (in_len / 4u * 3u) - pad;
|
||||||
|
}
|
||||||
|
|
||||||
|
b64_size_t Base64_encodeLength( const b64_data_t *in, b64_size_t in_len )
|
||||||
|
{
|
||||||
|
return ((4u * in_len / 3u) + 3u) & ~0x3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(BASE64_TEST)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define TEST_EXPECT(i,x) if (!(x)) {fprintf( stderr, "failed test: %s (for i == %d)\n", #x, i ); ++fails;}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct _td
|
||||||
|
{
|
||||||
|
const char *in;
|
||||||
|
const char *out;
|
||||||
|
};
|
||||||
|
|
||||||
|
int i;
|
||||||
|
unsigned int fails = 0u;
|
||||||
|
struct _td test_data[] = {
|
||||||
|
{ "", "" },
|
||||||
|
{ "p", "cA==" },
|
||||||
|
{ "pa", "cGE=" },
|
||||||
|
{ "pah", "cGFo" },
|
||||||
|
{ "paho", "cGFobw==" },
|
||||||
|
{ "paho ", "cGFobyA=" },
|
||||||
|
{ "paho w", "cGFobyB3" },
|
||||||
|
{ "paho wi", "cGFobyB3aQ==" },
|
||||||
|
{ "paho wit", "cGFobyB3aXQ=" },
|
||||||
|
{ "paho with", "cGFobyB3aXRo" },
|
||||||
|
{ "paho with ", "cGFobyB3aXRoIA==" },
|
||||||
|
{ "paho with w", "cGFobyB3aXRoIHc=" },
|
||||||
|
{ "paho with we", "cGFobyB3aXRoIHdl" },
|
||||||
|
{ "paho with web", "cGFobyB3aXRoIHdlYg==" },
|
||||||
|
{ "paho with webs", "cGFobyB3aXRoIHdlYnM=" },
|
||||||
|
{ "paho with webso", "cGFobyB3aXRoIHdlYnNv" },
|
||||||
|
{ "paho with websoc", "cGFobyB3aXRoIHdlYnNvYw==" },
|
||||||
|
{ "paho with websock", "cGFobyB3aXRoIHdlYnNvY2s=" },
|
||||||
|
{ "paho with websocke", "cGFobyB3aXRoIHdlYnNvY2tl" },
|
||||||
|
{ "paho with websocket", "cGFobyB3aXRoIHdlYnNvY2tldA==" },
|
||||||
|
{ "paho with websockets", "cGFobyB3aXRoIHdlYnNvY2tldHM=" },
|
||||||
|
{ "paho with websockets.", "cGFobyB3aXRoIHdlYnNvY2tldHMu" },
|
||||||
|
{ "The quick brown fox jumps over the lazy dog",
|
||||||
|
"VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==" },
|
||||||
|
{ "Man is distinguished, not only by his reason, but by this singular passion from\n"
|
||||||
|
"other animals, which is a lust of the mind, that by a perseverance of delight\n"
|
||||||
|
"in the continued and indefatigable generation of knowledge, exceeds the short\n"
|
||||||
|
"vehemence of any carnal pleasure.",
|
||||||
|
"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
|
||||||
|
"IHNpbmd1bGFyIHBhc3Npb24gZnJvbQpvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg"
|
||||||
|
"dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodAppbiB0aGUgY29udGlu"
|
||||||
|
"dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo"
|
||||||
|
"ZSBzaG9ydAp2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=" },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* decode tests */
|
||||||
|
i = 0;
|
||||||
|
while ( test_data[i].in != NULL )
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
char out[512u];
|
||||||
|
r = Base64_decode( out, sizeof(out), test_data[i].out, strlen(test_data[i].out) );
|
||||||
|
TEST_EXPECT( i, r == strlen(test_data[i].in) && strncmp(out, test_data[i].in, strlen(test_data[i].in)) == 0 );
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decode length tests */
|
||||||
|
i = 0;
|
||||||
|
while ( test_data[i].in != NULL )
|
||||||
|
{
|
||||||
|
TEST_EXPECT( i, Base64_decodeLength(test_data[i].out, strlen(test_data[i].out)) == strlen(test_data[i].in));
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encode tests */
|
||||||
|
i = 0;
|
||||||
|
while ( test_data[i].in != NULL )
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
char out[512u];
|
||||||
|
r = Base64_encode( out, sizeof(out), test_data[i].in, strlen(test_data[i].in) );
|
||||||
|
TEST_EXPECT( i, r == strlen(test_data[i].out) && strncmp(out, test_data[i].out, strlen(test_data[i].out)) == 0 );
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encode length tests */
|
||||||
|
i = 0;
|
||||||
|
while ( test_data[i].in != NULL )
|
||||||
|
{
|
||||||
|
TEST_EXPECT( i, Base64_encodeLength(test_data[i].in, strlen(test_data[i].in)) == strlen(test_data[i].out) );
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( fails )
|
||||||
|
printf( "%u test failed!\n", fails );
|
||||||
|
else
|
||||||
|
printf( "all tests passed\n" );
|
||||||
|
return fails;
|
||||||
|
}
|
||||||
|
#endif /* if defined(BASE64_TEST) */
|
||||||
83
3rd/paho.mqtt.c/src/Base64.h
Normal file
83
3rd/paho.mqtt.c/src/Base64.h
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2018 Wind River Systems, Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Keith Holman - initial implementation and documentation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(BASE64_H)
|
||||||
|
#define BASE64_H
|
||||||
|
|
||||||
|
/** type for size of a buffer, it saves passing around @p size_t (unsigned long long or unsigned long int) */
|
||||||
|
typedef unsigned int b64_size_t;
|
||||||
|
/** type for raw base64 data */
|
||||||
|
typedef unsigned char b64_data_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decodes base64 data
|
||||||
|
*
|
||||||
|
* @param[out] out decoded data
|
||||||
|
* @param[in] out_len length of output buffer
|
||||||
|
* @param[in] in base64 string to decode
|
||||||
|
* @param[in] in_len length of input buffer
|
||||||
|
*
|
||||||
|
* @return the amount of data decoded
|
||||||
|
*
|
||||||
|
* @see Base64_decodeLength
|
||||||
|
* @see Base64_encode
|
||||||
|
*/
|
||||||
|
b64_size_t Base64_decode( b64_data_t *out, b64_size_t out_len,
|
||||||
|
const char *in, b64_size_t in_len );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of buffer required to decode base64 data
|
||||||
|
*
|
||||||
|
* @param[in] in base64 string to decode
|
||||||
|
* @param[in] in_len length of input buffer
|
||||||
|
*
|
||||||
|
* @return the size of buffer the decoded string would require
|
||||||
|
*
|
||||||
|
* @see Base64_decode
|
||||||
|
* @see Base64_encodeLength
|
||||||
|
*/
|
||||||
|
b64_size_t Base64_decodeLength( const char *in, b64_size_t in_len );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes base64 data
|
||||||
|
*
|
||||||
|
* @param[out] out encode base64 string
|
||||||
|
* @param[in] out_len length of output buffer
|
||||||
|
* @param[in] in raw data to encode
|
||||||
|
* @param[in] in_len length of input buffer
|
||||||
|
*
|
||||||
|
* @return the amount of data encoded
|
||||||
|
*
|
||||||
|
* @see Base64_decode
|
||||||
|
* @see Base64_encodeLength
|
||||||
|
*/
|
||||||
|
b64_size_t Base64_encode( char *out, b64_size_t out_len,
|
||||||
|
const b64_data_t *in, b64_size_t in_len );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Size of buffer required to encode base64 data
|
||||||
|
*
|
||||||
|
* @param[in] in raw data to encode
|
||||||
|
* @param[in] in_len length of input buffer
|
||||||
|
*
|
||||||
|
* @return the size of buffer the encoded string would require
|
||||||
|
*
|
||||||
|
* @see Base64_decodeLength
|
||||||
|
* @see Base64_encode
|
||||||
|
*/
|
||||||
|
b64_size_t Base64_encodeLength( const b64_data_t *in, b64_size_t in_len );
|
||||||
|
|
||||||
|
#endif /* BASE64_H */
|
||||||
433
3rd/paho.mqtt.c/src/CMakeLists.txt
Normal file
433
3rd/paho.mqtt.c/src/CMakeLists.txt
Normal file
@@ -0,0 +1,433 @@
|
|||||||
|
#*******************************************************************************
|
||||||
|
# Copyright (c) 2015, 2026 logi.cals GmbH, Frank Pagliughi <fpagliughi@mindspring.com> and others
|
||||||
|
#
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
# and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
#
|
||||||
|
# The Eclipse Public License is available at
|
||||||
|
# https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
# and the Eclipse Distribution License is available at
|
||||||
|
# http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Rainer Poisel - initial version
|
||||||
|
# Ian Craggs (IBM Corp.) - merge master
|
||||||
|
# Ian Craggs - update for MQTTV5 support
|
||||||
|
#*******************************************************************************/
|
||||||
|
|
||||||
|
## compilation/linkage settings
|
||||||
|
|
||||||
|
configure_file(VersionInfo.h.in
|
||||||
|
${CMAKE_BINARY_DIR}/VersionInfo.h
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
set(common_src
|
||||||
|
MQTTTime.c
|
||||||
|
MQTTProtocolClient.c
|
||||||
|
Clients.c
|
||||||
|
utf-8.c
|
||||||
|
MQTTPacket.c
|
||||||
|
MQTTPacketOut.c
|
||||||
|
Messages.c
|
||||||
|
Tree.c
|
||||||
|
Socket.c
|
||||||
|
Log.c
|
||||||
|
MQTTPersistence.c
|
||||||
|
Thread.c
|
||||||
|
MQTTProtocolOut.c
|
||||||
|
MQTTPersistenceDefault.c
|
||||||
|
SocketBuffer.c
|
||||||
|
LinkedList.c
|
||||||
|
MQTTProperties.c
|
||||||
|
MQTTReasonCodes.c
|
||||||
|
Base64.c
|
||||||
|
SHA1.c
|
||||||
|
WebSocket.c
|
||||||
|
Proxy.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT PAHO_HIGH_PERFORMANCE)
|
||||||
|
set(common_src ${common_src}
|
||||||
|
StackTrace.c
|
||||||
|
Heap.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(PAHO_WITH_LIBRESSL)
|
||||||
|
set(LIBS_SYSTEM ws2_32 crypt32 rpcrt4 bcrypt)
|
||||||
|
else()
|
||||||
|
set(LIBS_SYSTEM ws2_32 crypt32 rpcrt4)
|
||||||
|
endif()
|
||||||
|
elseif(UNIX)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
set(LIBS_SYSTEM c dl pthread rt)
|
||||||
|
# anl is only available with glibc so check if it is found before using
|
||||||
|
# it or build will fail on uclibc or musl
|
||||||
|
find_library(LIB_ANL anl)
|
||||||
|
if(LIB_ANL)
|
||||||
|
set(LIBS_SYSTEM "${LIBS_SYSTEM}" anl)
|
||||||
|
endif()
|
||||||
|
if(PAHO_WITH_LIBUUID)
|
||||||
|
set(LIBS_SYSTEM "${LIBS_SYSTEM}" uuid)
|
||||||
|
endif()
|
||||||
|
add_definitions(-D_GNU_SOURCE -fvisibility=hidden)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
|
set(LIBS_SYSTEM c dl)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
|
set(LIBS_SYSTEM compat pthread)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "QNX")
|
||||||
|
set(LIBS_SYSTEM c socket)
|
||||||
|
else()
|
||||||
|
set(LIBS_SYSTEM c pthread)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_SHARED)
|
||||||
|
# common compilation for libpaho-mqtt3c and libpaho-mqtt3a
|
||||||
|
add_library(common_obj OBJECT ${common_src})
|
||||||
|
set_target_properties(common_obj PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
target_compile_definitions(common_obj PRIVATE PAHO_MQTT_EXPORTS=1)
|
||||||
|
|
||||||
|
add_executable(MQTTVersion MQTTVersion.c)
|
||||||
|
target_compile_definitions(MQTTVersion PUBLIC PAHO_MQTT_IMPORTS=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_STATIC)
|
||||||
|
add_library(common_obj_static OBJECT ${common_src})
|
||||||
|
set_target_properties(common_obj_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
target_compile_definitions(common_obj_static PRIVATE PAHO_MQTT_STATIC=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_SHARED)
|
||||||
|
add_library(paho-mqtt3c SHARED
|
||||||
|
$<TARGET_OBJECTS:common_obj>
|
||||||
|
MQTTClient.c
|
||||||
|
)
|
||||||
|
add_library(paho-mqtt3a SHARED
|
||||||
|
$<TARGET_OBJECTS:common_obj>
|
||||||
|
MQTTAsync.c
|
||||||
|
MQTTAsyncUtils.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3c ALIAS paho-mqtt3c)
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3a ALIAS paho-mqtt3a)
|
||||||
|
|
||||||
|
target_link_libraries(paho-mqtt3c ${LIBS_SYSTEM})
|
||||||
|
target_link_libraries(paho-mqtt3a ${LIBS_SYSTEM})
|
||||||
|
target_link_libraries(MQTTVersion paho-mqtt3a paho-mqtt3c ${LIBS_SYSTEM})
|
||||||
|
|
||||||
|
set_target_properties(paho-mqtt3c paho-mqtt3a PROPERTIES
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
|
COMPILE_DEFINITIONS "PAHO_MQTT_EXPORTS=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
set(MQTTCLIENT_ENTRY_POINT _MQTTClient_init)
|
||||||
|
set(MQTTASYNC_ENTRY_POINT _MQTTAsync_init)
|
||||||
|
elseif(NOT WIN32)
|
||||||
|
set(MQTTCLIENT_ENTRY_POINT MQTTClient_init)
|
||||||
|
set(MQTTASYNC_ENTRY_POINT MQTTAsync_init)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
set_target_properties(paho-mqtt3c PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-init,${MQTTCLIENT_ENTRY_POINT}"
|
||||||
|
)
|
||||||
|
set_target_properties(paho-mqtt3a PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-init,${MQTTASYNC_ENTRY_POINT}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(TARGET paho-mqtt3c paho-mqtt3a)
|
||||||
|
target_include_directories(${TARGET}
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_BINARY_DIR})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
install(TARGETS paho-mqtt3c paho-mqtt3a
|
||||||
|
EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS MQTTVersion
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_STATIC)
|
||||||
|
add_library(paho-mqtt3c-static STATIC
|
||||||
|
$<TARGET_OBJECTS:common_obj_static>
|
||||||
|
MQTTClient.c
|
||||||
|
)
|
||||||
|
add_library(paho-mqtt3a-static STATIC
|
||||||
|
$<TARGET_OBJECTS:common_obj_static>
|
||||||
|
MQTTAsync.c
|
||||||
|
MQTTAsyncUtils.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3c-static ALIAS paho-mqtt3c-static)
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3a-static ALIAS paho-mqtt3a-static)
|
||||||
|
|
||||||
|
target_link_libraries(paho-mqtt3c-static ${LIBS_SYSTEM})
|
||||||
|
target_link_libraries(paho-mqtt3a-static ${LIBS_SYSTEM})
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
set_target_properties(paho-mqtt3c-static PROPERTIES OUTPUT_NAME paho-mqtt3c)
|
||||||
|
set_target_properties(paho-mqtt3a-static PROPERTIES OUTPUT_NAME paho-mqtt3a)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(paho-mqtt3c-static paho-mqtt3a-static PROPERTIES
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
|
COMPILE_DEFINITIONS "PAHO_MQTT_STATIC=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(TARGET paho-mqtt3c-static paho-mqtt3a-static)
|
||||||
|
target_include_directories(${TARGET}
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_BINARY_DIR})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(NOT PAHO_BUILD_SHARED)
|
||||||
|
install(TARGETS paho-mqtt3c-static paho-mqtt3a-static
|
||||||
|
EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
install(TARGETS paho-mqtt3c-static paho-mqtt3a-static
|
||||||
|
EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
MQTTAsync.h
|
||||||
|
MQTTClient.h
|
||||||
|
MQTTClientPersistence.h
|
||||||
|
MQTTProperties.h
|
||||||
|
MQTTReasonCodes.h
|
||||||
|
MQTTSubscribeOpts.h
|
||||||
|
MQTTExportDeclarations.h
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(PAHO_WITH_SSL OR PAHO_WITH_LIBRESSL)
|
||||||
|
if(PAHO_WITH_LIBRESSL)
|
||||||
|
find_package(LibreSSL REQUIRED)
|
||||||
|
set(SSL_LIBRARY_NAME LibreSSL)
|
||||||
|
set(SSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR})
|
||||||
|
set(SSL_ROOT_DIR ${LIBRESSL_ROOT_DIR})
|
||||||
|
else()
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
set(SSL_LIBRARY_NAME OpenSSL)
|
||||||
|
set(SSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(SSL_ROOT_DIR ${OPENSSL_ROOT_DIR})
|
||||||
|
endif()
|
||||||
|
message(STATUS "Using ${SSL_LIBRARY_NAME} with headers at ${SSL_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
if(PAHO_BUILD_SHARED)
|
||||||
|
## common compilation for libpaho-mqtt3cs and libpaho-mqtt3as
|
||||||
|
## Note: SSL libraries must be recompiled due to ifdefs
|
||||||
|
add_library(common_ssl_obj OBJECT ${common_src})
|
||||||
|
target_include_directories(common_ssl_obj PUBLIC ${SSL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set_property(TARGET common_ssl_obj PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
target_compile_definitions(common_ssl_obj PRIVATE OPENSSL=1 PAHO_MQTT_EXPORTS=1)
|
||||||
|
|
||||||
|
add_library(paho-mqtt3cs SHARED
|
||||||
|
$<TARGET_OBJECTS:common_ssl_obj>
|
||||||
|
MQTTClient.c
|
||||||
|
SSLSocket.c
|
||||||
|
)
|
||||||
|
add_library(paho-mqtt3as SHARED
|
||||||
|
$<TARGET_OBJECTS:common_ssl_obj>
|
||||||
|
MQTTAsync.c
|
||||||
|
MQTTAsyncUtils.c
|
||||||
|
SSLSocket.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3cs ALIAS paho-mqtt3cs)
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3as ALIAS paho-mqtt3as)
|
||||||
|
|
||||||
|
set_target_properties(paho-mqtt3cs paho-mqtt3as PROPERTIES
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
|
COMPILE_DEFINITIONS "OPENSSL=1;PAHO_MQTT_EXPORTS=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
set(MQTTCLIENT_ENTRY_POINT _MQTTClient_init)
|
||||||
|
set(MQTTASYNC_ENTRY_POINT _MQTTAsync_init)
|
||||||
|
elseif(NOT WIN32)
|
||||||
|
set(MQTTCLIENT_ENTRY_POINT MQTTClient_init)
|
||||||
|
set(MQTTASYNC_ENTRY_POINT MQTTAsync_init)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
set_target_properties(paho-mqtt3cs PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-init,${MQTTCLIENT_ENTRY_POINT}"
|
||||||
|
)
|
||||||
|
set_target_properties(paho-mqtt3as PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-init,${MQTTASYNC_ENTRY_POINT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(TARGET paho-mqtt3cs paho-mqtt3as)
|
||||||
|
target_include_directories(${TARGET}
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
|
target_link_libraries(${TARGET}
|
||||||
|
PUBLIC
|
||||||
|
${SSL_LIBRARY_NAME}::SSL ${SSL_LIBRARY_NAME}::Crypto ${LIBS_SYSTEM}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
install(TARGETS paho-mqtt3cs paho-mqtt3as
|
||||||
|
EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAHO_BUILD_STATIC)
|
||||||
|
## common compilation for libpaho-mqtt3cs and libpaho-mqtt3as
|
||||||
|
## Note: SSL libraries must be recompiled due ifdefs
|
||||||
|
add_library(common_ssl_obj_static OBJECT ${common_src})
|
||||||
|
target_include_directories(common_ssl_obj_static PUBLIC ${SSL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set_property(TARGET common_ssl_obj_static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
target_compile_definitions(common_ssl_obj_static PRIVATE OPENSSL=1 PAHO_MQTT_STATIC=1)
|
||||||
|
|
||||||
|
add_library(paho-mqtt3cs-static STATIC
|
||||||
|
$<TARGET_OBJECTS:common_ssl_obj_static>
|
||||||
|
MQTTClient.c
|
||||||
|
SSLSocket.c
|
||||||
|
)
|
||||||
|
add_library(paho-mqtt3as-static STATIC
|
||||||
|
$<TARGET_OBJECTS:common_ssl_obj_static>
|
||||||
|
MQTTAsync.c
|
||||||
|
MQTTAsyncUtils.c
|
||||||
|
SSLSocket.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3cs-static ALIAS paho-mqtt3cs-static)
|
||||||
|
add_library(eclipse-paho-mqtt-c::paho-mqtt3as-static ALIAS paho-mqtt3as-static)
|
||||||
|
|
||||||
|
set_target_properties(paho-mqtt3cs-static paho-mqtt3as-static PROPERTIES
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
|
COMPILE_DEFINITIONS "OPENSSL=1;PAHO_MQTT_STATIC=1"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
set_target_properties(paho-mqtt3cs-static PROPERTIES OUTPUT_NAME paho-mqtt3cs)
|
||||||
|
set_target_properties(paho-mqtt3as-static PROPERTIES OUTPUT_NAME paho-mqtt3as)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
set(MQTTCLIENT_ENTRY_POINT _MQTTClient_init)
|
||||||
|
set(MQTTASYNC_ENTRY_POINT _MQTTAsync_init)
|
||||||
|
elseif(NOT WIN32)
|
||||||
|
set(MQTTCLIENT_ENTRY_POINT MQTTClient_init)
|
||||||
|
set(MQTTASYNC_ENTRY_POINT MQTTAsync_init)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
set_target_properties(paho-mqtt3cs-static PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-init,${MQTTCLIENT_ENTRY_POINT}"
|
||||||
|
)
|
||||||
|
set_target_properties(paho-mqtt3as-static PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-init,${MQTTASYNC_ENTRY_POINT}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT PAHO_BUILD_SHARED)
|
||||||
|
install(TARGETS paho-mqtt3cs-static paho-mqtt3as-static
|
||||||
|
EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
install(TARGETS paho-mqtt3cs-static paho-mqtt3as-static
|
||||||
|
EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(TARGET paho-mqtt3cs-static paho-mqtt3as-static)
|
||||||
|
target_include_directories(${TARGET}
|
||||||
|
PUBLIC
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
|
target_link_libraries(${TARGET}
|
||||||
|
PUBLIC
|
||||||
|
${SSL_LIBRARY_NAME}::SSL ${SSL_LIBRARY_NAME}::Crypto ${LIBS_SYSTEM}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(EXPORT eclipse-paho-mqtt-cTargets
|
||||||
|
FILE eclipse-paho-mqtt-cConfig.cmake
|
||||||
|
NAMESPACE eclipse-paho-mqtt-c::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/eclipse-paho-mqtt-c
|
||||||
|
)
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
write_basic_package_version_file("eclipse-paho-mqtt-cConfigVersion.cmake"
|
||||||
|
VERSION ${CLIENT_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/eclipse-paho-mqtt-cConfigVersion.cmake"
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_LIBDIR}/cmake/eclipse-paho-mqtt-c
|
||||||
|
)
|
||||||
|
|
||||||
|
# Base64 test
|
||||||
|
add_executable(Base64Test EXCLUDE_FROM_ALL Base64.c Base64.h)
|
||||||
|
target_compile_definitions(Base64Test PUBLIC BASE64_TEST)
|
||||||
|
|
||||||
|
if(PAHO_WITH_SSL OR PAHO_WITH_LIBRESSL)
|
||||||
|
add_executable(Base64TestOpenSSL EXCLUDE_FROM_ALL Base64.c Base64.h )
|
||||||
|
target_link_libraries(Base64TestOpenSSL ${SSL_LIBRARY_NAME}::SSL ${SSL_LIBRARY_NAME}::Crypto)
|
||||||
|
target_compile_definitions(Base64TestOpenSSL PUBLIC BASE64_TEST OPENSSL=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# SHA1 test
|
||||||
|
add_executable(Sha1Test EXCLUDE_FROM_ALL SHA1.c SHA1.h)
|
||||||
|
target_compile_definitions(Sha1Test PUBLIC SHA1_TEST)
|
||||||
|
|
||||||
|
if(PAHO_WITH_SSL OR PAHO_WITH_LIBRESSL)
|
||||||
|
add_executable(Sha1TestOpenSSL EXCLUDE_FROM_ALL SHA1.c SHA1.h)
|
||||||
|
target_link_libraries(Sha1TestOpenSSL ${SSL_LIBRARY_NAME}::SSL ${SSL_LIBRARY_NAME}::Crypto)
|
||||||
|
target_compile_definitions(Sha1TestOpenSSL PUBLIC SHA1_TEST OPENSSL=1)
|
||||||
|
endif()
|
||||||
55
3rd/paho.mqtt.c/src/Clients.c
Normal file
55
3rd/paho.mqtt.c/src/Clients.c
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2022 IBM Corp.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
* Ian Craggs - add SSL support
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* \brief functions which apply to client structures
|
||||||
|
* */
|
||||||
|
|
||||||
|
|
||||||
|
#include "Clients.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List callback function for comparing clients by clientid
|
||||||
|
* @param a first integer value
|
||||||
|
* @param b second integer value
|
||||||
|
* @return boolean indicating whether a and b are equal
|
||||||
|
*/
|
||||||
|
int clientIDCompare(void* a, void* b)
|
||||||
|
{
|
||||||
|
Clients* client = (Clients*)a;
|
||||||
|
/*printf("comparing clientdIDs %s with %s\n", client->clientID, (char*)b);*/
|
||||||
|
return strcmp(client->clientID, (char*)b) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List callback function for comparing clients by socket
|
||||||
|
* @param a first integer value
|
||||||
|
* @param b second integer value
|
||||||
|
* @return boolean indicating whether a and b are equal
|
||||||
|
*/
|
||||||
|
int clientSocketCompare(void* a, void* b)
|
||||||
|
{
|
||||||
|
Clients* client = (Clients*)a;
|
||||||
|
/*printf("comparing %d with %d\n", (char*)a, (char*)b); */
|
||||||
|
return client->net.socket == *(SOCKET*)b;
|
||||||
|
}
|
||||||
176
3rd/paho.mqtt.c/src/Clients.h
Normal file
176
3rd/paho.mqtt.c/src/Clients.h
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2024 IBM Corp. and Ian Craggs
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
* Ian Craggs - add SSL support
|
||||||
|
* Ian Craggs - fix for bug 413429 - connectionLost not called
|
||||||
|
* Ian Craggs - change will payload to binary
|
||||||
|
* Ian Craggs - password to binary
|
||||||
|
* Ian Craggs - MQTT 5 support
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(CLIENTS_H)
|
||||||
|
#define CLIENTS_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "MQTTTime.h"
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <winsock2.h>
|
||||||
|
#endif
|
||||||
|
#if defined(OPENSSL)
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
#endif
|
||||||
|
#include "MQTTClient.h"
|
||||||
|
#include "LinkedList.h"
|
||||||
|
#include "MQTTClientPersistence.h"
|
||||||
|
#include "Socket.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stored publication data to minimize copying
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char *topic;
|
||||||
|
int topiclen;
|
||||||
|
char* payload;
|
||||||
|
int payloadlen;
|
||||||
|
int refcount;
|
||||||
|
uint8_t mask[4];
|
||||||
|
} Publications;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client publication message data
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int qos;
|
||||||
|
int retain;
|
||||||
|
int msgid;
|
||||||
|
int MQTTVersion;
|
||||||
|
MQTTProperties properties;
|
||||||
|
Publications *publish;
|
||||||
|
START_TIME_TYPE lastTouch; /**> used for retry and expiry */
|
||||||
|
char nextMessageType; /**> PUBREC, PUBREL, PUBCOMP */
|
||||||
|
int len; /**> length of the whole structure+data */
|
||||||
|
} Messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client will message data
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char *topic;
|
||||||
|
int payloadlen;
|
||||||
|
void *payload;
|
||||||
|
int retained;
|
||||||
|
int qos;
|
||||||
|
} willMessages;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SOCKET socket;
|
||||||
|
START_TIME_TYPE lastSent;
|
||||||
|
START_TIME_TYPE lastReceived;
|
||||||
|
START_TIME_TYPE lastPing;
|
||||||
|
#if defined(OPENSSL)
|
||||||
|
SSL* ssl;
|
||||||
|
SSL_CTX* ctx;
|
||||||
|
char *https_proxy;
|
||||||
|
char *https_proxy_auth;
|
||||||
|
#endif
|
||||||
|
char *http_proxy;
|
||||||
|
char *http_proxy_auth;
|
||||||
|
int websocket; /**< socket has been upgraded to use web sockets */
|
||||||
|
char *websocket_key;
|
||||||
|
const MQTTClient_nameValue* httpHeaders;
|
||||||
|
} networkHandles;
|
||||||
|
|
||||||
|
|
||||||
|
/* connection states */
|
||||||
|
/** no connection in progress, see connected value */
|
||||||
|
#define NOT_IN_PROGRESS 0x0
|
||||||
|
/** TCP connection in progress */
|
||||||
|
#define TCP_IN_PROGRESS 0x1
|
||||||
|
/** SSL connection in progress */
|
||||||
|
#define SSL_IN_PROGRESS 0x2
|
||||||
|
/** Websocket connection in progress */
|
||||||
|
#define WEBSOCKET_IN_PROGRESS 0x3
|
||||||
|
/** TCP completed, waiting for MQTT ACK */
|
||||||
|
#define WAIT_FOR_CONNACK 0x4
|
||||||
|
/** Proxy connection in progress */
|
||||||
|
#define PROXY_CONNECT_IN_PROGRESS 0x5
|
||||||
|
/** Disconnecting */
|
||||||
|
#define DISCONNECTING -2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data related to one client
|
||||||
|
* The entire structure is initialized to 0 on creation, so all fields default to 0.
|
||||||
|
*/
|
||||||
|
typedef struct Clients
|
||||||
|
{
|
||||||
|
char* clientID; /**< the string id of the client */
|
||||||
|
const char* username; /**< MQTT v3.1 user name */
|
||||||
|
int passwordlen; /**< MQTT password length */
|
||||||
|
const void* password; /**< MQTT v3.1 binary password */
|
||||||
|
unsigned int cleansession : 1; /**< MQTT V3 clean session flag */
|
||||||
|
unsigned int cleanstart : 1; /**< MQTT V5 clean start flag */
|
||||||
|
unsigned int connected : 1; /**< whether it is currently connected */
|
||||||
|
unsigned int good : 1; /**< if we have an error on the socket we turn this off */
|
||||||
|
unsigned int ping_outstanding : 1;
|
||||||
|
unsigned int ping_due : 1; /**< we couldn't send a ping so we should send one when we can */
|
||||||
|
signed int connect_state : 4;
|
||||||
|
START_TIME_TYPE ping_due_time; /**< the time at which the ping should have been sent (ping_due) */
|
||||||
|
networkHandles net; /**< network info for this client */
|
||||||
|
int msgID; /**< the MQTT message id */
|
||||||
|
int keepAliveInterval; /**< the MQTT keep alive interval */
|
||||||
|
int savedKeepAliveInterval; /**< saved keep alive interval, in case reset by server keep alive */
|
||||||
|
int retryInterval; /**< the MQTT retry interval for QoS > 0 */
|
||||||
|
int maxInflightMessages; /**< the max number of inflight outbound messages we allow */
|
||||||
|
willMessages* will; /**< the MQTT will message, if any */
|
||||||
|
List* inboundMsgs; /**< inbound in flight messages */
|
||||||
|
List* outboundMsgs; /**< outbound in flight messages */
|
||||||
|
int connect_count; /**< the number of outbound messages on reconnect - to ensure we send them all */
|
||||||
|
int connect_sent; /**< the current number of outbound messages on reconnect that we've sent */
|
||||||
|
List* messageQueue; /**< inbound complete but undelivered messages */
|
||||||
|
List* outboundQueue; /**< outbound queued messages */
|
||||||
|
unsigned int qentry_seqno;
|
||||||
|
void* phandle; /**< the persistence handle */
|
||||||
|
MQTTClient_persistence* persistence; /**< a persistence implementation */
|
||||||
|
MQTTPersistence_beforeWrite* beforeWrite; /**< persistence write callback */
|
||||||
|
MQTTPersistence_afterRead* afterRead; /**< persistence read callback */
|
||||||
|
void* beforeWrite_context; /**< context to be used with the persistence beforeWrite callbacks */
|
||||||
|
void* afterRead_context; /**< context to be used with the persistence afterRead callback */
|
||||||
|
void* context; /**< calling context - used when calling disconnect_internal */
|
||||||
|
int MQTTVersion; /**< the version of MQTT being used, 3, 4 or 5 */
|
||||||
|
unsigned int sessionExpiry; /**< MQTT 5 session expiry */
|
||||||
|
char* httpProxy; /**< HTTP proxy */
|
||||||
|
char* httpsProxy; /**< HTTPS proxy */
|
||||||
|
#if defined(OPENSSL)
|
||||||
|
MQTTClient_SSLOptions *sslopts; /**< the SSL/TLS connect options */
|
||||||
|
SSL_SESSION* session; /**< SSL session pointer for fast handhake */
|
||||||
|
#endif
|
||||||
|
} Clients;
|
||||||
|
|
||||||
|
int clientIDCompare(void* a, void* b);
|
||||||
|
int clientSocketCompare(void* a, void* b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration data related to all clients
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char* version;
|
||||||
|
List* clients;
|
||||||
|
} ClientStates;
|
||||||
|
|
||||||
|
#endif
|
||||||
538
3rd/paho.mqtt.c/src/Heap.c
Normal file
538
3rd/paho.mqtt.c/src/Heap.c
Normal file
@@ -0,0 +1,538 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2024 IBM Corp.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
* Ian Craggs - use tree data structure instead of list
|
||||||
|
* Ian Craggs - change roundup to Heap_roundup to avoid macro name clash on MacOSX
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* \brief functions to manage the heap with the goal of eliminating memory leaks
|
||||||
|
*
|
||||||
|
* For any module to use these functions transparently, simply include the Heap.h
|
||||||
|
* header file. Malloc and free will be redefined, but will behave in exactly the same
|
||||||
|
* way as normal, so no recoding is necessary.
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
#include "Tree.h"
|
||||||
|
#include "Log.h"
|
||||||
|
#include "StackTrace.h"
|
||||||
|
#include "Thread.h"
|
||||||
|
|
||||||
|
#if defined(HEAP_UNIT_TESTS)
|
||||||
|
char* Broker_recordFFDC(char* symptoms);
|
||||||
|
#endif /* HEAP_UNIT_TESTS */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "Heap.h"
|
||||||
|
|
||||||
|
#if !defined(NO_HEAP_TRACKING)
|
||||||
|
|
||||||
|
#undef malloc
|
||||||
|
#undef realloc
|
||||||
|
#undef free
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
mutex_type heap_mutex;
|
||||||
|
#else
|
||||||
|
static pthread_mutex_t heap_mutex_store = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
static mutex_type heap_mutex = &heap_mutex_store;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static heap_info state = {0, 0}; /**< global heap state information */
|
||||||
|
|
||||||
|
typedef uint64_t eyecatcherType;
|
||||||
|
static eyecatcherType eyecatcher = (eyecatcherType)0x8888888888888888;
|
||||||
|
#define PRIeyecatcher PRIx64 /**< print eyecatcher in HEX notation */
|
||||||
|
|
||||||
|
/*#define HEAP_STACK 1 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Each item on the heap is recorded with this structure.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char* file; /**< the name of the source file where the storage was allocated */
|
||||||
|
int line; /**< the line no in the source file where it was allocated */
|
||||||
|
void* ptr; /**< pointer to the allocated storage */
|
||||||
|
size_t size; /**< size of the allocated storage */
|
||||||
|
#if defined(HEAP_STACK)
|
||||||
|
char* stack;
|
||||||
|
#endif
|
||||||
|
} storageElement;
|
||||||
|
|
||||||
|
static Tree heap; /**< Tree that holds the allocation records */
|
||||||
|
static const char *errmsg = "Memory allocation error";
|
||||||
|
|
||||||
|
|
||||||
|
static size_t Heap_roundup(size_t size);
|
||||||
|
static int ptrCompare(void* a, void* b, int value);
|
||||||
|
/*static void Heap_check(char* string, void* ptr);*/
|
||||||
|
static void checkEyecatchers(char* file, int line, void* p, size_t size);
|
||||||
|
static int Internal_heap_unlink(char* file, int line, void* p);
|
||||||
|
static void HeapScan(enum LOG_LEVELS log_level);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Round allocation size up to a multiple of the size of an int. Apart from possibly reducing fragmentation,
|
||||||
|
* on the old v3 gcc compilers I was hitting some weird behaviour, which might have been errors in
|
||||||
|
* sizeof() used on structures and related to packing. In any case, this fixes that too.
|
||||||
|
* @param size the size actually needed
|
||||||
|
* @return the rounded up size
|
||||||
|
*/
|
||||||
|
static size_t Heap_roundup(size_t size)
|
||||||
|
{
|
||||||
|
static int multsize = 4*sizeof(int);
|
||||||
|
|
||||||
|
if (size % multsize != 0)
|
||||||
|
size += multsize - (size % multsize);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List callback function for comparing storage elements
|
||||||
|
* @param a pointer to the current content in the tree (storageElement*)
|
||||||
|
* @param b pointer to the memory to free
|
||||||
|
* @return boolean indicating whether a and b are equal
|
||||||
|
*/
|
||||||
|
static int ptrCompare(void* a, void* b, int value)
|
||||||
|
{
|
||||||
|
a = ((storageElement*)a)->ptr;
|
||||||
|
if (value)
|
||||||
|
b = ((storageElement*)b)->ptr;
|
||||||
|
|
||||||
|
return (a > b) ? -1 : (a == b) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static void Heap_check(char* string, void* ptr)
|
||||||
|
{
|
||||||
|
Node* curnode = NULL;
|
||||||
|
storageElement* prev, *s = NULL;
|
||||||
|
|
||||||
|
printf("Heap_check start %p\n", ptr);
|
||||||
|
while ((curnode = TreeNextElement(&heap, curnode)) != NULL)
|
||||||
|
{
|
||||||
|
prev = s;
|
||||||
|
s = (storageElement*)(curnode->content);
|
||||||
|
|
||||||
|
if (prev)
|
||||||
|
{
|
||||||
|
if (ptrCompare(s, prev, 1) != -1)
|
||||||
|
{
|
||||||
|
printf("%s: heap order error %d %p %p\n", string, ptrCompare(s, prev, 1), prev->ptr, s->ptr);
|
||||||
|
exit(99);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("%s: heap order good %d %p %p\n", string, ptrCompare(s, prev, 1), prev->ptr, s->ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates a block of memory. A direct replacement for malloc, but keeps track of items
|
||||||
|
* allocated in a list, so that free can check that a item is being freed correctly and that
|
||||||
|
* we can check that all memory is freed at shutdown.
|
||||||
|
* @param file use the __FILE__ macro to indicate which file this item was allocated in
|
||||||
|
* @param line use the __LINE__ macro to indicate which line this item was allocated at
|
||||||
|
* @param size the size of the item to be allocated
|
||||||
|
* @return pointer to the allocated item, or NULL if there was an error
|
||||||
|
*/
|
||||||
|
void* mymalloc(char* file, int line, size_t size)
|
||||||
|
{
|
||||||
|
storageElement* s = NULL;
|
||||||
|
size_t space = sizeof(storageElement);
|
||||||
|
size_t filenamelen = strlen(file)+1;
|
||||||
|
void* rc = NULL;
|
||||||
|
|
||||||
|
Paho_thread_lock_mutex(heap_mutex);
|
||||||
|
size = Heap_roundup(size);
|
||||||
|
if ((s = malloc(sizeof(storageElement))) == NULL)
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, 13, errmsg);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
memset(s, 0, sizeof(storageElement));
|
||||||
|
|
||||||
|
s->size = size; /* size without eyecatchers */
|
||||||
|
if ((s->file = malloc(filenamelen)) == NULL)
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, 13, errmsg);
|
||||||
|
free(s);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
memset(s->file, 0, filenamelen);
|
||||||
|
|
||||||
|
space += filenamelen;
|
||||||
|
strcpy(s->file, file);
|
||||||
|
#if defined(HEAP_STACK)
|
||||||
|
#define STACK_LEN 300
|
||||||
|
if ((s->stack = malloc(STACK_LEN)) == NULL)
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, 13, errmsg);
|
||||||
|
free(s->file);
|
||||||
|
free(s);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
memset(s->stack, 0, STACK_LEN);
|
||||||
|
StackTrace_get(Paho_thread_getid(), s->stack, STACK_LEN);
|
||||||
|
#endif
|
||||||
|
s->line = line;
|
||||||
|
/* Add space for eyecatcher at each end */
|
||||||
|
if ((s->ptr = malloc(size + 2*sizeof(eyecatcherType))) == NULL)
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, 13, errmsg);
|
||||||
|
free(s->file);
|
||||||
|
free(s);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
memset(s->ptr, 0, size + 2*sizeof(eyecatcherType));
|
||||||
|
space += size + 2*sizeof(eyecatcherType);
|
||||||
|
*(eyecatcherType*)(s->ptr) = eyecatcher; /* start eyecatcher */
|
||||||
|
*(eyecatcherType*)(((char*)(s->ptr)) + (sizeof(eyecatcherType) + size)) = eyecatcher; /* end eyecatcher */
|
||||||
|
Log(TRACE_MAX, -1, "Allocating %d bytes in heap at file %s line %d ptr %p\n", (int)size, file, line, s->ptr);
|
||||||
|
TreeAdd(&heap, s, space);
|
||||||
|
state.current_size += size;
|
||||||
|
if (state.current_size > state.max_size)
|
||||||
|
state.max_size = state.current_size;
|
||||||
|
rc = ((eyecatcherType*)(s->ptr)) + 1; /* skip start eyecatcher */
|
||||||
|
exit:
|
||||||
|
Paho_thread_unlock_mutex(heap_mutex);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void checkEyecatchers(char* file, int line, void* p, size_t size)
|
||||||
|
{
|
||||||
|
eyecatcherType *sp = (eyecatcherType*)p;
|
||||||
|
char *cp = (char*)p;
|
||||||
|
eyecatcherType us;
|
||||||
|
static const char *msg = "Invalid %s eyecatcher %" PRIeyecatcher " in heap item at file %s line %d";
|
||||||
|
|
||||||
|
if ((us = *--sp) != eyecatcher)
|
||||||
|
Log(LOG_ERROR, 13, msg, "start", us, file, line);
|
||||||
|
|
||||||
|
cp += size;
|
||||||
|
if ((us = *(eyecatcherType*)cp) != eyecatcher)
|
||||||
|
Log(LOG_ERROR, 13, msg, "end", us, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an item from the recorded heap without actually freeing it.
|
||||||
|
* Use sparingly!
|
||||||
|
* @param file use the __FILE__ macro to indicate which file this item was allocated in
|
||||||
|
* @param line use the __LINE__ macro to indicate which line this item was allocated at
|
||||||
|
* @param p pointer to the item to be removed
|
||||||
|
*/
|
||||||
|
static int Internal_heap_unlink(char* file, int line, void* p)
|
||||||
|
{
|
||||||
|
Node* e = NULL;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
e = TreeFind(&heap, ((eyecatcherType*)p)-1);
|
||||||
|
if (e == NULL)
|
||||||
|
Log(LOG_ERROR, 13, "Failed to remove heap item at file %s line %d", file, line);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
storageElement* s = (storageElement*)(e->content);
|
||||||
|
Log(TRACE_MAX, -1, "Freeing %d bytes in heap at file %s line %d, heap use now %d bytes\n",
|
||||||
|
(int)s->size, file, line, (int)state.current_size);
|
||||||
|
checkEyecatchers(file, line, p, s->size);
|
||||||
|
/* free(s->ptr); */
|
||||||
|
free(s->file);
|
||||||
|
state.current_size -= s->size;
|
||||||
|
TreeRemoveNodeIndex(&heap, e, 0);
|
||||||
|
free(s);
|
||||||
|
rc = 1;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees a block of memory. A direct replacement for free, but checks that a item is in
|
||||||
|
* the allocates list first.
|
||||||
|
* @param file use the __FILE__ macro to indicate which file this item was allocated in
|
||||||
|
* @param line use the __LINE__ macro to indicate which line this item was allocated at
|
||||||
|
* @param p pointer to the item to be freed
|
||||||
|
*/
|
||||||
|
void myfree(char* file, int line, void* p)
|
||||||
|
{
|
||||||
|
if (p) /* it is legal und usual to call free(NULL) */
|
||||||
|
{
|
||||||
|
Paho_thread_lock_mutex(heap_mutex);
|
||||||
|
if (Internal_heap_unlink(file, line, p))
|
||||||
|
free(((eyecatcherType*)p)-1);
|
||||||
|
Paho_thread_unlock_mutex(heap_mutex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, -1, "Call of free(NULL) in %s,%d",file,line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an item from the recorded heap without actually freeing it.
|
||||||
|
* Use sparingly!
|
||||||
|
* @param file use the __FILE__ macro to indicate which file this item was allocated in
|
||||||
|
* @param line use the __LINE__ macro to indicate which line this item was allocated at
|
||||||
|
* @param p pointer to the item to be removed
|
||||||
|
*/
|
||||||
|
void Heap_unlink(char* file, int line, void* p)
|
||||||
|
{
|
||||||
|
Paho_thread_lock_mutex(heap_mutex);
|
||||||
|
Internal_heap_unlink(file, line, p);
|
||||||
|
Paho_thread_unlock_mutex(heap_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reallocates a block of memory. A direct replacement for realloc, but keeps track of items
|
||||||
|
* allocated in a list, so that free can check that a item is being freed correctly and that
|
||||||
|
* we can check that all memory is freed at shutdown.
|
||||||
|
* We have to remove the item from the tree, as the memory is in order and so it needs to
|
||||||
|
* be reinserted in the correct place.
|
||||||
|
* @param file use the __FILE__ macro to indicate which file this item was reallocated in
|
||||||
|
* @param line use the __LINE__ macro to indicate which line this item was reallocated at
|
||||||
|
* @param p pointer to the item to be reallocated
|
||||||
|
* @param size the new size of the item
|
||||||
|
* @return pointer to the allocated item, or NULL if there was an error
|
||||||
|
*/
|
||||||
|
void *myrealloc(char* file, int line, void* p, size_t size)
|
||||||
|
{
|
||||||
|
void* rc = NULL;
|
||||||
|
storageElement* s = NULL;
|
||||||
|
|
||||||
|
Paho_thread_lock_mutex(heap_mutex);
|
||||||
|
s = TreeRemoveKey(&heap, ((eyecatcherType*)p)-1);
|
||||||
|
if (s == NULL)
|
||||||
|
Log(LOG_ERROR, 13, "Failed to reallocate heap item at file %s line %d", file, line);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t space = sizeof(storageElement);
|
||||||
|
size_t filenamelen = strlen(file)+1;
|
||||||
|
|
||||||
|
checkEyecatchers(file, line, p, s->size);
|
||||||
|
size = Heap_roundup(size);
|
||||||
|
state.current_size += size - s->size;
|
||||||
|
if (state.current_size > state.max_size)
|
||||||
|
state.max_size = state.current_size;
|
||||||
|
void* newPtr = realloc(s->ptr, size + 2*sizeof(eyecatcherType));
|
||||||
|
if (newPtr == NULL)
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, 13, errmsg);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
s->ptr = newPtr;
|
||||||
|
space += size + 2*sizeof(eyecatcherType) - s->size;
|
||||||
|
*(eyecatcherType*)(s->ptr) = eyecatcher; /* start eyecatcher */
|
||||||
|
*(eyecatcherType*)(((char*)(s->ptr)) + (sizeof(eyecatcherType) + size)) = eyecatcher; /* end eyecatcher */
|
||||||
|
s->size = size;
|
||||||
|
space -= strlen(s->file);
|
||||||
|
newPtr = realloc(s->file, filenamelen);
|
||||||
|
if (newPtr == NULL)
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, 13, errmsg);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
s->file = newPtr;
|
||||||
|
space += filenamelen;
|
||||||
|
strcpy(s->file, file);
|
||||||
|
s->line = line;
|
||||||
|
rc = s->ptr;
|
||||||
|
TreeAdd(&heap, s, space);
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
Paho_thread_unlock_mutex(heap_mutex);
|
||||||
|
return (rc == NULL) ? NULL : ((eyecatcherType*)(rc)) + 1; /* skip start eyecatcher */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility to find an item in the heap. Lets you know if the heap already contains
|
||||||
|
* the memory location in question.
|
||||||
|
* @param p pointer to a memory location
|
||||||
|
* @return pointer to the storage element if found, or NULL
|
||||||
|
*/
|
||||||
|
void* Heap_findItem(void* p)
|
||||||
|
{
|
||||||
|
Node* e = NULL;
|
||||||
|
|
||||||
|
Paho_thread_lock_mutex(heap_mutex);
|
||||||
|
e = TreeFind(&heap, ((eyecatcherType*)p)-1);
|
||||||
|
Paho_thread_unlock_mutex(heap_mutex);
|
||||||
|
return (e == NULL) ? NULL : e->content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scans the heap and reports any items currently allocated.
|
||||||
|
* To be used at shutdown if any heap items have not been freed.
|
||||||
|
*/
|
||||||
|
static void HeapScan(enum LOG_LEVELS log_level)
|
||||||
|
{
|
||||||
|
Node* current = NULL;
|
||||||
|
|
||||||
|
Paho_thread_lock_mutex(heap_mutex);
|
||||||
|
Log(log_level, -1, "Heap scan start, total %d bytes", (int)state.current_size);
|
||||||
|
while ((current = TreeNextElement(&heap, current)) != NULL)
|
||||||
|
{
|
||||||
|
storageElement* s = (storageElement*)(current->content);
|
||||||
|
Log(log_level, -1, "Heap element size %d, line %d, file %s, ptr %p", (int)s->size, s->line, s->file, s->ptr);
|
||||||
|
Log(log_level, -1, " Content %.*s", (10 > current->size) ? (int)s->size : 10, (char*)(((eyecatcherType*)s->ptr) + 1));
|
||||||
|
#if defined(HEAP_STACK)
|
||||||
|
Log(log_level, -1, " Stack:\n%s", s->stack);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Log(log_level, -1, "Heap scan end");
|
||||||
|
Paho_thread_unlock_mutex(heap_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Heap initialization.
|
||||||
|
*/
|
||||||
|
int Heap_initialize(void)
|
||||||
|
{
|
||||||
|
TreeInitializeNoMalloc(&heap, ptrCompare);
|
||||||
|
heap.heap_tracking = 0; /* no recursive heap tracking! */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Heap termination.
|
||||||
|
*/
|
||||||
|
void Heap_terminate(void)
|
||||||
|
{
|
||||||
|
Log(TRACE_MIN, -1, "Maximum heap use was %d bytes", (int)state.max_size);
|
||||||
|
if (state.current_size > 20) /* One log list is freed after this function is called */
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, -1, "Some memory not freed at shutdown, possible memory leak");
|
||||||
|
HeapScan(LOG_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access to heap state
|
||||||
|
* @return pointer to the heap state structure
|
||||||
|
*/
|
||||||
|
heap_info* Heap_get_info(void)
|
||||||
|
{
|
||||||
|
return &state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dump a string from the heap so that it can be displayed conveniently
|
||||||
|
* @param file file handle to dump the heap contents to
|
||||||
|
* @param str the string to dump, could be NULL
|
||||||
|
*/
|
||||||
|
int HeapDumpString(FILE* file, char* str)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
size_t len = str ? strlen(str) + 1 : 0; /* include the trailing null */
|
||||||
|
|
||||||
|
if (fwrite(&(str), sizeof(char*), 1, file) != 1)
|
||||||
|
rc = -1;
|
||||||
|
else if (fwrite(&(len), sizeof(int), 1 ,file) != 1)
|
||||||
|
rc = -1;
|
||||||
|
else if (len > 0 && fwrite(str, len, 1, file) != 1)
|
||||||
|
rc = -1;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dump the state of the heap
|
||||||
|
* @param file file handle to dump the heap contents to
|
||||||
|
*/
|
||||||
|
int HeapDump(FILE* file)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
Node* current = NULL;
|
||||||
|
|
||||||
|
while (rc == 0 && (current = TreeNextElement(&heap, current)))
|
||||||
|
{
|
||||||
|
storageElement* s = (storageElement*)(current->content);
|
||||||
|
|
||||||
|
if (fwrite(&(s->ptr), sizeof(s->ptr), 1, file) != 1)
|
||||||
|
rc = -1;
|
||||||
|
else if (fwrite(&(current->size), sizeof(current->size), 1, file) != 1)
|
||||||
|
rc = -1;
|
||||||
|
else if (fwrite(s->ptr, current->size, 1, file) != 1)
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(HEAP_UNIT_TESTS)
|
||||||
|
|
||||||
|
void Log(enum LOG_LEVELS log_level, int msgno, char* format, ...)
|
||||||
|
{
|
||||||
|
printf("Log %s", format);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* Broker_recordFFDC(char* symptoms)
|
||||||
|
{
|
||||||
|
printf("recordFFDC");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
#define malloc(x) mymalloc(__FILE__, __LINE__, x)
|
||||||
|
#define realloc(a, b) myrealloc(__FILE__, __LINE__, a, b)
|
||||||
|
#define free(x) myfree(__FILE__, __LINE__, x)
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
char* h = NULL;
|
||||||
|
Heap_initialize();
|
||||||
|
|
||||||
|
h = malloc(12);
|
||||||
|
free(h);
|
||||||
|
printf("freed h\n");
|
||||||
|
|
||||||
|
h = malloc(12);
|
||||||
|
h = realloc(h, 14);
|
||||||
|
h = realloc(h, 25);
|
||||||
|
h = realloc(h, 255);
|
||||||
|
h = realloc(h, 2225);
|
||||||
|
h = realloc(h, 22225);
|
||||||
|
printf("freeing h\n");
|
||||||
|
free(h);
|
||||||
|
Heap_terminate();
|
||||||
|
printf("Finishing\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HEAP_UNIT_TESTS */
|
||||||
|
|
||||||
|
/* Local Variables: */
|
||||||
|
/* indent-tabs-mode: t */
|
||||||
|
/* c-basic-offset: 8 */
|
||||||
|
/* End: */
|
||||||
90
3rd/paho.mqtt.c/src/Heap.h
Normal file
90
3rd/paho.mqtt.c/src/Heap.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2020 IBM Corp. and others
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
* Ian Craggs - use tree data structure instead of list
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(HEAP_H)
|
||||||
|
#define HEAP_H
|
||||||
|
|
||||||
|
#if defined(HIGH_PERFORMANCE)
|
||||||
|
#define NO_HEAP_TRACKING 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PAHO_MEMORY_ERROR -99
|
||||||
|
|
||||||
|
#include "MQTTExportDeclarations.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if !defined(NO_HEAP_TRACKING)
|
||||||
|
|
||||||
|
#if !defined(TREE_C)
|
||||||
|
/**
|
||||||
|
* redefines malloc to use "mymalloc" so that heap allocation can be tracked
|
||||||
|
* @param x the size of the item to be allocated
|
||||||
|
* @return the pointer to the item allocated, or NULL
|
||||||
|
*/
|
||||||
|
#define malloc(x) mymalloc(__FILE__, __LINE__, x)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redefines realloc to use "myrealloc" so that heap allocation can be tracked
|
||||||
|
* @param a the heap item to be reallocated
|
||||||
|
* @param b the new size of the item
|
||||||
|
* @return the new pointer to the heap item
|
||||||
|
*/
|
||||||
|
#define realloc(a, b) myrealloc(__FILE__, __LINE__, a, b)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redefines free to use "myfree" so that heap allocation can be tracked
|
||||||
|
* @param x the pointer to the item to be freed
|
||||||
|
*/
|
||||||
|
#define free(x) myfree(__FILE__, __LINE__, x)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about the state of the heap.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
size_t current_size; /**< current size of the heap in bytes */
|
||||||
|
size_t max_size; /**< max size the heap has reached in bytes */
|
||||||
|
} heap_info;
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void* mymalloc(char*, int, size_t size);
|
||||||
|
void* myrealloc(char*, int, void* p, size_t size);
|
||||||
|
void myfree(char*, int, void* p);
|
||||||
|
|
||||||
|
void Heap_scan(FILE* file);
|
||||||
|
int Heap_initialize(void);
|
||||||
|
void Heap_terminate(void);
|
||||||
|
LIBMQTT_API heap_info* Heap_get_info(void);
|
||||||
|
int HeapDump(FILE* file);
|
||||||
|
int HeapDumpString(FILE* file, char* str);
|
||||||
|
void* Heap_findItem(void* p);
|
||||||
|
void Heap_unlink(char* file, int line, void* p);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
22
3rd/paho.mqtt.c/src/Keysight_ws_add
Normal file
22
3rd/paho.mqtt.c/src/Keysight_ws_add
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#if WINVER <= _WIN32_WINNT_WIN8
|
||||||
|
#define HTON(x) hton((uint64_t) (x), sizeof(x))
|
||||||
|
uint64_t hton(uint64_t x, size_t n)
|
||||||
|
{
|
||||||
|
uint64_t y = 0;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
for (i=0; i < n; ++i)
|
||||||
|
{
|
||||||
|
y = (y << 8) | (x & 0xff);
|
||||||
|
x = (x >> 8);
|
||||||
|
}
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
#define htons(x) (uint16_t) HTON(x)
|
||||||
|
#define htonl(x) (uint32_t) HTON(x)
|
||||||
|
#define htonll(x) (uint64_t) HTON(x)
|
||||||
|
|
||||||
|
#define ntohs(x) htons(x)
|
||||||
|
#define ntohl(x) htonl(x)
|
||||||
|
#define ntohll(x) htonll(x)
|
||||||
|
#endif
|
||||||
508
3rd/paho.mqtt.c/src/LinkedList.c
Normal file
508
3rd/paho.mqtt.c/src/LinkedList.c
Normal file
@@ -0,0 +1,508 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2020 IBM Corp.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
* Ian Craggs - updates for the async client
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* \brief functions which apply to linked list structures.
|
||||||
|
*
|
||||||
|
* These linked lists can hold data of any sort, pointed to by the content pointer of the
|
||||||
|
* ListElement structure. ListElements hold the points to the next and previous items in the
|
||||||
|
* list.
|
||||||
|
* */
|
||||||
|
|
||||||
|
#include "LinkedList.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "Heap.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a list structure to empty - all null values. Does not remove any items from the list.
|
||||||
|
* @param newl a pointer to the list structure to be initialized
|
||||||
|
*/
|
||||||
|
void ListZero(List* newl)
|
||||||
|
{
|
||||||
|
memset(newl, '\0', sizeof(List));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates and initializes a new list structure.
|
||||||
|
* @return a pointer to the new list structure
|
||||||
|
*/
|
||||||
|
List* ListInitialize(void)
|
||||||
|
{
|
||||||
|
List* newl = malloc(sizeof(List));
|
||||||
|
if (newl)
|
||||||
|
ListZero(newl);
|
||||||
|
return newl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append an already allocated ListElement and content to a list. Can be used to move
|
||||||
|
* an item from one list to another.
|
||||||
|
* @param aList the list to which the item is to be added
|
||||||
|
* @param content the list item content itself
|
||||||
|
* @param newel the ListElement to be used in adding the new item
|
||||||
|
* @param size the size of the element
|
||||||
|
*/
|
||||||
|
void ListAppendNoMalloc(List* aList, void* content, ListElement* newel, size_t size)
|
||||||
|
{ /* for heap use */
|
||||||
|
newel->content = content;
|
||||||
|
newel->next = NULL;
|
||||||
|
newel->prev = aList->last;
|
||||||
|
if (aList->first == NULL)
|
||||||
|
aList->first = newel;
|
||||||
|
else
|
||||||
|
aList->last->next = newel;
|
||||||
|
aList->last = newel;
|
||||||
|
++(aList->count);
|
||||||
|
aList->size += size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append an item to a list.
|
||||||
|
* @param aList the list to which the item is to be added
|
||||||
|
* @param content the list item content itself
|
||||||
|
* @param size the size of the element
|
||||||
|
*/
|
||||||
|
ListElement* ListAppend(List* aList, void* content, size_t size)
|
||||||
|
{
|
||||||
|
ListElement* newel = malloc(sizeof(ListElement));
|
||||||
|
if (newel)
|
||||||
|
ListAppendNoMalloc(aList, content, newel, size);
|
||||||
|
return newel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert an item to a list at a specific position.
|
||||||
|
* @param aList the list to which the item is to be added
|
||||||
|
* @param content the list item content itself
|
||||||
|
* @param size the size of the element
|
||||||
|
* @param index the position in the list. If NULL, this function is equivalent
|
||||||
|
* to ListAppend.
|
||||||
|
*/
|
||||||
|
ListElement* ListInsert(List* aList, void* content, size_t size, ListElement* index)
|
||||||
|
{
|
||||||
|
ListElement* newel = malloc(sizeof(ListElement));
|
||||||
|
|
||||||
|
if (newel == NULL)
|
||||||
|
return newel;
|
||||||
|
if ( index == NULL )
|
||||||
|
ListAppendNoMalloc(aList, content, newel, size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newel->content = content;
|
||||||
|
newel->next = index;
|
||||||
|
newel->prev = index->prev;
|
||||||
|
|
||||||
|
index->prev = newel;
|
||||||
|
if ( newel->prev != NULL )
|
||||||
|
newel->prev->next = newel;
|
||||||
|
else
|
||||||
|
aList->first = newel;
|
||||||
|
|
||||||
|
++(aList->count);
|
||||||
|
aList->size += size;
|
||||||
|
}
|
||||||
|
return newel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds an element in a list by comparing the content pointers, rather than the contents
|
||||||
|
* @param aList the list in which the search is to be conducted
|
||||||
|
* @param content pointer to the list item content itself
|
||||||
|
* @return the list item found, or NULL
|
||||||
|
*/
|
||||||
|
ListElement* ListFind(List* aList, void* content)
|
||||||
|
{
|
||||||
|
return ListFindItem(aList, content, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds an element in a list by comparing the content or pointer to the content. A callback
|
||||||
|
* function is used to define the method of comparison for each element.
|
||||||
|
* @param aList the list in which the search is to be conducted
|
||||||
|
* @param content pointer to the content to look for
|
||||||
|
* @param callback pointer to a function which compares each element (NULL means compare by content pointer)
|
||||||
|
* @return the list element found, or NULL
|
||||||
|
*/
|
||||||
|
ListElement* ListFindItem(List* aList, void* content, int(*callback)(void*, void*))
|
||||||
|
{
|
||||||
|
ListElement* rc = NULL;
|
||||||
|
|
||||||
|
if (aList->current != NULL && ((callback == NULL && aList->current->content == content) ||
|
||||||
|
(callback != NULL && callback(aList->current->content, content))))
|
||||||
|
rc = aList->current;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ListElement* current = NULL;
|
||||||
|
|
||||||
|
/* find the content */
|
||||||
|
while (ListNextElement(aList, ¤t) != NULL)
|
||||||
|
{
|
||||||
|
if (callback == NULL)
|
||||||
|
{
|
||||||
|
if (current->content == content)
|
||||||
|
{
|
||||||
|
rc = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (callback(current->content, content))
|
||||||
|
{
|
||||||
|
rc = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rc != NULL)
|
||||||
|
aList->current = rc;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and optionally frees an element in a list by comparing the content.
|
||||||
|
* A callback function is used to define the method of comparison for each element.
|
||||||
|
* @param aList the list in which the search is to be conducted
|
||||||
|
* @param content pointer to the content to look for
|
||||||
|
* @param callback pointer to a function which compares each element
|
||||||
|
* @param freeContent boolean value to indicate whether the item found is to be freed
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
static int ListUnlink(List* aList, void* content, int(*callback)(void*, void*), int freeContent)
|
||||||
|
{
|
||||||
|
ListElement* next = NULL;
|
||||||
|
ListElement* saved = aList->current;
|
||||||
|
int saveddeleted = 0;
|
||||||
|
|
||||||
|
if (!ListFindItem(aList, content, callback))
|
||||||
|
return 0; /* false, did not remove item */
|
||||||
|
|
||||||
|
if (aList->current->prev == NULL)
|
||||||
|
/* so this is the first element, and we have to update the "first" pointer */
|
||||||
|
aList->first = aList->current->next;
|
||||||
|
else
|
||||||
|
aList->current->prev->next = aList->current->next;
|
||||||
|
|
||||||
|
if (aList->current->next == NULL)
|
||||||
|
aList->last = aList->current->prev;
|
||||||
|
else
|
||||||
|
aList->current->next->prev = aList->current->prev;
|
||||||
|
|
||||||
|
next = aList->current->next;
|
||||||
|
if (freeContent)
|
||||||
|
{
|
||||||
|
free(aList->current->content);
|
||||||
|
aList->current->content = NULL;
|
||||||
|
}
|
||||||
|
if (saved == aList->current)
|
||||||
|
saveddeleted = 1;
|
||||||
|
free(aList->current);
|
||||||
|
if (saveddeleted)
|
||||||
|
aList->current = next;
|
||||||
|
else
|
||||||
|
aList->current = saved;
|
||||||
|
--(aList->count);
|
||||||
|
return 1; /* successfully removed item */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes but does not free an item in a list by comparing the pointer to the content.
|
||||||
|
* @param aList the list in which the search is to be conducted
|
||||||
|
* @param content pointer to the content to look for
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
int ListDetach(List* aList, void* content)
|
||||||
|
{
|
||||||
|
return ListUnlink(aList, content, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and frees an item in a list by comparing the pointer to the content.
|
||||||
|
* @param aList the list from which the item is to be removed
|
||||||
|
* @param content pointer to the content to look for
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
int ListRemove(List* aList, void* content)
|
||||||
|
{
|
||||||
|
return ListUnlink(aList, content, NULL, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and frees an the first item in a list.
|
||||||
|
* @param aList the list from which the item is to be removed
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
void* ListDetachHead(List* aList)
|
||||||
|
{
|
||||||
|
void *content = NULL;
|
||||||
|
if (aList->count > 0)
|
||||||
|
{
|
||||||
|
ListElement* first = aList->first;
|
||||||
|
if (aList->current == first)
|
||||||
|
aList->current = first->next;
|
||||||
|
if (aList->last == first) /* i.e. no of items in list == 1 */
|
||||||
|
aList->last = NULL;
|
||||||
|
content = first->content;
|
||||||
|
aList->first = aList->first->next;
|
||||||
|
if (aList->first)
|
||||||
|
aList->first->prev = NULL;
|
||||||
|
free(first);
|
||||||
|
--(aList->count);
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and frees an the first item in a list.
|
||||||
|
* @param aList the list from which the item is to be removed
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
int ListRemoveHead(List* aList)
|
||||||
|
{
|
||||||
|
free(ListDetachHead(aList));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes but does not free the last item in a list.
|
||||||
|
* @param aList the list from which the item is to be removed
|
||||||
|
* @return the last item removed (or NULL if none was)
|
||||||
|
*/
|
||||||
|
void* ListPopTail(List* aList)
|
||||||
|
{
|
||||||
|
void* content = NULL;
|
||||||
|
if (aList->count > 0)
|
||||||
|
{
|
||||||
|
ListElement* last = aList->last;
|
||||||
|
if (aList->current == last)
|
||||||
|
aList->current = last->prev;
|
||||||
|
if (aList->first == last) /* i.e. no of items in list == 1 */
|
||||||
|
aList->first = NULL;
|
||||||
|
content = last->content;
|
||||||
|
aList->last = aList->last->prev;
|
||||||
|
if (aList->last)
|
||||||
|
aList->last->next = NULL;
|
||||||
|
free(last);
|
||||||
|
--(aList->count);
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes but does not free an element in a list by comparing the content.
|
||||||
|
* A callback function is used to define the method of comparison for each element.
|
||||||
|
* @param aList the list in which the search is to be conducted
|
||||||
|
* @param content pointer to the content to look for
|
||||||
|
* @param callback pointer to a function which compares each element
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
int ListDetachItem(List* aList, void* content, int(*callback)(void*, void*))
|
||||||
|
{ /* do not free the content */
|
||||||
|
return ListUnlink(aList, content, callback, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and frees an element in a list by comparing the content.
|
||||||
|
* A callback function is used to define the method of comparison for each element
|
||||||
|
* @param aList the list in which the search is to be conducted
|
||||||
|
* @param content pointer to the content to look for
|
||||||
|
* @param callback pointer to a function which compares each element
|
||||||
|
* @return 1=item removed, 0=item not removed
|
||||||
|
*/
|
||||||
|
int ListRemoveItem(List* aList, void* content, int(*callback)(void*, void*))
|
||||||
|
{ /* remove from list and free the content */
|
||||||
|
return ListUnlink(aList, content, callback, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and frees all items in a list, leaving the list ready for new items.
|
||||||
|
* @param aList the list to which the operation is to be applied
|
||||||
|
*/
|
||||||
|
void ListEmpty(List* aList)
|
||||||
|
{
|
||||||
|
while (aList->first != NULL)
|
||||||
|
{
|
||||||
|
ListElement* first = aList->first;
|
||||||
|
if (first->content != NULL)
|
||||||
|
{
|
||||||
|
free(first->content);
|
||||||
|
first->content = NULL;
|
||||||
|
}
|
||||||
|
aList->first = first->next;
|
||||||
|
free(first);
|
||||||
|
}
|
||||||
|
aList->count = 0;
|
||||||
|
aList->size = 0;
|
||||||
|
aList->current = aList->first = aList->last = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and frees all items in a list, and frees the list itself
|
||||||
|
* @param aList the list to which the operation is to be applied
|
||||||
|
*/
|
||||||
|
void ListFree(List* aList)
|
||||||
|
{
|
||||||
|
ListEmpty(aList);
|
||||||
|
free(aList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes and but does not free all items in a list, and frees the list itself
|
||||||
|
* @param aList the list to which the operation is to be applied
|
||||||
|
*/
|
||||||
|
void ListFreeNoContent(List* aList)
|
||||||
|
{
|
||||||
|
while (aList->first != NULL)
|
||||||
|
{
|
||||||
|
ListElement* first = aList->first;
|
||||||
|
aList->first = first->next;
|
||||||
|
free(first);
|
||||||
|
}
|
||||||
|
free(aList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forward iteration through a list
|
||||||
|
* @param aList the list to which the operation is to be applied
|
||||||
|
* @param pos pointer to the current position in the list. NULL means start from the beginning of the list
|
||||||
|
* This is updated on return to the same value as that returned from this function
|
||||||
|
* @return pointer to the current list element
|
||||||
|
*/
|
||||||
|
ListElement* ListNextElement(List* aList, ListElement** pos)
|
||||||
|
{
|
||||||
|
return *pos = (*pos == NULL) ? aList->first : (*pos)->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backward iteration through a list
|
||||||
|
* @param aList the list to which the operation is to be applied
|
||||||
|
* @param pos pointer to the current position in the list. NULL means start from the end of the list
|
||||||
|
* This is updated on return to the same value as that returned from this function
|
||||||
|
* @return pointer to the current list element
|
||||||
|
*/
|
||||||
|
ListElement* ListPrevElement(List* aList, ListElement** pos)
|
||||||
|
{
|
||||||
|
return *pos = (*pos == NULL) ? aList->last : (*pos)->prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List callback function for comparing integers
|
||||||
|
* @param a first integer value
|
||||||
|
* @param b second integer value
|
||||||
|
* @return boolean indicating whether a and b are equal
|
||||||
|
*/
|
||||||
|
int intcompare(void* a, void* b)
|
||||||
|
{
|
||||||
|
return *((int*)a) == *((int*)b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List callback function for comparing C strings
|
||||||
|
* @param a first integer value
|
||||||
|
* @param b second integer value
|
||||||
|
* @return boolean indicating whether a and b are equal
|
||||||
|
*/
|
||||||
|
int stringcompare(void* a, void* b)
|
||||||
|
{
|
||||||
|
return strcmp((char*)a, (char*)b) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(UNIT_TESTS)
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int i, *ip, *todelete;
|
||||||
|
ListElement* current = NULL;
|
||||||
|
List* l = ListInitialize();
|
||||||
|
printf("List initialized\n");
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
ip = malloc(sizeof(int));
|
||||||
|
*ip = i;
|
||||||
|
ListAppend(l, (void*)ip, sizeof(int));
|
||||||
|
if (i==5)
|
||||||
|
todelete = ip;
|
||||||
|
printf("List element appended %d\n", *((int*)(l->last->content)));
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("List contents:\n");
|
||||||
|
current = NULL;
|
||||||
|
while (ListNextElement(l, ¤t) != NULL)
|
||||||
|
printf("List element: %d\n", *((int*)(current->content)));
|
||||||
|
|
||||||
|
printf("List contents in reverse order:\n");
|
||||||
|
current = NULL;
|
||||||
|
while (ListPrevElement(l, ¤t) != NULL)
|
||||||
|
printf("List element: %d\n", *((int*)(current->content)));
|
||||||
|
|
||||||
|
/* if ListFindItem(l, *ip, intcompare)->content */
|
||||||
|
|
||||||
|
printf("List contents having deleted element %d:\n", *todelete);
|
||||||
|
ListRemove(l, todelete);
|
||||||
|
current = NULL;
|
||||||
|
while (ListNextElement(l, ¤t) != NULL)
|
||||||
|
printf("List element: %d\n", *((int*)(current->content)));
|
||||||
|
|
||||||
|
i = 9;
|
||||||
|
ListRemoveItem(l, &i, intcompare);
|
||||||
|
printf("List contents having deleted another element, %d, size now %d:\n", i, l->size);
|
||||||
|
current = NULL;
|
||||||
|
while (ListNextElement(l, ¤t) != NULL)
|
||||||
|
printf("List element: %d\n", *((int*)(current->content)));
|
||||||
|
|
||||||
|
ListFree(l);
|
||||||
|
printf("List freed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
105
3rd/paho.mqtt.c/src/LinkedList.h
Normal file
105
3rd/paho.mqtt.c/src/LinkedList.h
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2020 IBM Corp.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v2.0
|
||||||
|
* and Eclipse Distribution License v1.0 which accompany this distribution.
|
||||||
|
*
|
||||||
|
* The Eclipse Public License is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
* and the Eclipse Distribution License is available at
|
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Ian Craggs - initial API and implementation and/or initial documentation
|
||||||
|
* Ian Craggs - updates for the async client
|
||||||
|
* Ian Craggs - change size types from int to size_t
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(LINKEDLIST_H)
|
||||||
|
#define LINKEDLIST_H
|
||||||
|
|
||||||
|
#include <stdlib.h> /* for size_t definition */
|
||||||
|
|
||||||
|
/*BE
|
||||||
|
defm defList(T)
|
||||||
|
|
||||||
|
def T concat Item
|
||||||
|
{
|
||||||
|
at 4
|
||||||
|
n32 ptr T concat Item suppress "next"
|
||||||
|
at 0
|
||||||
|
n32 ptr T concat Item suppress "prev"
|
||||||
|
at 8
|
||||||
|
n32 ptr T id2str(T)
|
||||||
|
}
|
||||||
|
|
||||||
|
def T concat List
|
||||||
|
{
|
||||||
|
n32 ptr T concat Item suppress "first"
|
||||||
|
n32 ptr T concat Item suppress "last"
|
||||||
|
n32 ptr T concat Item suppress "current"
|
||||||
|
n32 dec "count"
|
||||||
|
n32 suppress "size"
|
||||||
|
}
|
||||||
|
endm
|
||||||
|
|
||||||
|
defList(INT)
|
||||||
|
defList(STRING)
|
||||||
|
defList(TMP)
|
||||||
|
|
||||||
|
BE*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure to hold all data for one list element
|
||||||
|
*/
|
||||||
|
typedef struct ListElementStruct
|
||||||
|
{
|
||||||
|
struct ListElementStruct *prev, /**< pointer to previous list element */
|
||||||
|
*next; /**< pointer to next list element */
|
||||||
|
void* content; /**< pointer to element content */
|
||||||
|
} ListElement;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure to hold all data for one list
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ListElement *first, /**< first element in the list */
|
||||||
|
*last, /**< last element in the list */
|
||||||
|
*current; /**< current element in the list, for iteration */
|
||||||
|
int count; /**< no of items */
|
||||||
|
size_t size; /**< heap storage used */
|
||||||
|
} List;
|
||||||
|
|
||||||
|
void ListZero(List*);
|
||||||
|
List* ListInitialize(void);
|
||||||
|
|
||||||
|
ListElement* ListAppend(List* aList, void* content, size_t size);
|
||||||
|
void ListAppendNoMalloc(List* aList, void* content, ListElement* newel, size_t size);
|
||||||
|
ListElement* ListInsert(List* aList, void* content, size_t size, ListElement* index);
|
||||||
|
|
||||||
|
int ListRemove(List* aList, void* content);
|
||||||
|
int ListRemoveItem(List* aList, void* content, int(*callback)(void*, void*));
|
||||||
|
void* ListDetachHead(List* aList);
|
||||||
|
int ListRemoveHead(List* aList);
|
||||||
|
void* ListPopTail(List* aList);
|
||||||
|
|
||||||
|
int ListDetach(List* aList, void* content);
|
||||||
|
int ListDetachItem(List* aList, void* content, int(*callback)(void*, void*));
|
||||||
|
|
||||||
|
void ListFree(List* aList);
|
||||||
|
void ListEmpty(List* aList);
|
||||||
|
void ListFreeNoContent(List* aList);
|
||||||
|
|
||||||
|
ListElement* ListNextElement(List* aList, ListElement** pos);
|
||||||
|
ListElement* ListPrevElement(List* aList, ListElement** pos);
|
||||||
|
|
||||||
|
ListElement* ListFind(List* aList, void* content);
|
||||||
|
ListElement* ListFindItem(List* aList, void* content, int(*callback)(void*, void*));
|
||||||
|
|
||||||
|
int intcompare(void* a, void* b);
|
||||||
|
int stringcompare(void* a, void* b);
|
||||||
|
|
||||||
|
#endif
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user