RSA key pair generation in tz_vmm

Jaemin Park jmpark81 at ...9...
Wed Dec 9 09:52:19 CET 2015


I'm currently modifying tz_vmm to use openssl (librcrypto) to generate RSA
key pair on i.mx53 QSB.
(That is, RSA key pair is generated inside the Secure World.)

Whenever I try to execute the following code, the error occurs.

The source code in tz_vmm (
/* key pair generation */
                int generate_keypair(){
                        int keylen;
                        char *pem_key;
                        BIGNUM *e=NULL;

                        keypair = RSA_new();

                        e = BN_new();
                        BN_set_word(e, 65537);

                        if (!RSA_generate_key_ex(keypair, 2048, e, NULL))
                                PERR("failed to generate key pair");

                        /* the big number is no longer used */
                        e = NULL;

                        /* To get the C-string PEM form: */
                        BIO *pub = BIO_new(BIO_s_mem());
                        PEM_write_bio_RSAPublicKey(pub, keypair);

                        keylen = BIO_pending(pub);
                        pem_key = (char*)malloc(keylen+1);
                        BIO_read(pub, pem_key, keylen);
                        pem_key[keylen+1] = '\0';


                        return keylen;

The error code (imx53 QSB)
[init -> tz_vmm] read_rtc: rtc not configured, returning 0
[init -> tz_vmm] no plugin found for fcntl(2)
[init -> tz_vmm] no plugin found for write(2)
[init -> tz_vmm] failed to generate key pair

What should I do to fix up this error?
Any comment is welcome.

I'm looking forward to your kind response.

My Best Regards,
Jaemin Park
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list