-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow allocating Cipher/Signature memory from CLEAR_ON_RESET
This can allow the applet to work well on cards with less transient memory that can be allocated with CLEAR_ON_DESELECT. Also adds a debug feature for SGLists to simulate having limited memory with jcardsim.
- Loading branch information
Alex Wilson
committed
Mar 31, 2019
1 parent
9d277df
commit edbc10b
Showing
4 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edbc10b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a strange change. Are you saying that J3H145 has less memory available as CLEAR_ON_DESELECT than CLEAR_ON_RESET ?
edbc10b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just gave it a shot and the same trick didn't work for me for a different applet on JC30M48CR. Odd.
edbc10b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinpaljak It seems that way? At least for the JC30M48CR card I'm trying it on, this applet instantiates fine with this change, but without it runs out of transient memory during instantiation (and the thing that runs out is in the constructor). On the J3H145 it seems we normally run out of memory doing the attestation feature setup instead, but with this change it works fine. I haven't gotten attestation to fit in the JC30M48CR yet.
edbc10b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Signature and cipher, you should not need to allocate "shareable" instances (second option set to true).
Think of this hypothetical case: there is 2KB total of transient memory available, no matter when it gets cleared (j3h has a bit more, but not that much more). Applet A allocates 1KB of clear on deselect. Applet B can allocate 2KB of clear on deselect. If applet A allocates 1 KB of clear on reset, applet B has maximum of 1KB eihter reset or deselect memory available. Unless you access eeprom from non-applet contexts or have weird multi-select scenarios, deselect should be preferred.