#ifndef _AUTH_H_ #define _AUTH_H_ #include "includes.h" typedef struct { unsigned char noUseStart[31];//不使用段 unsigned int authCode;//不适用第一个字节 unsigned char SlaveNum;//从机可用个数 unsigned char noUseEnd[17]; } __attribute__((packed)) AUTH_INFO; #define AUTH_PARA_ADDR 0x0801FC00 //127k //鉴权参数保持地址 1K //typedef enum{ // AUTH_ING, // AUTH_OK //}AUTHSTATUE; void authCheck(void); void GetStartAddrByFlashSize(void); void takeNoteThatFlushAppCompleteOrNot(char status); void authLink(); void checkLastAppUpdateCompleteOrNot(void); void extCodeBuffer(unsigned char *randString, int randlen, unsigned char *targetString, int targetlen); void PocAuthProcess(char *msg); extern unsigned int auth_seg_addr,iap_temp_addr,app_seg_addr; extern unsigned short this_dev_page_size,this_dev_flash_size; extern unsigned char SlaveNum; extern unsigned char Authed; #define PRO_HEADER 0x89 #define TX_RX_SEED 0x86 #define PRO_AUTH_RESPONS 0x30 //向服务器请求握手 #define PRO_AUTH_ACK 0x31 //服务响应握手 #define PRO_AUTH_QUERY 0X32 //服务器向我索要 参数请求 #define PRO_AUTH_REQ 0x34 //终端请求鉴权 #define PRO_AUTH_OK 0x35 //终端应答鉴权结果一样 #define PRO_AUTH_SUC 0x36 //鉴权工具通知鉴权成功 返回鉴权码 #define PRO_AUTH_FAI 0x37 //终端通知键鉴权结果不一致 #endif