资源简介
这是单片机驱动ASHA204的C语言代码代码。在SAMD21单片机上测试可用。
代码片段和文件信息
// ATMEL Microcontroller Software Support - Colorado Springs CO -
// ----------------------------------------------------------------------------
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL “AS IS“ AND ANY EXPRESS OR
// IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
// MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
// DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
// ----------------------------------------------------------------------------
/** \file
* \brief SHA204 Helper Functions
* \author Tuwuh Sarwoprasojo Atmel Bali Team
* \date November 21 2011
*/
#include // needed for memcpy()
#include
#include “sha204_helper.h“
#include “sha204_lib_return_codes.h“ // declarations of function return codes
#include “sha204_comm_marshaling.h“ // definitions and declarations for the Command module
// Atmel‘s SHA256 implementation
// #include “Sha256_atmel.h“
// Modified free/open-source SHA256 implementation (taken from SA102 library)
#include “sha256.h“
/** \brief This is a wrapper function for SHA256 algorithm.
*
* User can modify this function depending on their SHA256 implementation.
*
* \param [inout] param Structure for input/output parameters. Refer to sha204h_calculate_sha256_in_out.
*/
static void sha204h_calculate_sha256(struct sha204h_calculate_sha256_in_out *param)
{
// This is the “free/open-source“ implementation
sha256(param->message param->length param->digest);
// This is Atmel‘s implementation
// create_sha256(param->length param->message param->digest);
}
/** \brief This function calculates a 32-byte nonce based on 20-byte input value (NumIn) and 32-byte random number (RandOut).
*
* This nonce will match with the nonce generated in the Device by Nonce opcode.
* To use this function Application first executes Nonce command in the Device with a chosen NumIn.
* Nonce opcode Mode parameter must be set to use random nonce (mode 0 or 1).
* The Device generates a nonce stores it in its TempKey and outputs random number RandOut to host.
* This RandOut along with NumIn are passed to nonce calculation function. The function calculates the nonce and returns it.
* This function can also be used to fill in the nonce directly to TempKey (pass-through mode). The flags will automatically set according to the mode us
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-03-25 14:33 com_sha204\
目录 0 2017-03-25 14:33 com_sha204\sha204_helper\
文件 33538 2017-03-02 21:05 com_sha204\sha204_helper\sha204_helper.c
文件 14251 2017-03-07 11:46 com_sha204\sha204_helper\sha204_helper.h
目录 0 2017-03-25 14:33 com_sha204\sha204_helper\sha256\
文件 6957 2011-11-18 11:30 com_sha204\sha204_helper\sha256\Sha256_atmel.c
文件 406 2011-11-18 11:32 com_sha204\sha204_helper\sha256\Sha256_atmel.h
文件 15848 2010-01-27 17:33 com_sha204\sha204_helper\sha256\sha256.c
文件 2847 2010-01-27 17:33 com_sha204\sha204_helper\sha256\sha256.h
目录 0 2017-03-25 14:33 com_sha204\sha204_library\
目录 0 2017-03-25 14:33 com_sha204\sha204_library\arch\
目录 0 2017-03-25 14:33 com_sha204\sha204_library\arch\smd21\
目录 0 2017-03-25 14:33 com_sha204\sha204_library\arch\smd21\i2c\
文件 24594 2017-02-26 13:18 com_sha204\sha204_library\arch\smd21\i2c\i2c_common.h
文件 34869 2017-02-24 17:13 com_sha204\sha204_library\arch\smd21\i2c\i2c_master.c
文件 19641 2017-02-24 17:13 com_sha204\sha204_library\arch\smd21\i2c\i2c_master.h
文件 9663 2017-03-25 13:22 com_sha204\sha204_library\arch\smd21\i2c\i2c_phys.c
文件 4757 2017-03-17 15:25 com_sha204\sha204_library\arch\smd21\i2c\i2c_phys.h
目录 0 2017-03-25 14:33 com_sha204\sha204_library\arch\smd21\timer\
文件 3955 2017-02-24 16:59 com_sha204\sha204_library\arch\smd21\timer\sha204_timer_utilities.c
文件 2148 2014-12-01 10:45 com_sha204\sha204_library\arch\smd21\timer\sha204_timer_utilities.h
文件 11705 2017-02-26 11:23 com_sha204\sha204_library\sha204_comm.c
文件 4202 2015-01-23 14:16 com_sha204\sha204_library\sha204_comm.h
文件 10526 2015-05-25 15:56 com_sha204\sha204_library\sha204_comm_marshaling.c
文件 26824 2015-05-25 15:17 com_sha204\sha204_library\sha204_comm_marshaling.h
文件 6998 2017-02-26 13:45 com_sha204\sha204_library\sha204_config.h
文件 10032 2017-02-24 17:03 com_sha204\sha204_library\sha204_i2c.c
文件 3945 2014-01-16 10:11 com_sha204\sha204_library\sha204_lib_return_codes.h
文件 4310 2017-02-26 11:24 com_sha204\sha204_library\sha204_physical.h
- 上一篇:yuv422与yuv420互转
- 下一篇:用VC编写的三菱PLC通讯
评论
共有 条评论