CN102354279B - Data processing method for embedded system and coprocessor - Google Patents

Data processing method for embedded system and coprocessor Download PDF

Info

Publication number
CN102354279B
CN102354279B CN201110278212.2A CN201110278212A CN102354279B CN 102354279 B CN102354279 B CN 102354279B CN 201110278212 A CN201110278212 A CN 201110278212A CN 102354279 B CN102354279 B CN 102354279B
Authority
CN
China
Prior art keywords
parameter
offset
data
bits
value
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
Application number
CN201110278212.2A
Other languages
Chinese (zh)
Other versions
CN102354279A (en
Inventor
陆舟
于华章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201110278212.2A priority Critical patent/CN102354279B/en
Publication of CN102354279A publication Critical patent/CN102354279A/en
Application granted granted Critical
Publication of CN102354279B publication Critical patent/CN102354279B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a data processing method for an embedded system and a coprocessor. The method comprises the following steps of: acquiring data to be processed and a first parameter; setting a value of a second parameter in a preset number of parameters to be a difference obtained by subtracting 2 from a value of the first parameter, setting an initial bit of an offset bit to be a preset bit of the second parameter, and presetting an initial value of current iterative data; when the value of the second parameter at a current offset bit is 1, performing a modular multiplication operation on the data to be processed and the value of the current iterative data to obtain a first operation result, and replacing the value of the current iterative data by using the first operation result; and when the current offset bit is verified to meet preset conditions, outputting the current iterative data as a multiplicative inverse of the data to be processed. By the data processing method and the coprocessor, the data processing efficiency of a processor system, particularly a security code system can be improved.

Description

The method of deal with data and coprocessor in embedded system
Technical field
The present invention relates to information security field, in particular to a kind of in embedded system method and the coprocessor of deal with data.
Background technology
Along with the pay attention to day by day of people to information security, cryptographic algorithm is perfect gradually, and the multiplicative inverse of data has also obtained abundant application in field of cryptography, has all related to the calculating of multiplicative inverse in cipher system in the process such as the generation of key, encryption and decryption.In prior art, the calculating of multiplicative inverse is generally realized by Extended Euclidean Algorithm by CPU, and the number relating in Current Password algorithm generally is large number, the operation efficiency that makes to calculate multiplicative inverse is low, length consuming time, and cost is higher, thereby make the calculating of multiplicative inverse become the bottleneck that algorithm is realized, affect the execution speed of whole cipher system.
At present large for the algorithm consumption of natural resource amount of the calculating multiplicative inverse of correlation technique, cause the efficiency of system deal with data low, length consuming time and the high problem of cost, effective solution is not yet proposed at present.
Summary of the invention
Fundamental purpose of the present invention be to provide a kind of in embedded system method and the coprocessor of deal with data, large to solve the algorithm consumption of natural resource amount of above-mentioned calculating multiplicative inverse, cause the efficiency of system deal with data low, length consuming time and the high problem of cost.
To achieve these goals, according to an aspect of the present invention, provide a kind of in embedded system the method for deal with data, should in embedded system, method of deal with data comprise: receive the instruction of calculating multiplicative inverse, and obtain pending data and the first parameter according to instruction; The value that the second parameter value in predetermined number parameter is set to the first parameter subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data; Judge whether the second parameter is 1 in the value of current bits of offset, if so, according to the value of pending data and current iteration data, carries out modular multiplication, to obtain the first operation result, and the value of current iteration data is replaced with to the first operation result; If not, according to current iteration data acquisition the second operation result, and the value of current iteration data is replaced with to the second operation result; In the current bits of offset of checking, meet when pre-conditioned the multiplicative inverse that current iteration data are pending data; The multiplicative inverse of the pending data that output obtains.
Further, according to the value of pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, comprise: current iteration data are carried out to computing module-square, obtain the mould square of current iteration data; The mould of pending data and current iteration data square is carried out to modular multiplication, obtain the first operation result, wherein, using the first parameter as modulus.
Further, in the second parameter, in the value of current bits of offset, it is not 1 o'clock, according to current iteration data acquisition the second operation result, comprise: in checking the second parameter, in the value of current bits of offset, be not 1 o'clock, current iteration data carried out to computing module-square, to obtain the second operation result.
Further, after the value of current iteration data replaces it, verify whether current bits of offset meets pre-conditioned, this verifies whether current bits of offset meets pre-conditioned step and comprise: judge whether current bits of offset is the lowest order of the second parameter; When current bits of offset is the lowest order of the second parameter, the multiplicative inverse that current iteration data are pending data; When current bits of offset is not the lowest order of the second parameter, bits of offset is pointed to one, the right side of current bits of offset, returns to described the second parameter of checking and in the value of current bits of offset be whether 1 step.
To achieve these goals, according to another aspect of the present invention, provide a kind of in embedded system the method for deal with data, should in embedded system, method of deal with data comprise: receive the instruction of calculating multiplicative inverse, and obtain pending data and the first parameter according to instruction; The value that the second parameter value in predetermined number parameter is set to the first parameter subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data; Judge whether the second parameter is 1 in the value of current bits of offset, wherein, in the second parameter, in the value of current bits of offset, it is 1 o'clock, according to pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, and the value of current iteration data is replaced with to the first operation result, in the second parameter, in the value of current bits of offset, it is not 1 o'clock, bits of offset is pointed to one, the left side of current bits of offset, after the currency involution of the 3rd parameter in predetermined number parameter, return and judge that whether described the second parameter is 1 step in the value of current bits of offset; In the current bits of offset of checking, meet when pre-conditioned, determine that current iteration data are the multiplicative inverse of pending data; The multiplicative inverse of the pending data that output obtains.
Further, according to the value of pending data and current iteration data, carrying out modular multiplication comprises: the currency of the 3rd parameter and current iteration data are carried out to modular multiplication, wherein, the initial value of the 3rd parameter equals pending data, and using the first parameter as modulus.
Further, after the value of current iteration data is replaced, verify whether current bits of offset meets pre-conditioned, this verifies whether current bits of offset meets pre-conditioned step and comprise: judge whether current bits of offset is the most significant digit of the second parameter; When current bits of offset is the most significant digit of the second parameter, the multiplicative inverse that current iteration data are pending data; When current bits of offset is not the most significant digit of the second parameter, carry out one, right side bits of offset being pointed to current bits of offset, after the currency involution of the 3rd parameter, return and judge that whether described the second parameter is 1 step in the value of current bits of offset.
To achieve these goals, according to another aspect of the invention, provide a kind of coprocessor, this coprocessor comprises: acquisition module, for receiving the instruction of calculating multiplicative inverse, and obtains pending data and the first parameter according to instruction; Module is set, and the value that is set to the first parameter for the second parameter value subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data; Computing module, for judging whether the second parameter is 1 in the value of current bits of offset, wherein, in the second parameter, in the value of current bits of offset, be 1 o'clock, according to the value of pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, and the value of current iteration data is replaced with to the first operation result, in the second parameter, in the value of current bits of offset, be not 1 o'clock, according to current iteration data acquisition the second operation result, and the value of current iteration data replaced with to the second operation result; Determination module, when pre-conditioned for meeting in the current bits of offset of checking, determines that current iteration data are the multiplicative inverse of pending data; Output module, for exporting the multiplicative inverse of pending data.
Further, computing module comprises: the first computing module, being used for is 1 o'clock in the second parameter in the value of current bits of offset, current iteration data are carried out to computing module-square, to obtain the mould square of current iteration data, and the mould of pending data and current iteration data square is carried out to modular multiplication, to obtain the first operation result, wherein, using the first parameter as modulus; In checking the second parameter, in the value of current bits of offset, be not 1 o'clock, current iteration data carried out to computing module-square, to obtain the second operation result.
Further, device also comprises: the first judge module, for judging whether current bits of offset is the lowest order of the second parameter; The first processing module, for when current bits of offset is the lowest order of the second parameter, the multiplicative inverse that current iteration data are pending data; When current bits of offset is not the lowest order of the second parameter, bits of offset is pointed to one, the right side of current bits of offset, returns to described the second parameter of checking and in the value of current bits of offset be whether 1 step.
To achieve these goals, in accordance with a further aspect of the present invention, provide a kind of coprocessor, this coprocessor comprises: acquisition module, for receiving the instruction of calculating multiplicative inverse, and obtains pending data and the first parameter according to instruction; Module is set, and the value that is set to the first parameter for the second parameter value subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data; Computing module, for judging whether the second parameter is 1 in the value of current bits of offset, wherein, in the second parameter, in the value of current bits of offset, it is 1 o'clock, according to the value of pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, and the value of current iteration data is replaced with to the first operation result, in the second parameter, in the value of current bits of offset, it is not 1 o'clock, bits of offset is pointed to one, the left side of current bits of offset, after the currency involution of the 3rd parameter, return and judge that whether the second parameter is 1 step in the value of current bits of offset; Determination module, when pre-conditioned for meeting in the current bits of offset of checking, the multiplicative inverse that current iteration data are pending data; Output module, for exporting the multiplicative inverse of the pending data that obtain.
Further, computing module comprises: the second computing module, for being 1 o'clock in the second parameter in the value of current bits of offset, the currency of the 3rd parameter and current iteration data are carried out to modular multiplication, wherein, the initial value of the 3rd parameter equals pending data, and using the first parameter as modulus.
Further, device also comprises: the second judge module, for judging whether current bits of offset is the most significant digit of the second parameter; The second processing module, for when current bits of offset is the most significant digit of the second parameter, the multiplicative inverse that current iteration data are pending data; When current bits of offset is not the most significant digit of the second parameter, system is carrying out one, left side bits of offset being pointed to current bits of offset, after the currency involution of the 3rd parameter, returns and judges that whether the second parameter is 1 step in the value of current bits of offset.
By the present invention, adopt and receive the instruction of calculating multiplicative inverse, and obtain pending data and the first parameter according to instruction; The value that the second parameter value is set to the first parameter subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data; Judge whether the second parameter is 1 in the value of current bits of offset, wherein, in the second parameter, in the value of current bits of offset, it is 1 o'clock, according to the value of pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, and the value of current iteration data being replaced with to the first operation result, is not 1 o'clock in the second parameter in the value of current bits of offset, according to current iteration data acquisition the second operation result, and the value of current iteration data is replaced with to the second operation result; In the current bits of offset of checking, meet when pre-conditioned the multiplicative inverse that current iteration data are pending data; The multiplicative inverse of the pending data that output obtains.
Because adopting modular multiplication, the application's algorithm replaces the calculating of being divided by of tossing about in bed in existing algorithm, computation process is simple, thereby the algorithm consumption of natural resource amount of calculating multiplicative inverse that has solved related art is large, cause the efficiency of system deal with data low, length consuming time and the high problem of cost, and then realize and reduced the cost of calculating multiplicative inverse, improved processor system, especially the effect of the work efficiency of security password system system deal with data.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, forms the application's a part, and schematic description and description of the present invention is used for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the illustrative view of functional configuration of a kind of coprocessor of the embodiment of the present invention one;
Fig. 2 is the process flow diagram of a kind of embodiment of the present invention two method of deal with data in embedded system;
Fig. 3 is the method flow diagram of deal with data in embedded system of the embodiment of the present invention three;
Fig. 4 is the method flow diagram of deal with data in embedded system of the embodiment of the present invention four.
Embodiment
It should be noted that, in the situation that not conflicting, embodiment and the feature in embodiment in the application can combine mutually.Describe below with reference to the accompanying drawings and in conjunction with the embodiments the present invention in detail.
Embodiment mono-
Fig. 1 is according to the illustrative view of functional configuration of the coprocessor in embedded system of the embodiment of the present invention.As shown in Figure 1, this coprocessor comprises: acquisition module 10, for receiving the instruction of calculating multiplicative inverse, and obtains pending data and the first parameter according to instruction; Module 30 is set, and the value that is set to the first parameter for the second parameter value subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data; Computing module 50, for judging whether the second parameter is 1 in the value of current bits of offset, wherein, when the second parameter is when the value of current bits of offset is 1, according to pending data and current iteration data, carry out modular multiplication, to generate the first operation result, and the value of current iteration data is replaced with to the first operation result, when the second parameter is when the value of current bits of offset is not 1, according to current iteration data acquisition the second operation result, and the value of current iteration data is replaced with to the second operation result; Determination module 70, when pre-conditioned for meeting in checking bits of offset, the multiplicative inverse that is pending data by current iteration data definition; Output module 90, for exporting the multiplicative inverse of the pending data that obtain.
The tossing about in bed to be divided by calculate of the multiplicative inverse that it is prime number by existing modulus that the above embodiments of the present application realize changed into: the modular multiplication algorithm device providing by embedded system, be that coprocessor is treated the processing that deal with data is carried out modular multiplication, obtain the multiplicative inverse of pending data.This calculating by multiplicative inverse is converted to modular multiplication, shortened the computing duration that calculates multiplicative inverse, improved operation efficiency, solved to a great extent and because the computation period of multiplicative inverse in prior art is long, made that system consumption resource is large, deal with data efficiency is low, thereby affect the problem of cipher system overall execution speed, and then realize and reduced the cost of calculating multiplicative inverse, improved processor system, especially the effect of the work efficiency of security password system system deal with data.
Concrete, the functional module being connected with acquisition module 10 in above-described embodiment also comprises: communication module, receives and send communication data between each module; And memory module, be used for storing pending data and the first parameter, deal with data, this deal with data is to treat deal with data to carry out the data that obtain after computing, can comprise: the result of preparation data, transit data and interative computation in calculating multiplicative inverse process, wherein, prepare data and refer to that treating deal with data carries out the operation result that modulo operation obtains, refer to the current iteration data that obtain; Transit data refers to the result of current iteration data being carried out to computing, the result of carrying out computing to preparing data.
Computing module 50 in the above embodiments of the present application can comprise: the first computing module, be used for when the second parameter is when the value of current bits of offset is 1, current iteration data are carried out to computing module-square, to generate the mould square of current iteration data, and the mould of pending data and current iteration data square is carried out to modular multiplication, to generate the first operation result, wherein, using the first parameter as modulus; For when the second parameter is when the value of current bits of offset is not 1, current iteration data are carried out to computing module-square, to generate the second operation result.
Device in the above embodiments of the present application can also comprise: the first judge module, for judging whether current bits of offset is the lowest order of the second parameter; The first processing module, for when current bits of offset is not the lowest order of the second parameter, points to bits of offset on one, the right side of current bits of offset.
In addition, coprocessor shown in Fig. 1 can also be following device for carrying out said, and this coprocessor can comprise: acquisition module 10, for receiving the instruction of calculating multiplicative inverse, and obtains pending data and the first parameter according to instruction, module 30 is set, and the value that is set to the first parameter for the second parameter value subtracts 2, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data, computing module 50, for judging whether described the second parameter is 1 in the value of current bits of offset, wherein, in described the second parameter, in the value of current bits of offset, it is 1 o'clock, according to the value of described pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, and the value of current iteration data is replaced with to described the first operation result, in described the second parameter, in the value of current bits of offset, it is not 1 o'clock, bits of offset is pointed to one, the left side of current bits of offset, after the currency involution of the 3rd parameter, whether system is returned to the second parameter of rejudging in described predetermined number parameter is 1 step in the value of current bits of offset, determination module 70, meets when pre-conditioned the multiplicative inverse that is pending data by current iteration data definition for the value of the bits of offset in checking predetermined number parameter, output module 90, for exporting the multiplicative inverse of the pending data that obtain.
Computing module in the above embodiments of the present application can comprise: the second computing module, be used for when the second parameter is when the value of current bits of offset is 1, the currency of the 3rd parameter and current iteration data are carried out to modular multiplication, wherein, the initial value of the 3rd parameter equals pending data, and using the first parameter as modulus.
Device in the above embodiments of the present application can also comprise: the second judge module, for judging whether current bits of offset is the most significant digit of the second parameter; The second processing module, for when current bits of offset is not the most significant digit of the second parameter, carries out one, left side bits of offset being pointed to current bits of offset, by the currency involution of the 3rd parameter.
Concrete, in the implementation process of above-described embodiment, computing module 50 can be realized current iteration data are carried out to computing, obtain the first operation result or the second operation result, can also be for the value of carrying out bits of offset from subtracting computing, or certainly the adding with the currency of the 3rd parameter from multiplication of value of carrying out bits of offset.
And in implementation process, can also utilize and module 30 is set realizes and generate the second parameter and bits of offset, and the value of the second parameter is set, the function of the initial bit of bits of offset, and this module can also be multiplexing, be used for generating second, third parameter, the value of juxtaposition the second parameter and the initial value of the 3rd parameter.
Preferably, the coprocessor in the application can also comprise replacement module: for the value of current iteration data being replaced with to the value of the first operation result or the second operation result; And offset module: for bits of offset is offset to lowest order by turn by the most significant digit of the second parameter, or for bits of offset is offset to most significant digit by turn by the lowest order of the second parameter.
The first processing module in above-described embodiment, the second processing module can be same processing modules in coprocessor, realization realizes different functions in the different stages, realized multiplexing functions, can be for verifying whether number in the second parameter specific bit is 1 in the present invention, the value of bits of offset be whether 1 or the value of bits of offset whether equal the figure place of the second parameter.
Embodiment bis-
Fig. 2 is the process flow diagram of the method for deal with data in embedded system according to the embodiment of the present invention, and the method comprises the steps: as shown in Figure 2
Step S102, is carried out and is received the instruction of calculating multiplicative inverse by the acquisition module 10 in Fig. 1, and obtain pending data and the first parameter according to instruction.
Step S104, subtracts 2 by the value that value that module 30 realizes the second parameter is set to the first parameter that arranges in Fig. 1, and the initial bit of bits of offset is set to the default position of the second parameter, and the initial value of default current iteration data.
Step S106, by the computing module 50 in Fig. 1, realize and judge that whether the second parameter is 1 in the value of current bits of offset, if so, carries out modular multiplication according to pending data and current iteration data, to generate the first operation result, and the value of current iteration data is replaced with to the first operation result; If not, according to current iteration data acquisition the second operation result, and the value of current iteration data is replaced with to the second operation result.
Step S108, is carried out in the current bits of offset of checking and is met when pre-conditioned by the determination module 70 in Fig. 1, current iteration data is defined as to the multiplicative inverse of pending data.
Step S110, exports the multiplicative inverse of the pending data that obtain by the output module 90 in Fig. 1.
The above embodiment of the present invention realizes the calculating of multiplicative inverse is converted to modular multiplication, the modular multiplication algorithm device providing by embedded system is realized, this calculating by multiplicative inverse is converted to modular multiplication, shortened the computing duration that calculates multiplicative inverse, improved operation efficiency, the computation period length having solved to a great extent due to multiplicative inverse in prior art makes system consumption resource large, deal with data efficiency is low, thereby affect the problem of cipher system overall execution speed, and then realize and reduced the cost of calculating multiplicative inverse, improved processor system, especially the effect of the work efficiency of security password system system deal with data.
Step S106 in the above embodiment of the present invention can replace with following implementation method: judge whether the second parameter is 1 in the value of current bits of offset, wherein, when the second parameter is when the value of current bits of offset is 1, according to pending data and current iteration data, carry out modular multiplication, to generate the first operation result, and the value of current iteration data is replaced with to the first operation result, when the second parameter is when the value of current bits of offset is not 1, bits of offset is pointed to one, the left side of current bits of offset, after the currency involution of the 3rd parameter, return and judge whether described the second parameter is 1 in the value of current bits of offset.
Embodiment tri-
Fig. 3 be the embodiment of the present invention three propose a kind of in embedded system the method flow diagram of deal with data.
In the step S106 of embodiment bis-, according to the value of pending data and current iteration data, carry out modular multiplication, to obtain the step of the first operation result, can comprise: current iteration data are carried out to computing module-square, to obtain the mould square of current iteration data; The value of the mould of pending data and current iteration data square is carried out to modular multiplication, to obtain the first operation result, wherein, using the first parameter as modulus.Meanwhile, in checking the second parameter, in the value of current bits of offset, be not 1 o'clock, current iteration data are carried out to computing module-square, to obtain the second operation result.
Preferably, after the value of current iteration data replaces it, verify whether current bits of offset meets pre-conditioned, this verifies whether current bits of offset meets pre-conditioned step and comprise: judge whether current bits of offset is the lowest order of the second parameter; When current bits of offset is the lowest order of the second parameter, the multiplicative inverse that current iteration data are pending data; When current bits of offset is not the lowest order of the second parameter, bits of offset is pointed to one, the right side of current bits of offset.
Concrete, as shown in Figure 3, the computational data multiplicative inverse in the signature calculation process of elliptic curve cryptosystem of take is example, provide a kind of in embedded system the method for deal with data, detailed realization flow comprises the steps:
Step 201: receive the instruction of calculating multiplicative inverse, obtain pending data, the first parameter;
Preferably, in the present embodiment one, calculate multiplicative inverse instruction for calculating the instruction of pending data multiplicative inverse.
The first parameter is for calculating the modulus in multiplicative inverse process.
Particularly, in the present embodiment, pending data and the first parameter are sexadecimal number, and the value of pending data is designated as to a, and the value of the first parameter is designated as to p, and the concrete assignment of a and p can be as follows:
a=5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B
p=FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF
Step 202: whether checking the first parameter is prime number, is to perform step 203, otherwise returns to error message, exits;
Preferably, in the present embodiment one, verify whether the first parameter is that prime number is specially: get at random six random numbers different and that be all less than the first parameter, using the first parameter as modulus, (p-1) inferior power to each random number carries out respectively modulo operation, whether the value obtaining after checking delivery is 1, if think that the first parameter is prime number, otherwise thinks that the first parameter is not prime number.
Step 203: according to the first parameter, the second parameter is set, and by the second parameter binary representation, the value of bits of offset is designated as i;
Preferably, in the present embodiment one, the value of the second parameter equals the value of the first parameter to subtract 2 values that obtain, and the binary form of described the second parameter is shown:
111111111111111111111111111111110000000000000000000000000000111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101
In the present embodiment one, the figure place of the second parameter can be 256.
Step 204: the initial value of iterative data is set to 1, and the initial bit that bits of offset is set is the most significant digit of described the second parameter;
Preferably, in the present embodiment one, calculate the multiplicative inverse of described pending data by process of iteration, the iterations that need to carry out equals the figure place of the second parameter.
Preferably, in the present embodiment, step 204 can also be:
Step 204 ': using pending data about the mould value of the first parameter the initial value as iterative data, the initial bit that bits of offset is set is the time high-order of the second parameter;
Preferably, in the present embodiment, calculate the multiplicative inverse of pending data by process of iteration, the figure place that the iterations that need to carry out equals the second parameter subtracts one.
Step 205: judge whether the second parameter is 1 in the value of current bits of offset, if so, execution step 206; Otherwise, execution step 207;
Step 206: using the first parameter as modulus, current iteration data are carried out to computing module-square, obtain the mould square data of current iteration data, the mould of current iteration data square data and pending data are carried out to modular multiplication, obtain the first operation result, and the value of current iteration data is replaced with to the value of the first operation result, execution step 108;
Step 207: using the first parameter as modulus, current iteration data are carried out to computing module-square, obtain the second operation result, the value of current iteration data is replaced with to the value of the second operation result;
Step 208: verifying whether current bits of offset is the lowest order of the second parameter, is to think that current iteration data are the multiplicative inverse of pending data, execution step 210, otherwise execution step 209;
Step 209: bits of offset is pointed to one, the right side of current bits of offset, returns to step 205;
Step 210: output current iteration data.Iterative data is now the multiplicative inverse of pending data.
In the present embodiment, the multiplicative inverse of the treated pending data that obtain:
AB9E4C64B60363073D968B0B529145986071EF1CD6DA80E9FF6B
AD7FF511D9A5
Embodiment tetra-
Fig. 4 is the method flow diagram of deal with data in embedded system according to the embodiment of the present invention two.
The step S106 of above-described embodiment two can replace with following embodiment: in the second parameter, in the value of current bits of offset, be 1 o'clock, according to the value of pending data and current iteration data, carry out modular multiplication, to obtain the first operation result, and the value of current iteration data is replaced with to the first operation result, in the second parameter, in the value of current bits of offset, it is not 1 o'clock, bits of offset is pointed to one, the left side of current bits of offset, after the currency involution of the 3rd parameter, return and judge that whether the second parameter is 1 step in the value of current bits of offset.
Preferably, after the value of above-mentioned current iteration data replaces it, verify whether current bits of offset meets pre-conditioned, whether the value of this bits of offset meets pre-conditioned step comprises: judge whether current bits of offset is the most significant digit of the second parameter; When current bits of offset is the most significant digit of the second parameter, the multiplicative inverse that current iteration data are pending data; When current bits of offset is not the most significant digit of the second parameter, system is being carried out one, left side bits of offset being pointed to current bits of offset, after the currency involution of the 3rd parameter in predetermined number parameter, return to the second parameter of rejudging in predetermined number parameter and in the value of current bits of offset be whether 1 step.
Concrete, as shown in Figure 4, the present embodiment is with under elliptic curve cryptosystem, and it is example that Jacobi projective coordinates are converted to computational data multiplicative inverse in affine coordinates process, the method that another kind deal with data in embedded system is provided, concrete steps are as follows:
Step 301: receive and calculate multiplicative inverse instruction, obtain pending data and the first parameter;
Calculate multiplicative inverse instruction for calculating the instruction of pending data multiplicative inverse.
The first parameter is for calculating the modulus in pending data multiplicative inverse process.
Preferably, in the present embodiment two, pending data and the first parameter are all binary number, and the value of pending data is designated as to a ', and the value of the first parameter is designated as to p ', and the concrete assignment of a ' and p ' can be as follows:
a′=1100010
p′=11111011
Step 302: whether checking the first parameter is prime number, is to perform step 303, otherwise returns to error message, exits;
Preferably, in the present embodiment two, verify whether the first parameter is that prime number is specially: get at random six random numbers different and that be all less than the first parameter, using the first parameter as modulus, (p '-1) inferior power to each random number carries out respectively modulo operation, whether the value obtaining after checking delivery is 1, if think that the first parameter is prime number, otherwise thinks that the first parameter is not prime number.
Step 303: according to the value that the first parameter arranges the second parameter, initial value that the 3rd parameter is set equals pending data;
Preferably, in the present embodiment, the value of the second parameter is for to subtract 2 by the value of the first parameter, and particularly, in the present embodiment, described the second parameter is shown with binary form
11111001
Preferably, in the present embodiment two, the 3rd parameter is variable, and the initial value of putting the 3rd parameter equals the value of pending data.
Step 304: the initial value of iterative data is set to 1, and the initial bit that bits of offset is set is the lowest order of the second parameter;
Step 305: judge whether the second parameter is 1 in the value of current bits of offset, is to perform step 306, otherwise execution step 308;
Step 306: using the first parameter as modulus, the currency of current iteration data and the 3rd parameter is carried out to modular multiplication, obtain the first operation result, and the value of current iteration data is replaced with to the value of the first operation result;
Step 307: verifying whether current bits of offset is the most significant digit of the second parameter, is to think that current iteration data are the multiplicative inverse of pending data, execution step 209, otherwise execution step 208.
Step 308: the currency involution of the 3rd parameter, bits of offset is pointed to one, the left side of current bits of offset, returns to step 305.
Step 309: output current iteration data.Iterative data is now the multiplicative inverse of pending data.
Preferably, in the present embodiment the multiplicative inverse of pending data is designated as to b ', the multiplicative inverse of the treated pending data that obtain is:
10010010。
It should be noted that, in the step shown in the process flow diagram of accompanying drawing, can in the computer system such as one group of computer executable instructions, carry out, and, although there is shown logical order in flow process, but in some cases, can carry out shown or described step with the order being different from herein.
From above description, can find out, the present invention has realized following technique effect: compared with the prior art, the present invention is converted to modular multiplication by the calculating of multiplicative inverse, the modular multiplication algorithm device providing by embedded system is realized, in arithmetic speed and implementation, all there is absolute advantage, shortened the computing duration that calculates multiplicative inverse, improved operation efficiency, solve to a great extent the long problem that affects cipher system overall execution speed of computation period because of multiplicative inverse in prior art, and reduced the cost of calculating multiplicative inverse.
Obviously, those skilled in the art should be understood that, above-mentioned each module of the present invention or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on the network that a plurality of calculation elements form, alternatively, they can be realized with the executable program code of calculation element, thereby, they can be stored in memory storage and be carried out by calculation element, or they are made into respectively to each integrated circuit modules, or a plurality of modules in them or step are made into single integrated circuit module to be realized.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (5)

1. a method for deal with data in embedded system, is characterized in that, comprising:
Step a: obtain pending data and the first parameter;
Step b: the value that the value of the second parameter is set to described the first parameter subtracts 2, the initial bit of bits of offset is set to the default position of described the second parameter, and the initial value of default current iteration data;
Step c: judge whether described the second parameter is 1 in the value of current bits of offset, if, according to the mould of described pending data and current iteration data square, carry out modular multiplication, generate the first operation result, and the value of current iteration data is replaced with to described the first operation result; If not, according to current iteration data, generate the second operation result, and the value of current iteration data is replaced with to described the second operation result;
Steps d: judge whether current bits of offset meets pre-conditioned, determine the multiplicative inverse that current iteration data are described pending data and carry out next step if meet, bits of offset is pointed to one, the right side of current bits of offset if do not meet, return to execution step c;
Step e: export the multiplicative inverse of described pending data,
Wherein, described the second parameter binary representation, is set to 1 by the initial value of iterative data, and the initial bit that bits of offset is set is the most significant digit of described the second parameter;
According to current iteration data, generating described the second operation result comprises: current iteration data are carried out to computing module-square, obtain described the second operation result, wherein, using described the first parameter as modulus;
Described in steps d, judge whether current bits of offset meets pre-conditioned being specially: judge whether current bits of offset is the lowest order of described the second parameter.
2. method according to claim 1, is characterized in that, according to described pending data and current iteration data, carries out modular multiplication, generates the first operation result and comprises:
Current iteration data are carried out to computing module-square, obtain the mould square of current iteration data, wherein, using described the first parameter as modulus;
The mould of described pending data and described current iteration data square is carried out to modular multiplication, obtain described the first operation result, wherein, using described the first parameter as modulus.
3. a method for deal with data in embedded system, is characterized in that, comprising:
Step a: obtain pending data and the first parameter;
Step b: the value that the second parameter value is set to described the first parameter subtracts 2, the initial bit of bits of offset is set to the default position of described the second parameter, and the initial value of default current iteration data;
Step c: judge whether described the second parameter is 1 in the value of current bits of offset, if, according to the mould of the currency of the 3rd parameter and current iteration data square, carry out modular multiplication, generate the first operation result, and the value of current iteration data is replaced with to described the first operation result; If not, perform step e;
Steps d: judge whether current bits of offset meets pre-conditioned, current iteration data are defined as to the multiplicative inverse of described pending data and carry out next step if meet; If do not meet and perform step e;
Step e: bits of offset is pointed to one, the left side of current bits of offset, and by after the currency involution of the 3rd parameter, returned to execution step c;
Step f: the multiplicative inverse of exporting described pending data;
Wherein, described the second parameter binary representation, is set to 1 by the initial value of iterative data, and the initial bit that bits of offset is set is the most significant digit of described the second parameter;
According to the currency of the 3rd parameter and current iteration data, carrying out modular multiplication generates the first operation result and comprises: the currency of the 3rd parameter and current iteration data are carried out to modular multiplication, wherein, the initial value of described the 3rd parameter equals described pending data, and using described the first parameter as modulus;
Described in steps d, judge whether current bits of offset meets pre-conditioned being specially: judge whether current bits of offset is the most significant digit of described the second parameter.
4. a coprocessor, is characterized in that, comprising:
Acquisition module, for receiving the instruction of calculating multiplicative inverse, and obtains pending data and the first parameter according to described instruction;
Module is set, and the value that is set to described the first parameter for the value of the second parameter of predetermined number parameter subtracts 2, and the initial bit of bits of offset is set to the default position of described the second parameter, and the initial value of default current iteration data;
Computing module, for judging whether described the second parameter is 1 in the value of current bits of offset, if, according to the mould of described pending data and current iteration data square, carry out modular multiplication, generate the first operation result, and the value of current iteration data is replaced with to described the first operation result, if not, according to current iteration data, generate the second operation result, and the value of current iteration data is replaced with to described the second operation result;
Determination module, when pre-conditioned for meeting in current bits of offset, is defined as current iteration data the multiplicative inverse of described pending data;
Output module, for exporting the multiplicative inverse of the described pending data that obtain;
Wherein, described the second parameter binary representation, is set to 1 by the initial value of iterative data, and the initial bit that bits of offset is set is the most significant digit of described the second parameter;
Described computing module comprises: the first computing module, be used for when described the second parameter is when the value of current bits of offset is 1, current iteration data are carried out to computing module-square, generate the mould square of current iteration data, and the mould of described pending data and current iteration data square is carried out to modular multiplication, to generate described the first operation result, wherein, using described the first parameter as modulus; When described the second parameter is when the value of current bits of offset is not 1, current iteration data are carried out to computing module-square, generate described the second operation result;
Described coprocessor also comprises: the first judge module, for judging whether current bits of offset is the lowest order of described the second parameter; The first processing module, for when current bits of offset is not the lowest order of described the second parameter, points to bits of offset on one, the right side of current bits of offset.
5. a coprocessor, is characterized in that, comprising:
Acquisition module, for obtaining pending data and the first parameter;
Module is set, and the value that is set to described the first parameter for the value of the second parameter of predetermined number parameter subtracts 2, and the initial bit of bits of offset is set to the default position of described the second parameter, and the initial value of default current iteration data;
Computing module, for judging whether described the second parameter is 1 in the value of current bits of offset, if, according to the mould of described pending data and current iteration data square, carry out modular multiplication, generate the first operation result, and the value of current iteration data is replaced with to described the first operation result, if not, bits of offset is pointed to one, the left side of current bits of offset, and by the currency involution of the 3rd parameter;
Determination module, when pre-conditioned for meeting in current bits of offset, determines that current iteration data are the multiplicative inverse of described pending data;
Output module, for exporting the multiplicative inverse of the described pending data that obtain;
Described coprocessor also comprises: the second judge module, for judging whether current bits of offset is the most significant digit of described the second parameter; The second processing module, for when current bits of offset is not the most significant digit of described the second parameter, points to bits of offset in one, the left side of current bits of offset, by the currency involution of the 3rd parameter;
Described computing module comprises: the second computing module, for described the second parameter, in the value of current bits of offset, it is 1 o'clock, the currency of the 3rd parameter and current iteration data are carried out to modular multiplication, wherein, the initial value of described the 3rd parameter equals described pending data, and using described the first parameter as modulus.
CN201110278212.2A 2011-09-19 2011-09-19 Data processing method for embedded system and coprocessor Active CN102354279B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110278212.2A CN102354279B (en) 2011-09-19 2011-09-19 Data processing method for embedded system and coprocessor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110278212.2A CN102354279B (en) 2011-09-19 2011-09-19 Data processing method for embedded system and coprocessor

Publications (2)

Publication Number Publication Date
CN102354279A CN102354279A (en) 2012-02-15
CN102354279B true CN102354279B (en) 2014-03-26

Family

ID=45577846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110278212.2A Active CN102354279B (en) 2011-09-19 2011-09-19 Data processing method for embedded system and coprocessor

Country Status (1)

Country Link
CN (1) CN102354279B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101320323A (en) * 2007-05-31 2008-12-10 汤姆森许可贸易公司 Method for calculating compressed RSA moduli
CN101965602A (en) * 2008-02-25 2011-02-02 国立大学法人冈山大学 Scalar multiplication method, raising method, recording medium where scalar multiplication program is recorded, and recording medium where raising method program is recorded

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070083586A1 (en) * 2005-10-12 2007-04-12 Jianjun Luo System and method for optimized reciprocal operations

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101320323A (en) * 2007-05-31 2008-12-10 汤姆森许可贸易公司 Method for calculating compressed RSA moduli
CN101965602A (en) * 2008-02-25 2011-02-02 国立大学法人冈山大学 Scalar multiplication method, raising method, recording medium where scalar multiplication program is recorded, and recording medium where raising method program is recorded

Also Published As

Publication number Publication date
CN102354279A (en) 2012-02-15

Similar Documents

Publication Publication Date Title
US10635405B2 (en) Homogenous atomic pattern for double, add, and subtract operations for digital authentication using elliptic curve cryptography
Shih et al. Securing M2M with post-quantum public-key cryptography
EP3590224B1 (en) Elliptic curve isogeny based key agreement protocol
CN112202568B (en) Software and hardware collaborative design SM9 digital signature communication method and system
US10721056B2 (en) Key processing method and device
US20080240443A1 (en) Method and apparatus for securely processing secret data
CN111064583B (en) Threshold SM2 digital signature method and device, electronic equipment and storage medium
CN1841443B (en) Calculation method, calculation equipment
CN104488219A (en) Methods and system for secure communication between an rfid tag and a reader
CN103903047B (en) Elliptic curve encryption coprocessor suitable for RFID security communication
Zheng et al. The software/hardware co-design and implementation of SM2/3/4 encryption/decryption and digital signature system
CN112101944A (en) Efficient privacy payment implementation method and device, computer equipment and storage medium
TW201810989A (en) Method and device to protect a cryptographic exponent
CN103631660A (en) Method and device for distributing storage resources in GPU in big integer calculating process
EP3020159A1 (en) Electronic signature system
Koppermann et al. 18 seconds to key exchange: Limitations of supersingular isogeny Diffie-Hellman on embedded devices
CN100380861C (en) Method for producing encrypt unit with dissymmetry encrypt system by discrete logarithm function
CN113055431A (en) Block chain-based industrial big data file efficient chaining method and device
CN117527223B (en) Distributed decryption method and system for quantum-password-resistant grid
CN107896142A (en) A kind of method and device for performing Montgomery Algorithm, computer-readable recording medium
CN102354279B (en) Data processing method for embedded system and coprocessor
Panjwani Scalable and parameterized hardware implementation of elliptic curve digital signature algorithm over prime fields
Xiao et al. New digital signature algorithm based on ECC and its application in bitcoin and IoT
CN114238205A (en) High-performance ECC coprocessor system resisting power consumption attack
Wiesmaier et al. An efficient mobile PACE implementation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant