JP6252341B2 - Electronic information storage medium, information processing method, and information processing program - Google Patents
Electronic information storage medium, information processing method, and information processing program Download PDFInfo
- Publication number
- JP6252341B2 JP6252341B2 JP2014092653A JP2014092653A JP6252341B2 JP 6252341 B2 JP6252341 B2 JP 6252341B2 JP 2014092653 A JP2014092653 A JP 2014092653A JP 2014092653 A JP2014092653 A JP 2014092653A JP 6252341 B2 JP6252341 B2 JP 6252341B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- update
- record
- indicating
- storage area
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
TLV構造のレコードを格納するデータ格納領域と書き込み保証用のバッファ領域を有する不揮発性メモリを備えるICチップ等の電子情報記憶媒体の技術分野に関する。 The present invention relates to a technical field of an electronic information storage medium such as an IC chip including a non-volatile memory having a data storage area for storing a record having a TLV structure and a buffer area for writing guarantee.
従来から、ICチップでは、不揮発性メモリへの書き込み処理中の引き抜き等による電源供給の中断に対処するため、トランザクション(Transaction)という仕組みが利用されている。トランザクションとは、特定の一連の処理の開始前もしくは終了後のどちらかの状態のみを取り得る仕組みのことをいう。この仕組みにより、不揮発性メモリのデータ格納領域に格納されるレコードが中途半端な内部状態とならないようにしている。特許文献1には、不揮発性メモリの書き込み先に対してデータの書き込み処理を行なっている途中で、ICカードリーダライターからICカードが引き抜かれたり、また電源瞬断などが発生するなどでデータの書き込み処理が失敗した場合でも、この書き込みデータが破壊されることがないように構成されている。
2. Description of the Related Art Conventionally, in IC chips, a mechanism called “Transaction” has been used to cope with interruption of power supply due to extraction or the like during writing processing to a nonvolatile memory. A transaction refers to a mechanism that can take only a state before or after the start of a specific series of processing. This mechanism prevents the records stored in the data storage area of the nonvolatile memory from being incompletely internal. In
ところで、ICチップでは、TLV(タグ(Tag)、データ長(Length)、データ値(Value))構造のレコード(データオブジェクト)を不揮発性メモリに書き込む場合、データの整合性を担保するため、不揮発性メモリに格納されているレコード、及びレコード管理情報(格納済みレコード数、レコードのチェックコードなど)を1回のトランザクションで更新するようになっている。このトランザクションにおける書き込み保証機能では、当該トランザクション中、更新用のレコード(更新後のレコード)を書き込み保証用のバッファ領域に格納した後に、当該データ格納領域のレコードを更新し、当該更新をコミットするように構成されている。更新用のレコード(不揮発性メモリに書き込むレコード)のデータ長(レコード長)が上記バッファ領域の容量以下の場合、1回のトランザクションで更新が完了し、コミットするまでに更新が中断しても、レコード及びレコード数などの整合性を保証することができる。 By the way, in an IC chip, when a record (data object) having a TLV (tag, tag, data length (length), and data value (value)) structure is written to a nonvolatile memory, a nonvolatile memory is used to ensure data consistency. The records stored in the memory and the record management information (number of stored records, record check code, etc.) are updated in one transaction. In this transaction, the write guarantee function stores the update record (updated record) in the write guarantee buffer area, updates the record in the data storage area, and commits the update during the transaction. It is configured. If the data length (record length) of the record for update (record to be written in the non-volatile memory) is less than the capacity of the buffer area, even if the update is completed in one transaction and the update is interrupted before committing, Consistency such as records and the number of records can be guaranteed.
しかしながら、更新用のレコードのデータ長が上記バッファ領域の容量を超える場合、複数回のコミットが行われるため、書き込み処理中の引き抜き等により更新が中断した場合、データの整合性が保証できないことがある。例えば、更新前のデータ値が途中から出力、つまり、意図しないデータ(中途半端なデータ)が外部に出力される可能性がある。 However, if the data length of the record for update exceeds the capacity of the buffer area, multiple commits are performed. Therefore, if the update is interrupted due to extraction during write processing, data consistency cannot be guaranteed. is there. For example, the data value before the update may be output from the middle, that is, unintended data (halfway data) may be output to the outside.
そこで、本発明は、更新用のレコードのデータ長がバッファ領域の容量を超える場合であっても、意図しないデータが外部に出力されることを回避することが可能な電子情報記憶媒体、情報処理方法、及び情報処理プログラムを提供することを目的とする。 Therefore, the present invention provides an electronic information storage medium, information processing capable of avoiding unintended data output to the outside even when the data length of the record for update exceeds the capacity of the buffer area It is an object to provide a method and an information processing program.
上記課題を解決するために、請求項1に記載の発明は、少なくともデータ値を示すデータと当該データ値のデータ長を示すデータとを含んで構成されるレコードを格納するデータ格納領域と、バッファ領域とを少なくとも有する不揮発性メモリと、更新用のレコードで前記データ格納領域のレコードを更新する際に、当該更新用のレコードの全部又は一部を前記バッファ領域に格納した後に、当該データ格納領域のレコードを更新し、当該更新をコミットするプロセッサと、を備える電子情報記憶媒体において、前記プロセッサは、前記更新用のレコードのデータ長が前記バッファ領域の容量を超える場合、前記データ格納領域のレコードに含まれる前記データ長を示すデータを、データがないことを示す値に更新し、当該更新をコミットする第1更新手段と、前記第1更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち前記バッファ領域の容量分のデータ値を示すデータで、前記データ格納領域のレコードに含まれる前記データ長を示すデータ以外の前記データを更新し、当該更新をコミットする第2更新手段と、前記第2更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータで、前記データ格納領域のレコードに含まれる更新されていない残りのデータを更新し、当該更新をコミットする第3更新手段と、前記更新用のレコードに含まれる全データが更新に利用された場合、前記更新用のレコードに含まれるデータ長を示すデータで、前記データ格納領域のレコードに含まれるデータ長を示すデータを更新し、当該更新をコミットする第4更新手段と、を備えることを特徴とする。
In order to solve the above problem, the invention according to
請求項2に記載の発明は、請求項1に記載の電子情報記憶媒体において、前記データがないことを示す値は0であることを特徴とする。 According to a second aspect of the present invention, in the electronic information storage medium according to the first aspect, a value indicating that there is no data is 0.
請求項3に記載の発明は、請求項1または2に記載の電子情報記憶媒体において、前記第3更新手段は、前記更新用のレコードに含まれるデータ値を示すデータが全てが更新に利用されるまで、更新に利用されていないデータ値を示すデータで、前記データ格納領域のレコードに含まれる更新されていないデータ値を示すデータを更新し、当該更新をコミットすることを繰り返すことを特徴とする。 According to a third aspect of the present invention, in the electronic information storage medium according to the first or second aspect, the third update means uses all the data indicating the data value included in the update record for updating. Until the data indicating the data value not used for updating is updated with the data indicating the data value not updated included in the record of the data storage area, and the update is repeatedly committed. To do.
請求項4に記載の発明は、少なくともデータ値を示すデータと当該データ値のデータ長を示すデータとを含んで構成されるレコードを格納するデータ格納領域と、バッファ領域とを少なくとも有する不揮発性メモリと、更新用のレコードで前記データ格納領域のレコードを更新する際に、当該データ格納領域のレコードの全部又は一部を前記バッファ領域にバックアップした後に、当該データ格納領域のレコードを更新し、当該更新をコミットするプロセッサと、を備える電子情報記憶媒体において前記プロセッサにより実行される情報処理方法であって、前記更新用のレコードのデータ長が前記バッファ領域の容量を超える場合、前記データ格納領域のレコードに含まれる前記データ長を示すデータを、データがないことを示す値に更新し、当該更新をコミットする第1更新ステップと、前記第1更新ステップによるコミット後に、前記更新用のレコードに含まれる全データのうち前記バッファ領域の容量分のデータ値を示すデータで、前記データ格納領域のレコードに含まれる前記データ長を示すデータ以外の前記データを更新し、当該更新をコミットする第2更新ステップと、前記第2更新ステップによるコミット後に、前記更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータで、前記データ格納領域のレコードに含まれる更新されていない残りのデータを更新し、当該更新をコミットする第3更新ステップと、前記更新用のレコードに含まれる全データが更新に利用された場合、前記更新用のレコードに含まれるデータ長を示すデータで、前記データ格納領域のレコードに含まれるデータ長を示すデータを更新し、当該更新をコミットする第4更新ステップと、を含むことを特徴とする。
The invention according to
請求項5に記載の発明は、少なくともデータ値を示すデータと当該データ値のデータ長を示すデータとを含んで構成されるレコードを格納するデータ格納領域と、バッファ領域とを少なくとも有する不揮発性メモリと、更新用のレコードで前記データ格納領域のレコードを更新する際に、当該更新用のレコードの全部又は一部を前記バッファ領域に格納した後に、当該データ格納領域のレコードを更新し、当該更新をコミットするプロセッサと、を備える電子情報記憶媒体における前記プロセッサを、前記更新用のレコードのデータ長が前記バッファ領域の容量を超える場合、前記データ格納領域のレコードに含まれる前記データ長を示すデータを、データがないことを示す値に更新し、当該更新をコミットする第1更新手段と、前記第1更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち前記バッファ領域の容量分のデータ値を示すデータで、前記データ格納領域のレコードに含まれる前記データ長を示すデータ以外の前記データを更新し、当該更新をコミットする第2更新手段と、前記第2更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータで、前記データ格納領域のレコードに含まれる更新されていない残りのデータを更新し、当該更新をコミットする第3更新手段と、前記更新用のレコードに含まれる全データが更新に利用された場合、前記更新用のレコードに含まれるデータ長を示すデータで、前記データ格納領域のレコードに含まれるデータ長を示すデータを更新し、当該更新をコミットする第4更新手段として機能させることを特徴とする。
The invention according to
本発明によれば、更新用のレコードのデータ長がバッファ領域の容量を超える場合であっても、意図しないデータが外部に出力されることを回避することができる。 According to the present invention, unintended data can be prevented from being output to the outside even when the data length of the update record exceeds the capacity of the buffer area.
以下、図面を参照して本発明の実施形態について詳細に説明する。以下に説明する実施形態は、ICカードに対して本発明を適用した場合の実施の形態である。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. The embodiment described below is an embodiment when the present invention is applied to an IC card.
先ず、図1を参照して、本実施形態に係るICカード1の構成及び機能概要について説明する。図1は、ICカード1の概要構成例を示す図である。なお、ICカード1は、キャッシュカード、クレジットカード、社員カード等として使用される。或いは、ICカード1は、スマートフォンや携帯電話機等の通信機器に組み込まれる。ICチップ1aは通信機器の回路基板上に直接組み込んで構成するようにしてもよい。
First, with reference to FIG. 1, the configuration and functional overview of the
ICカード1には、図1に示すように、ICチップ1aが搭載されている。ICチップ1aは、本発明の電子情報記憶媒体の一例である。ICチップ1aは、CPU(Central Processing Unit)10、RAM(Random Access Memory)11、ROM(Read Only Memory)12、不揮発性メモリ13、及びI/O回路14を備えて構成される。なお、I/O回路14は、外部端末2とのインターフェイスを担う。ICカード1が接触ICカードの場合、I/O回路14には、例えばISO/IEC7816によって定められたC1〜C8の8個の端子が設けられている。例えば、C1端子は電源端子、C2端子はリセット端子、C3端子はクロック端子、C5端子はグランド端子、C7端子は外部端末2とのデータ通信を行う端子である。なお、この例では、接触式のICカードの例を示したが、外部端末2に近づくことにより、磁界をエネルギーとして無結線状態で電源供給され(電圧印加され)、動作する非接触式のICカード(アンテナ及び変復調回路を含む)であってもよい。外部端末2の例としては、ICカード発行機、ATM、改札機、認証用ゲート等が挙げられる。或いは、ICカード1が通信機器に組み込まれる場合、外部端末2には通信機器の機能を担うコントローラが該当する。
An IC chip 1a is mounted on the
CPU10は、ROM12または不揮発性メモリ13に記憶されたプログラム(本発明の情報処理プログラムを含む)を実行するプロセッサ(コンピュータ)である。CPU10は、記憶されたプログラムに従って後述する処理を実行する。不揮発性メモリ13は、例えばフラッシュメモリが適用される。なお、不揮発性メモリ13は、「Electrically Erasable Programmable Read-Only Memory」であっても構わない。不揮発性メモリ13には、データ格納領域、及び書き込み保証用のバッファ領域等を有する。データ格納領域には、例えばISO/IEC7816−4によって定められたMF(Master File)、DF(Dedicated File)、及びEF(Elementary File)などから構成される階層構造を有する複数のファイルが定義される。MFは、データ格納領域におけるファイル構成において最上位に位置し、MFの下位階層にはDF及びEFが位置する。DFは、例えばアプリケーションプログラムごとに設けられる。EFは、例えば、DFに格納されるアプリケーションプログラムで使用される複数のレコード(データオブジェクト)を格納するレコードファイルである。レコードは、レコードの識別子であるタグ(Tag)を示すデータ、データ値(Value)のデータ長(Length)を示すデータ、及びデータ値(Value)を示すデータを含んで構成される。なお、データ格納領域には、レコード管理情報として、ページごとに対応するデータ誤り検出符号(例えば、CRC(Cyclic Redundancy Check))、及びレコード数が格納される。ページとは、データの読み書きが行われる最小単位(例えば128バイト、256バイト、または512バイト)をいう。
The
CPU10は、例えば外部端末2からI/O回路14を介して受信されたコマンド(例えば、書き込みコマンド)により指定された更新用のレコードでデータ格納領域のレコードを更新する際に、トランザクションにより、当該更新用のレコード(更新後のレコード)の全部又は一部をバッファ領域に格納した後に当該データ格納領域のレコードを更新し、当該更新をコミットすることを前提とする。
When the
そして、CPU10は、本発明における第1更新手段、第2更新手段、第3更新手段、及び第4更新手段として機能する。具体的には、CPU10は、コマンドにより指定された更新用のレコード(レコードデータ)のデータ長(以下、「更新レコード長」という)がバッファ領域の容量を超える場合、更新用のレコードに含まれるタグ(Tag)を示すデータで、データ格納領域のレコードに含まれるタグ(Tag)を示すデータを更新し、且つ、データ格納領域のレコードに含まれるデータ長(Length)を示すデータを、データがないことを示す値(例えば、0)に更新し、当該更新をコミット(1回目のコミット)する。
The
ここで、コマンドは、例えば、APDU(Application Protocol Data Unit)として外部端末2から送信される。APDUとして送られるコマンドは、CLA部、INS部、P1部、P2部、Lc部、Data部、Le部から構成される。CLA部及びINS部は、コマンドの種類を示す情報を格納する。P1部及びP2部は、コマンド処理におけるパラメータを格納する。Lc部は、Data部のデータ長(本実施形態では、更新レコード長)を格納する。Data部は、更新用のレコード(レコードデータ)を格納する。Le部は、コマンドをチェックするための情報を格納する。また、コミットとは、レコードの更新を確定する処理であり、例えばレコードごとに記憶された更新完了フラグを“1”にセットする処理である。言い換えれば、コミットとは、バッファ領域に格納されたデータをデータ格納領域に反映して、更新完了フラグを“1”にセットする処理ということもできる。
Here, the command is transmitted from the
CPU10は、1回目のコミット後に、更新用のレコードに含まれる全データのうちバッファ領域の容量分のデータ値(Value)を示すデータ(つまり、データ値(Value)を示すデータの一部)で、データ格納領域のレコードに含まれるタグ(Tag)及びデータ長(Length)を示すデータ以外のデータ(例えば、データ値(Value)を示すデータの一部)を更新し、当該更新をコミット(2回目のコミット)する。そして、CPU10は、2回目のコミット後に、更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータ値(Value)を示すデータで、データ格納領域のレコードに含まれる更新されていない残りのデータ値(Value)を示すデータを更新し、当該更新をコミット(3回目のコミット)する。そして、CPU10は、3回目のコミット後に、更新用のレコードに含まれるデータ値(Value)を示すデータの全てが更新に利用された場合、更新用のレコードに含まれるデータ長(Length)を示すデータで、データ格納領域のレコードに含まれるデータ長(Length)を示すデータを更新し、当該更新をコミット(4回目のコミット)する。なお、CPU10は、2回目のコミット後、更新用のレコードに含まれるデータ値(Value)を示すデータの全てが更新に利用されるまで、更新に利用されていないデータ値(Value)を示すデータで、データ格納領域のレコードに含まれる更新されていないデータ値(Value)を示すデータを更新し、当該更新をコミットすることを繰り返すことになる。
After the first commit, the
次に、図2及び図3等を参照して、ICカード1aにおけるCPU10のコマンド受信時の処理の一例について説明する。図2は、CPU10のコマンド受信時の処理の一例を示すフローチャートである。図3は、データ格納領域のレコードの一例と、更新用のレコードの一例とを示す図である。図3の例では、データ格納領域のレコードのデータ長(以下、「格納済みレコード長」という)は25バイトであり(図3(A))、更新用のレコードの更新レコード長は20バイトである(図3(B))。なお、図3の例では、データ格納領域のレコード、及び更新用のレコードそれぞれに含まれるデータを16進数(h)で表している。例えば、データ格納領域のレコードに含まれるデータ長(Length)を示すデータは17(h)となっているが、これは10進数で23である。従って、データ格納領域のレコードに含まれるデータ値(Value)を示すデータのデータ長は23バイトである。一方、更新用のレコードに含まれるデータ長(Length)を示すデータは12(h)となっているが、これは10進数で18である。従って、データ格納領域のレコードに含まれるデータ値(Value)を示すデータのデータ長は18バイトである。
Next, an example of processing when the
図2に示す処理は、CPU10が、例えば外部端末2からI/O回路14を介してコマンドを受信することにより開始される。図2に示す処理が開始されると、CPU10は、受信されたコマンドで指定された更新用のレコードの更新レコード長が、バッファ領域の容量を超えているか否か判定する(ステップS1)。CPU10は、更新レコード長がバッファ領域の容量を超えていないと判定した場合(ステップS1:NO)、ステップS2へ進む。なお、ステップS2〜S6の処理は、従来の処理と同様である。一方、CPU10は、更新レコード長がバッファ領域の容量を超えていると判定した場合(ステップS1:YES)、ステップS7へ進む。
The processing shown in FIG. 2 is started when the
ステップS2では、CPU10は、トランザクションを開始し、受信されたコマンドが含む更新用のレコードをバッファ領域に格納する。次いで、CPU10は、データ格納領域のレコード(つまり、タグ(Tag)、データ長(Length)、及びデータ値(Value)を示すデータ)を、バッファ領域に格納された更新用のレコードで更新(上書き(データ反映))する(ステップS3)。次いで、CPU10は、レコード管理情報を更新する(ステップS4)。レコード管理情報の更新では、例えば、更新されたレコードのCRCが計算されて格納される。次いで、CPU10は、トランザクションを終了し(ステップS5)、ステップS3及びステップS4での更新をコミットし(ステップS6)、図2に示す処理を終了する。
In step S2, the
ここで、更新レコード長がバッファ領域の容量を超えている場合に、従来の処理が行われた場合について説明する。図4は、更新レコード長がバッファ領域の容量を超えている場合に従来の処理が行われた場合、データ格納領域のデータが更新されていく様子と、コミットの前後で処理が中断した場合において読み出されるレコード(読み出しレコード)とを示す図である。なお、図4の例では、不揮発性メモリ13における書き込み保証用のバッファ領域の容量を16バイトとしている。この場合、更新用のレコードに含まれる全データのうち、その先頭からバッファ領域の容量分のデータ(つまり、更新対象のレコードの一部)で、データ格納領域のレコードに含まれる全データのうち、そのデータの先頭からバッファ領域の容量分のデータが更新される(図4(2))。そして、1回目のコミットが行われる(図4(3))。その後、更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータ(つまり、データ値(Value)を示すデータの一部)で、データ格納領域のレコードに含まれる更新されていない残りのデータが更新され(図4(4))、2回目のコミットが行われる(図4(5))。このように、従来の処理が行われる場合において、2回目のコミット完了前に処理が中断した場合の読み出しレコードに含まれるデータは、図4(B)に示すように中途半端なデータとなる。すなわち、当該レコードに含まれるデータ長(Length)を示すデータは12(h)にコミット済であるため、当該レコードに含まれるデータ値(Value)を示すデータは、更新済のデータと更新前のデータとが混在してしまうことになる。このような中途半端なデータは、CRCでは異常判定できないため(CRC計算後にコミットがなされるため)、正しいデータとして出力されてしまうことになる。
Here, a case where the conventional process is performed when the update record length exceeds the capacity of the buffer area will be described. Fig. 4 shows how the data in the data storage area is updated when the conventional processing is performed when the update record length exceeds the capacity of the buffer area, and when the processing is interrupted before and after the commit. It is a figure which shows the record (read record) read. In the example of FIG. 4, the capacity of the write guarantee buffer area in the
一方、図5は、更新レコード長がバッファ領域の容量を超えている場合に本発明の処理が行われた場合に、データ格納領域のデータが更新されていく様子と、コミットの前後で処理が中断した場合において読み出されるレコードとを示す図である。なお、図5の例でも、不揮発性メモリ13における書き込み保証用のバッファ領域の容量を16バイトとしている。この場合、CPU10は、ステップS7において、トランザクションを開始し、受信されたコマンドが含む更新用のレコードに含まれる全データのうち、タグ(Tag)を示すデータ及びデータがないことを示す値(例えば、00(h))(つまり、更新対象のレコードの一部)をバッファ領域に格納する。次いで、CPU10は、バッファ領域に格納されたタグ(Tag)を示すデータで、データ格納領域のレコードに含まれるタグ(Tag)を示すデータを更新し、且つ、データ格納領域のレコードに含まれるデータ長(Length)を示すデータを、例えば00(h)(バッファ領域に格納された「データがないことを示す値」)に更新(00(h)で上書き)する(ステップS8、図5(2))。次いで、CPU10は、トランザクションを終了し(ステップS9)、ステップS8での更新をコミット(1回目のコミット)する(ステップS10、図5(3))。
On the other hand, FIG. 5 shows how data in the data storage area is updated when the process of the present invention is performed when the update record length exceeds the capacity of the buffer area, and the process before and after the commit. It is a figure which shows the record read when interrupted. In the example of FIG. 5 as well, the capacity of the write guarantee buffer area in the
次いで、CPU10は、未更新のデータ値(Value)を示すデータのデータ長が、バッファ領域の容量を超えているか否かを判定する(ステップS11)。ここで、未更新のデータ値(Value)を示すデータとは、更新用のレコードに含まれるデータ値(Value)を示すデータのうち、更新に利用されていないデータである。CPU10は、未更新のデータ値(Value)を示すデータのデータ長が、バッファ領域の容量を超えていると判定した場合(ステップS11:YES)、ステップS12へ進む。一方、CPU10は、未更新のデータ値(Value)を示すデータのデータ長が、バッファ領域の容量を超えていないと判定した場合(ステップS11:NO)、ステップS16へ進む。
Next, the
ステップS12では、CPU10は、トランザクションを開始し、更新用のレコードに含まれる更新に利用されていないデータ値(Value)を示すデータのうち、バッファ領域の容量分のデータ(つまり、当該データ値(Value)を示すデータの一部)をバッファ領域に格納する。次いで、CPU10は、バッファ領域に格納されたデータ値(Value)を示すデータ(更新に利用されていない残りのデータ)で、データ格納領域のレコードに含まれる更新されていないデータ値(Value)を示すデータを更新する(ステップS13、図5(4))。次いで、CPU10は、トランザクションを終了し(ステップS14)、ステップS13での更新をコミット(2回目のコミット)し(ステップS15、図5(5))、ステップS11に戻る。なお、ステップS11〜S15の処理は、更新用のレコードに含まれるデータ値(Value)を示すデータの全てが更新に利用されるまで、繰り返されることになる。
In step S12, the
ステップS16では、CPU10は、トランザクションを開始し、更新用のレコードに含まれる更新に利用されていないデータ値(Value)を示すデータをバッファ領域に格納する。次いで、CPU10は、バッファ領域に格納された残りのデータ値(Value)を示すデータで、データ格納領域のレコードに含まれる更新されていないデータ値(Value)を示すデータを更新する(ステップS17、図5(6))。次いで、CPU10は、トランザクションを終了し(ステップS18)、ステップS17での更新をコミット(3回目のコミット)する(ステップS19、図5(7))。
In step S <b> 16, the
次いで、CPU10は、ステップS20において、トランザクションを開始し、更新用のレコードに含まれるデータ長(Length)を示すデータをバッファ領域に格納する。次いで、CPU10は、バッファ領域に格納されたデータ長(Length)を示すデータで、データ格納領域のレコードに含まれるデータ長(Length)を示すデータを更新する(ステップS21。図5(8))。次いで、CPU10は、上記ステップS4と同様、レコード管理情報を更新する(ステップS22)。次いで、CPU10は、トランザクションを終了し(ステップS23)、ステップS20での更新をコミット(4回目のコミット)する(ステップS24、図5(9))。
Next, in step S20, the
このように、本発明の処理が行われる場合において、4回目のコミット完了前に処理が中断した場合の読み出しレコードに含まれるデータは、図5(B)に示すように、当該レコードに含まれるデータ長(Length)を示すデータは00(h)にコミット済であるため、当該レコードに含まれるデータ値(Value)を示すデータは無となる。そのため、中途半端なデータが出力されない。 As described above, when the processing of the present invention is performed, the data included in the read record when the processing is interrupted before the completion of the fourth commit is included in the record as shown in FIG. Since the data indicating the data length (Length) has been committed at 00 (h), there is no data indicating the data value (Value) included in the record. Therefore, halfway data is not output.
以上説明したように、上記実施形態によれば、更新レコード長がバッファ領域の容量を超える場合、データ格納領域のレコードに含まれるデータ長(Length)を示すデータを、データがないことを示す値(例えば、0)に更新し、当該更新をコミットした後、データ格納領域のレコードに含まれるデータ値(Value)を示すデータを更新及びコミットし、更新用のレコードに含まれるデータ値(Value)を示すデータの全てが更新に利用された場合、更新用のレコードに含まれるデータ長(Length)を示すデータで、データ格納領域のレコードに含まれるデータ長(Length)を示すデータを更新し、当該更新をコミットするように構成したので、更新レコード長がバッファ領域の容量を超える場合であっても、利用者が意図しないデータ(中途半端なデータ)が外部に出力されることを回避することができる。 As described above, according to the above embodiment, when the update record length exceeds the capacity of the buffer area, the data indicating the data length (Length) included in the record in the data storage area is replaced with a value indicating that there is no data. After updating to (for example, 0) and committing the update, the data indicating the data value (Value) included in the record in the data storage area is updated and committed, and the data value (Value) included in the update record is updated. When all of the data indicating is used for updating, the data indicating the data length (Length) included in the record in the data storage area is updated with the data indicating the data length (Length) included in the update record, Since the configuration is such that the update is committed, even if the update record length exceeds the capacity of the buffer area, unintended data (half-finished data) Output) to the outside can be avoided.
1 ICカード
1a ICチップ
2 外部端末
10 CPU
11 RAM
12 ROM
13 不揮発性メモリ
14 I/O回路
1 IC card
11 RAM
12 ROM
13 Non-volatile memory 14 I / O circuit
Claims (5)
更新用のレコードで前記データ格納領域のレコードを更新する際に、当該更新用のレコードの全部又は一部を前記バッファ領域に格納した後に、当該データ格納領域のレコードを更新し、当該更新をコミットするプロセッサと、を備える電子情報記憶媒体において、
前記プロセッサは、
前記更新用のレコードのデータ長が前記バッファ領域の容量を超える場合、前記データ格納領域のレコードに含まれる前記データ長を示すデータを、データがないことを示す値に更新し、当該更新をコミットする第1更新手段と、
前記第1更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち前記バッファ領域の容量分のデータ値を示すデータで、前記データ格納領域のレコードに含まれる前記データ長を示すデータ以外の前記データを更新し、当該更新をコミットする第2更新手段と、
前記第2更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータで、前記データ格納領域のレコードに含まれる更新されていない残りのデータを更新し、当該更新をコミットする第3更新手段と、
前記更新用のレコードに含まれる全データが更新に利用された場合、前記更新用のレコードに含まれるデータ長を示すデータで、前記データ格納領域のレコードに含まれるデータ長を示すデータを更新し、当該更新をコミットする第4更新手段と、
を備えることを特徴とする電子情報記憶媒体。 A non-volatile memory having at least a data storage area for storing a record including data indicating at least a data value and data indicating a data length of the data value, and a buffer area;
When updating a record in the data storage area with an update record, after storing all or part of the update record in the buffer area, update the record in the data storage area and commit the update An electronic information storage medium comprising:
The processor is
If the data length of the record for update exceeds the capacity of the buffer area, the data indicating the data length included in the record in the data storage area is updated to a value indicating no data, and the update is committed First updating means for
Data indicating the data value corresponding to the capacity of the buffer area among all data included in the update record after committing by the first update means, and indicating the data length included in the record in the data storage area A second update means for updating the data other than and committing the update;
After the commit by the second update means, the remaining data not updated in the data storage area is updated with the remaining data not used for updating among all the data included in the update record. A third updating means for committing the update;
When all data included in the update record is used for update, the data indicating the data length included in the record in the data storage area is updated with data indicating the data length included in the update record. A fourth update means for committing the update;
An electronic information storage medium comprising:
更新用のレコードで前記データ格納領域のレコードを更新する際に、当該更新用のレコードの全部又は一部を前記バッファ領域に格納した後に、当該データ格納領域のレコードを更新し、当該更新をコミットするプロセッサと、を備える電子情報記憶媒体において前記プロセッサにより実行される情報処理方法であって、
前記更新用のレコードのデータ長が前記バッファ領域の容量を超える場合、前記データ格納領域のレコードに含まれる前記データ長を示すデータを、データがないことを示す値に更新し、当該更新をコミットする第1更新ステップと、
前記第1更新ステップによるコミット後に、前記更新用のレコードに含まれる全データのうち前記バッファ領域の容量分のデータ値を示すデータで、前記データ格納領域のレコードに含まれる前記データ長を示すデータ以外の前記データを更新し、当該更新をコミットする第2更新ステップと、
前記第2更新ステップによるコミット後に、前記更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータで、前記データ格納領域のレコードに含まれる更新されていない残りのデータを更新し、当該更新をコミットする第3更新ステップと、
前記更新用のレコードに含まれる全データが更新に利用された場合、前記更新用のレコードに含まれるデータ長を示すデータで、前記データ格納領域のレコードに含まれるデータ長を示すデータを更新し、当該更新をコミットする第4更新ステップと、
を含むことを特徴とする情報処理方法。 A non-volatile memory having at least a data storage area for storing a record including data indicating at least a data value and data indicating a data length of the data value, and a buffer area;
When updating a record in the data storage area with an update record, after storing all or part of the update record in the buffer area, update the record in the data storage area and commit the update An information processing method executed by the processor in an electronic information storage medium comprising:
If the data length of the record for update exceeds the capacity of the buffer area, the data indicating the data length included in the record in the data storage area is updated to a value indicating no data, and the update is committed A first updating step,
Data indicating a data value corresponding to the capacity of the buffer area among all data included in the update record after commit in the first update step, and indicating the data length included in the record in the data storage area A second update step of updating the data other than and committing the update;
After the commit in the second update step, the remaining unupdated data included in the record in the data storage area is updated with the remaining data that is not used for update among all the data included in the update record. And a third update step for committing the update,
When all data included in the update record is used for update, the data indicating the data length included in the record in the data storage area is updated with data indicating the data length included in the update record. A fourth update step for committing the update;
An information processing method comprising:
更新用のレコードで前記データ格納領域のレコードを更新する際に、当該更新用のレコードの全部又は一部を前記バッファ領域に格納した後に、当該データ格納領域のレコードを更新し、当該更新をコミットするプロセッサと、を備える電子情報記憶媒体における前記プロセッサを、
前記更新用のレコードのデータ長が前記バッファ領域の容量を超える場合、前記データ格納領域のレコードに含まれる前記データ長を示すデータを、データがないことを示す値に更新し、当該更新をコミットする第1更新手段と、
前記第1更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち前記バッファ領域の容量分のデータ値を示すデータで、前記データ格納領域のレコードに含まれる前記データ長を示すデータ以外の前記データを更新し、当該更新をコミットする第2更新手段と、
前記第2更新手段によるコミット後に、前記更新用のレコードに含まれる全データのうち更新に利用されていない残りのデータで、前記データ格納領域のレコードに含まれる更新されていない残りのデータを更新し、当該更新をコミットする第3更新手段と、
前記更新用のレコードに含まれる全データが更新に利用された場合、前記更新用のレコードに含まれるデータ長を示すデータで、前記データ格納領域のレコードに含まれるデータ長を示すデータを更新し、当該更新をコミットする第4更新手段として機能させることを特徴とする情報処理プログラム。 A non-volatile memory having at least a data storage area for storing a record including data indicating at least a data value and data indicating a data length of the data value, and a buffer area;
When updating a record in the data storage area with an update record, after storing all or part of the update record in the buffer area, update the record in the data storage area and commit the update A processor in an electronic information storage medium comprising:
If the data length of the record for update exceeds the capacity of the buffer area, the data indicating the data length included in the record in the data storage area is updated to a value indicating no data, and the update is committed First updating means for
Data indicating the data value corresponding to the capacity of the buffer area among all data included in the update record after committing by the first update means, and indicating the data length included in the record in the data storage area A second update means for updating the data other than and committing the update;
After the commit by the second update means, the remaining data not updated in the data storage area is updated with the remaining data not used for updating among all the data included in the update record. A third updating means for committing the update;
When all data included in the update record is used for update, the data indicating the data length included in the record in the data storage area is updated with data indicating the data length included in the update record. And an information processing program that functions as fourth update means for committing the update.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014092653A JP6252341B2 (en) | 2014-04-28 | 2014-04-28 | Electronic information storage medium, information processing method, and information processing program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014092653A JP6252341B2 (en) | 2014-04-28 | 2014-04-28 | Electronic information storage medium, information processing method, and information processing program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2015210707A JP2015210707A (en) | 2015-11-24 |
JP6252341B2 true JP6252341B2 (en) | 2017-12-27 |
Family
ID=54612827
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014092653A Active JP6252341B2 (en) | 2014-04-28 | 2014-04-28 | Electronic information storage medium, information processing method, and information processing program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6252341B2 (en) |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002007178A (en) * | 2000-06-22 | 2002-01-11 | Mitsubishi Electric Corp | Device for setting buffer size |
US6823417B2 (en) * | 2001-10-01 | 2004-11-23 | Hewlett-Packard Development Company, L.P. | Memory controller for memory card manages file allocation table |
JP4208079B2 (en) * | 2004-05-14 | 2009-01-14 | インターナショナル・ビジネス・マシーンズ・コーポレーション | Database server, program, recording medium, and control method |
JP5214291B2 (en) * | 2008-03-19 | 2013-06-19 | 株式会社東芝 | IC card and IC card control method |
SG151197A1 (en) * | 2007-09-20 | 2009-04-30 | Toshiba Kk | Portable electronic apparatus and control method for portable electronic apparatus |
-
2014
- 2014-04-28 JP JP2014092653A patent/JP6252341B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2015210707A (en) | 2015-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
RU2146399C1 (en) | Method for data storage in non-volatile memory unit, method for using integral circuit device, and integral circuit device | |
US7017825B2 (en) | IC card and data processing method therefor | |
EP2102748B1 (en) | System and method for recovery of memory transactions | |
JP6252341B2 (en) | Electronic information storage medium, information processing method, and information processing program | |
JP2008027070A (en) | Portable electronic apparatus and control method of portable electronic apparatus | |
JP6233134B2 (en) | Electronic information storage medium, information processing method, and information processing program | |
EP3023925B1 (en) | Secure element with applications | |
JP7322923B2 (en) | Secure element, transaction control method and device | |
US7346730B2 (en) | Mobile electronic device | |
JP2006293706A (en) | Multi-application ic card with application updating function | |
JP5983349B2 (en) | IC card, data read / write method, and data read / write program | |
CN112698785B (en) | Data updating method of storage device | |
JP7021465B2 (en) | Electronic information storage device, IC card, data recovery method, and data recovery program | |
JP5708228B2 (en) | IC card and IC card refresh method | |
JP2016153945A (en) | Electronic information storage medium, counter rewriting method and counter rewriting program | |
JP6015461B2 (en) | Information recording medium, data read / write method, and data read / write program | |
JP6915437B2 (en) | Update method and update program using electronic information storage medium, IC card, electronic information storage medium | |
EP4024254A1 (en) | Method and device for updating data | |
JP6281302B2 (en) | Information processing apparatus, IC card, and data processing method | |
JP2007034434A (en) | Ic card, method for writing data to ic card, and ic card program | |
JP7068603B2 (en) | Update method and update program using electronic information storage medium, IC card, electronic information storage medium | |
JP2008047042A (en) | Portable electronic device and ic card | |
JP2008305263A (en) | Nonvolatile semiconductor storage device and memory management method | |
JP2013003831A (en) | Ic chip, processing program for ic chip, and writing processing method in ic chip | |
JP5853559B2 (en) | IC chip, processing method in IC chip, IC chip processing program, and IC card |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170227 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20171031 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20171113 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6252341 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |