|Publication number||US7131121 B2|
|Application number||US 09/992,558|
|Publication date||Oct 31, 2006|
|Filing date||Nov 14, 2001|
|Priority date||Nov 14, 2001|
|Also published as||EP1451677A2, US20030093781, WO2003042817A2, WO2003042817A3|
|Publication number||09992558, 992558, US 7131121 B2, US 7131121B2, US-B2-7131121, US7131121 B2, US7131121B2|
|Inventors||Ksheerabdhi Krishna, Tim Wilkinson, Sylvain Prevost, Yannick Burianne|
|Original Assignee||Axalto, Inc.|
|Export Citation||BiBTeX, EndNote, RefMan|
|Patent Citations (13), Non-Patent Citations (10), Referenced by (3), Classifications (6), Legal Events (6)|
|External Links: USPTO, USPTO Assignment, Espacenet|
1. Field of the Present Invention
The present invention generally relates to the field of smart cards and more particularly to an improved smart card and method for determining the boundaries of method bodies within converted applet files loaded into a smart card.
2. History of Related Art
Most consumers are familiar with and use credit cards, debit cards, automatic teller machine (ATM) cards, stored value cards, and the like. For many types of transactions, however, the current trend is away from these types of cards and into a class of devices generally referred to as smart cards. A smart card is a plastic, credit-card sized card that includes an electronic device (chip) embedded in the card's bulk plastic. Rather than only employing a magnetic strip to store information, smart cards employ a microprocessor and a memory element embedded within the chip.
Because they have a chip, smart cards can be programmed to operate in a number of varied capacities such as stored value cards, credit cards, debit cards, ATM cards, calling cards, personal identity cards, critical record storage devices, etc. In these varied capacities, a smart card may be designed to use a number of different application programs. Smart cards are compliant with Standard 7816 Parts 1–10 of the International Organization for Standardization (ISO), which are incorporated by reference herein and referred to generally as “ISO 7816.”
Initially, application program development for smart cards was essentially proprietary to the smart card manufacturers or the smart card issuers. Smart card application development has, however, evolved over recent years so that it is no longer proprietary. Through the adoption of open architectures for application development, it is now possible to develop applications that can run on smart cards from different manufacturers, on other devices for the storage of data (i.e., storage devices), or other resource constrained devices that, like smart cards, have small amounts of available memory. Java Card smart card technology is an example of one such open development architecture. It uses the Java™ programming language and employs the Java Card smart card runtime environment (JCRE). The JCRE conforms to ISO 7816 and defines a platform on which applications written in the Java programming language can run on smart cards and other resource-constrained devices. Applications written for the JCRE are referred to as applets and must conform with the Java Card 2.1 Virtual Machine Specification (as revised from time to time) published by Sun Microsystems, Inc., which is incorporated by reference herein and referred to generally as the “JCVM Specification.”
The process of loading an applet onto a smart card for execution requires that the source code of the applet first be converted into a corresponding binary representation of the classes making up the applet. This corresponding binary representation is referred to as a CAP file (converted applet file) and is the file format in which applications are loaded onto smart cards utilizing the JCRE. The CAP file is typically loaded as a block of bytes occupying contiguous space in the non-volatile read/write memory of the smart card by an installer module located on the smart card.
A CAP file consists of a set of components each of which defines differing elements or aspects of the contents of the CAP file. One such component is the Method Component which defines each of the methods (i.e., procedures or routines associated with one or more classes) declared in the package that makes up the CAP file. The following are among the items included in the Method Component: (1) a size item which indicates the number of bytes in the Method Component, (2) a handler count item which indicates the number of exception handler entries in the exception handler array, (3) an exception handlers item which provides relevant information for each exception handler (including a starting offset and a length for indicating the range of bytecodes for which the exception handler is active (i.e., a “catch range”) and further including the starting address of the exception handler), and (4) a methods item which defines each of the variable length methods (i.e., method bodies) declared in the package making up the CAP file with each such method body containing a method header followed by the bytecodes (i.e., instructions) that implement such method body. While each method header contains relevant information defining the requirements for the operand stack, associated parameters being passed to the method body, and local variables for the method body, the method header does not specify the size of the associated method body.
The bytecodes within each method body typically contain operands consisting of various symbolic or unresolved code references which must be resolved prior to execution. The process of resolving these particular operands is generally referred to as linking or resolution and involves looking-up the symbolic reference in a corresponding table present in memory (constant pool) or other storage device or calculating the unresolved relative code reference and replacing the reference with the actual memory address or an internally accessible symbolic reference at which the particular command, function, definition, etc. is stored. The terms “resolve,” “resolution,” “resolving,” and “linking” are used throughout to broadly describe the foregoing process of replacing the unresolved code or symbolic reference within the code or data structure with an internally accessible symbolic reference or actual memory address.
One method utilized by the prior art to implement the resolution process is to access a list of bytecode offsets into each method body, which list designates the applicable bytecodes within each method body requiring resolution (i.e., relocation annotations). This list of bytecode offsets is provided in the form of another component in the CAP file referred to as the Reference Location Component. The Reference Location Component is required by the prior art because the boundaries of each method body (i.e., the beginning and the end of each method body) are not specified in the Method Component. The Reference Location Component is used solely for the resolution process and is not referenced by any other component in a CAP file.
A second method utilized by the prior art to implement the resolution process without accessing the list of relocation annotations contained in the Reference Location Component is to access information contained in another component of the CAP file referred to as the Descriptor Component. The Descriptor Component contains sufficient information to permit parsing and verification of all elements of the CAP file. Consequently, the Descriptor Component contains information on the boundaries of each method body so as to permit parsing and examination of the bytecodes contained within each method body. Because of its lengthy size, however, the Descriptor Component is an optional component of the CAP file, and as such, is not always available.
It would be beneficial to implement an apparatus and method for the efficient linking of CAP files that does not rely upon relocation annotations (such as those provided in the Reference Location Component), but rather which enables the contiguous bytecodes making up the methods item of the Method Component to be examined (and if necessary, their operands resolved) without reliance upon the Descriptor Component.
The structure and operation of the invention will become apparent upon reading the following detailed description and upon reference to the accompanying drawings in which:
While the invention is susceptible to various modifications and alternative forms, specific embodiments thereof are shown by way of example in the drawings and will herein be described in detail. It should be understood, however, that the drawings and detailed description presented herein are not intended to limit the invention to the particular embodiment disclosed. On the contrary, the invention is limited only by the claim language.
Generally speaking the present invention contemplates a smart card and method in which the smart card may be configured to receive computer code such as converted applet files with unresolved references within the method bodies for such files and examine each bytecode within the method bodies (and if applicable, resolve their operands) in a sequential manner and without relying upon relocation annotations such as those provided in a Reference Location Component. Throughout the description and the drawings, elements which are the same will be accorded the same reference numerals.
The microprocessor with an integral memory element 115 of
Generally, the memory element 215 may be configured to include random access memory (RAM) 220, read only memory (ROM) 225, and non-volatile read/write memory 230. Read only memory 225 may be configured to include installer module 210. In an alternative configuration, RAM 220, ROM 225, and non-volatile read/write memory 230 are not located in the same memory element 215, but rather, in some combination of separate electronic units.
The exception handler array is then examined to determine if one or more exception handler items are present for the bytecode range of the applicable method body 435. If an exception handler item for the bytecode range of the applicable method body is present, then the FLR for the exception handler item (i.e., end of the exception handler) is determined 440 and if the FLR for the exception handler code is greater than the previously determined FLR (i.e., the exception handling code is contained at the end of the method body), each bytecode up to and including the FLR for the exception handling code is examined and its corresponding operands resolved as necessary 445. If an exception handler item for the bytecode range of the applicable method body is not present or (if applicable) following the determination of the FLR for the exception handler item and resolution of applicable bytecode operands for the exception handler item, the Start Pointer is incremented to the first bytecode following the FLR 450 (which will be a method header if a subsequent method body follows), the Start Pointer is skipped over the method header 415, and the Start Pointer is once again examined to determine if it is less than the End Pointer 420. If the Start Pointer is equal to or greater than the End Pointer 420, then the bytecodes in each of the method bodies of the Method Component have been traversed and resolved (where applicable) and the process is completed.
Upon entering the method, a FLR Pointer is set to equal the Start Pointer 505. As noted in the detailed description for
A determination is made as to whether the bytecode pointed to by the BC Pointer is of a type that makes a forward call (i.e., forward jump instruction) 525. It will be apparent to those skilled in the art that the instructions in the JCVM Specification having a hexadecimal opcode value of 60–70, 73, 75, and 98–A8 are illustrative of bytecode types making a forward call. If the bytecode pointed to by the BC Pointer is of a type that makes a forward call, a temporary FLR Pointer is set to the location of the forward call 530. A determination is then made as to whether the temporary FLR Pointer is greater than the current FLR Pointer 535. If so, a logical return for the method body that is farther than the current FLR has been located and the FLR Pointer is set to equal the temporary FLR Pointer 540.
Following the examination as to whether the temporary FLR Pointer is greater than the current FLR Pointer (and if applicable setting the FLR Pointer to equal the temporary FLR Pointer), the bytecode pointed to by the BC Pointer is examined to determine if the applicable operand(s) require resolution 545. If the applicable operand(s) require resolution, then the bytecode pointed to by the BC Pointer is resolved 550. Following the examination (and applicable resolution) of the bytecode pointed to by the BC Pointer, the Start Pointer is incremented to the next bytecode 555.
A determination is then made as to whether the bytecode pointed to by the BC Pointer is a logical return (i.e., valid ending instruction) 560. It will be apparent to those skilled in the art that the instructions in the JCVM Specification having a hexadecimal opcode value of 70, 77–7A, 93, A8 are illustrative of bytecode types that are a logical return. If the bytecode pointed to by the BC Pointer is not a logical return, then a determination is made as to whether the Start Pointer is greater than the FLR Pointer 565. If the Start Pointer is greater than the FLR Pointer 565, then the FLR Pointer is set to equal the Start Pointer 570.
If the bytecode pointed to by the BC Pointer is a logical return or (if applicable) following examination of the Start Pointer and (if applicable setting of the FLR Pointer to equal the Start Pointer), the Start Pointer is once again examined to determine if it is less than or equal to the FLR Pointer 510. If the Start Pointer is greater than the FLR Pointer 510, the FLR for the current method body (other than applicable exception handling code) has been determined, each bytecode up to and including the FLR has been examined (and if necessary, its operands resolved), and the process completed.
The process depicted in
It should be appreciated that portions of the present invention may be implemented as a set of computer executable instructions (software) stored on or contained in a computer-readable medium. The computer readable medium may include a non-volatile medium such as a floppy diskette, hard disk, flash memory card, ROM, CD ROM, DVD, magnetic tape, or another suitable medium.
As introduced above, the term “smart card” was described with reference to the device shown in
A person skilled in the art will appreciate that there are many alternative implementations of the invention described and claimed herein. For example, the embodiments described use various pointers, e.g., the Start, End, FLR, BC, and Exception Pointers. These pointers may be implemented using pointer data types provided by many programming languages and operating systems. Alternatively, they may be implemented as offsets from given locations. For example, in the latter alternative, a base location may be set at the start of a method body. Each of the pointers may then be implemented as offsets from that base location. Thus, the word “pointer” herein connotes a data element that provides a way, function, and result of specifying a location in a program or data structure so that access can be made to the content at that location thereby allowing examination, comparisons, or other operations involving that content.
It will be apparent to those skilled in the art having the benefit of this disclosure that the present invention contemplates a smart card and method for the efficient linking of computer code that does not rely upon relocation annotations. It is understood that the forms of the invention shown and described in the detailed description and the drawings are to be taken merely as presently preferred examples and that the invention is limited only by the language of the claims.
|Cited Patent||Filing date||Publication date||Applicant||Title|
|US5075848 *||Dec 22, 1989||Dec 24, 1991||Intel Corporation||Object lifetime control in an object-oriented memory protection mechanism|
|US5581768 *||Feb 27, 1995||Dec 3, 1996||Intel Corporation||Method and apparatus for executing applications in place from write once/seldom memories|
|US5668999 *||Dec 20, 1994||Sep 16, 1997||Sun Microsystems, Inc.||System and method for pre-verification of stack usage in bytecode program loops|
|US6026485 *||Jan 23, 1997||Feb 15, 2000||Sun Microsystems, Inc.||Instruction folding for a stack-based machine|
|US6338160 *||Jan 20, 2000||Jan 8, 2002||Nazomi Communications, Inc.||Constant pool reference resolution method|
|US6496910 *||Jun 4, 1999||Dec 17, 2002||International Business Machines Corporation||Method and device for loading instruction codes to a memory and linking said instruction codes|
|US6779732 *||Aug 31, 2001||Aug 24, 2004||Schulumberger Malco, Inc.||Method and apparatus for linking converted applet files|
|US20010034818 *||Mar 2, 2001||Oct 25, 2001||Christian May||Method for linking program modules reloaded into a main memory of a processor on a smart card|
|US20020093856 *||Nov 5, 2001||Jul 18, 2002||International Business Machines Corporation||File language verification|
|US20030028686 *||Feb 2, 1999||Feb 6, 2003||Judith E. Schwabe||Token-based linking|
|US20030042318 *||Aug 31, 2001||Mar 6, 2003||Ksheerabdhi Krishna||Method and apparatus for linking converted applet files|
|WO1999049392A1||Nov 12, 1998||Sep 30, 1999||International Business Machines Corporation||Java runtime system with modified constant pool|
|WO2003042817A2||Nov 14, 2002||May 22, 2003||Schlumberger Systemes S.A.||Method and apparatus for linking converted applet files without relocation annotations|
|1||*||"Java Card 2.1 Virtual Machine Specification", 1999, Sun Microsystems, Chapters 1-3.|
|2||"Java Card 2.1.1 Virtual Machine Specification" C.S. Dept. Univ. of Augsburg-May 18, 2000, Chapter 6 . . . (item 2 cont.) www.informatik.uni-augsberg.de/lehrsluehle/info1/lehre/ss03/javacard/javacard-2.1.1/JCVMSpec.pdf.|
|3||*||Aho, Sethi, and Ullman, "Compilers: Principles, Techniques, and Tools", 1986, Addison-Wesley, ISBN 0-201-10088-6, Chapter 9.|
|4||*||JDC Tech Tips, "Getting Started with Javap", Aug. 2000, Sun Microsystems, accessed online on Sep. 13, 2004 at <http://java.sun.com/developer/TechTips/2000/tt0829.html>.|
|5||*||Ksheerabdhi Krishna, Michael Montgomery, "A Simple(r) Interface Distribution Mechanism for Java Card", Sep. 2000, Java Card Workshop 2000, Cannes, France.|
|6||*||Lance, Untch, and Wahl, "Bytecode-based Java Program Analysis", 1999, '99 ACM Souteast Regional Conference.|
|7||*||Lindholm and Yellin, "The Java Virtual Machine Specification Second Edition", 1999, Chapters 3 and 5.|
|8||*||Michael Hind, "Pointer analysis: haven't we solved this problem yet?", Jun. 2001, Proceedings of the 2001 ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, ISBN:1-58113-413-4, pp. 54-61.|
|9||Tim Lindholm, Frank Yetlin. "The Java Virtual Machine Specification Second Edition", Apr. 1999, Sun Microsystems Inc., Palo Alto, CA, USA, pp. 120-123 XP-002269823.|
|10||*||Zhiqun Chen, "Java Card Technology for Smart Cards", Jun. 2000, Addison Wesley, ISBN 0-201-70329-7, Section 1.1 and Chapter 3.|
|Citing Patent||Filing date||Publication date||Applicant||Title|
|US7246347 *||Jun 24, 2003||Jul 17, 2007||Sun Microsystems, Inc||Method and apparatus for loading class files into non-volatile memory|
|US7702872 *||Dec 3, 2004||Apr 20, 2010||Giesecke & Devrient Gmbh||Java smart card chip having memory area reserved for global variables|
|US20070168951 *||Dec 3, 2004||Jul 19, 2007||Giesecke & Devrient Gmbh||Java smart card chip having memory area reserved for global variables|
|U.S. Classification||717/165, 719/332|
|International Classification||G06F9/44, G06F9/445|
|Feb 26, 2002||AS||Assignment|
Owner name: SCHLUMBERGER MALCO, INC., MARYLAND
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:KRISHNA, KSHEERABDHI;WILKINSON, TIM;PREVOST, SYLVAIN;ANDOTHERS;REEL/FRAME:012624/0238;SIGNING DATES FROM 20011221 TO 20020125
|Aug 10, 2005||AS||Assignment|
Owner name: AXALTO INC., TEXAS
Free format text: CHANGE OF NAME;ASSIGNOR:SCHLUMBERGER MALCO, INC.;REEL/FRAME:016883/0761
Effective date: 20040217
|Apr 21, 2010||FPAY||Fee payment|
Year of fee payment: 4
|Jun 13, 2014||REMI||Maintenance fee reminder mailed|
|Oct 31, 2014||LAPS||Lapse for failure to pay maintenance fees|
|Dec 23, 2014||FP||Expired due to failure to pay maintenance fee|
Effective date: 20141031