<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ECC key derivation and agreement</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/128517/ecc-key-derivation-and-agreement</link><description>Hey, I am trying to implement ecdh key agreement and derivation, but I am getting PSA_ERROR_INVALID_ARGUMENT (-135) from psa_key_derivation_key_agreement: Any idea what is causing this, because when I was testing with psa_raw_key_agreement it succeeded</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Jun 2026 17:19:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/128517/ecc-key-derivation-and-agreement" /><item><title>RE: ECC key derivation and agreement</title><link>https://devzone.nordicsemi.com/thread/568441?ContentTypeID=1</link><pubDate>Thu, 25 Jun 2026 17:19:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2252516-34f8-4948-86af-a30c8d81a568</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Dropping of around 32 kB from log silence is a good win. It looks the TF-M module disables didn’t help because your PSA_WANT_* config already keeps those modules out of the build and the remaining 130 kB is mostly the crypto libraries (P-384, ECDH, HKDF, CCM, Oberon&amp;nbsp;and CC3XX).&lt;/p&gt;
&lt;p&gt;However you can try disabling unused CC3XX hardware sub-drivers:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_PSA_USE_CC3XX_ASYMMETRIC_SIGNATURE_DRIVER=n
CONFIG_PSA_USE_CC3XX_CIPHER_DRIVER=n
CONFIG_PSA_USE_CC3XX_HASH_DRIVER=n
CONFIG_PSA_USE_CC3XX_MAC_DRIVER=n&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But keep CC3XX for key agreement (ECDH), AEAD (CCM), and key management.&amp;nbsp;If you still need more after measuring, you can have P-256 instead of P-384 (Only if your server allows it).&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ECC key derivation and agreement</title><link>https://devzone.nordicsemi.com/thread/568416?ContentTypeID=1</link><pubDate>Thu, 25 Jun 2026 12:12:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0ab8f15-ee42-4266-a58b-18e482e0eb8e</guid><dc:creator>thomasGronroos</dc:creator><description>&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;Disabling logging dropped about 32kB, now around 130kB for the tfm size, but I was unable to reduce it any further.&lt;br /&gt;Here are the current configs, the commented out symbols didn&amp;#39;t have any impact:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;# TFM configurations (~130kB)
CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
CONFIG_TFM_CMAKE_BUILD_TYPE_MINSIZEREL=y
# CONFIG_TFM_CMAKE_BUILD_TYPE_DEBUG=y
CONFIG_TFM_SFN=y
CONFIG_TFM_LOG_LEVEL_SILENCE=y


CONFIG_TFM_PARTITION_CRYPTO=y
CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE=n
CONFIG_TFM_PARTITION_PROTECTED_STORAGE=n
CONFIG_TFM_PARTITION_INITIAL_ATTESTATION=n

CONFIG_TFM_PSA_FRAMEWORK_HAS_MM_IOVEC=y

# CONFIG_TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED=n
# CONFIG_TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED=y
# CONFIG_TFM_CRYPTO_CIPHER_MODULE_ENABLED=n
# CONFIG_TFM_CRYPTO_PAKE_MODULE_ENABLED=n

# CONFIG_HW_UNIQUE_KEY=n
# CONFIG_HW_UNIQUE_KEY_RANDOM=n
# CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n

CONFIG_PM_PARTITION_SIZE_TFM=0x20000
CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0x8000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Enable nRF Security backend for PSA Crypto API
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C=n
# CONFIG_MBEDTLS_ENABLE_HEAP=y
# CONFIG_MBEDTLS_HEAP_SIZE=8192


# Enable cryptographic features
CONFIG_PSA_WANT_GENERATE_RANDOM=y
CONFIG_PSA_WANT_ALG_HMAC_DRBG=y
CONFIG_PSA_WANT_ECC_SECP_R1_384=y
CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE=y
CONFIG_PSA_WANT_ALG_ECDH=y
CONFIG_PSA_WANT_ALG_HMAC=y
CONFIG_PSA_WANT_ALG_SHA_256=y
CONFIG_PSA_WANT_ALG_HKDF=y
CONFIG_PSA_WANT_KEY_TYPE_AES=y
CONFIG_PSA_WANT_ALG_CCM=y

# CONFIG_PSA_WANT_ALG_RSA_OAEP=y
# CONFIG_PSA_WANT_RSA_KEY_SIZE_4096=y
# CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=y&lt;/pre&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# The Zephyr CMSIS emulation assumes that ticks are ms, currently
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000

# CONFIG_MAIN_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=8192
# CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=8192

# Enable logging
CONFIG_CONSOLE=y
CONFIG_LOG=y

&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ECC key derivation and agreement</title><link>https://devzone.nordicsemi.com/thread/568383?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2026 16:03:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecef00bd-0cb0-404f-bc03-6c18a49ba543</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good to hear the P-384 config fixed the issue. On TF-M size question, yes MinSizeRel can shrinks the image but as you have SecureFault so we may keep it as it is and try the other size reductions first. Can you try adding these&amp;nbsp;config:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_TFM_LOG_LEVEL_SILENCE=y
CONFIG_TFM_PSA_FRAMEWORK_HAS_MM_IOVEC=y

CONFIG_TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED=n
CONFIG_TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED=n
CONFIG_TFM_CRYPTO_CIPHER_MODULE_ENABLED=n
CONFIG_TFM_CRYPTO_PAKE_MODULE_ENABLED=n&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Also double-check your prj.conf and only enable the CONFIG_PSA_WANT_* options you actually use, that often makes more difference than the TF-M settings alone.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ECC key derivation and agreement</title><link>https://devzone.nordicsemi.com/thread/568365?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2026 12:20:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1be84f91-ad5f-4aab-a602-eb98c09ca787</guid><dc:creator>thomasGronroos</dc:creator><description>&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;Thanks, I totally missed that miss configuration.&lt;br /&gt;&lt;br /&gt;I also have a question about TFM size when using crypto APIs. Is it possible reduce the TFM partition size to or under 100kB? I am currently hovering around 163kB.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;Memory region         Used Size  Region Size  %age Used
           FLASH:      163228 B       160 KB     99.63%
             RAM:       36884 B        88 KB     40.93%&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is the current configuration for TFM:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
CONFIG_TFM_CMAKE_BUILD_TYPE_MINSIZEREL=n
CONFIG_TFM_PARTITION_CRYPTO=y
CONFIG_TFM_SFN=y
# CONFIG_TFM_CRYPTO_SINGLE_PART_FUNCS_DISABLED=y

CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE=n
CONFIG_TFM_PARTITION_PROTECTED_STORAGE=n
CONFIG_TFM_PARTITION_INITIAL_ATTESTATION=n

CONFIG_PM_PARTITION_SIZE_TFM=0x28000&lt;/pre&gt;&lt;br /&gt;I tried enabling minsizerel, which would have reduced the TFM partition size to around 130kB but that causes TFM to throw a SecureFault.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ECC key derivation and agreement</title><link>https://devzone.nordicsemi.com/thread/568300?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2026 09:05:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5485f246-ec79-4c83-80b6-5145507b9f38</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Your issue seems to be due to&amp;nbsp;a curve configuration mismatch. As your code uses P-384 (KEY_SIZE 384) but your prj.conf only enables P-256. Can you&amp;nbsp;try adding&amp;nbsp;this to your prj.conf:&lt;/p&gt;
&lt;p&gt;CONFIG_PSA_WANT_ECC_SECP_R1_384=y&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>