MicrochipTech / cryptoauth-openssl-engine

DEPRECATED: Use https://github.com/MicrochipTech/cryptoauthlib/wiki/PKCS11-Linux-Setup
Other
76 stars 49 forks source link

Engine crashes during different use cases #18

Open duhampler opened 6 years ago

duhampler commented 6 years ago

Hello, I've build the engine with a yoto build system and using it with openssl 1.0.2j I tried different commands and every time i've got this error: openssl: pthread_mutex_lock.c:352: __pthread_mutex_lock_full: Assertion `INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH || !robust' failed.

OpenSSL is running on a embedded linux ARM platform with an ATECC508A connected to I²C. Complete out put


root@test:~# openssl version
OpenSSL 1.0.2j  26 Sep 2016

root@test:~# openssl req -keygen_engine ateccx08 -newkey ec:prime256v1.pem -keyout client_eccx08.key
$$eccx08_engine.c:211:bind_helper(): Entered
$$eccx08_ecdsa_sign.c:282:eccx08_ecdsa_init(): Entered
$$eccx08_eckey_meth.c:938:eccx08_pkey_meth_init(): Entered
$$eccx08_engine.c:314:bind_helper(): Succeeded
$$eccx08_engine.c:161:eccx08_init(): Entered
$$eccx08_cert.c:163:eccx08_cert_init(): Entered
$$eccx08_eckey_meth.c:802:eccx08_pmeth_selector(): Entered
$$eccx08_eckey_meth.c:536:eccx08_pkey_ec_init(): Entered
Private-Key: (256 bit)
ASN1 OID: prime256v1
NIST CURVE: P-256
$$eccx08_eckey_meth.c:586:eccx08_pkey_ec_keygen_init(): Entered
Private-Key: (256 bit)
ASN1 OID: prime256v1
NIST CURVE: P-256
Generating a 256 bit EC private key
$$eccx08_eckey_meth.c:614:eccx08_pkey_ec_keygen(): Entered
Private-Key: (256 bit)
ASN1 OID: prime256v1
NIST CURVE: P-256
openssl: pthread_mutex_lock.c:352: __pthread_mutex_lock_full: Assertion `INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH || !robust' failed.
Aborted

root@test:~# openssl engine -t ateccx08 -post GET_DEVICE_KEY:/home/root/testfile
$$eccx08_engine.c:211:bind_helper(): Entered
$$eccx08_ecdsa_sign.c:282:eccx08_ecdsa_init(): Entered
$$eccx08_eckey_meth.c:938:eccx08_pkey_meth_init(): Entered
$$eccx08_engine.c:314:bind_helper(): Succeeded
(ateccx08) Microchip ATECCx08 Engine
$$eccx08_engine.c:161:eccx08_init(): Entered
$$eccx08_cert.c:163:eccx08_cert_init(): Entered
     [ available ]
$$eccx08_cmd_defns.c:360:eccx08_cmd_ctrl(): Entered
$$eccx08_cmd_defns.c:215:get_key(): Entered
$$eccx08_eckey_meth.c:518:eccx08_load_pubkey(): Entered
$$eccx08_eckey_meth.c:412:eccx08_load_pubkey_internal(): Entered
$$eccx08_eckey_meth.c:121:eccx08_eckey_new_key(): Entered
$$eccx08_eckey_meth.c:154:eccx08_eckey_new_key(): KEY ID: ATECCx08:02:00:00:00$$eccx08_eckey_meth.c:206:eccx08_eckey_new_key(): EXITING
openssl: pthread_mutex_lock.c:352: __pthread_mutex_lock_full: Assertion `INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH || !robust' failed.
Aborted

So why is the engine never returning back to openssl? And another question. Where is all the documention gone? All links refering to this repos documentation are redirected to the wikis Home. Thank you

bryan-hunt commented 6 years ago

So a series of questions:

a) Yotta or Yocto build systems? They are quite different.

b) Do you have a build log?

c) `INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH || !robust' is a Linux system error. If you've restarted the machine and you still get the same error on the first command you run then there are two things I would check:

d) Documentation - there was a substantial architectural change between the first and second generations of this engine. The documentation for the first generation of it was highly misleading (and would result in not utilizing the device properly). Obviously for the second generation it simply would not apply at all. Improved documentation and scripts are planned to go along with the OpenSSL 1.1 support planned for release later in the end of April.

bryan-hunt commented 6 years ago

A change has been pushed to master to resolve another issue that I am wondering is impacting your environment in a different way. You may wish to try it out and see if it resolves the fault with the mutex you're seeing.