xref: /dpdk/doc/guides/sample_app_ug/fips_validation.rst (revision 0a2a3c01bcbd6597d26baf2a0d234810aa7cdde7)
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
15*0a2a3c01SGowrishankar Muthukrishnancomputation to the NIST Cryptographic Algorithm Validation Program (CAVP) and
16*0a2a3c01SGowrishankar 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
20*0a2a3c01SGowrishankar Muthukrishnanimplementation must meet all the requirements of FIPS 140-2 (in case of CAVP)
21*0a2a3c01SGowrishankar Muthukrishnanand FIPS 140-3 (in case of ACVP) and must successfully complete the
22*0a2a3c01SGowrishankar Muthukrishnancryptographic algorithm validation process.
233d0fad56SMarko Kovacevic
243d0fad56SMarko KovacevicLimitations
253d0fad56SMarko Kovacevic-----------
263d0fad56SMarko Kovacevic
27*0a2a3c01SGowrishankar MuthukrishnanCAVP
28*0a2a3c01SGowrishankar Muthukrishnan----
29*0a2a3c01SGowrishankar Muthukrishnan
30*0a2a3c01SGowrishankar 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
38*0a2a3c01SGowrishankar 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
54*0a2a3c01SGowrishankar MuthukrishnanACVP
55*0a2a3c01SGowrishankar Muthukrishnan----
56*0a2a3c01SGowrishankar Muthukrishnan
57*0a2a3c01SGowrishankar Muthukrishnan* The application does not supply the test vectors. The user is expected to
58*0a2a3c01SGowrishankar Muthukrishnan  obtain the test vector files from `ACVP  <https://pages.nist.gov/ACVP>`_
59*0a2a3c01SGowrishankar Muthukrishnan  website.
60*0a2a3c01SGowrishankar Muthukrishnan* Supported test vectors
61*0a2a3c01SGowrishankar Muthukrishnan    * AES-CBC (128,192,256) - AFT, MCT
62*0a2a3c01SGowrishankar Muthukrishnan    * AES-GCM (128,192,256) - AFT
63*0a2a3c01SGowrishankar Muthukrishnan    * AES-CMAC (128,192,256) - AFT
64*0a2a3c01SGowrishankar Muthukrishnan    * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
65*0a2a3c01SGowrishankar Muthukrishnan
66*0a2a3c01SGowrishankar Muthukrishnan
673d0fad56SMarko KovacevicApplication Information
683d0fad56SMarko Kovacevic-----------------------
693d0fad56SMarko Kovacevic
703d0fad56SMarko KovacevicIf a ``.req`` is used as the input file after the application is finished
713d0fad56SMarko Kovacevicrunning it will generate a response file or ``.rsp``. Differences between the
723d0fad56SMarko Kovacevictwo files are, the ``.req`` file has missing information for instance if doing
733d0fad56SMarko Kovacevicencryption you will not have the cipher text and that will be generated in the
743d0fad56SMarko Kovacevicresponse file. Also if doing decryption it will not have the plain text until it
753d0fad56SMarko Kovacevicfinished the work and in the response file it will be added onto the end of each
763d0fad56SMarko Kovacevicoperation.
773d0fad56SMarko Kovacevic
783d0fad56SMarko KovacevicThe application can be run with a ``.rsp`` file and what the outcome of that
793d0fad56SMarko Kovacevicwill be is it will add a extra line in the generated ``.rsp`` which should be
803d0fad56SMarko Kovacevicthe same as the ``.rsp`` used to run the application, this is useful for
813d0fad56SMarko Kovacevicvalidating if the application has done the operation correctly.
823d0fad56SMarko Kovacevic
833d0fad56SMarko Kovacevic
843d0fad56SMarko KovacevicCompiling the Application
853d0fad56SMarko Kovacevic-------------------------
863d0fad56SMarko Kovacevic
873d0fad56SMarko Kovacevic* Compile Application
883d0fad56SMarko Kovacevic
89e2a94f9aSCiara Power    To compile the sample application see :doc:`compiling`.
903d0fad56SMarko Kovacevic
913d0fad56SMarko Kovacevic*  Run ``dos2unix`` on the request files
923d0fad56SMarko Kovacevic
933d0fad56SMarko Kovacevic    .. code-block:: console
943d0fad56SMarko Kovacevic
953d0fad56SMarko Kovacevic         dos2unix AES/req/*
961998071cSJakub Poczatek         dos2unix GCM/req/*
973d0fad56SMarko Kovacevic         dos2unix CCM/req/*
983d0fad56SMarko Kovacevic         dos2unix CMAC/req/*
993d0fad56SMarko Kovacevic         dos2unix HMAC/req/*
1003d0fad56SMarko Kovacevic         dos2unix TDES/req/*
1011998071cSJakub Poczatek         dos2unix SHA/req/*
1023d0fad56SMarko Kovacevic
1033d0fad56SMarko KovacevicRunning the Application
1043d0fad56SMarko Kovacevic-----------------------
1053d0fad56SMarko Kovacevic
1063d0fad56SMarko KovacevicThe application requires a number of command line options:
1073d0fad56SMarko Kovacevic
1083d0fad56SMarko Kovacevic    .. code-block:: console
1093d0fad56SMarko Kovacevic
110e2a94f9aSCiara Power         ./dpdk-fips_validation [EAL options]
1113d0fad56SMarko Kovacevic         -- --req-file FILE_PATH/FOLDER_PATH
1123d0fad56SMarko Kovacevic         --rsp-file FILE_PATH/FOLDER_PATH
1133d0fad56SMarko Kovacevic         [--cryptodev DEVICE_NAME] [--cryptodev-id ID] [--path-is-folder]
114952e10cdSFan Zhang         --mbuf-dataroom DATAROOM_SIZE
1153d0fad56SMarko Kovacevic
1163d0fad56SMarko Kovacevicwhere,
1173d0fad56SMarko Kovacevic  * req-file: The path of the request file or folder, separated by
1183d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1193d0fad56SMarko Kovacevic
1203d0fad56SMarko Kovacevic  * rsp-file: The path that the response file or folder is stored. separated by
1213d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1223d0fad56SMarko Kovacevic
1233d0fad56SMarko Kovacevic  * cryptodev: The name of the target DPDK Crypto device to be validated.
1243d0fad56SMarko Kovacevic
1253d0fad56SMarko Kovacevic  * cryptodev-id: The id of the target DPDK Crypto device to be validated.
1263d0fad56SMarko Kovacevic
1273d0fad56SMarko Kovacevic  * path-is-folder: If presented the application expects req-file and rsp-file
1283d0fad56SMarko Kovacevic    are folder paths.
1293d0fad56SMarko Kovacevic
130952e10cdSFan Zhang  * mbuf-dataroom: By default the application creates mbuf pool with maximum
131952e10cdSFan Zhang    possible data room (65535 bytes). If the user wants to test scatter-gather
132952e10cdSFan Zhang    list feature of the PMD he or she may set this value to reduce the dataroom
1339c30a6f3SHenry Nadeau    size so that the input data may be divided into multiple chained mbufs.
134952e10cdSFan Zhang
1353d0fad56SMarko Kovacevic
136218c4e68SBruce RichardsonTo run the application in linux environment to test one AES FIPS test data
1373d0fad56SMarko Kovacevicfile for crypto_aesni_mb PMD, issue the command:
1383d0fad56SMarko Kovacevic
1393d0fad56SMarko Kovacevic.. code-block:: console
1403d0fad56SMarko Kovacevic
141e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_mb --
1423d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE.req --rsp-file ./PATH/TO/RESPONSE/FILE.rsp
1433d0fad56SMarko Kovacevic    --cryptodev crypto_aesni_mb
1443d0fad56SMarko Kovacevic
145218c4e68SBruce RichardsonTo run the application in linux environment to test all AES-GCM FIPS test
1463d0fad56SMarko Kovacevicdata files in one folder for crypto_aesni_gcm PMD, issue the command:
1473d0fad56SMarko Kovacevic
1483d0fad56SMarko Kovacevic.. code-block:: console
1493d0fad56SMarko Kovacevic
150e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_gcm0 --
1513d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE/FOLDER/
1523d0fad56SMarko Kovacevic    --rsp-file ./PATH/TO/RESPONSE/FILE/FOLDER/
1533d0fad56SMarko Kovacevic    --cryptodev-id 0 --path-is-folder
154