cipher sample basic process

Take the cipher sample (for 3DES encryption and decryption) in the QAT sample code as an example,

There are two files in this folder, the cpa_cipher_sample_user.c file contains the main function mian(), the main work is to initialize the memory qaeMemInit() and enable the multi-process mode icp_sal_userStartMultiProcess(), and call the cipherSample() function in main().

The cpa_cipher_sample.c file contains two functions. The cipherSample() function performs related instance, session, and polling operations. The cipherPerformOp() function needs to be called to process specific data; the cipherPerformOp() function is responsible for allocating memory and processing operands. Finally, call the QAT general interface cpaCySymPerformOp() to perform encryption and decryption operations.

See the flow chart below. All black fonts are functions, and each sample code is basically the same; red fonts are statement blocks, including memory allocation and data assignment.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325134421&siteId=291194637