WizziLab / modem_ref_v5_3_217

Dependents:   modem_ref_helper_for_v5_3_217

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers kal_crypto.h Source File

kal_crypto.h

Go to the documentation of this file.
00001 /// @copyright
00002 /// ========================================================================={{{
00003 /// Copyright (c) 20XX                                                         /
00004 /// All rights reserved                                                        /
00005 ///                                                                            /
00006 /// IMPORTANT: This Software may not be modified, copied or distributed unless /
00007 /// embedded on a WizziLab product. Other than for the foregoing purpose, this /
00008 /// Software and/or its documentation may not be used, reproduced, copied,     /
00009 /// prepared derivative works of, modified, performed, distributed, displayed  /
00010 /// or sold for any purpose. For the sole purpose of embedding this Software   /
00011 /// on a WizziLab product, copy, modification and distribution of this         /
00012 /// Software is granted provided that the following conditions are respected:  /
00013 ///                                                                            /
00014 /// *  Redistributions of source code must retain the above copyright notice,  /
00015 ///    this list of conditions and the following disclaimer                    /
00016 ///                                                                            /
00017 /// *  Redistributions in binary form must reproduce the above copyright       /
00018 ///    notice, this list of conditions and the following disclaimer in the     /
00019 ///    documentation and/or other materials provided with the distribution.    /
00020 ///                                                                            /
00021 /// *  The name of WizziLab can not be used to endorse or promote products     /
00022 ///    derived from this software without specific prior written permission.   /
00023 ///                                                                            /
00024 /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS        /
00025 /// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED  /
00026 /// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR /
00027 /// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR          /
00028 /// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,      /
00029 /// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,        /
00030 /// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,            /
00031 /// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY     /
00032 /// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    /
00033 /// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS         /
00034 /// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.               /
00035 /// WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,       /
00036 /// ENHANCEMENTS OR MODIFICATIONS.                                             /
00037 ///                                                                            /
00038 /// Should you have any questions regarding your right to use this Software,   /
00039 /// contact WizziLab at www.wizzilab.com.                                      /
00040 ///                                                                            /
00041 /// =========================================================================}}}
00042 /// @endcopyright
00043 
00044 //  =======================================================================
00045 /// @file           kal_crypto.h
00046 /// @brief          KAL Crypto utilities
00047 //  =======================================================================
00048 
00049 #ifndef _KAL_CRYPTO_H_
00050 #define _KAL_CRYPTO_H_
00051 
00052 #include "hal_types.h"
00053 
00054 // ======================================================================
00055 //
00056 //
00057 //                        SHA-2 256 Tool-suite. 
00058 //          (From Brad Conte's Licence-free implementation)
00059 //
00060 //
00061 // ======================================================================
00062 
00063 /// SHA256 digest output size in bytes
00064 #define SHA256_BLOCK_SIZE 32 
00065 
00066 //======================================================================
00067 // kal_sha256_init
00068 //----------------------------------------------------------------------
00069 /// @brief Initialize an SHA Hash generation. To be called before any
00070 ///        other kal_sha256_update/final functions.
00071 //======================================================================
00072 public void kal_sha256_init(void);
00073 
00074 //======================================================================
00075 // kal_sha256_update
00076 //----------------------------------------------------------------------
00077 /// @brief Used to 'push' new data into the hash calculation.
00078 /// @param data pointer to the (char) data stream to hash.
00079 /// @param len data stream length in bytes
00080 //======================================================================
00081 public void kal_sha256_update(u8 data[], uint len);
00082 
00083 //======================================================================
00084 // kal_sha256_final
00085 //----------------------------------------------------------------------
00086 /// @brief To be called when all data has been pushed into the hash
00087 ///        generator. Finalize and outputs resulting SHA hash.
00088 /// @param hash Pointer to the Output (char) buffer. Fills 32-bytes.
00089 //======================================================================
00090 public void kal_sha256_final(u8 hash[]);
00091 
00092 #endif // _KAL_CRYPTO_H_
00093