Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Works with 1.5.0, not with 1.6.0 #42

Closed
torntrousers opened this issue Mar 12, 2021 · 4 comments
Closed

Works with 1.5.0, not with 1.6.0 #42

torntrousers opened this issue Mar 12, 2021 · 4 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@torntrousers
Copy link
Contributor

I'm using ArduinoBearSSL to connect to server with TLS and its works with the 1.5.0 release butnot with the 1.6.0 release. Going back through the commits trying each it breaks with this change: #31

The server does have a certificate with an ECDSA key.

Is there some bug, or am I suppose to explicitly call setEccVrfy/setEccSign now? And if so what would the arg be?

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Mar 12, 2021
@torntrousers
Copy link
Contributor Author

It looks like the issue is with https://github.com/arduino-libraries/ArduinoBearSSL/blob/master/src/BearSSLClient.cpp#L50-L51 vs https://github.com/arduino-libraries/ArduinoBearSSL/blob/master/src/BearSSLClient.cpp#L240-L241

I'm not using mutual TLS for this call so don't call setEccSlot, so the ecVrfy and _ecSign get those default values set at L50 and L51, which is not what they have in the 1.5.0 release.

@torntrousers
Copy link
Contributor Author

torntrousers commented Mar 12, 2021

This change fixes it for me:

C:\cqtlibs\temp\demo-nano-33-iot\.pio\libdeps\nano_33_iot\ArduinoBearSSL>git diff
diff --git a/src/BearSSLClient.cpp b/src/BearSSLClient.cpp
index 67d00ee..905063e 100644
--- a/src/BearSSLClient.cpp
+++ b/src/BearSSLClient.cpp
@@ -46,8 +46,8 @@ BearSSLClient::BearSSLClient(Client* client, const br_x509_trust_anchor* myTAs,
   _numTAs(myNumTAs),
   _noSNI(false)
 {
-  _ecVrfy = br_ecdsa_vrfy_asn1_get_default();
-  _ecSign = br_ecdsa_sign_asn1_get_default();
+  _ecVrfy = eccX08_vrfy_asn1;
+  _ecSign = eccX08_sign_asn1;

   _ecKey.curve = 0;
   _ecKey.x = NULL;

What was the intention for using br_ecdsa_vrfy_asn1_get_default() and br_ecdsa_sign_asn1_get_default() @ffontaine ?

@ffontaine
Copy link
Contributor

The goal was to be able to use ArduinoBearSSL without the ECC508 (e.g. using an IoT SAFE applet in a SIM card to sign and the main CPU to verify). To do so, I moved eccX08_vrfy_asn1 and eccX08_sign_asn1 to setEccSlot. You can set back the default values, I'll use setEccVrfy in my own code.

@aentinger
Copy link
Contributor

Fixed by merging #43.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants