If an applet frequently changes a particular value in an NVM byte array, is that actually causing flash-type page wear-leveling down underneath Javacard’s awareness? Or is the code just directly “wearing out” one physical byte location in EEPROM?
Put another way, should an applet include its own wear-leveling logic for (relatively) frequently changing non-volatile variables, or is this handled by the runtime or something else at a lower level?
Hint: applet implementations should generally think about local wear levelling options. The FIDO signature counter is such a case. Storage may differ, it isn’t necessarily flash. EEPROM with 1 Mio+ write/erase cycles is common as well. Even FRAM is available. But as @laforge pointed out: you need to contact the manufacturer of your choice for a definitive answer (or access to an API that handles transactional, wear-levelled memory for you).
These days, everything is downloaded from a DP+ server. So the applet developers unfortunately don’t have foresight into who the manufacturer will be. (so … “write once debug everywhere”).
Although JCSystem transactions means preimaging, and wear leveling is isn’t hard once your that far along.
Well, nope, not everything is downloaded from a DP+ server. This assumption is just oversimplified up to wrong.
And many implementations use Y-branches depending on the JCRE they are running on, mostly decided within the constructor.
And … modern TSMs serve multiple images depending on the eUICC/eSE they are communicating with. (Y-branch in deployment)
And … if you are a professional you get device lists telling you which manufacturer/model/series contains which chipset in which country/area. So therefore, in my case, I know VERY exactly which chip to expect within the device.
Anyway, wear levelling is one of the easier tasks.
I think maybe (you mention TSM and eSE) you’re thinking of newer devices with embedded EUICCs soldered into the board, and yes I definitely see your point in that world. The SIM is part of the phone. That could be a manageable set of configrations to solve with on and off card Y branches. But for profile generation, and applets inside profiles, running in modem type “IoT” devices, it seems like there could be a lot of target hardware and SIMOS config to write for and test. And ur right, in that world you can still go into a physical sim card or a old school SMDP server (SGP.02), it’s an older world with lots of backward support. Older phones just get tossed after 3-4 years so there usually a new world by comparison.
Physical UICCs can have TSMs (or application management security domains) as well. I have some dozen of them.
While talking about IoT devices using TSM / AMSD approaches might not be feasible - or you’re able to use OTA commands.
I would try to keep applets directly within the profile as platform-agnostic as possible and try to deploy every more complex logic on demand / after profile has been deployed and the UICC is known. But this heavily depends if your IoT device is reachable by your MNO for OTA updates and if you have an interface to your MNO and interact with your UICCs.
We’ve the same issue regarding the availability of very specific cryptographic primitives (like ECDH “with FULL_XY”).