Application of OpenSSL on OKMX8MP-C Development Board
OKMX8MP-C development board of Forlinx Embedded is developed with high-performance processor NXP i.MX8M Plus, with AI computing capacity up to 2.3TOPS, can be used for lightweight edge computing. With flexible I/O interface configuration and advanced&rich multimedia resources, convenient for customer application development.
In OKMX8MP-C development board, Forlinx has transplanted OpenSSL. OpenSSL software package can be divided into three functional parts: SSL protocol library, application program, and cryptographic algorithm library. The directory structure of OpenSSL is divided based on these three functional parts.
As a cryptography-based security development kit, OpenSSL provides quite powerful and comprehensive functions, including major cryptographic algorithms, commonly used key and certificate encapsulation management functions and SSL protocols, and a wealth of applications for testing or other use.
OpenSSL has interactive mode and batch mode. Input OpenSSL directly and press Enter to enter interactive mode. Input OpenSSL with command options to enter batch mode.
1. Interactive mode
Version: to print version and other information about OpenSSL.
Usage: version-[avbofp]
Example: version-a prints all information
Version number and version release date: OpenSSL1.1.1g, 21 April 2020
Options built with library: options
Directory where certificates and private keys are stored: OPENSSLDIR
passwd: Generate various password ciphertexts.
Usage: opensslpasswd [-crypt] [-1] [-apr1] [-salt string] [-in file] [-stdin][-noverify] [-quiet] [-table] {password}
Example: passwd-cryp default optionto generate standard unix password ciphertext.
passwd-1 Generate md5 password ciphertext.
DSA: For processing DSA keys, format conversion and printing information.
Usage: 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 to generate a DSA parameter file.
gendsa-out dsakey.pem dsaparam.pem Generate DSA key from DSA parameter file.
Above are some example of interactive mode, and following are for batch mode.
2. Batch mode
Generate password
openssl rand: to generate pseudo-random bytes
Usage: openssl rand [-out file] [-base64] [-hex] num
- -out file: write file
- -base64: base64 encoded output
- -hex: hex encoded output
Example: generate base64 encoded random numbers
Message digest algorithm Application
openssl dgst: for data summarization
Usage: 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: Calculate hash value of openssl1.txt by SHA1 algorithm.
Calculate hash value of openssl1.txt by SHA1 algorithm and output it to sha1.txt.
Codec application
Encode openssl1.txt with base64 and output it to jiami.txt.
OpenSSL performance test
openssl speed: to test performance of library.
Usage: openssl speed [md5][rsa2048][rmd160]
Test speeds of generating different keys.
Take RSA-2048 as an example to test and compare of OpenSSL performance on OKMX8MM-C, OKMX8MQ-C and OKMX8MP-C respectively here for your reference.
OKMX8MM-C Single Board Computer
OKMX8MQ-C Single Board Computer
OKMX8MP-C Single Board Computer
From above test results, private key of OKMX8MM-C development board is generated 84.5 times per second, private key of OKMX8MQ-C development board is generated 120.5 times per second, private key of OKMX8MP-C development board is generated 148.1 times per second. It can be seen OpenSSL performance of OKMX8MP-C development board is the best.