Hey friends
Im trying to do a secure connection between my stm32 board and server.
I wrote the code based on GitHub - eziya/STM32F4_HAL_ETH_MBEDTLS: STM32 mbedTLS library testing (SSL/TLS client) that i found.
My board is based on stm32h7 series.
And im using google to test my app.(ip 142.250.74.196 port 443)
This is the debug section:
https://aws1.discourse-cdn.com/standard17/uploads/mbed/original/2X/e/ee636c…
How should i solve the problem?
Greetings!
I'm having an issue while veryfing signature with imported RSA2048
public key, generated with Win7 CryptoAPI (PUBLICKEYBLOB) into latest
mbedtls 2.28.x.
The blob contains RSA modulus N (256 bytes) and public exponent E (4
bytes) - I do extract them succesfully, then provide into
mbedtls_rsa_import_raw. It all goes smth. like this:
u32 errval = mbedtls_rsa_init(ctx, MBEDTLS_RSA_PKCS_V15, 0);
// errval == 0 here
errval = mbedtls_rsa_import_raw(ctx, n, nlen, 0l, 0, 0l, 0, 0l, 0, e, elen);
// errval == 0 here
errval = mbedtls_rsa_complete(ctx);
// errval == 0 here
errval = mbedtls_rsa_check_pubkey(ctx);
// errval == 0 here
Then i ran:
errval = mbedtls_rsa_pkcs1_verify(ctx, 0l, 0l, MBEDTLS_RSA_PUBLIC,
MBEDTLS_MD_SHA512, 0, _src,
_sign);
and get -0x4380 (verify failed)
_src - is sha512 hash of data to be verified (64 bytes)
_sign - is 256 bytes of signature, provided by win7 cryptoapi
P.S. just in case, i did tried messing with endianess in every way for e
AND n, it didn't help.
I added a little debugging inside library/rsa.cpp, turned out we do call
mbedtls_rsa_rsassa_pkcs1_v15_verify,
and there is a memcmp between 'encoded' and 'encoded_expected' bufs.
'encoded' is derived from signature (_sign), and 'encoded_expected' is
derived from hash (_src)
printhex for 'encoded' looks like this:
1a1da83b 14be17a2 c8401d41 1d453909
...
total 16 lines (256 bytes)
...
7fb37ea2 719a5562 aebdb3ed 296e0ed1
but printhex for 'encoded_expected' looks like this:
ffff0100 ffffffff ffffffff ffffffff
ffffffff ffffffff ffffffff ffffffff
...
wtf??? padding ???
...
ffffffff ffffffff ffffffff ffffffff
ffffffff ffffffff ffffffff 30513000
6009060d 65014886 03020403 40040005
b190b45a a40b354f 32271b34 f022abd3
... sha512-derived data here, 64 bytes
557abf2b e2cc4e0f 0b77bdfc b45688b0
So, there is no way these two bufs match. I wonded if there is some
issue in parsing _sign, or I didn't prepared input data good enough.
Any ideas?
B.R.,
m4D.
I am trying to modify the dtls_server.c example to keep track of whether session caching was used for a given connection.
Ideally I would have an interget value i.e `session_resumed = #1 or 0`
One way I tried to do this was by reading the value of the mbedtls_ssl_context struct `ssl`:
```
/*
* 5. Handshake
*/
do ret = mbedtls_ssl_handshake( &ssl );
while( ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE );
if( ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED ) {
printf( " hello verification requested\n" );
ret = 0;
goto reset;
}
else if( ret != 0 ) {
printf( " failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", (unsigned int) -ret );
goto reset;
}
printf( " session cache status: %d\n", ssl.handshake.resume );
```
The issue with this is that the ssl struct is set to private, so the code fails to compile with the error: 'struct mbedtls_ssl_context' has no member named 'handshake'
Can somebody help me with some example code that would make this possible?
Hi all,
Please note that in the next couple of weeks, we will migrate Mbed TLS to a new GitHub organisation. Your existing scripts, links etc for accessing Mbed TLS on GitHub should not be affected.
This will change the url from https://github.com/ARMmbed/mbedtls to https://github.com/Mbed-TLS/mbedtls . GitHub will redirect any accesses to the old URL for the foreseeable future, but we would recommend updating your links once the migration is complete.
All of the Mbed TLS repositories will migrate to this new organisation, i.e.:
mbedtls
mbedtls-docs
mbedtls-test
Thanks
Dave Rodgman
Hello,
mbedTLS has ECDSA module that takes Signature with ASN1 encoding as input
mbedtls_pk_verify()
The Signature I receive is without ASN1 encoded.
Trying to find an implementation within mbedTLS that can add ASN1 to signature before I feed into the verify function.
Any help ?
[RF IDeas]<http://www.rfideas.com/>
Deep Patel
Sr. Embedded Software Engineer
D:
224-333-2084
P:
847-870-1723 Ext 437
E:
ddpatel(a)rfideas.com<mailto:ddpatel@rfideas.com>
A: <https://www.rfideas.com/>
425 North Martingale Road, Suite 1680, Schaumburg, IL 60173
<https://www.rfideas.com/>
Hi All,
Please find the link to the TrustedFirmware Community Code of Conduct here:
https://developer.trustedfirmware.org/w/collaboration/community_guidelines/…
Trusted Firmware has a very diverse and global developer community. It is
important that we adhere to the code of conduct in all our interactions.
For some of you all this may be new and for others just a gentle reminder.
In either case, if you have any questions, please feel free to reach out to
me directly.
And thanks to you all for your contributions to the TrustedFirmware
community!
Best regards,
Don Harbin
TrustedFirmware Community Manager
don.harbin(a)linaro.org
Hello!
Is there a time plan for when there will be an official release with TLS 1.3 (Client) that supports mutual authentication?
Kind Regards
Tove Rumar
Software Engineer
u-blox Malmo
Östra Varvsgatan 4
SE- Malmö
www.u-blox.com<https://www.u-blox.com>
Reliable. Smart. Secure.
Hi All,
A gentle reminder that the US-Europe timezone-friendly MBed TLS Tech forum
is next Monday.
If you have any topics, please let Dave Rodgman know. :)
Best regards,
Don Harbin
TrustedFirmware Community Manager
don.harbin(a)linaro.org
Hello,
we are using mbedTLS version 2.16.
We are facing a problem in verifying the signed message for ECDSA type of
algorithms. Do you have any sample code for this as given for the RSA type
algorithm in rsa_verify.c.
We have derived the R and S values and their length, but we are not sure
which context to use to verify the signature.
Please help urgently.
--
Regards,
Sunil Jain