lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b148f09-d20d-b6be-d31b-6c8a553658c9@loongson.cn>
Date: Wed, 7 May 2025 09:33:32 +0800
From: Qunqin Zhao <zhaoqunqin@...ngson.cn>
To: Stefano Garzarella <sgarzare@...hat.com>
Cc: lee@...nel.org, herbert@...dor.apana.org.au, davem@...emloft.net,
 peterhuewe@....de, jarkko@...nel.org, linux-kernel@...r.kernel.org,
 loongarch@...ts.linux.dev, linux-crypto@...r.kernel.org, jgg@...pe.ca,
 linux-integrity@...r.kernel.org, pmenzel@...gen.mpg.de,
 Yinggang Gu <guyinggang@...ngson.cn>, Huacai Chen <chenhuacai@...ngson.cn>
Subject: Re: [PATCH v9 4/5] tpm: Add a driver for Loongson TPM device


在 2025/5/6 下午10:13, Stefano Garzarella 写道:
> On Tue, May 06, 2025 at 11:19:46AM +0800, Qunqin Zhao wrote:
>> Loongson Security Engine supports random number generation, hash,
>> symmetric encryption and asymmetric encryption. Based on these
>> encryption functions, TPM2 have been implemented in the Loongson
>> Security Engine firmware. This driver is responsible for copying data
>> into the memory visible to the firmware and receiving data from the
>> firmware.
>>
>> Co-developed-by: Yinggang Gu <guyinggang@...ngson.cn>
>> Signed-off-by: Yinggang Gu <guyinggang@...ngson.cn>
>> Signed-off-by: Qunqin Zhao <zhaoqunqin@...ngson.cn>
>> Reviewed-by: Huacai Chen <chenhuacai@...ngson.cn>
>> Reviewed-by: Jarkko Sakkinen <jarkko@...nel.org>
>> ---
>> v9: "tpm_loongson_driver" --> "tpm_loongson"
>>    "depends on CRYPTO_DEV_LOONGSON_SE" --> "depends on MFD_LOONGSON_SE"
>>
...
>> +static int tpm_loongson_recv(struct tpm_chip *chip, u8 *buf, size_t 
>> count)
>> +{
>> +    struct loongson_se_engine *tpm_engine = 
>> dev_get_drvdata(&chip->dev);
>> +    struct tpm_loongson_cmd *cmd_ret = tpm_engine->command_ret;
>> +
>> +    memcpy(buf, tpm_engine->data_buffer, cmd_ret->data_len);
>
> Should we limit the memcpy to `count`?
>
> I mean, can happen that `count` is less than `cmd_ret->data_len`?

Hi, Stefan, thanks for your comment.

Firmware ensures "cmd_ret->data_len" will be less than TPM_BUFSIZE,  so 
this would never happen.

BR, Qunqin.

>
> Thanks,
> Stefano


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