xref: /dpdk/doc/guides/sample_app_ug/fips_validation.rst (revision 64569ffa0f739e28a58d9455a863ef71a3686722)
13d0fad56SMarko Kovacevic..  SPDX-License-Identifier: BSD-3-Clause
23d0fad56SMarko Kovacevic    Copyright(c) 2018 Intel Corporation.
33d0fad56SMarko Kovacevic
43d0fad56SMarko KovacevicFederal Information Processing Standards (FIPS) CryptoDev Validation
53d0fad56SMarko Kovacevic====================================================================
63d0fad56SMarko Kovacevic
73d0fad56SMarko KovacevicOverview
83d0fad56SMarko Kovacevic--------
93d0fad56SMarko Kovacevic
103d0fad56SMarko KovacevicFederal Information Processing Standards (FIPS) are publicly announced standards
113d0fad56SMarko Kovacevicdeveloped by the United States federal government for use in computer systems by
123d0fad56SMarko Kovacevicnon-military government agencies and government contractors.
133d0fad56SMarko Kovacevic
143d0fad56SMarko KovacevicThis application is used to parse and perform symmetric cryptography
150a2a3c01SGowrishankar Muthukrishnancomputation to the NIST Cryptographic Algorithm Validation Program (CAVP) and
160a2a3c01SGowrishankar MuthukrishnanAutomated Crypto Validation Protocol (ACVP) test vectors.
173d0fad56SMarko Kovacevic
183d0fad56SMarko KovacevicFor an algorithm implementation to be listed on a cryptographic module
193d0fad56SMarko Kovacevicvalidation certificate as an Approved security function, the algorithm
200a2a3c01SGowrishankar Muthukrishnanimplementation must meet all the requirements of FIPS 140-2 (in case of CAVP)
210a2a3c01SGowrishankar Muthukrishnanand FIPS 140-3 (in case of ACVP) and must successfully complete the
220a2a3c01SGowrishankar Muthukrishnancryptographic algorithm validation process.
233d0fad56SMarko Kovacevic
243d0fad56SMarko KovacevicLimitations
253d0fad56SMarko Kovacevic-----------
263d0fad56SMarko Kovacevic
270a2a3c01SGowrishankar MuthukrishnanCAVP
280a2a3c01SGowrishankar Muthukrishnan----
290a2a3c01SGowrishankar Muthukrishnan
300a2a3c01SGowrishankar Muthukrishnan* The version of request file supported is ``CAVS 21.0``.
313d0fad56SMarko Kovacevic* If the header comment in a ``.req`` file does not contain a Algo tag
323d0fad56SMarko Kovacevic  i.e ``AES,TDES,GCM`` you need to manually add it into the header comment for
333d0fad56SMarko Kovacevic  example::
343d0fad56SMarko Kovacevic
353d0fad56SMarko Kovacevic      # VARIABLE KEY - KAT for CBC / # TDES VARIABLE KEY - KAT for CBC
363d0fad56SMarko Kovacevic
373d0fad56SMarko Kovacevic* The application does not supply the test vectors. The user is expected to
380a2a3c01SGowrishankar Muthukrishnan  obtain the test vector files from `CAVP
393d0fad56SMarko Kovacevic  <https://csrc.nist.gov/projects/cryptographic-algorithm-validation-
403d0fad56SMarko Kovacevic  program/block-ciphers>`_ website. To obtain the ``.req`` files you need to
413d0fad56SMarko Kovacevic  email a person from the NIST website and pay for the ``.req`` files.
423d0fad56SMarko Kovacevic  The ``.rsp`` files from the site can be used to validate and compare with
433d0fad56SMarko Kovacevic  the ``.rsp`` files created by the FIPS application.
443d0fad56SMarko Kovacevic
453d0fad56SMarko Kovacevic* Supported test vectors
46cd255ccfSMarko Kovacevic    * AES-CBC (128,192,256) - GFSbox, KeySbox, MCT, MMT
474aaad299SMarko Kovacevic    * AES-GCM (128,192,256) - EncryptExtIV, Decrypt
48305921f4SMarko Kovacevic    * AES-CCM (128) - VADT, VNT, VPT, VTT, DVPT
49ac026f46SMarko Kovacevic    * AES-CMAC (128) - Generate, Verify
50f64adb67SMarko Kovacevic    * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
51527cbf3dSMarko Kovacevic    * TDES-CBC (1 Key, 2 Keys, 3 Keys) - MMT, Monte, Permop, Subkey, Varkey,
52527cbf3dSMarko Kovacevic      VarText
533d0fad56SMarko Kovacevic
540a2a3c01SGowrishankar MuthukrishnanACVP
550a2a3c01SGowrishankar Muthukrishnan----
560a2a3c01SGowrishankar Muthukrishnan
570a2a3c01SGowrishankar Muthukrishnan* The application does not supply the test vectors. The user is expected to
580a2a3c01SGowrishankar Muthukrishnan  obtain the test vector files from `ACVP  <https://pages.nist.gov/ACVP>`_
590a2a3c01SGowrishankar Muthukrishnan  website.
600a2a3c01SGowrishankar Muthukrishnan* Supported test vectors
610a2a3c01SGowrishankar Muthukrishnan    * AES-CBC (128,192,256) - AFT, MCT
620a2a3c01SGowrishankar Muthukrishnan    * AES-GCM (128,192,256) - AFT
630a2a3c01SGowrishankar Muthukrishnan    * AES-CMAC (128,192,256) - AFT
64f8e431edSGowrishankar Muthukrishnan    * AES-XTS (128,256) - AFT
650a2a3c01SGowrishankar Muthukrishnan    * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
66d5c24714SGowrishankar Muthukrishnan    * SHA (1, 256, 384, 512) - AFT, MCT
67*64569ffaSGowrishankar Muthukrishnan    * TDES-CBC - AFT, MCT
68*64569ffaSGowrishankar Muthukrishnan    * TDES-ECB - AFT, MCT
690a2a3c01SGowrishankar Muthukrishnan
700a2a3c01SGowrishankar Muthukrishnan
713d0fad56SMarko KovacevicApplication Information
723d0fad56SMarko Kovacevic-----------------------
733d0fad56SMarko Kovacevic
743d0fad56SMarko KovacevicIf a ``.req`` is used as the input file after the application is finished
753d0fad56SMarko Kovacevicrunning it will generate a response file or ``.rsp``. Differences between the
763d0fad56SMarko Kovacevictwo files are, the ``.req`` file has missing information for instance if doing
773d0fad56SMarko Kovacevicencryption you will not have the cipher text and that will be generated in the
783d0fad56SMarko Kovacevicresponse file. Also if doing decryption it will not have the plain text until it
793d0fad56SMarko Kovacevicfinished the work and in the response file it will be added onto the end of each
803d0fad56SMarko Kovacevicoperation.
813d0fad56SMarko Kovacevic
823d0fad56SMarko KovacevicThe application can be run with a ``.rsp`` file and what the outcome of that
833d0fad56SMarko Kovacevicwill be is it will add a extra line in the generated ``.rsp`` which should be
843d0fad56SMarko Kovacevicthe same as the ``.rsp`` used to run the application, this is useful for
853d0fad56SMarko Kovacevicvalidating if the application has done the operation correctly.
863d0fad56SMarko Kovacevic
873d0fad56SMarko Kovacevic
883d0fad56SMarko KovacevicCompiling the Application
893d0fad56SMarko Kovacevic-------------------------
903d0fad56SMarko Kovacevic
913d0fad56SMarko Kovacevic* Compile Application
923d0fad56SMarko Kovacevic
93e2a94f9aSCiara Power    To compile the sample application see :doc:`compiling`.
943d0fad56SMarko Kovacevic
953d0fad56SMarko Kovacevic*  Run ``dos2unix`` on the request files
963d0fad56SMarko Kovacevic
973d0fad56SMarko Kovacevic    .. code-block:: console
983d0fad56SMarko Kovacevic
993d0fad56SMarko Kovacevic         dos2unix AES/req/*
1001998071cSJakub Poczatek         dos2unix GCM/req/*
1013d0fad56SMarko Kovacevic         dos2unix CCM/req/*
1023d0fad56SMarko Kovacevic         dos2unix CMAC/req/*
1033d0fad56SMarko Kovacevic         dos2unix HMAC/req/*
1043d0fad56SMarko Kovacevic         dos2unix TDES/req/*
1051998071cSJakub Poczatek         dos2unix SHA/req/*
1063d0fad56SMarko Kovacevic
1073d0fad56SMarko KovacevicRunning the Application
1083d0fad56SMarko Kovacevic-----------------------
1093d0fad56SMarko Kovacevic
1103d0fad56SMarko KovacevicThe application requires a number of command line options:
1113d0fad56SMarko Kovacevic
1123d0fad56SMarko Kovacevic    .. code-block:: console
1133d0fad56SMarko Kovacevic
114e2a94f9aSCiara Power         ./dpdk-fips_validation [EAL options]
1153d0fad56SMarko Kovacevic         -- --req-file FILE_PATH/FOLDER_PATH
1163d0fad56SMarko Kovacevic         --rsp-file FILE_PATH/FOLDER_PATH
1173d0fad56SMarko Kovacevic         [--cryptodev DEVICE_NAME] [--cryptodev-id ID] [--path-is-folder]
118952e10cdSFan Zhang         --mbuf-dataroom DATAROOM_SIZE
1193d0fad56SMarko Kovacevic
1203d0fad56SMarko Kovacevicwhere,
1213d0fad56SMarko Kovacevic  * req-file: The path of the request file or folder, separated by
1223d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1233d0fad56SMarko Kovacevic
1243d0fad56SMarko Kovacevic  * rsp-file: The path that the response file or folder is stored. separated by
1253d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1263d0fad56SMarko Kovacevic
1273d0fad56SMarko Kovacevic  * cryptodev: The name of the target DPDK Crypto device to be validated.
1283d0fad56SMarko Kovacevic
1293d0fad56SMarko Kovacevic  * cryptodev-id: The id of the target DPDK Crypto device to be validated.
1303d0fad56SMarko Kovacevic
1313d0fad56SMarko Kovacevic  * path-is-folder: If presented the application expects req-file and rsp-file
1323d0fad56SMarko Kovacevic    are folder paths.
1333d0fad56SMarko Kovacevic
134952e10cdSFan Zhang  * mbuf-dataroom: By default the application creates mbuf pool with maximum
135952e10cdSFan Zhang    possible data room (65535 bytes). If the user wants to test scatter-gather
136952e10cdSFan Zhang    list feature of the PMD he or she may set this value to reduce the dataroom
1379c30a6f3SHenry Nadeau    size so that the input data may be divided into multiple chained mbufs.
138952e10cdSFan Zhang
1393d0fad56SMarko Kovacevic
140218c4e68SBruce RichardsonTo run the application in linux environment to test one AES FIPS test data
1413d0fad56SMarko Kovacevicfile for crypto_aesni_mb PMD, issue the command:
1423d0fad56SMarko Kovacevic
1433d0fad56SMarko Kovacevic.. code-block:: console
1443d0fad56SMarko Kovacevic
145e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_mb --
1463d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE.req --rsp-file ./PATH/TO/RESPONSE/FILE.rsp
1473d0fad56SMarko Kovacevic    --cryptodev crypto_aesni_mb
1483d0fad56SMarko Kovacevic
149218c4e68SBruce RichardsonTo run the application in linux environment to test all AES-GCM FIPS test
1503d0fad56SMarko Kovacevicdata files in one folder for crypto_aesni_gcm PMD, issue the command:
1513d0fad56SMarko Kovacevic
1523d0fad56SMarko Kovacevic.. code-block:: console
1533d0fad56SMarko Kovacevic
154e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_gcm0 --
1553d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE/FOLDER/
1563d0fad56SMarko Kovacevic    --rsp-file ./PATH/TO/RESPONSE/FILE/FOLDER/
1573d0fad56SMarko Kovacevic    --cryptodev-id 0 --path-is-folder
158