<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/crypto/stm32, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-02-05T20:12:48+00:00</updated>
<entry>
<title>crypto: stm32/crc32 - fix parsing list of devices</title>
<updated>2024-02-05T20:12:48+00:00</updated>
<author>
<name>Thomas Bourgoin</name>
<email>thomas.bourgoin@foss.st.com</email>
</author>
<published>2023-12-15T11:17:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=91256fcd578a27764b38480257d9890b9c1cd73c'/>
<id>urn:sha1:91256fcd578a27764b38480257d9890b9c1cd73c</id>
<content type='text'>
[ Upstream commit 0eaef675b94c746900dcea7f6c41b9a103ed5d53 ]

smatch warnings:
drivers/crypto/stm32/stm32-crc32.c:108 stm32_crc_get_next_crc() warn:
can 'crc' even be NULL?

Use list_first_entry_or_null instead of list_first_entry to retrieve
the first device registered.
The function list_first_entry always return a non NULL pointer even if
the list is empty. Hence checking if the pointer returned is NULL does
not tell if the list is empty or not.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/
Reported-by: Dan Carpenter &lt;error27@gmail.com&gt;
Closes: https://lore.kernel.org/r/202311281111.ou2oUL2i-lkp@intel.com/
Signed-off-by: Thomas Bourgoin &lt;thomas.bourgoin@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: stm32 - fix loop iterating through scatterlist for DMA</title>
<updated>2023-09-13T07:43:04+00:00</updated>
<author>
<name>Thomas Bourgoin</name>
<email>thomas.bourgoin@foss.st.com</email>
</author>
<published>2023-07-13T15:15:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=08c86156361c97849a465746e78d57c00597c8e2'/>
<id>urn:sha1:08c86156361c97849a465746e78d57c00597c8e2</id>
<content type='text'>
commit d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f upstream.

We were reading the length of the scatterlist sg after copying value of
tsg inside.
So we are using the size of the previous scatterlist and for the first
one we are using an unitialised value.
Fix this by copying tsg in sg[0] before reading the size.

Fixes : 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Bourgoin &lt;thomas.bourgoin@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>crypto: stm32 - Properly handle pm_runtime_get failing</title>
<updated>2023-09-13T07:42:32+00:00</updated>
<author>
<name>Uwe Kleine-König</name>
<email>u.kleine-koenig@pengutronix.de</email>
</author>
<published>2023-07-31T16:54:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=501f77cfce8a60d583ce20a0c3f3a3eee3e5521a'/>
<id>urn:sha1:501f77cfce8a60d583ce20a0c3f3a3eee3e5521a</id>
<content type='text'>
[ Upstream commit aec48805163338f8413118796c1dd035661b9140 ]

If pm_runtime_get() (disguised as pm_runtime_resume_and_get()) fails, this
means the clk wasn't prepared and enabled. Returning early in this case
however is wrong as then the following resource frees are skipped and this
is never catched up. So do all the cleanups but clk_disable_unprepare().

Also don't emit a warning, as stm32_hash_runtime_resume() already emitted
one.

Note that the return value of stm32_hash_remove() is mostly ignored by
the device core. The only effect of returning zero instead of an error
value is to suppress another warning in platform_remove(). So return 0
even if pm_runtime_resume_and_get() failed.

Fixes: 8b4d566de6a5 ("crypto: stm32/hash - Add power management support")
Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>crypto: stm32 - fix reference leak in stm32_crc_remove</title>
<updated>2022-03-25T04:21:05+00:00</updated>
<author>
<name>Zheng Yongjun</name>
<email>zhengyongjun3@huawei.com</email>
</author>
<published>2022-03-17T13:16:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e9a36feecee0ee5845f2e0656f50f9942dd0bed3'/>
<id>urn:sha1:e9a36feecee0ee5845f2e0656f50f9942dd0bed3</id>
<content type='text'>
pm_runtime_get_sync() will increment pm usage counter even it
failed. Forgetting to call pm_runtime_put_noidle will result
in reference leak in stm32_crc_remove, so we should fix it.

Signed-off-by: Zheng Yongjun &lt;zhengyongjun3@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: stm32/crc32 - Fix kernel BUG triggered in probe()</title>
<updated>2021-12-31T07:10:55+00:00</updated>
<author>
<name>Marek Vasut</name>
<email>marex@denx.de</email>
</author>
<published>2021-12-20T19:50:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=29009604ad4e3ef784fd9b9fef6f23610ddf633d'/>
<id>urn:sha1:29009604ad4e3ef784fd9b9fef6f23610ddf633d</id>
<content type='text'>
The include/linux/crypto.h struct crypto_alg field cra_driver_name description
states "Unique name of the transformation provider. " ... " this contains the
name of the chip or provider and the name of the transformation algorithm."

In case of the stm32-crc driver, field cra_driver_name is identical for all
registered transformation providers and set to the name of the driver itself,
which is incorrect. This patch fixes it by assigning a unique cra_driver_name
to each registered transformation provider.

The kernel crash is triggered when the driver calls crypto_register_shashes()
which calls crypto_register_shash(), which calls crypto_register_alg(), which
calls __crypto_register_alg(), which returns -EEXIST, which is propagated
back through this call chain. Upon -EEXIST from crypto_register_shash(), the
crypto_register_shashes() starts unregistering the providers back, and calls
crypto_unregister_shash(), which calls crypto_unregister_alg(), and this is
where the BUG() triggers due to incorrect cra_refcnt.

