transacted memory for smart cards pieter hartel univ
play

Transacted Memory for Smart Cards Pieter Hartel, Univ. Twente, NL - PowerPoint PPT Presentation

Transacted Memory for Smart Cards Pieter Hartel, Univ. Twente, NL Michael Butler, Univ. Southampton, UK Eduard de Jong, Sun Micro systems, USA Mark Longley, Univ. Southampton, UK 1 Overview What is transacted memory? Combining Z,


  1. Transacted Memory for Smart Cards Pieter Hartel, Univ. Twente, NL Michael Butler, Univ. Southampton, UK Eduard de Jong, Sun Micro systems, USA Mark Longley, Univ. Southampton, UK 1

  2. Overview • What is transacted memory? • Combining Z, Promela (SPIN) and C • Conclusions 2

  3. Java Card transactions • atomic updates • audit trail • limited resources (64KB ROM, 64KB EEPROM, 2KB RAM) • Java Card logs previous value 3

  4. Transacted memory – abstract Before After tag 1, gen 2 unused 10 £ , Feb 3, 2001 tag 1, gen 3 tag 1, gen 3 80 £ , Feb 5, 2001 80 £ , Feb 5, 2001 unused tag 1, gen 4 70 £ , Feb 8, 2001 tag 5, gen 1 tag 5, gen 1 10 Downing street 10 Downing street Write, commit and verify: info = { 70 £ , Feb 8, 2001 } ; tag = 1; Write( tag, info ); Commit( tag ); assert( DRead( tag ) == info ); 4

  5. Transacted memory – concrete Before After unused tag 1, gen 4, page 0 70 £ tag 1, gen 4, page 2 tag 1, gen 4, page 2 2001 2001 tag 1, gen 4, page 1 tag 1, gen 4, page 1 Feb 8 Feb 8 Write: info = { 70 £ , Feb 8, 2001 } ; tag = 1; Write page( tag, 2, info[2]); Write page( tag, 1, info[1]); Write page( tag, 0, info[0]); 5

  6. Methodology ✬ ✩ Revise ❄ ✬ ✩ Abstract ✫ ✪ Refine ✬ ✩ ❄ Refinement 1 ✫ ✪ Refine ✬ ✩ ❄ Refinement 2 ✫ ✪ Z Informal ✬ ✩ ❄ Prototype ✫ ✪ 6 C/Promela

  7. Functions in C and Promela Function Call byte NewTag(byte size) { byte tag; ... byte tag = NewTag( 3 ); return tag; } Promela: Non-deterministic choice proctype NewTag() { byte size, tag; .... byte tag; go?MSize,size -> go!MSize,3; ..... if if :: done!Mabort; ... :: done?Mabort -> ... :: done!MTag,tag; ... :: done?MTag,tag -> ... fi fi 7

  8. Test program • 2000 page writes • 65 aborted writes • No failed assertions 8

  9. Issues – Z • Non-standard constructs PROCEDURE release : Memory × P Loc → Memory release ( mem , lset ) = FOR l IN lset DO write ( mem , l , . . . ) • Syntax and typing problems, e.g. a × b instead of a ∗ b • 10 issues in 2 pages 9

  10. Issues – Promela/C • Typing problems, missing definitions • Committed write does not commit • Uncommitted pages not released • Data may be committed twice 10

  11. Conclusions • Using non-standard Z does not help • Z good for abstract • Promela good for concrete • ad-hoc common notation • Prototype is RAM space efficient • Time efficient with HW support? 11

  12. More work on Transacted Memory Erik Poll, Univ. Nijmegen, NL Using JML & Java instead of Z & C : • translation of abstract Z spec to JML • translation of C implementation to Java Both relatively straightforward. 12

  13. JML vs Z specification − Z easier to read than JML + JML spec can easily be made executable 13

  14. Java vs C implementation − C closer to realistic machine-code implementation + Java implementation of enumerations as classes revealed bug (but is clumsy; type-safe enums would be nicer!) + Java’s exception mechanism enables realistic test scenarios, including card tears public Tag NewTag(byte size) throws CardTearException { ... } 14

  15. Java & JML vs Z & C + abstract JML spec and concrete Java implementation in the same language (namely Java) Future work: relating abstract spec and implementation 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend