Exportable version of WizziLab's modem driver.
kal_crypto.h@13:10589aaf8853, 2017-09-18 (annotated)
- Committer:
- Jeej
- Date:
- Mon Sep 18 13:35:49 2017 +0000
- Revision:
- 13:10589aaf8853
Added root permission functions.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeej | 13:10589aaf8853 | 1 | /// @copyright |
Jeej | 13:10589aaf8853 | 2 | /// ========================================================================={{{ |
Jeej | 13:10589aaf8853 | 3 | /// Copyright (c) 20XX / |
Jeej | 13:10589aaf8853 | 4 | /// All rights reserved / |
Jeej | 13:10589aaf8853 | 5 | /// / |
Jeej | 13:10589aaf8853 | 6 | /// IMPORTANT: This Software may not be modified, copied or distributed unless / |
Jeej | 13:10589aaf8853 | 7 | /// embedded on a WizziLab product. Other than for the foregoing purpose, this / |
Jeej | 13:10589aaf8853 | 8 | /// Software and/or its documentation may not be used, reproduced, copied, / |
Jeej | 13:10589aaf8853 | 9 | /// prepared derivative works of, modified, performed, distributed, displayed / |
Jeej | 13:10589aaf8853 | 10 | /// or sold for any purpose. For the sole purpose of embedding this Software / |
Jeej | 13:10589aaf8853 | 11 | /// on a WizziLab product, copy, modification and distribution of this / |
Jeej | 13:10589aaf8853 | 12 | /// Software is granted provided that the following conditions are respected: / |
Jeej | 13:10589aaf8853 | 13 | /// / |
Jeej | 13:10589aaf8853 | 14 | /// * Redistributions of source code must retain the above copyright notice, / |
Jeej | 13:10589aaf8853 | 15 | /// this list of conditions and the following disclaimer / |
Jeej | 13:10589aaf8853 | 16 | /// / |
Jeej | 13:10589aaf8853 | 17 | /// * Redistributions in binary form must reproduce the above copyright / |
Jeej | 13:10589aaf8853 | 18 | /// notice, this list of conditions and the following disclaimer in the / |
Jeej | 13:10589aaf8853 | 19 | /// documentation and/or other materials provided with the distribution. / |
Jeej | 13:10589aaf8853 | 20 | /// / |
Jeej | 13:10589aaf8853 | 21 | /// * The name of WizziLab can not be used to endorse or promote products / |
Jeej | 13:10589aaf8853 | 22 | /// derived from this software without specific prior written permission. / |
Jeej | 13:10589aaf8853 | 23 | /// / |
Jeej | 13:10589aaf8853 | 24 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS / |
Jeej | 13:10589aaf8853 | 25 | /// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED / |
Jeej | 13:10589aaf8853 | 26 | /// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR / |
Jeej | 13:10589aaf8853 | 27 | /// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR / |
Jeej | 13:10589aaf8853 | 28 | /// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, / |
Jeej | 13:10589aaf8853 | 29 | /// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, / |
Jeej | 13:10589aaf8853 | 30 | /// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, / |
Jeej | 13:10589aaf8853 | 31 | /// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY / |
Jeej | 13:10589aaf8853 | 32 | /// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING / |
Jeej | 13:10589aaf8853 | 33 | /// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS / |
Jeej | 13:10589aaf8853 | 34 | /// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. / |
Jeej | 13:10589aaf8853 | 35 | /// WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, / |
Jeej | 13:10589aaf8853 | 36 | /// ENHANCEMENTS OR MODIFICATIONS. / |
Jeej | 13:10589aaf8853 | 37 | /// / |
Jeej | 13:10589aaf8853 | 38 | /// Should you have any questions regarding your right to use this Software, / |
Jeej | 13:10589aaf8853 | 39 | /// contact WizziLab at www.wizzilab.com. / |
Jeej | 13:10589aaf8853 | 40 | /// / |
Jeej | 13:10589aaf8853 | 41 | /// =========================================================================}}} |
Jeej | 13:10589aaf8853 | 42 | /// @endcopyright |
Jeej | 13:10589aaf8853 | 43 | |
Jeej | 13:10589aaf8853 | 44 | // ======================================================================= |
Jeej | 13:10589aaf8853 | 45 | /// @file kal_crypto.h |
Jeej | 13:10589aaf8853 | 46 | /// @brief KAL Crypto utilities |
Jeej | 13:10589aaf8853 | 47 | // ======================================================================= |
Jeej | 13:10589aaf8853 | 48 | |
Jeej | 13:10589aaf8853 | 49 | #ifndef _KAL_CRYPTO_H_ |
Jeej | 13:10589aaf8853 | 50 | #define _KAL_CRYPTO_H_ |
Jeej | 13:10589aaf8853 | 51 | |
Jeej | 13:10589aaf8853 | 52 | #include "hal_types.h" |
Jeej | 13:10589aaf8853 | 53 | |
Jeej | 13:10589aaf8853 | 54 | // ====================================================================== |
Jeej | 13:10589aaf8853 | 55 | // |
Jeej | 13:10589aaf8853 | 56 | // |
Jeej | 13:10589aaf8853 | 57 | // SHA-2 256 Tool-suite. |
Jeej | 13:10589aaf8853 | 58 | // (From Brad Conte's Licence-free implementation) |
Jeej | 13:10589aaf8853 | 59 | // |
Jeej | 13:10589aaf8853 | 60 | // |
Jeej | 13:10589aaf8853 | 61 | // ====================================================================== |
Jeej | 13:10589aaf8853 | 62 | |
Jeej | 13:10589aaf8853 | 63 | /// SHA256 digest output size in bytes |
Jeej | 13:10589aaf8853 | 64 | #define SHA256_BLOCK_SIZE 32 |
Jeej | 13:10589aaf8853 | 65 | |
Jeej | 13:10589aaf8853 | 66 | //====================================================================== |
Jeej | 13:10589aaf8853 | 67 | // kal_sha256_init |
Jeej | 13:10589aaf8853 | 68 | //---------------------------------------------------------------------- |
Jeej | 13:10589aaf8853 | 69 | /// @brief Initialize an SHA Hash generation. To be called before any |
Jeej | 13:10589aaf8853 | 70 | /// other kal_sha256_update/final functions. |
Jeej | 13:10589aaf8853 | 71 | //====================================================================== |
Jeej | 13:10589aaf8853 | 72 | public void kal_sha256_init(void); |
Jeej | 13:10589aaf8853 | 73 | |
Jeej | 13:10589aaf8853 | 74 | //====================================================================== |
Jeej | 13:10589aaf8853 | 75 | // kal_sha256_update |
Jeej | 13:10589aaf8853 | 76 | //---------------------------------------------------------------------- |
Jeej | 13:10589aaf8853 | 77 | /// @brief Used to 'push' new data into the hash calculation. |
Jeej | 13:10589aaf8853 | 78 | /// @param data pointer to the (char) data stream to hash. |
Jeej | 13:10589aaf8853 | 79 | /// @param len data stream length in bytes |
Jeej | 13:10589aaf8853 | 80 | //====================================================================== |
Jeej | 13:10589aaf8853 | 81 | public void kal_sha256_update(u8 data[], uint len); |
Jeej | 13:10589aaf8853 | 82 | |
Jeej | 13:10589aaf8853 | 83 | //====================================================================== |
Jeej | 13:10589aaf8853 | 84 | // kal_sha256_final |
Jeej | 13:10589aaf8853 | 85 | //---------------------------------------------------------------------- |
Jeej | 13:10589aaf8853 | 86 | /// @brief To be called when all data has been pushed into the hash |
Jeej | 13:10589aaf8853 | 87 | /// generator. Finalize and outputs resulting SHA hash. |
Jeej | 13:10589aaf8853 | 88 | /// @param hash Pointer to the Output (char) buffer. Fills 32-bytes. |
Jeej | 13:10589aaf8853 | 89 | //====================================================================== |
Jeej | 13:10589aaf8853 | 90 | public void kal_sha256_final(u8 hash[]); |
Jeej | 13:10589aaf8853 | 91 | |
Jeej | 13:10589aaf8853 | 92 | #endif // _KAL_CRYPTO_H_ |
Jeej | 13:10589aaf8853 | 93 |