Fixes: b51dbe90912a ("crypto: stm32 - Support for STM32 CRC32 crypto module")
Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 4.12+
Cc: Alexandre Torgue &lt;alexandre.torgue@foss.st.com&gt;
Cc: Fabien Dessenne &lt;fabien.dessenne@st.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: Lionel Debieve &lt;lionel.debieve@st.com&gt;
Cc: Nicolas Toromanoff &lt;nicolas.toromanoff@st.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-stm32@st-md-mailman.stormreply.com
To: linux-crypto@vger.kernel.org
Acked-by: Nicolas Toromanoff &lt;nicolas.toromanoff@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: stm32 - Revert broken pm_runtime_resume_and_get changes</title>
<updated>2021-12-11T05:49:17+00:00</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2021-12-01T06:30:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3d6b661330a7954d8136df98160d525eb04dcd6a'/>
<id>urn:sha1:3d6b661330a7954d8136df98160d525eb04dcd6a</id>
<content type='text'>
We should not call pm_runtime_resume_and_get where the reference
count is expected to be incremented unconditionally.  This patch
reverts these calls to the original unconditional get_sync call.

Reported-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Fixes: 747bf30fd944 ("crypto: stm32/cryp - Fix PM reference leak...")
Fixes: 1cb3ad701970 ("crypto: stm32/hash - Fix PM reference leak...")
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Acked-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: stm32/cryp - reorder hw initialization</title>
<updated>2021-12-11T05:48:06+00:00</updated>
<author>
<name>Nicolas Toromanoff</name>
<email>nicolas.toromanoff@foss.st.com</email>
</author>
<published>2021-11-30T07:55:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=95fe2253cc1ad65d7f140d1944fa1b5d3c67abc0'/>
<id>urn:sha1:95fe2253cc1ad65d7f140d1944fa1b5d3c67abc0</id>
<content type='text'>
The CRYP IP checks the written key depending of the configuration, it's
safer to write the whole configuration to hardware then the key to avoid
unexpected key rejection.

Signed-off-by: Nicolas Toromanoff &lt;nicolas.toromanoff@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: stm32/cryp - fix bugs and crash in tests</title>
<updated>2021-12-11T05:48:06+00:00</updated>
<author>
<name>Nicolas Toromanoff</name>
<email>nicolas.toromanoff@foss.st.com</email>
</author>
<published>2021-11-30T07:55:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4b898d5cfa4d9a0ad5bc82cb5eafdc092394c6a9'/>
<id>urn:sha1:4b898d5cfa4d9a0ad5bc82cb5eafdc092394c6a9</id>
<content type='text'>
Extra crypto manager auto test were crashing or failling due
to 2 reasons:
- block in a dead loop (dues to issues in cipher end process management)
- crash due to read/write unmapped memory (this crash was also reported
when using openssl afalg engine)

Rework interrupt management, interrupts are masked as soon as they are
no more used: if input buffer is fully consumed, "Input FIFO not full"
interrupt is masked and if output buffer is full, "Output FIFO not
empty" interrupt is masked.
And crypto request finish when input *and* outpout buffer are fully
read/write.

About the crash due to unmapped memory, using scatterwalk_copychunks()
that will map and copy each block fix the issue.
Using this api and copying full block will also fix unaligned data
access, avoid early copy of in/out buffer, and make useless the extra
alignment constraint.

Fixes: 9e054ec21ef8 ("crypto: stm32 - Support for STM32 CRYP crypto module")

Reported-by: Marek Vasut &lt;marex@denx.de&gt;
Signed-off-by: Nicolas Toromanoff &lt;nicolas.toromanoff@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: stm32/cryp - fix lrw chaining mode</title>
<updated>2021-12-11T05:48:06+00:00</updated>
<author>
<name>Nicolas Toromanoff</name>
<email>nicolas.toromanoff@foss.st.com</email>
</author>
<published>2021-11-30T07:54:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fa97dc2d48b476ea98199d808d3248d285987e99'/>
<id>urn:sha1:fa97dc2d48b476ea98199d808d3248d285987e99</id>
<content type='text'>
This fixes the lrw autotest if lrw uses the CRYP as the AES block cipher
provider (as ecb(aes)). At end of request, CRYP should not update the IV
in case of ECB chaining mode. Indeed the ECB chaining mode never uses
the IV, but the software LRW chaining mode uses the IV field as
a counter and due to the (unexpected) update done by CRYP while the AES
block process, the counter get a wrong value when the IV overflow.

Fixes: 5f49f18d27cd ("crypto: stm32/cryp - update to return iv_out")

Signed-off-by: Nicolas Toromanoff &lt;nicolas.toromanoff@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: stm32/cryp - fix double pm exit</title>
<updated>2021-12-11T05:48:06+00:00</updated>
<author>
<name>Nicolas Toromanoff</name>
<email>nicolas.toromanoff@foss.st.com</email>
</author>
<published>2021-11-30T07:54:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6c12e742785bf9333faf60bfb96575bdd763448e'/>
<id>urn:sha1:6c12e742785bf9333faf60bfb96575bdd763448e</id>
<content type='text'>
Delete extraneous lines in probe error handling code: pm was
disabled twice.

Fixes: 65f9aa36ee47 ("crypto: stm32/cryp - Add power management support")

Reported-by: Marek Vasut &lt;marex@denx.de&gt;
Signed-off-by: Nicolas Toromanoff &lt;nicolas.toromanoff@foss.st.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
