Skip to content

Commit

Permalink
gp: fix endianness of two RSA public exponents
Browse files Browse the repository at this point in the history
GP tests 30125 (9d-21-98) and 30127 (9d-28-5d) use badly encoded
constants: TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE_GEN_NOT_ODD (= 65538)
TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE_NOT_GEN_DEFAULT (= 66001),
respectively.

The values are given in decimal in the test suite documentation and
were erroneously encoded in little endian order in source file
host/xtest/gp/include/xml_datastorage_api.h.

Fix the values by using big endian encoding as expected by the GP API
when big numbers are provided as input to crypto functions.

Fixes the failure of "xtest gp_30125" after OP-TEE OS commit [1] (prior
to that commit, both the code and the test were wrong).

Link: [1] OP-TEE/optee_os@c9366c1
Signed-off-by: Jerome Forissier <[email protected]>
  • Loading branch information
jforissier committed Mar 30, 2021
1 parent e86aba2 commit 7b239ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions host/xtest/gp/include/xml_datastorage_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,15 @@ TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE_GEN_OUT_OF_RANGE_INF[] = {
};

static const uint8_t TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE_GEN_NOT_ODD[] = {
0x02, 0x00, 0x01, /* 65538 */
0x01, 0x00, 0x02, /* 65538 */
};

static const uint8_t TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE_65537[] = {
0x01, 0x00, 0x01, /* 65537 */
};

static const uint8_t TEE_ATTR_RSA_PUBLIC_EXPONENT_VALUE_NOT_GEN_DEFAULT[] = {
0xd1, 0x01, 0x01, /* 66001 */
0x01, 0x01, 0xd1, /* 66001 */
};

static const uint8_t TEE_ATTR_AES_192_VALUE01[] = {
Expand Down

0 comments on commit 7b239ab

Please sign in to comment.