How to Apply OpenSSL on i.MX8M Plus EVK?

Forlinx Embedded OKMX8MP-C EVK is developed with NXP i.MX8M Plus high-performance processor with AI computing power up to 2.3TOPS to meet lightweight edge computing needs. At the same time flexible I/O interface configuration and advanced rich multimedia resources to facilitate customer application development.

The OKMX8MP-C EVK is ported with OpenSSL tools. The entire OpenSSL package can be roughly divided into three main functional parts: the SSL protocol library, the application program, and the cryptographic algorithm library. The directory structure of enSSL is also planned around these three functional sections.

In this article, we will share some simple applications of OpenSSL on the OKMX8MP-C evaluation kit.


OpenSSL is divided into interactive mode and batch mode. Type OpenSSL directly and press Enter to enter interactive mode, and type OpenSSL with the command option to enter batch mode.

1 Interaction Modes

Version: Used to print version and other information about OpenSSL.

Using method: version-[avbofp]

Example: version-a prints all messages

Version number and release date: OpenSSL1.1.1g, April 21

2020 Options for building with libraries: options

Directory for storing certificates and private keys: OPENSSLDIR

passwd:Generate various password ciphertext.

Using method:  opensslpasswd [-crypt] [-1] [-apr1] [-salt  string] [-in file] [-stdin][-noverify] [-quiet] [-table] {password}

Examples: passwd-cryp Default option, generates a standard unix password cipher.

Version number and release date

passwd-1 generates md5 passphrase ciphertext.

md5 passphrase

DSA: Used to process DSA keys, format conversions and print information.

Using method: openssldsa [-inform PEM|DER] [-outform PEM|DER] [-in filename][-passinarg] [-out filename] [-passout arg] [-des] [-des3] [-idea][-text][-noout] [-modulus] [-engine id]

Example: dsaparam -out dsaparam.pem 1024 a DSA parameter file.

dsaparam.pem 1024

gendsa-out dsakey.pem dsaparam.pem to generate DSA key based on DSA parameter file.

DSA parameter file

The above is a simple way to use the interactive mode, and the following describes some of the functions in the batch mode.

2 Batch Mode

Generating Password Function

openssl rand: Used to generate pseudo-random bytes

Using method:openssl rand [-out file] [-base64] [-hex] num

-out file written to file

-Base64 base64 encoding output

-hex hexadecimal code output

Example: Generating base64-encoded random numbers as an example

Batch Mode

Message Digest Algorithm Application

openssl dgst: for data summarization

Using method:openssl dgst [-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1 ] [-c] [-d ] [-hex] [-binary] [-out filename] [-sign filename] [-passin arg] [-verify filename] [-prverify filename][-signature filename ] [file...]

Example: To compute the hash value of the file openssl1.txt using the SHA1 algorithm.

Message Digest Algorithm Application

The hash value of the file openssl1.txt is calculated using the SHA1 algorithm and output to the file sha1.txt.

hash value

Codec Applications

Encode the file openssl1.txt with base64 and output to jiami.txt.

Codec Applications

Finally, a method for testing OpenSSL performance is presented.

3 OpenSSL Performance Test

openssl speed: This command is used to test the performance of the library.

Using method:openssl speed [md5][rsa2048][rmd160]

Test the speed of generating different keys.

Take RSA-2048 as an example, test the performance comparison of OpenSSL on OKMX8MM-C, OKMX8MQ-C and OKMX8MP-C, respectively, to provide a reference for users.







From the above test results, we can see that the private key of OKMX8MM-C EVK is generated 84.5 times per second, the private key of OKMX8MQ-C EVK is generated 120.5 times per second, and the private key of OKMX8MP-C EVK is generated 148.1 times per second, which shows that the OKMX8MP-C EVK wins in the aspect of OpenSSL performance.