Hello,
I would like to read back the key once I finished my crypto computation.
Do you know, please, how I can read back the value of the AES stored into the registers AES_KEY_0_REG ~ AES_KEY_3_REG (0x3ff01010-0x3ff0101C), once the set_key has been processed?
The reference manual shows Access R/W for these registers.
I have tried different code in arduino core such as:
Serial.print("K=");
for (int i = 0; i < 4; i++) {
char str[6];
keyreg= *((volatile uint32_t *) (0x3ff01010+0x4*i));
sprintf(str, "%04x", (int)keyreg);
Serial.print(str);
}
But no success. As I see is all 0. Did I make a mistake?
I have also tried REG_READ function defined into soc.h but not compilation fails...
If someone has a code example, it would be perfect, even if it is not for these specific registers.
Regards
sk
Read registers using C code?
Re: Read registers using C code?
For these registers you should use DPORT_REG_READ macro. If you still have a compilation error when using DPORT_REG_READ, please post the error here.
If all the registers of a peripheral read back as 0, then it might mean that you haven't enabled clock for the peripheral and taken it out of reset. See periph_module_enable and periph_module_reset functions.
If all the registers of a peripheral read back as 0, then it might mean that you haven't enabled clock for the peripheral and taken it out of reset. See periph_module_enable and periph_module_reset functions.
Re: mbedtls_aes_crypt_ecb VS mbed_internal_aes_encrypt ESP32
Hi SK,
It's a documentation error. The AES_KEY registers are WRITE ONLY and hence will always return 0 when read
As suggested on other thread in general the dport registers should be read with DPORT_REG_READ()
It's a documentation error. The AES_KEY registers are WRITE ONLY and hence will always return 0 when read
As suggested on other thread in general the dport registers should be read with DPORT_REG_READ()
Re: mbedtls_aes_crypt_ecb VS mbed_internal_aes_encrypt ESP32
Hello esp_hermal,
thanks for your explanation.
It makes sense these registers are set to write only for real and not RW.
Regards
sk
thanks for your explanation.
It makes sense these registers are set to write only for real and not RW.
Regards
sk
Re: Read registers using C code?
READ_REG works for me for reading EFUSE_BLK3_RDATA6_REG. I'm using it in a CPP file, but doubt that would make it compile better than C. Since you didn't bother to list the compile error, you won't get much help here. But I'm guessing it's a missing header include.
Or maybe those registers require you to use the PORT command as described above.
John A
Or maybe those registers require you to use the PORT command as described above.
John A
Re: Read registers using C code?
Moderator's note: This question was asked in two places and I've merged the responses here. If replies seem to not make sense, this is because not all of the posts were originally in this thread.
Re: Read registers using C code?
Hi,
thanks you all for your remarks.
I will try what you are pointing and keep you updated.
Regards
sk
thanks you all for your remarks.
I will try what you are pointing and keep you updated.
Regards
sk
Who is online
Users browsing this forum: No registered users and 459 guests