libtpmtss: Fix problematic usage of chunk_from_chars() in TSS2 implementations
See 8ea13bbc5c for details.
References #3249.
This commit is contained in:
@@ -494,7 +494,8 @@ METHOD(tpm_tss_t, get_public, chunk_t,
|
|||||||
{
|
{
|
||||||
TPM2B_PUBLIC_KEY_RSA *rsa;
|
TPM2B_PUBLIC_KEY_RSA *rsa;
|
||||||
TPMT_RSA_SCHEME *scheme;
|
TPMT_RSA_SCHEME *scheme;
|
||||||
chunk_t aik_exponent, aik_modulus;
|
chunk_t aik_exponent = chunk_from_chars(0x01, 0x00, 0x01);
|
||||||
|
chunk_t aik_modulus;
|
||||||
uint32_t exponent;
|
uint32_t exponent;
|
||||||
|
|
||||||
scheme = &public.t.publicArea.parameters.rsaDetail.scheme;
|
scheme = &public.t.publicArea.parameters.rsaDetail.scheme;
|
||||||
@@ -504,11 +505,7 @@ METHOD(tpm_tss_t, get_public, chunk_t,
|
|||||||
rsa = &public.t.publicArea.unique.rsa;
|
rsa = &public.t.publicArea.unique.rsa;
|
||||||
aik_modulus = chunk_create(rsa->t.buffer, rsa->t.size);
|
aik_modulus = chunk_create(rsa->t.buffer, rsa->t.size);
|
||||||
exponent = htonl(public.t.publicArea.parameters.rsaDetail.exponent);
|
exponent = htonl(public.t.publicArea.parameters.rsaDetail.exponent);
|
||||||
if (!exponent)
|
if (exponent)
|
||||||
{
|
|
||||||
aik_exponent = chunk_from_chars(0x01, 0x00, 0x01);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
aik_exponent = chunk_from_thing(exponent);
|
aik_exponent = chunk_from_thing(exponent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -448,7 +448,8 @@ METHOD(tpm_tss_t, get_public, chunk_t,
|
|||||||
{
|
{
|
||||||
TPM2B_PUBLIC_KEY_RSA *rsa;
|
TPM2B_PUBLIC_KEY_RSA *rsa;
|
||||||
TPMT_RSA_SCHEME *scheme;
|
TPMT_RSA_SCHEME *scheme;
|
||||||
chunk_t aik_exponent, aik_modulus;
|
chunk_t aik_exponent = chunk_from_chars(0x01, 0x00, 0x01);
|
||||||
|
chunk_t aik_modulus;
|
||||||
uint32_t exponent;
|
uint32_t exponent;
|
||||||
|
|
||||||
scheme = &public.publicArea.parameters.rsaDetail.scheme;
|
scheme = &public.publicArea.parameters.rsaDetail.scheme;
|
||||||
@@ -458,11 +459,7 @@ METHOD(tpm_tss_t, get_public, chunk_t,
|
|||||||
rsa = &public.publicArea.unique.rsa;
|
rsa = &public.publicArea.unique.rsa;
|
||||||
aik_modulus = chunk_create(rsa->buffer, rsa->size);
|
aik_modulus = chunk_create(rsa->buffer, rsa->size);
|
||||||
exponent = htonl(public.publicArea.parameters.rsaDetail.exponent);
|
exponent = htonl(public.publicArea.parameters.rsaDetail.exponent);
|
||||||
if (!exponent)
|
if (exponent)
|
||||||
{
|
|
||||||
aik_exponent = chunk_from_chars(0x01, 0x00, 0x01);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
aik_exponent = chunk_from_thing(exponent);
|
aik_exponent = chunk_from_thing(exponent);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user