#include "extAuth.h" #include #ifdef I_AM_LTE #define RAND_STR_LEN 6 const unsigned char srcAuth[16]={0x17,0x0d,0x55,0x9f,0xab,0xcc,0x1c,0x8f,0x30,0x0a,0x28,0xda,0x3c,0x91,0x11,0x6d}; const unsigned char randStr[RAND_STR_LEN]={'s','z','5','0','2','8'}; static unsigned char codeRandStr[RAND_STR_LEN]; unsigned char * extGetCodeRandStr(int *outlen){ *outlen=RAND_STR_LEN; return codeRandStr; } /*随机生成一个种子 offset,偏移时间*/ static unsigned char extRandSeed(unsigned int offset){ unsigned char seed; srand(getBaseSeconds()+offset); seed=rand()/256; return seed; } /*使用seed1,seed2对长度为srclen的srcStr进行运算加密*/ static void extCodeToRandStrTmp(unsigned char seed1,unsigned char seed2,unsigned char *srcStr, int srclen){ unsigned int i,j; unsigned char newSeed=seed1|seed2|0xa7; for(i=0;i=randlen) j=0; } //再对targetString的奇数索引字节,与randString的高低4位指向的srcAuth索引字节异常 j=0; for(i=0;i>4)&0x0F; value=srcAuth[k]; if(++j>=randlen) j=0; if(i%2) targetString[i] ^= value; } }