xrn_common_backend.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. /*
  2. Software License
  3. Copyright (C) 2021-05-24 Xoronos
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, version 3.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. */
  14. /*
  15. Liabilities
  16. The software is provided "AS IS" without any warranty of any kind, either expressed,
  17. implied, or statutory, including, but not limited to, any warranty that the software
  18. will conform to specifications, any implied warranties of merchantability, fitness
  19. for a particular purpose, and freedom from infringement, and any warranty that the
  20. documentation will conform to the software, or any warranty that the software will
  21. be error free.
  22. In no event shall Xoronos be liable for any damages, including, but not limited to,
  23. direct, indirect, special or consequential damages, arising out of, resulting from,
  24. or in any way connected with this software, whether or not based upon warranty,
  25. contract, tort, or otherwise, whether or not injury was sustained by persons or
  26. property or otherwise, and whether or not loss was sustained from, or arose out of
  27. the results of, or use of, the software or services provided hereunder.
  28. To request the provided software under a different license you can contact us at
  29. support@xoronos.com
  30. */
  31. #ifndef XORON_REPORTS_UTIL_H
  32. #define XORON_REPORTS_UTIL_H
  33. #include <stdint.h>
  34. #include <stdlib.h>
  35. #include <stdio.h>
  36. #define XPRINT_ERR(Y,X) \
  37. if( xlog.err_en ) { fprintf(xlog.err_fp ,"[XRN-ERR %10d]: %s, time %ld, FILE: %s , LINE %d, FUNCTION: %s\n", Y, X, time(NULL), __FILE__,__LINE__,__FUNCTION__); }
  38. #define XPRINT_WAR(X,Y) \
  39. if ( Y > 0x80000000 ) for( int war_idx = 12 ; war_idx < 31 ; war_idx ++ ) { if (((( xlog.war_shown >> war_idx ) & 0x00000001 ) == 0 ) && (( Y & (uint32_t)( 0x00000001 << war_idx )) >> war_idx == 1 ) ) { if( xlog.war_en ) { fprintf(xlog.war_fp ,"[XRN-WAR]: %s, time %ld, FILE: %s , LINE %d, FUNCTION: %s\n", X, time(NULL), __FILE__,__LINE__,__FUNCTION__); xlog.war_shown = xlog.war_shown | (uint32_t) 0x00000001 << war_idx ; } } }
  40. #define XPRINT_NOT(X) \
  41. if( xlog.not_en ) { if ( X == 0 ) { fprintf(xlog.not_fp ,"{ \"message_type\" : \"info\" , \"time\" : \"%ld\" , \"function\" : \"%s\" , \"result\" : \"PASS\" }\n", time(NULL), __FUNCTION__ ); } else { fprintf(xlog.not_fp ,"{ \"message_type\" : \"info\" , \"time\" : \"%ld\" , \"function\" : \"%s\" , \"result\" : \"FAIL\" }\n", time(NULL), __FUNCTION__ ); } }
  42. #define XPRINT_DEB() \
  43. if( xlog.deb_en ) { fprintf(xlog.deb_fp ,"[XRN-DEB]: seed %x time %ld %s\n", xlog.deb_seed, time(NULL), __FUNCTION__ ); }
  44. void xrn_free( void *ptr, uint64_t size
  45. );
  46. #define XRN_FREE(X) xrn_free((void *)X,(uint64_t)sizeof(*X))
  47. #define XRN_FREEN(X,Y) xrn_free((void *)X,(uint64_t)Y)
  48. #define XRN_FREE_XSTATE(X,Y) xrn_free((void *)X,sizeof(xnum_t)*((uint64_t)(Y)+1))
  49. void xrn_crc64( uint8_t * buffer, int len, uint64_t * crcval
  50. );
  51. void xrn_crc32( uint8_t * buffer, int len, uint32_t * crcval
  52. );
  53. void xrn_crc16( uint8_t * buffer, int len, uint16_t * crcval
  54. );
  55. void xrn_crc8( uint8_t * buffer, int len, uint8_t * crcval
  56. );
  57. int xrn_feof( FILE * fp
  58. );
  59. static const uint64_t CRC64_TABLE[] = {
  60. UINT64_C( 0x0000000000000000 ), UINT64_C( 0x7ad870c830358979 ),
  61. UINT64_C( 0xf5b0e190606b12f2 ), UINT64_C( 0x8f689158505e9b8b ),
  62. UINT64_C( 0xc038e5739841b68f ), UINT64_C( 0xbae095bba8743ff6 ),
  63. UINT64_C( 0x358804e3f82aa47d ), UINT64_C( 0x4f50742bc81f2d04 ),
  64. UINT64_C( 0xab28ecb46814fe75 ), UINT64_C( 0xd1f09c7c5821770c ),
  65. UINT64_C( 0x5e980d24087fec87 ), UINT64_C( 0x24407dec384a65fe ),
  66. UINT64_C( 0x6b1009c7f05548fa ), UINT64_C( 0x11c8790fc060c183 ),
  67. UINT64_C( 0x9ea0e857903e5a08 ), UINT64_C( 0xe478989fa00bd371 ),
  68. UINT64_C( 0x7d08ff3b88be6f81 ), UINT64_C( 0x07d08ff3b88be6f8 ),
  69. UINT64_C( 0x88b81eabe8d57d73 ), UINT64_C( 0xf2606e63d8e0f40a ),
  70. UINT64_C( 0xbd301a4810ffd90e ), UINT64_C( 0xc7e86a8020ca5077 ),
  71. UINT64_C( 0x4880fbd87094cbfc ), UINT64_C( 0x32588b1040a14285 ),
  72. UINT64_C( 0xd620138fe0aa91f4 ), UINT64_C( 0xacf86347d09f188d ),
  73. UINT64_C( 0x2390f21f80c18306 ), UINT64_C( 0x594882d7b0f40a7f ),
  74. UINT64_C( 0x1618f6fc78eb277b ), UINT64_C( 0x6cc0863448deae02 ),
  75. UINT64_C( 0xe3a8176c18803589 ), UINT64_C( 0x997067a428b5bcf0 ),
  76. UINT64_C( 0xfa11fe77117cdf02 ), UINT64_C( 0x80c98ebf2149567b ),
  77. UINT64_C( 0x0fa11fe77117cdf0 ), UINT64_C( 0x75796f2f41224489 ),
  78. UINT64_C( 0x3a291b04893d698d ), UINT64_C( 0x40f16bccb908e0f4 ),
  79. UINT64_C( 0xcf99fa94e9567b7f ), UINT64_C( 0xb5418a5cd963f206 ),
  80. UINT64_C( 0x513912c379682177 ), UINT64_C( 0x2be1620b495da80e ),
  81. UINT64_C( 0xa489f35319033385 ), UINT64_C( 0xde51839b2936bafc ),
  82. UINT64_C( 0x9101f7b0e12997f8 ), UINT64_C( 0xebd98778d11c1e81 ),
  83. UINT64_C( 0x64b116208142850a ), UINT64_C( 0x1e6966e8b1770c73 ),
  84. UINT64_C( 0x8719014c99c2b083 ), UINT64_C( 0xfdc17184a9f739fa ),
  85. UINT64_C( 0x72a9e0dcf9a9a271 ), UINT64_C( 0x08719014c99c2b08 ),
  86. UINT64_C( 0x4721e43f0183060c ), UINT64_C( 0x3df994f731b68f75 ),
  87. UINT64_C( 0xb29105af61e814fe ), UINT64_C( 0xc849756751dd9d87 ),
  88. UINT64_C( 0x2c31edf8f1d64ef6 ), UINT64_C( 0x56e99d30c1e3c78f ),
  89. UINT64_C( 0xd9810c6891bd5c04 ), UINT64_C( 0xa3597ca0a188d57d ),
  90. UINT64_C( 0xec09088b6997f879 ), UINT64_C( 0x96d1784359a27100 ),
  91. UINT64_C( 0x19b9e91b09fcea8b ), UINT64_C( 0x636199d339c963f2 ),
  92. UINT64_C( 0xdf7adabd7a6e2d6f ), UINT64_C( 0xa5a2aa754a5ba416 ),
  93. UINT64_C( 0x2aca3b2d1a053f9d ), UINT64_C( 0x50124be52a30b6e4 ),
  94. UINT64_C( 0x1f423fcee22f9be0 ), UINT64_C( 0x659a4f06d21a1299 ),
  95. UINT64_C( 0xeaf2de5e82448912 ), UINT64_C( 0x902aae96b271006b ),
  96. UINT64_C( 0x74523609127ad31a ), UINT64_C( 0x0e8a46c1224f5a63 ),
  97. UINT64_C( 0x81e2d7997211c1e8 ), UINT64_C( 0xfb3aa75142244891 ),
  98. UINT64_C( 0xb46ad37a8a3b6595 ), UINT64_C( 0xceb2a3b2ba0eecec ),
  99. UINT64_C( 0x41da32eaea507767 ), UINT64_C( 0x3b024222da65fe1e ),
  100. UINT64_C( 0xa2722586f2d042ee ), UINT64_C( 0xd8aa554ec2e5cb97 ),
  101. UINT64_C( 0x57c2c41692bb501c ), UINT64_C( 0x2d1ab4dea28ed965 ),
  102. UINT64_C( 0x624ac0f56a91f461 ), UINT64_C( 0x1892b03d5aa47d18 ),
  103. UINT64_C( 0x97fa21650afae693 ), UINT64_C( 0xed2251ad3acf6fea ),
  104. UINT64_C( 0x095ac9329ac4bc9b ), UINT64_C( 0x7382b9faaaf135e2 ),
  105. UINT64_C( 0xfcea28a2faafae69 ), UINT64_C( 0x8632586aca9a2710 ),
  106. UINT64_C( 0xc9622c4102850a14 ), UINT64_C( 0xb3ba5c8932b0836d ),
  107. UINT64_C( 0x3cd2cdd162ee18e6 ), UINT64_C( 0x460abd1952db919f ),
  108. UINT64_C( 0x256b24ca6b12f26d ), UINT64_C( 0x5fb354025b277b14 ),
  109. UINT64_C( 0xd0dbc55a0b79e09f ), UINT64_C( 0xaa03b5923b4c69e6 ),
  110. UINT64_C( 0xe553c1b9f35344e2 ), UINT64_C( 0x9f8bb171c366cd9b ),
  111. UINT64_C( 0x10e3202993385610 ), UINT64_C( 0x6a3b50e1a30ddf69 ),
  112. UINT64_C( 0x8e43c87e03060c18 ), UINT64_C( 0xf49bb8b633338561 ),
  113. UINT64_C( 0x7bf329ee636d1eea ), UINT64_C( 0x012b592653589793 ),
  114. UINT64_C( 0x4e7b2d0d9b47ba97 ), UINT64_C( 0x34a35dc5ab7233ee ),
  115. UINT64_C( 0xbbcbcc9dfb2ca865 ), UINT64_C( 0xc113bc55cb19211c ),
  116. UINT64_C( 0x5863dbf1e3ac9dec ), UINT64_C( 0x22bbab39d3991495 ),
  117. UINT64_C( 0xadd33a6183c78f1e ), UINT64_C( 0xd70b4aa9b3f20667 ),
  118. UINT64_C( 0x985b3e827bed2b63 ), UINT64_C( 0xe2834e4a4bd8a21a ),
  119. UINT64_C( 0x6debdf121b863991 ), UINT64_C( 0x1733afda2bb3b0e8 ),
  120. UINT64_C( 0xf34b37458bb86399 ), UINT64_C( 0x8993478dbb8deae0 ),
  121. UINT64_C( 0x06fbd6d5ebd3716b ), UINT64_C( 0x7c23a61ddbe6f812 ),
  122. UINT64_C( 0x3373d23613f9d516 ), UINT64_C( 0x49aba2fe23cc5c6f ),
  123. UINT64_C( 0xc6c333a67392c7e4 ), UINT64_C( 0xbc1b436e43a74e9d ),
  124. UINT64_C( 0x95ac9329ac4bc9b5 ), UINT64_C( 0xef74e3e19c7e40cc ),
  125. UINT64_C( 0x601c72b9cc20db47 ), UINT64_C( 0x1ac40271fc15523e ),
  126. UINT64_C( 0x5594765a340a7f3a ), UINT64_C( 0x2f4c0692043ff643 ),
  127. UINT64_C( 0xa02497ca54616dc8 ), UINT64_C( 0xdafce7026454e4b1 ),
  128. UINT64_C( 0x3e847f9dc45f37c0 ), UINT64_C( 0x445c0f55f46abeb9 ),
  129. UINT64_C( 0xcb349e0da4342532 ), UINT64_C( 0xb1eceec59401ac4b ),
  130. UINT64_C( 0xfebc9aee5c1e814f ), UINT64_C( 0x8464ea266c2b0836 ),
  131. UINT64_C( 0x0b0c7b7e3c7593bd ), UINT64_C( 0x71d40bb60c401ac4 ),
  132. UINT64_C( 0xe8a46c1224f5a634 ), UINT64_C( 0x927c1cda14c02f4d ),
  133. UINT64_C( 0x1d148d82449eb4c6 ), UINT64_C( 0x67ccfd4a74ab3dbf ),
  134. UINT64_C( 0x289c8961bcb410bb ), UINT64_C( 0x5244f9a98c8199c2 ),
  135. UINT64_C( 0xdd2c68f1dcdf0249 ), UINT64_C( 0xa7f41839ecea8b30 ),
  136. UINT64_C( 0x438c80a64ce15841 ), UINT64_C( 0x3954f06e7cd4d138 ),
  137. UINT64_C( 0xb63c61362c8a4ab3 ), UINT64_C( 0xcce411fe1cbfc3ca ),
  138. UINT64_C( 0x83b465d5d4a0eece ), UINT64_C( 0xf96c151de49567b7 ),
  139. UINT64_C( 0x76048445b4cbfc3c ), UINT64_C( 0x0cdcf48d84fe7545 ),
  140. UINT64_C( 0x6fbd6d5ebd3716b7 ), UINT64_C( 0x15651d968d029fce ),
  141. UINT64_C( 0x9a0d8ccedd5c0445 ), UINT64_C( 0xe0d5fc06ed698d3c ),
  142. UINT64_C( 0xaf85882d2576a038 ), UINT64_C( 0xd55df8e515432941 ),
  143. UINT64_C( 0x5a3569bd451db2ca ), UINT64_C( 0x20ed197575283bb3 ),
  144. UINT64_C( 0xc49581ead523e8c2 ), UINT64_C( 0xbe4df122e51661bb ),
  145. UINT64_C( 0x3125607ab548fa30 ), UINT64_C( 0x4bfd10b2857d7349 ),
  146. UINT64_C( 0x04ad64994d625e4d ), UINT64_C( 0x7e7514517d57d734 ),
  147. UINT64_C( 0xf11d85092d094cbf ), UINT64_C( 0x8bc5f5c11d3cc5c6 ),
  148. UINT64_C( 0x12b5926535897936 ), UINT64_C( 0x686de2ad05bcf04f ),
  149. UINT64_C( 0xe70573f555e26bc4 ), UINT64_C( 0x9ddd033d65d7e2bd ),
  150. UINT64_C( 0xd28d7716adc8cfb9 ), UINT64_C( 0xa85507de9dfd46c0 ),
  151. UINT64_C( 0x273d9686cda3dd4b ), UINT64_C( 0x5de5e64efd965432 ),
  152. UINT64_C( 0xb99d7ed15d9d8743 ), UINT64_C( 0xc3450e196da80e3a ),
  153. UINT64_C( 0x4c2d9f413df695b1 ), UINT64_C( 0x36f5ef890dc31cc8 ),
  154. UINT64_C( 0x79a59ba2c5dc31cc ), UINT64_C( 0x037deb6af5e9b8b5 ),
  155. UINT64_C( 0x8c157a32a5b7233e ), UINT64_C( 0xf6cd0afa9582aa47 ),
  156. UINT64_C( 0x4ad64994d625e4da ), UINT64_C( 0x300e395ce6106da3 ),
  157. UINT64_C( 0xbf66a804b64ef628 ), UINT64_C( 0xc5bed8cc867b7f51 ),
  158. UINT64_C( 0x8aeeace74e645255 ), UINT64_C( 0xf036dc2f7e51db2c ),
  159. UINT64_C( 0x7f5e4d772e0f40a7 ), UINT64_C( 0x05863dbf1e3ac9de ),
  160. UINT64_C( 0xe1fea520be311aaf ), UINT64_C( 0x9b26d5e88e0493d6 ),
  161. UINT64_C( 0x144e44b0de5a085d ), UINT64_C( 0x6e963478ee6f8124 ),
  162. UINT64_C( 0x21c640532670ac20 ), UINT64_C( 0x5b1e309b16452559 ),
  163. UINT64_C( 0xd476a1c3461bbed2 ), UINT64_C( 0xaeaed10b762e37ab ),
  164. UINT64_C( 0x37deb6af5e9b8b5b ), UINT64_C( 0x4d06c6676eae0222 ),
  165. UINT64_C( 0xc26e573f3ef099a9 ), UINT64_C( 0xb8b627f70ec510d0 ),
  166. UINT64_C( 0xf7e653dcc6da3dd4 ), UINT64_C( 0x8d3e2314f6efb4ad ),
  167. UINT64_C( 0x0256b24ca6b12f26 ), UINT64_C( 0x788ec2849684a65f ),
  168. UINT64_C( 0x9cf65a1b368f752e ), UINT64_C( 0xe62e2ad306bafc57 ),
  169. UINT64_C( 0x6946bb8b56e467dc ), UINT64_C( 0x139ecb4366d1eea5 ),
  170. UINT64_C( 0x5ccebf68aecec3a1 ), UINT64_C( 0x2616cfa09efb4ad8 ),
  171. UINT64_C( 0xa97e5ef8cea5d153 ), UINT64_C( 0xd3a62e30fe90582a ),
  172. UINT64_C( 0xb0c7b7e3c7593bd8 ), UINT64_C( 0xca1fc72bf76cb2a1 ),
  173. UINT64_C( 0x45775673a732292a ), UINT64_C( 0x3faf26bb9707a053 ),
  174. UINT64_C( 0x70ff52905f188d57 ), UINT64_C( 0x0a2722586f2d042e ),
  175. UINT64_C( 0x854fb3003f739fa5 ), UINT64_C( 0xff97c3c80f4616dc ),
  176. UINT64_C( 0x1bef5b57af4dc5ad ), UINT64_C( 0x61372b9f9f784cd4 ),
  177. UINT64_C( 0xee5fbac7cf26d75f ), UINT64_C( 0x9487ca0fff135e26 ),
  178. UINT64_C( 0xdbd7be24370c7322 ), UINT64_C( 0xa10fceec0739fa5b ),
  179. UINT64_C( 0x2e675fb4576761d0 ), UINT64_C( 0x54bf2f7c6752e8a9 ),
  180. UINT64_C( 0xcdcf48d84fe75459 ), UINT64_C( 0xb71738107fd2dd20 ),
  181. UINT64_C( 0x387fa9482f8c46ab ), UINT64_C( 0x42a7d9801fb9cfd2 ),
  182. UINT64_C( 0x0df7adabd7a6e2d6 ), UINT64_C( 0x772fdd63e7936baf ),
  183. UINT64_C( 0xf8474c3bb7cdf024 ), UINT64_C( 0x829f3cf387f8795d ),
  184. UINT64_C( 0x66e7a46c27f3aa2c ), UINT64_C( 0x1c3fd4a417c62355 ),
  185. UINT64_C( 0x935745fc4798b8de ), UINT64_C( 0xe98f353477ad31a7 ),
  186. UINT64_C( 0xa6df411fbfb21ca3 ), UINT64_C( 0xdc0731d78f8795da ),
  187. UINT64_C( 0x536fa08fdfd90e51 ), UINT64_C( 0x29b7d047efec8728 )
  188. };
  189. static const unsigned int CRC32_TABLE[] = {
  190. UINT32_C( 0x00000000 ), UINT32_C( 0x04c11db7 ), UINT32_C( 0x09823b6e ), UINT32_C( 0x0d4326d9 ),
  191. UINT32_C( 0x130476dc ), UINT32_C( 0x17c56b6b ), UINT32_C( 0x1a864db2 ), UINT32_C( 0x1e475005 ),
  192. UINT32_C( 0x2608edb8 ), UINT32_C( 0x22c9f00f ), UINT32_C( 0x2f8ad6d6 ), UINT32_C( 0x2b4bcb61 ),
  193. UINT32_C( 0x350c9b64 ), UINT32_C( 0x31cd86d3 ), UINT32_C( 0x3c8ea00a ), UINT32_C( 0x384fbdbd ),
  194. UINT32_C( 0x4c11db70 ), UINT32_C( 0x48d0c6c7 ), UINT32_C( 0x4593e01e ), UINT32_C( 0x4152fda9 ),
  195. UINT32_C( 0x5f15adac ), UINT32_C( 0x5bd4b01b ), UINT32_C( 0x569796c2 ), UINT32_C( 0x52568b75 ),
  196. UINT32_C( 0x6a1936c8 ), UINT32_C( 0x6ed82b7f ), UINT32_C( 0x639b0da6 ), UINT32_C( 0x675a1011 ),
  197. UINT32_C( 0x791d4014 ), UINT32_C( 0x7ddc5da3 ), UINT32_C( 0x709f7b7a ), UINT32_C( 0x745e66cd ),
  198. UINT32_C( 0x9823b6e0 ), UINT32_C( 0x9ce2ab57 ), UINT32_C( 0x91a18d8e ), UINT32_C( 0x95609039 ),
  199. UINT32_C( 0x8b27c03c ), UINT32_C( 0x8fe6dd8b ), UINT32_C( 0x82a5fb52 ), UINT32_C( 0x8664e6e5 ),
  200. UINT32_C( 0xbe2b5b58 ), UINT32_C( 0xbaea46ef ), UINT32_C( 0xb7a96036 ), UINT32_C( 0xb3687d81 ),
  201. UINT32_C( 0xad2f2d84 ), UINT32_C( 0xa9ee3033 ), UINT32_C( 0xa4ad16ea ), UINT32_C( 0xa06c0b5d ),
  202. UINT32_C( 0xd4326d90 ), UINT32_C( 0xd0f37027 ), UINT32_C( 0xddb056fe ), UINT32_C( 0xd9714b49 ),
  203. UINT32_C( 0xc7361b4c ), UINT32_C( 0xc3f706fb ), UINT32_C( 0xceb42022 ), UINT32_C( 0xca753d95 ),
  204. UINT32_C( 0xf23a8028 ), UINT32_C( 0xf6fb9d9f ), UINT32_C( 0xfbb8bb46 ), UINT32_C( 0xff79a6f1 ),
  205. UINT32_C( 0xe13ef6f4 ), UINT32_C( 0xe5ffeb43 ), UINT32_C( 0xe8bccd9a ), UINT32_C( 0xec7dd02d ),
  206. UINT32_C( 0x34867077 ), UINT32_C( 0x30476dc0 ), UINT32_C( 0x3d044b19 ), UINT32_C( 0x39c556ae ),
  207. UINT32_C( 0x278206ab ), UINT32_C( 0x23431b1c ), UINT32_C( 0x2e003dc5 ), UINT32_C( 0x2ac12072 ),
  208. UINT32_C( 0x128e9dcf ), UINT32_C( 0x164f8078 ), UINT32_C( 0x1b0ca6a1 ), UINT32_C( 0x1fcdbb16 ),
  209. UINT32_C( 0x018aeb13 ), UINT32_C( 0x054bf6a4 ), UINT32_C( 0x0808d07d ), UINT32_C( 0x0cc9cdca ),
  210. UINT32_C( 0x7897ab07 ), UINT32_C( 0x7c56b6b0 ), UINT32_C( 0x71159069 ), UINT32_C( 0x75d48dde ),
  211. UINT32_C( 0x6b93dddb ), UINT32_C( 0x6f52c06c ), UINT32_C( 0x6211e6b5 ), UINT32_C( 0x66d0fb02 ),
  212. UINT32_C( 0x5e9f46bf ), UINT32_C( 0x5a5e5b08 ), UINT32_C( 0x571d7dd1 ), UINT32_C( 0x53dc6066 ),
  213. UINT32_C( 0x4d9b3063 ), UINT32_C( 0x495a2dd4 ), UINT32_C( 0x44190b0d ), UINT32_C( 0x40d816ba ),
  214. UINT32_C( 0xaca5c697 ), UINT32_C( 0xa864db20 ), UINT32_C( 0xa527fdf9 ), UINT32_C( 0xa1e6e04e ),
  215. UINT32_C( 0xbfa1b04b ), UINT32_C( 0xbb60adfc ), UINT32_C( 0xb6238b25 ), UINT32_C( 0xb2e29692 ),
  216. UINT32_C( 0x8aad2b2f ), UINT32_C( 0x8e6c3698 ), UINT32_C( 0x832f1041 ), UINT32_C( 0x87ee0df6 ),
  217. UINT32_C( 0x99a95df3 ), UINT32_C( 0x9d684044 ), UINT32_C( 0x902b669d ), UINT32_C( 0x94ea7b2a ),
  218. UINT32_C( 0xe0b41de7 ), UINT32_C( 0xe4750050 ), UINT32_C( 0xe9362689 ), UINT32_C( 0xedf73b3e ),
  219. UINT32_C( 0xf3b06b3b ), UINT32_C( 0xf771768c ), UINT32_C( 0xfa325055 ), UINT32_C( 0xfef34de2 ),
  220. UINT32_C( 0xc6bcf05f ), UINT32_C( 0xc27dede8 ), UINT32_C( 0xcf3ecb31 ), UINT32_C( 0xcbffd686 ),
  221. UINT32_C( 0xd5b88683 ), UINT32_C( 0xd1799b34 ), UINT32_C( 0xdc3abded ), UINT32_C( 0xd8fba05a ),
  222. UINT32_C( 0x690ce0ee ), UINT32_C( 0x6dcdfd59 ), UINT32_C( 0x608edb80 ), UINT32_C( 0x644fc637 ),
  223. UINT32_C( 0x7a089632 ), UINT32_C( 0x7ec98b85 ), UINT32_C( 0x738aad5c ), UINT32_C( 0x774bb0eb ),
  224. UINT32_C( 0x4f040d56 ), UINT32_C( 0x4bc510e1 ), UINT32_C( 0x46863638 ), UINT32_C( 0x42472b8f ),
  225. UINT32_C( 0x5c007b8a ), UINT32_C( 0x58c1663d ), UINT32_C( 0x558240e4 ), UINT32_C( 0x51435d53 ),
  226. UINT32_C( 0x251d3b9e ), UINT32_C( 0x21dc2629 ), UINT32_C( 0x2c9f00f0 ), UINT32_C( 0x285e1d47 ),
  227. UINT32_C( 0x36194d42 ), UINT32_C( 0x32d850f5 ), UINT32_C( 0x3f9b762c ), UINT32_C( 0x3b5a6b9b ),
  228. UINT32_C( 0x0315d626 ), UINT32_C( 0x07d4cb91 ), UINT32_C( 0x0a97ed48 ), UINT32_C( 0x0e56f0ff ),
  229. UINT32_C( 0x1011a0fa ), UINT32_C( 0x14d0bd4d ), UINT32_C( 0x19939b94 ), UINT32_C( 0x1d528623 ),
  230. UINT32_C( 0xf12f560e ), UINT32_C( 0xf5ee4bb9 ), UINT32_C( 0xf8ad6d60 ), UINT32_C( 0xfc6c70d7 ),
  231. UINT32_C( 0xe22b20d2 ), UINT32_C( 0xe6ea3d65 ), UINT32_C( 0xeba91bbc ), UINT32_C( 0xef68060b ),
  232. UINT32_C( 0xd727bbb6 ), UINT32_C( 0xd3e6a601 ), UINT32_C( 0xdea580d8 ), UINT32_C( 0xda649d6f ),
  233. UINT32_C( 0xc423cd6a ), UINT32_C( 0xc0e2d0dd ), UINT32_C( 0xcda1f604 ), UINT32_C( 0xc960ebb3 ),
  234. UINT32_C( 0xbd3e8d7e ), UINT32_C( 0xb9ff90c9 ), UINT32_C( 0xb4bcb610 ), UINT32_C( 0xb07daba7 ),
  235. UINT32_C( 0xae3afba2 ), UINT32_C( 0xaafbe615 ), UINT32_C( 0xa7b8c0cc ), UINT32_C( 0xa379dd7b ),
  236. UINT32_C( 0x9b3660c6 ), UINT32_C( 0x9ff77d71 ), UINT32_C( 0x92b45ba8 ), UINT32_C( 0x9675461f ),
  237. UINT32_C( 0x8832161a ), UINT32_C( 0x8cf30bad ), UINT32_C( 0x81b02d74 ), UINT32_C( 0x857130c3 ),
  238. UINT32_C( 0x5d8a9099 ), UINT32_C( 0x594b8d2e ), UINT32_C( 0x5408abf7 ), UINT32_C( 0x50c9b640 ),
  239. UINT32_C( 0x4e8ee645 ), UINT32_C( 0x4a4ffbf2 ), UINT32_C( 0x470cdd2b ), UINT32_C( 0x43cdc09c ),
  240. UINT32_C( 0x7b827d21 ), UINT32_C( 0x7f436096 ), UINT32_C( 0x7200464f ), UINT32_C( 0x76c15bf8 ),
  241. UINT32_C( 0x68860bfd ), UINT32_C( 0x6c47164a ), UINT32_C( 0x61043093 ), UINT32_C( 0x65c52d24 ),
  242. UINT32_C( 0x119b4be9 ), UINT32_C( 0x155a565e ), UINT32_C( 0x18197087 ), UINT32_C( 0x1cd86d30 ),
  243. UINT32_C( 0x029f3d35 ), UINT32_C( 0x065e2082 ), UINT32_C( 0x0b1d065b ), UINT32_C( 0x0fdc1bec ),
  244. UINT32_C( 0x3793a651 ), UINT32_C( 0x3352bbe6 ), UINT32_C( 0x3e119d3f ), UINT32_C( 0x3ad08088 ),
  245. UINT32_C( 0x2497d08d ), UINT32_C( 0x2056cd3a ), UINT32_C( 0x2d15ebe3 ), UINT32_C( 0x29d4f654 ),
  246. UINT32_C( 0xc5a92679 ), UINT32_C( 0xc1683bce ), UINT32_C( 0xcc2b1d17 ), UINT32_C( 0xc8ea00a0 ),
  247. UINT32_C( 0xd6ad50a5 ), UINT32_C( 0xd26c4d12 ), UINT32_C( 0xdf2f6bcb ), UINT32_C( 0xdbee767c ),
  248. UINT32_C( 0xe3a1cbc1 ), UINT32_C( 0xe760d676 ), UINT32_C( 0xea23f0af ), UINT32_C( 0xeee2ed18 ),
  249. UINT32_C( 0xf0a5bd1d ), UINT32_C( 0xf464a0aa ), UINT32_C( 0xf9278673 ), UINT32_C( 0xfde69bc4 ),
  250. UINT32_C( 0x89b8fd09 ), UINT32_C( 0x8d79e0be ), UINT32_C( 0x803ac667 ), UINT32_C( 0x84fbdbd0 ),
  251. UINT32_C( 0x9abc8bd5 ), UINT32_C( 0x9e7d9662 ), UINT32_C( 0x933eb0bb ), UINT32_C( 0x97ffad0c ),
  252. UINT32_C( 0xafb010b1 ), UINT32_C( 0xab710d06 ), UINT32_C( 0xa6322bdf ), UINT32_C( 0xa2f33668 ),
  253. UINT32_C( 0xbcb4666d ), UINT32_C( 0xb8757bda ), UINT32_C( 0xb5365d03 ), UINT32_C( 0xb1f740b4 )
  254. };
  255. static const uint16_t CRC16_TABLE[] = {
  256. UINT16_C( 0x0000 ), UINT16_C( 0xc181 ), UINT16_C( 0xc301 ), UINT16_C( 0x0280 ), UINT16_C( 0xc241 ),
  257. UINT16_C( 0xc601 ), UINT16_C( 0x0780 ), UINT16_C( 0x0500 ), UINT16_C( 0xc481 ), UINT16_C( 0x0440 ),
  258. UINT16_C( 0xcc01 ), UINT16_C( 0x0d80 ), UINT16_C( 0x0f00 ), UINT16_C( 0xce81 ), UINT16_C( 0x0e40 ),
  259. UINT16_C( 0x0a00 ), UINT16_C( 0xcb81 ), UINT16_C( 0xc901 ), UINT16_C( 0x0880 ), UINT16_C( 0xc841 ),
  260. UINT16_C( 0xd801 ), UINT16_C( 0x1980 ), UINT16_C( 0x1b00 ), UINT16_C( 0xda81 ), UINT16_C( 0x1a40 ),
  261. UINT16_C( 0x1e00 ), UINT16_C( 0xdf81 ), UINT16_C( 0xdd01 ), UINT16_C( 0x1c80 ), UINT16_C( 0xdc41 ),
  262. UINT16_C( 0x1400 ), UINT16_C( 0xd581 ), UINT16_C( 0xd701 ), UINT16_C( 0x1680 ), UINT16_C( 0xd641 ),
  263. UINT16_C( 0xd201 ), UINT16_C( 0x1380 ), UINT16_C( 0x1100 ), UINT16_C( 0xd081 ), UINT16_C( 0x1040 ),
  264. UINT16_C( 0xf001 ), UINT16_C( 0x3180 ), UINT16_C( 0x3300 ), UINT16_C( 0xf281 ), UINT16_C( 0x3240 ),
  265. UINT16_C( 0x3600 ), UINT16_C( 0xf781 ), UINT16_C( 0xf501 ), UINT16_C( 0x3480 ), UINT16_C( 0xf441 ),
  266. UINT16_C( 0x3c00 ), UINT16_C( 0xfd81 ), UINT16_C( 0xff01 ), UINT16_C( 0x3e80 ), UINT16_C( 0xfe41 ),
  267. UINT16_C( 0xfa01 ), UINT16_C( 0x3b80 ), UINT16_C( 0x3900 ), UINT16_C( 0xf881 ), UINT16_C( 0x3840 ),
  268. UINT16_C( 0x2800 ), UINT16_C( 0xe981 ), UINT16_C( 0xeb01 ), UINT16_C( 0x2a80 ), UINT16_C( 0xea41 ),
  269. UINT16_C( 0xee01 ), UINT16_C( 0x2f80 ), UINT16_C( 0x2d00 ), UINT16_C( 0xec81 ), UINT16_C( 0x2c40 ),
  270. UINT16_C( 0xe401 ), UINT16_C( 0x2580 ), UINT16_C( 0x2700 ), UINT16_C( 0xe681 ), UINT16_C( 0x2640 ),
  271. UINT16_C( 0x2200 ), UINT16_C( 0xe381 ), UINT16_C( 0xe101 ), UINT16_C( 0x2080 ), UINT16_C( 0xe041 ),
  272. UINT16_C( 0xa001 ), UINT16_C( 0x6180 ), UINT16_C( 0x6300 ), UINT16_C( 0xa281 ), UINT16_C( 0x6240 ),
  273. UINT16_C( 0x6600 ), UINT16_C( 0xa781 ), UINT16_C( 0xa501 ), UINT16_C( 0x6480 ), UINT16_C( 0xa441 ),
  274. UINT16_C( 0x6c00 ), UINT16_C( 0xad81 ), UINT16_C( 0xaf01 ), UINT16_C( 0x6e80 ), UINT16_C( 0xae41 ),
  275. UINT16_C( 0xaa01 ), UINT16_C( 0x6b80 ), UINT16_C( 0x6900 ), UINT16_C( 0xa881 ), UINT16_C( 0x6840 ),
  276. UINT16_C( 0x7800 ), UINT16_C( 0xb981 ), UINT16_C( 0xbb01 ), UINT16_C( 0x7a80 ), UINT16_C( 0xba41 ),
  277. UINT16_C( 0xbe01 ), UINT16_C( 0x7f80 ), UINT16_C( 0x7d00 ), UINT16_C( 0xbc81 ), UINT16_C( 0x7c40 ),
  278. UINT16_C( 0xb401 ), UINT16_C( 0x7580 ), UINT16_C( 0x7700 ), UINT16_C( 0xb681 ), UINT16_C( 0x7640 ),
  279. UINT16_C( 0x7200 ), UINT16_C( 0xb381 ), UINT16_C( 0xb101 ), UINT16_C( 0x7080 ), UINT16_C( 0xb041 ),
  280. UINT16_C( 0x5000 ), UINT16_C( 0x9181 ), UINT16_C( 0x9301 ), UINT16_C( 0x5280 ), UINT16_C( 0x9241 ),
  281. UINT16_C( 0x9601 ), UINT16_C( 0x5780 ), UINT16_C( 0x5500 ), UINT16_C( 0x9481 ), UINT16_C( 0x5440 ),
  282. UINT16_C( 0x9c01 ), UINT16_C( 0x5d80 ), UINT16_C( 0x5f00 ), UINT16_C( 0x9e81 ), UINT16_C( 0x5e40 ),
  283. UINT16_C( 0x5a00 ), UINT16_C( 0x9b81 ), UINT16_C( 0x9901 ), UINT16_C( 0x5880 ), UINT16_C( 0x9841 ),
  284. UINT16_C( 0x8801 ), UINT16_C( 0x4980 ), UINT16_C( 0x4b00 ), UINT16_C( 0x8a81 ), UINT16_C( 0x4a40 ),
  285. UINT16_C( 0x4e00 ), UINT16_C( 0x8f81 ), UINT16_C( 0x8d01 ), UINT16_C( 0x4c80 ), UINT16_C( 0x8c41 ),
  286. UINT16_C( 0x4400 ), UINT16_C( 0x8581 ), UINT16_C( 0x8701 ), UINT16_C( 0x4680 ), UINT16_C( 0x8641 ),
  287. UINT16_C( 0x8201 ), UINT16_C( 0x4380 ), UINT16_C( 0x4100 ), UINT16_C( 0x8081 ), UINT16_C( 0x4040 )
  288. };
  289. static const uint8_t CRC8_TABLE[] = {
  290. UINT8_C( 0x00 ), UINT8_C( 0x07 ), UINT8_C( 0x0e ), UINT8_C( 0x09 ), UINT8_C( 0x1c ), UINT8_C( 0x1b ),
  291. UINT8_C( 0x12 ), UINT8_C( 0x15 ), UINT8_C( 0x38 ), UINT8_C( 0x3f ), UINT8_C( 0x36 ), UINT8_C( 0x31 ),
  292. UINT8_C( 0x24 ), UINT8_C( 0x23 ), UINT8_C( 0x2a ), UINT8_C( 0x2d ), UINT8_C( 0x70 ), UINT8_C( 0x77 ),
  293. UINT8_C( 0x7e ), UINT8_C( 0x79 ), UINT8_C( 0x6c ), UINT8_C( 0x6b ), UINT8_C( 0x62 ), UINT8_C( 0x65 ),
  294. UINT8_C( 0x48 ), UINT8_C( 0x4f ), UINT8_C( 0x46 ), UINT8_C( 0x41 ), UINT8_C( 0x54 ), UINT8_C( 0x53 ),
  295. UINT8_C( 0x5a ), UINT8_C( 0x5d ), UINT8_C( 0xe0 ), UINT8_C( 0xe7 ), UINT8_C( 0xee ), UINT8_C( 0xe9 ),
  296. UINT8_C( 0xfc ), UINT8_C( 0xfb ), UINT8_C( 0xf2 ), UINT8_C( 0xf5 ), UINT8_C( 0xd8 ), UINT8_C( 0xdf ),
  297. UINT8_C( 0xd6 ), UINT8_C( 0xd1 ), UINT8_C( 0xc4 ), UINT8_C( 0xc3 ), UINT8_C( 0xca ), UINT8_C( 0xcd ),
  298. UINT8_C( 0x90 ), UINT8_C( 0x97 ), UINT8_C( 0x9e ), UINT8_C( 0x99 ), UINT8_C( 0x8c ), UINT8_C( 0x8b ),
  299. UINT8_C( 0x82 ), UINT8_C( 0x85 ), UINT8_C( 0xa8 ), UINT8_C( 0xaf ), UINT8_C( 0xa6 ), UINT8_C( 0xa1 ),
  300. UINT8_C( 0xb4 ), UINT8_C( 0xb3 ), UINT8_C( 0xba ), UINT8_C( 0xbd ), UINT8_C( 0xc7 ), UINT8_C( 0xc0 ),
  301. UINT8_C( 0xc9 ), UINT8_C( 0xce ), UINT8_C( 0xdb ), UINT8_C( 0xdc ), UINT8_C( 0xd5 ), UINT8_C( 0xd2 ),
  302. UINT8_C( 0xff ), UINT8_C( 0xf8 ), UINT8_C( 0xf1 ), UINT8_C( 0xf6 ), UINT8_C( 0xe3 ), UINT8_C( 0xe4 ),
  303. UINT8_C( 0xed ), UINT8_C( 0xea ), UINT8_C( 0xb7 ), UINT8_C( 0xb0 ), UINT8_C( 0xb9 ), UINT8_C( 0xbe ),
  304. UINT8_C( 0xab ), UINT8_C( 0xac ), UINT8_C( 0xa5 ), UINT8_C( 0xa2 ), UINT8_C( 0x8f ), UINT8_C( 0x88 ),
  305. UINT8_C( 0x81 ), UINT8_C( 0x86 ), UINT8_C( 0x93 ), UINT8_C( 0x94 ), UINT8_C( 0x9d ), UINT8_C( 0x9a ),
  306. UINT8_C( 0x27 ), UINT8_C( 0x20 ), UINT8_C( 0x29 ), UINT8_C( 0x2e ), UINT8_C( 0x3b ), UINT8_C( 0x3c ),
  307. UINT8_C( 0x35 ), UINT8_C( 0x32 ), UINT8_C( 0x1f ), UINT8_C( 0x18 ), UINT8_C( 0x11 ), UINT8_C( 0x16 ),
  308. UINT8_C( 0x03 ), UINT8_C( 0x04 ), UINT8_C( 0x0d ), UINT8_C( 0x0a ), UINT8_C( 0x57 ), UINT8_C( 0x50 ),
  309. UINT8_C( 0x59 ), UINT8_C( 0x5e ), UINT8_C( 0x4b ), UINT8_C( 0x4c ), UINT8_C( 0x45 ), UINT8_C( 0x42 ),
  310. UINT8_C( 0x6f ), UINT8_C( 0x68 ), UINT8_C( 0x61 ), UINT8_C( 0x66 ), UINT8_C( 0x73 ), UINT8_C( 0x74 ),
  311. UINT8_C( 0x7d ), UINT8_C( 0x7a ), UINT8_C( 0x89 ), UINT8_C( 0x8e ), UINT8_C( 0x87 ), UINT8_C( 0x80 ),
  312. UINT8_C( 0x95 ), UINT8_C( 0x92 ), UINT8_C( 0x9b ), UINT8_C( 0x9c ), UINT8_C( 0xb1 ), UINT8_C( 0xb6 ),
  313. UINT8_C( 0xbf ), UINT8_C( 0xb8 ), UINT8_C( 0xad ), UINT8_C( 0xaa ), UINT8_C( 0xa3 ), UINT8_C( 0xa4 ),
  314. UINT8_C( 0xf9 ), UINT8_C( 0xfe ), UINT8_C( 0xf7 ), UINT8_C( 0xf0 ), UINT8_C( 0xe5 ), UINT8_C( 0xe2 ),
  315. UINT8_C( 0xeb ), UINT8_C( 0xec ), UINT8_C( 0xc1 ), UINT8_C( 0xc6 ), UINT8_C( 0xcf ), UINT8_C( 0xc8 ),
  316. UINT8_C( 0xdd ), UINT8_C( 0xda ), UINT8_C( 0xd3 ), UINT8_C( 0xd4 ), UINT8_C( 0x69 ), UINT8_C( 0x6e ),
  317. UINT8_C( 0x67 ), UINT8_C( 0x60 ), UINT8_C( 0x75 ), UINT8_C( 0x72 ), UINT8_C( 0x7b ), UINT8_C( 0x7c ),
  318. UINT8_C( 0x51 ), UINT8_C( 0x56 ), UINT8_C( 0x5f ), UINT8_C( 0x58 ), UINT8_C( 0x4d ), UINT8_C( 0x4a ),
  319. UINT8_C( 0x43 ), UINT8_C( 0x44 ), UINT8_C( 0x19 ), UINT8_C( 0x1e ), UINT8_C( 0x17 ), UINT8_C( 0x10 ),
  320. UINT8_C( 0x05 ), UINT8_C( 0x02 ), UINT8_C( 0x0b ), UINT8_C( 0x0c ), UINT8_C( 0x21 ), UINT8_C( 0x26 ),
  321. UINT8_C( 0x2f ), UINT8_C( 0x28 ), UINT8_C( 0x3d ), UINT8_C( 0x3a ), UINT8_C( 0x33 ), UINT8_C( 0x34 ),
  322. UINT8_C( 0x4e ), UINT8_C( 0x49 ), UINT8_C( 0x40 ), UINT8_C( 0x47 ), UINT8_C( 0x52 ), UINT8_C( 0x55 ),
  323. UINT8_C( 0x5c ), UINT8_C( 0x5b ), UINT8_C( 0x76 ), UINT8_C( 0x71 ), UINT8_C( 0x78 ), UINT8_C( 0x7f ),
  324. UINT8_C( 0x6a ), UINT8_C( 0x6d ), UINT8_C( 0x64 ), UINT8_C( 0x63 ), UINT8_C( 0x3e ), UINT8_C( 0x39 ),
  325. UINT8_C( 0x30 ), UINT8_C( 0x37 ), UINT8_C( 0x22 ), UINT8_C( 0x25 ), UINT8_C( 0x2c ), UINT8_C( 0x2b ),
  326. UINT8_C( 0x06 ), UINT8_C( 0x01 ), UINT8_C( 0x08 ), UINT8_C( 0x0f ), UINT8_C( 0x1a ), UINT8_C( 0x1d ),
  327. UINT8_C( 0x14 ), UINT8_C( 0x13 ), UINT8_C( 0xae ), UINT8_C( 0xa9 ), UINT8_C( 0xa0 ), UINT8_C( 0xa7 ),
  328. UINT8_C( 0xb2 ), UINT8_C( 0xb5 ), UINT8_C( 0xbc ), UINT8_C( 0xbb ), UINT8_C( 0x96 ), UINT8_C( 0x91 ),
  329. UINT8_C( 0x98 ), UINT8_C( 0x9f ), UINT8_C( 0x8a ), UINT8_C( 0x8d ), UINT8_C( 0x84 ), UINT8_C( 0x83 ),
  330. UINT8_C( 0xde ), UINT8_C( 0xd9 ), UINT8_C( 0xd0 ), UINT8_C( 0xd7 ), UINT8_C( 0xc2 ), UINT8_C( 0xc5 ),
  331. UINT8_C( 0xcc ), UINT8_C( 0xcb ), UINT8_C( 0xe6 ), UINT8_C( 0xe1 ), UINT8_C( 0xe8 ), UINT8_C( 0xef ),
  332. UINT8_C( 0xfa ), UINT8_C( 0xfd ), UINT8_C( 0xf4 ), UINT8_C( 0xf3 )
  333. };
  334. void xrn_load_sub_type( uint8_t subtype, uint8_t * crc_bytes, int *nbits
  335. );
  336. void xrn_dump_sub_type( uint8_t * subtype, uint8_t crc_bytes, int nbits
  337. );
  338. typedef struct cksumnum_t {
  339. uint8_t num[32];
  340. } cksumnum_t;
  341. typedef struct header_block_t {
  342. uint32_t magic_number;
  343. uint32_t tag;
  344. uint64_t offset;
  345. uint64_t length;
  346. uint64_t total_length;
  347. uint8_t crc8;
  348. } header_block_t;
  349. typedef struct steg_header_block_t {
  350. header_block_t a;
  351. header_block_t b;
  352. } steg_header_block_t;
  353. void print_header_block( header_block_t header
  354. );
  355. uint8_t cksumnum_buff_crc8( uint8_t buff_index, cksumnum_t * chsumnum_buff
  356. );
  357. int get_random_bytes( uint8_t * buffer, uint32_t len
  358. );
  359. #endif