(HW)来自SDK的ECDH(曲线25519)与(外部)LibSodium:共享秘密问题

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
11个帖子/ 0新
最后一篇
nhan.ngodinh.
离线
最后一次露面:1年4个月前
加入:2017-03-21 10:20
(HW)来自SDK的ECDH(曲线25519)与(外部)LibSodium:共享秘密问题

你好,
我正在开发ECDH-Curve25519加密应用程序,它应该基于我的Dev板上的HW Accellerator。
At the moment I am able to generate a [Shared Secret] by using as from your guide (DA1468x_DA15xxx_SDK_1.0.14.1081/doc/html/group___e_c_d_h.html).
Checking flags and resources buffer it seems all OK!

使用“LibSodium库”(再次,相同的ECDH曲线),应与另一个外部设备上的相同曲线25519(思考Linux-PC)相同的曲线25519生成的另一个“共享秘密”。

Now, at this point something wrong happens: the two shared secret are completely different.

Did you have any idea or even experienced such a problem?
Did you ever tested the algorithm for compatibility with other shared secret generators?

先感谢您

[SDK-uss] :: da1468x_da15xxx_sdk_1.0.14.1081
[PC-linux]:: libsodium+linux ubuntu 18

设备:
PM_DIALOG.
离线
最后一次露面:9小时8分钟前
职员
加入:2018-02-08 11:03
Hi nhan.ngodinh,

Hi nhan.ngodinh,

Let me check your issue and I will get back to you as soon as I have an answer for you.

谢谢,PM_DIALOG.

nhan.ngodinh.
离线
最后一次露面:1年4个月前
加入:2017-03-21 10:20
你好,

你好,
为了今天给出一些讨论点,我用“测试向量”测试了[SDK代码],从[https://tools.ietf.org/html/rfc7748#page-14]
结果是错误的预期[共享秘密]的尊重。
相反,使用[Ubuntu + libsodium]对[Linux-PC]进行相同的测试它返回正确的[共享密钥]。

现在,如果我没有发出任何错误,我猜您可能不符合那个(非正式)标准RFC 7748。

谢谢,nn.

PM_DIALOG.
离线
最后一次露面:9小时8分钟前
职员
加入:2018-02-08 11:03
Hi nhan.ngodinh,

Hi nhan.ngodinh,

您可以澄清[SDK代码]和您使用的测试矢量吗?您不应该采取不同的结果,但我会尝试复制您的问题。此外,您使用的任何输入/代码片段都会非常有用。

谢谢,PM_DIALOG.

nhan.ngodinh.
离线
最后一次露面:1年4个月前
加入:2017-03-21 10:20
你好,

你好,
as I specified in my previous comment, test vectors are taken as from [https://tools.ietf.org/html/rfc7748#page-14]-> pag 13.
For simplicity I'm attaching below the keys and resulting shared secret:

# Alice's private key, a:
77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB1777FBA51DB92C2A

# Alice's public key, X25519(a, 9):
8520F0098930A754748B7DDCB43EF75A0DBF3A0D26381AF4EBA4A98EA9B4E6A

# Bob's public key, X25519(b, 9):
DE9EDB7D7B7DC1B4D35B61C2ECE435373F8343C85B78674DADFC7E146F882B4F.

#their共享秘密,K:
4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742

[SDK代码]:
#参考SRC:
da1468x_da15xxx_sdk_1.0.14.1081 / sdk / interfaces / crypto / src / crypto_ecdh.c

#代码片段:
/ *强制使用只使用曲线25519加入crypto_ecdh.h * /
#define crypto_ecdh_use_only_curve25519(1)

/ *初始化曲线结构* /
initialised_privileged_data crypto_ecdh_context_t c_ctx = crypto_ecdh_init_ctx(crypto_ec_params_curve25519);

/* copying Alice's private key into the "d" filed */
memcpy(&(c_ctx.d [0]),alice_priv,32);
/ *设置拼写标志* /
c_ctx.flags |= CRYPTO_ECDH_CTX_d;
/ *将Alice的Pub键复制到“x坐标”提起,唯一用于曲线25519 * /
memcpy(&(c_ctx.ql [0] [0]),ALICE_PUBK,32);
/ *设置拼写标志* /
c_ctx.flags | = crypto_ecdh_ctx_ql;
/ *将bob的pub键复制到“x坐标”归档中,唯一用于曲线25519 * /
memcpy(&(c_ctx.qp [0] [0]),bob_pubk,32);
/ *设置拼写标志* /
c_ctx.flags |= CRYPTO_ECDH_CTX_Qp;

/* calling crypto_ecdh_compute for generating shared key (flags should be ok at this point) */
crypto_ecdh_compute(&c_ctx,c_ctx_timeout);
/ *打印共享秘密和标志(标志= 15,因为它应该但共享错误)* /
printf(“共享秘密[标志 - >%d] \ n”,c_ctx.flags);
for(uint32_t i = 0; i < 32; i++)
printf(“\”%x \“,”,c_ctx.s [i]);

如果你需要更多的东西,请告诉我。

谢谢,nn.

PM_DIALOG.
离线
最后一次露面:9小时8分钟前
职员
加入:2018-02-08 11:03
Hi nhan.ngodinh,,

Hi nhan.ngodinh,,

我会尽力复制你的问题,我会尽快回复你的反馈。

谢谢,PM_DIALOG.

nhan.ngodinh.
离线
最后一次露面:1年4个月前
加入:2017-03-21 10:20
你好,

你好,

did you get the chance to have a look at the problem?

我需要了解是否继续使用SDK“ECDH-Curve25519”或转移到另一种解决方案。

请静音我们有一些压力,最后的帖子日期为“2019-03-01”。

你非常适合你的支持。

问候

nn

PM_DIALOG.
离线
最后一次露面:9小时8分钟前
职员
加入:2018-02-08 11:03
Hi nhan.ngodinh,

Hi nhan.ngodinh,

道歉的德lay, but I have driven your issue internally, so i will get back to you when I have any update from the Team.

谢谢,PM_DIALOG.

PM_DIALOG.
离线
最后一次露面:9小时8分钟前
职员
加入:2018-02-08 11:03
Hi nhan.ngodinh,

Hi nhan.ngodinh,

您能否在哪个项目中告诉我,您可以在哪个项目中努力?在BLE或非BLE项目中?如果您正在进行非BLE项目,我建议您进入BLE项目(例如BLE_APP项目)并按照相同的步骤进行操作。您是否能够在BLE项目中获得正确的结果?

谢谢,PM_DIALOG.

nhan.ngodinh.
离线
最后一次露面:1年4个月前
加入:2017-03-21 10:20
你好,

你好,

“我建议您进入BLE项目(例如BLE_APP项目)并按照相同的程序”, 你在跟我开玩笑吗?

只是重新推荐:你不知道该API的问题是什么?一个月后......

我们正在谈论网络安全功能,我建议进一步调查这个问题,以解决您的问题,让我们在任何项目中使用它作为常见(有用的......)API ...

无论如何,我猜最好不要用它,直到你提供有效的替代方案(或预期的修复)。

非常感谢您的支持

问候

AA.

PM_DIALOG.
离线
最后一次露面:9小时8分钟前
职员
加入:2018-02-08 11:03
Hi nhan.ngodinh,

Hi nhan.ngodinh,

我将在注册的电子邮件地址与您联系。

谢谢,PM_DIALOG.