Closed hallowsman closed 3 months ago
Hi @hallowsman,
This is expected as per the specification of the TEE_BigIntConvertToOctetString()
function:
The TEE_BigIntConvertToOctetString function converts the absolute value of an integer in TEE_BigInt format into an octet string
Note the words: "absolute value". You can use TEE_BigIntCmpS32(op, 0)
to get the sign of op
.
If you add this to your example:
int32_t s;
TEE_BigIntConvertToS32(&s, result);
printf("%d\n", s)
...it will print -53
.
it worked ,thanks!!!
use TEE_BigIntNeg function,input is 0x35,but output is still 35?
// 打印带符号的大整数 void TEE_BigIntPrintSigned(const TEE_BigInt bigInt) { size_t len = TEE_BigIntSizeInBytes(bigInt); uint8_t buffer = malloc(len); if (!buffer) { printf("内存分配失败\n"); return; }
}
// TEE_BigIntNeg 取反 取负操作 void fun_tee_bigint_neg() { size_t len = TEE_BigIntSizeInU32(1024); uint32_t twoints[2 * len]; // 分配足够的空间来存储两个大整数
}