Method for locking a rewritable non-volatile memory and electronic device implementing said method
A method for locking a rewritable non-volatile memory of an electronic device is described. A first step of initialising the electronic device is performed. At least one memory area of the rewritable non-volatile memory is then selected from a set of N memory areas of the rewritable non-volatile memory, each of the N memory areas having a content, N being an integer ≥2. The memory area selected is locked by volatile locking. A second step of initialising the electronic device is performed using a content stored in the memory area selected.
1 . A method for locking a rewritable non-volatile memory of an electronic device, the method comprising:
performing a first step of initialising the electronic device;
selecting at least one memory area of the rewritable non-volatile memory from a set of N memory areas of the rewritable non-volatile memory, each of the N memory areas comprising a version of a content, N being an integer ≥2,
wherein the selecting at least one memory area comprises:
comparing the versions of the content stored in the N memory areas;
selecting a memory area comprising a most recent version of the content; and when each of M memory areas, where M is an integer belonging to [2; N], comprise the same most recent version of the content, selecting, from said M memory areas, a memory area different from a memory area identified as having been selected during a previous initialization of the electronic device, said previous initialization being associated with a booting or rebooting of the electronic device;
locking the at least one selected memory area by a locking known as volatile locking, the locking being deactivated only by powering down the at least one selected memory area;
wherein at least one non-selected memory area of the N memory areas remains unlocked and is configured for receiving a new version of the content for a subsequent update; and
performing a second step of initialising the electronic device using a content stored in the at least one selected memory area.
2 . The method according to claim 1 , furthermore comprising hardware maintenance of the N memory areas before any locking of the at least one selected memory area, the hardware maintenance comprising an error detection and a correction of errors detected.
3 . The method according to claim 1 , wherein the performing a first step of initialising the electronic device comprises:
authenticating, by a secure initial boot, first booting software stored in a first memory area of the rewritable non-volatile memory;
starting up the first booting software;
authenticating, by the first booting software, second booting software stored in a second memory area of the rewritable non-volatile memory different from the first area;
starting up the second booting software; and
authenticating, by the second booting software, for each of the N memory areas, the content.
4 . The method according to claim 3 , wherein locking the at least one selected memory area by volatile locking furthermore comprises locking the second memory area by volatile locking.
5 . The method according to claim 4 , furthermore comprising hardware maintenance of the second memory area before any volatile locking of the second memory area, the hardware maintenance comprising an error detection and a correction of errors detected.
6 . The method according to claim 3 , wherein the first memory area is a one-time programming memory.
7 . The method according to claim 1 , wherein the rewritable non-volatile memory area is a NAND flash memory and/or an eMMC memory.
8 . The method according to claim 1 , wherein the content is application firmware and the second step of initialising the electronic device comprises the starting up of the application firmware.
9 . The method according to claim 1 , furthermore comprising, after the performing the second step of initialising the electronic device using the content stored in the at least one selected memory area:
determining that an update is necessary;
selecting from the set of N memory areas at least one non-locked memory area;
loading a new version of the content into the at least one non-locked memory area selected;
rebooting the electronic device.
10 . An electronic device comprising a rewritable non-volatile memory and at least one processor configured for:
performing a first step of initialising the electronic device;
selecting at least one memory area of the rewritable non-volatile memory from a set of N memory areas of the rewritable non-volatile memory, each of the N memory areas comprising a content, N being an integer ≥2,
wherein the selecting at least one memory area comprises:
comparing the versions of the content stored in the N memory areas;
selecting a memory area comprising a most recent version of the content; and
when each of M memory areas, where M is an integer belonging to [2; N], comprise the same most recent version of the content, selecting, from said M memory areas, a memory area different from a memory area identified as having been selected during a previous initialization of the electronic device, said previous initialization being associated with a booting or rebooting of the electronic device,
locking the at least one selected memory area by a locking, known as volatile locking, the locking being deactivated only by powering down the at least one selected memory area; and
wherein at least one non-selected memory area remains unlocked and is configured for receiving a new version of the content for a subsequent update; and
performing a second step of initialising the electronic device using a content stored in the at least one selected memory area.
11 . A non-transitory computer-readable storage medium that stores a computer program comprising instructions for implementing the locking method according to claim 1 , when the program is executed by a processor.