查看: 2034|回复: 2

【Atmel加密认证开发套件AT88CKECCROOT试用】-4.1287使用SHA204笔记

[复制链接]
  • TA的每日心情

    2016-3-1 11:42
  • 签到天数: 45 天

    连续签到: 1 天

    [LV.5]常住居民I

    发表于 2016-2-25 21:52:00 | 显示全部楼层 |阅读模式
    分享到:
    本帖最后由 akai1314 于 2016-2-25 21:55 编辑

    放假了很久,今天看了半天的demo,写下自己的笔记

    从这里拿到了Demo
    URL:http://www.atmel.com/images/SHA204_90USB1287_1.0.0.zip

    使用atmel studio7 要进行转换.导入才能转化
    一 project

    硬件独立的文件有:

    sha204_example_main.c
    sha204_comm_marshaling.∗
    sha204_comm.∗
    sha204_comm_interface.h
    sha204_i2c.c
    sha204_swi.∗
    sha204_timer_utilities.∗
    sha204_lib_return_codes.h
    sha204_config.h
    sha204_physical.h


    硬件dependent文件 -就是硬件依赖模块,意味着 如果跨平台使用这些代码,要修改这些文件
    两种选择:
    1.   实现sha204_physical.h 中 列出的声明函数
    2.   从以下三个模块中选择其一:• bitbang_phys.c: Physical implementation as single wire interface (SWI) using
    GPIO (includes delay_x.h)
    .• uart_phys.c: Physical implementation as single wire interface (SWI) using a
    UART (includes avr_compatible.h)
    .• i2c_phys.c: Physical implementation as two wire interface (I2C).


    本项目中默认的IIC接口, 如果要使用上边三个文件中其中一个atmel已经把三个文件都放在了src 文件夹了。太棒了


    我们可以轻松创建3种接口的访问方式:
    1.创建的时候 使用sha204_example_-main.c and sha204_comm添加进项目,所有的硬件都要引入sha204_lib_return_codes.h and sha204_physical.h.
    2. Supply communication interface hardware independent modules. For SWI add sha204_swi., for I2C add sha204_i2c.. You might have to also modify sha204_-i2c.c, especially for 32-bit CPUs, since their I2C peripherals implement such functionality in hardware. For instance, they might not support the generation of  individual Start and Stop conditions.
    3.• Supply communication interface hardware dependent modules. If you do notuse an AVR CPU, you have to implement the functions in these modules. For SWI using UART add uart_phys.c, for SWI using GPIO add bitbang_phys.c, and for I2C add i2c_phys.. Be aware that uart_phys.c includes avr_compatible.h and bitbang_phys.c includes delay_x.h. Also, both SWI modules include swi_-
    phys.h.
    4.
    Supply a timer utility module. You can either use the one provided, timer_-utilities., or provide your own. The SHA204 library uses two delay functions, delay_ms(uint8_t) and delay_10us(uint8_t). These functions do not use hardware timers but loop counters. The supplied module is tuned for an AT90USB1287 CPU running at 16 MHz, but you can easily tune it for other micro-controllers as long as one loop iteration (decrement, compare, and jump) does not take longer than 10 us

    创建project 使用IIC接口
    从sha204_example_main.c入手

    SHA204 是一个SHA-256加密器件。来一个简单的事例就是:我们在登陆一些 金融类的网站时会看到


















    回复

    使用道具 举报

  • TA的每日心情

    2016-3-1 11:42
  • 签到天数: 45 天

    连续签到: 1 天

    [LV.5]常住居民I

     楼主| 发表于 2016-2-25 21:57:27 | 显示全部楼层
    @噗噗熊 噗噗姐 :帖子怎么写不成。也添加不了图片了。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2016-3-1 11:42
  • 签到天数: 45 天

    连续签到: 1 天

    [LV.5]常住居民I

     楼主| 发表于 2016-2-25 21:58:02 | 显示全部楼层
    帖子怎么写不成了
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-27 00:30 , Processed in 0.122607 second(s), 19 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.