This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于nvmem_read 读取eeprom内容的问题



根据官方文档的说明,smartconfig(使用AES128加密)完成后,相关的信息会存储在 shared memory (EEPROM file ID 13)中。

我现在想读取改字段的内容,并解析出ssid及wifi密码。

// read the received data from fileID #13 and parse it according to the followings:
// 1) SSID LEN - not encrypted
// 2) SSID - not encrypted
// 3) KEY LEN - not encrypted. always 32 bytes long
// 4) Security type - not encrypted
// 5) KEY - encrypted together with true key length as the first byte in KEY
// to elaborate, there are two corner cases:
// 1) the KEY is 32 bytes long. In this case, the first byte does not represent KEY length
// 2) the KEY is 31 bytes long. In this case, the first byte represent KEY length and equals 31
returnValue = nvmem_read(NVMEM_SHARED_MEM_FILEID, SMART_CONFIG_PROFILE_SIZE, 0, profileArray);

printf("returnValue %d \r\n profileArray:",returnValue);
for(i=0;i<SMART_CONFIG_PROFILE_SIZE;i++)
printf("%c",profileArray[i]);
printf("\r\n");

执行结果如下:

returnValue 0
profileArray:home_assistant@鞖L

读取到的内容和注释的匹配不上,home_assistant事device name ,按理不应该出现在改字段中。  而且后续AES解密出来的内容也不对。。

请问可能原因是什么?  谢谢!

固件中的aes key和我android测试工具设置的key是一致的

注:我是将host driver 移植到了linux下

版本为CC3000 SDK_V1.11,手机端使用android smartconfig测试工具

使用不加密方式通信时,可以成功获取并连上wifi

  • 这个key是计算过后的,不是PSK的密码。所以你读出来和你输入的密码是对不上的。

  •  psk的密码就是指 wifi密码?

    我知道 nvmem_read(NVMEM_SHARED_MEM_FILEID, SMART_CONFIG_PROFILE_SIZE, 0, profileArray); 读出来的是加密后的信息,需要解密

    但是按照注释

    // read the received data from fileID #13 and parse it according to the followings:
    // 1) SSID LEN - not encrypted
    // 2) SSID - not encrypted
    // 3) KEY LEN - not encrypted. always 32 bytes long
    // 4) Security type - not encrypted
    // 5) KEY - encrypted together with true key length as the first byte in KEY
    // to elaborate, there are two corner cases:
    // 1) the KEY is 32 bytes long. In this case, the first byte does not represent KEY length
    // 2) the KEY is 31 bytes long. In this case, the first byte represent KEY length and equals 31

    有些字段是没有加密的,应该可以直接解析出来,如下

    ssidPtr = &profileArray[1];

    ssidLen = profileArray[0];

    decKeyPtr = &profileArray[profileArray[0] + 3]; 

    aes_decrypt(decKeyPtr, key);
    if (profileArray[profileArray[0] + 1] > 16)
    aes_decrypt((unsigned char *)(decKeyPtr + 16), key);

    但解析出来的ssidLen不对 

    解密后出来的key也不正确

    -------------------------------------------------------------------------------

    我现在是想将ssid和密码读出来,然后提供给另一块无线网卡

    按照这个方法是否可行?能否解析出ssid及密码的明文?

    ----------------------------------------

    项目很急,现在卡在这个位置了,望解答拜托!

    能否提供一个其他的联系方式,邮箱等都行

    我邮箱是huhu0205xz@163.com

    谢谢!

  • 那你可以选择用加密的Smart Config吗?这样你可以很轻松的读到SSID和密码。