auth.h 1.4 KB

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