intel / intel/QAT_Engine

Can the modulus value be less than 7F in the ras key in FIPS mode?

Open
#183 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
443
Forks
137
PR merge metrics
No merged PRs in 30d

Description

Hi,
I am developing related to fips rsa.
I am posting this because the following problem occurred during development.

The situation where the problem occurred is as follows.
1. RSA key generation in Non-FIPS and FIPS mode using QAT PCI card.
2. I tried rsa sign with the generated RSA key, but the following error occurred.
-------------------------------------------------------------------------------------------------------
[error] LacRsa_DecryptParamsCheck() - : Invalid API Param - inputData must be < modulusN
-------------------------------------------------------------------------------------------------------

=> The value of leftmost (8emLen - emBits) bits of the current input value is 7F or less.
-------------------------------------------------------------------------------------------------------
#define FIPS_SAMPLE_UNSET_TOP_BIT(byte) \
do \
{ \
byte &= 0x7F; \
} while (0)
-------------------------------------------------------------------------------------------------------

But will using a QAT PCI card produce a value where the leftmost (8emLen-emBits) bits of the generated RSA key modulus
are less than 7F?

Input value and modulus value at failure.
-------------------------------------------------------------------------------------------------------
Fail Modulus(256) :
73 2B 22 F1 14 CD 5A 05 FD AE 5F 26 0D E1 4C 95
EC BE 6C C2 4A B0 5B B3 EA 8E 30 BB 71 E8 FA A2
A8 CE 52 A2 54 33 40 B1 6F 07 E1 C0 A1 A3 7D 63
86 60 48 55 1A 6D D5 ED 69 D8 84 BA 25 FC 1F DD
B4 16 E1 82 82 A2 69 FF C1 47 50 98 9D CA 0C A3
72 18 D8 1D 3D 65 01 4A 2E 96 19 FC 57 AA 55 D8
23 59 F0 F8 E1 D3 DD B1 78 C3 3C CF E8 6F 5B 1C
6F 03 A8 E6 CA 8C 78 8B 8A E3 16 78 8C 5B 3E E3
D2 94 9B BE 85 42 41 1C 65 1E 1A E8 17 FC 65 1F
EF 23 0A 5C 40 34 3B C2 DA 09 F1 D8 0E B9 E8 37
40 DA B4 0A 5A 42 8F 71 55 31 A4 A5 E4 59 43 74
7D 7C EB 35 72 FB 6D 7C 1C 8E 75 75 39 40 5B E9
72 DD 57 CC DF F3 BC 37 A7 EB 7F 90 3F 48 F5 42
47 A8 E2 64 73 5D 09 53 3A 96 13 30 87 C0 9C D9
55 CC 1D 22 0F A8 0F F2 BC 0F 21 C0 ED C6 8A 7B
D6 80 D3 81 CE 37 54 9B 8D 6E 2D 27 CF 15 F3 33

Fail EM.pData :
78 F6 B5 4E 3A 27 EF 53 7D 23 46 C5 3F DB 4E 64
97 D6 04 E7 62 DC 5A 6F B3 0E D5 56 D2 DD DD 91
7A 7A 4D E8 B9 F7 71 B3 7C AF 3D 2F A9 DF 1E 31
68 01 AE 0F F1 97 7F D8 B8 51 A4 02 53 CA 34 D3
1E 6D 9D EF DA AB F3 CE D9 25 72 24 78 E1 D7 AC
E5 82 7D 47 7D 1E 02 32 8A E2 A8 A1 B0 B2 33 7B
0E 98 EC 84 A4 C3 CA 51 2F 4D 3F 33 5D 1B B3 BF
16 B0 6E 3A 8D 15 1E AB 4A E8 2B B1 D0 9E 04 2C
EF 81 E4 5A FD 85 92 30 B7 3E A7 92 97 73 6B 72
BA EF D9 BF 2B 20 96 0A C6 8F EA 98 1F F3 5E C2
27 FA 12 E6 59 6A 17 15 FD BA 4D 71 7D EA 7E 91
CF 47 84 4C E2 E1 8A 01 9D A6 33 00 E6 41 B0 A9
52 E3 3A B1 6E BD 3D FA 3D D5 60 4B 51 61 32 B6
9A 4F 5B 38 A3 6B 3F 44 01 1D 4C F6 63 58 75 24
C8 62 F9 85 D0 9C F3 23 39 F5 2C 6A 06 13 76 E6
82 1B F3 0F 1F 4E 51 31 9C A5 61 33 83 49 34 BC
-------------------------------------------------------------------------------------------------------
Please tell me how to solve this problem. Please.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.