xref: /dpdk/doc/guides/sample_app_ug/fips_validation.rst (revision 55a7050e212fe9366c5e0409cfc0892ddee27b3e)
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
63*55a7050eSGowrishankar Muthukrishnan    * AES-CCM (128,192,256) - AFT
640a2a3c01SGowrishankar Muthukrishnan    * AES-CMAC (128,192,256) - AFT
65c8956fd2SBrian Dooley    * AES-CTR (128,192,256) - AFT, CTR
66e27268bdSBrian Dooley    * AES-GMAC (128,192,256) - AFT
67f8e431edSGowrishankar Muthukrishnan    * AES-XTS (128,256) - AFT
681ea7940eSGowrishankar Muthukrishnan    * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512, SHA3_224, SHA3_256, SHA3_384, SHA3_512)
691ea7940eSGowrishankar Muthukrishnan    * SHA (1, 224, 256, 384, 512) - AFT, MCT
701ea7940eSGowrishankar Muthukrishnan    * SHA3 (224, 256, 384, 512) - AFT, MCT
71225f04fbSGowrishankar Muthukrishnan    * SHAKE (128, 256) - AFT, MCT, VOT
7264569ffaSGowrishankar Muthukrishnan    * TDES-CBC - AFT, MCT
7364569ffaSGowrishankar Muthukrishnan    * TDES-ECB - AFT, MCT
7436128a67SGowrishankar Muthukrishnan    * RSA
75b455d261SGowrishankar Muthukrishnan    * ECDSA
760a2a3c01SGowrishankar Muthukrishnan
770a2a3c01SGowrishankar Muthukrishnan
783d0fad56SMarko KovacevicApplication Information
793d0fad56SMarko Kovacevic-----------------------
803d0fad56SMarko Kovacevic
813d0fad56SMarko KovacevicIf a ``.req`` is used as the input file after the application is finished
823d0fad56SMarko Kovacevicrunning it will generate a response file or ``.rsp``. Differences between the
833d0fad56SMarko Kovacevictwo files are, the ``.req`` file has missing information for instance if doing
843d0fad56SMarko Kovacevicencryption you will not have the cipher text and that will be generated in the
853d0fad56SMarko Kovacevicresponse file. Also if doing decryption it will not have the plain text until it
863d0fad56SMarko Kovacevicfinished the work and in the response file it will be added onto the end of each
873d0fad56SMarko Kovacevicoperation.
883d0fad56SMarko Kovacevic
893d0fad56SMarko KovacevicThe application can be run with a ``.rsp`` file and what the outcome of that
903d0fad56SMarko Kovacevicwill be is it will add a extra line in the generated ``.rsp`` which should be
913d0fad56SMarko Kovacevicthe same as the ``.rsp`` used to run the application, this is useful for
923d0fad56SMarko Kovacevicvalidating if the application has done the operation correctly.
933d0fad56SMarko Kovacevic
943d0fad56SMarko Kovacevic
953d0fad56SMarko KovacevicCompiling the Application
963d0fad56SMarko Kovacevic-------------------------
973d0fad56SMarko Kovacevic
983d0fad56SMarko Kovacevic* Compile Application
993d0fad56SMarko Kovacevic
100e2a94f9aSCiara Power    To compile the sample application see :doc:`compiling`.
1013d0fad56SMarko Kovacevic
1023d0fad56SMarko Kovacevic*  Run ``dos2unix`` on the request files
1033d0fad56SMarko Kovacevic
1043d0fad56SMarko Kovacevic    .. code-block:: console
1053d0fad56SMarko Kovacevic
1063d0fad56SMarko Kovacevic         dos2unix AES/req/*
1071998071cSJakub Poczatek         dos2unix GCM/req/*
1083d0fad56SMarko Kovacevic         dos2unix CCM/req/*
1093d0fad56SMarko Kovacevic         dos2unix CMAC/req/*
1103d0fad56SMarko Kovacevic         dos2unix HMAC/req/*
1113d0fad56SMarko Kovacevic         dos2unix TDES/req/*
1121998071cSJakub Poczatek         dos2unix SHA/req/*
1133d0fad56SMarko Kovacevic
1143d0fad56SMarko KovacevicRunning the Application
1153d0fad56SMarko Kovacevic-----------------------
1163d0fad56SMarko Kovacevic
1173d0fad56SMarko KovacevicThe application requires a number of command line options:
1183d0fad56SMarko Kovacevic
1193d0fad56SMarko Kovacevic    .. code-block:: console
1203d0fad56SMarko Kovacevic
121e2a94f9aSCiara Power         ./dpdk-fips_validation [EAL options]
1223d0fad56SMarko Kovacevic         -- --req-file FILE_PATH/FOLDER_PATH
1233d0fad56SMarko Kovacevic         --rsp-file FILE_PATH/FOLDER_PATH
1243d0fad56SMarko Kovacevic         [--cryptodev DEVICE_NAME] [--cryptodev-id ID] [--path-is-folder]
125952e10cdSFan Zhang         --mbuf-dataroom DATAROOM_SIZE
1263d0fad56SMarko Kovacevic
1273d0fad56SMarko Kovacevicwhere,
1283d0fad56SMarko Kovacevic  * req-file: The path of the request file or folder, separated by
1293d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1303d0fad56SMarko Kovacevic
1313d0fad56SMarko Kovacevic  * rsp-file: The path that the response file or folder is stored. separated by
1323d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1333d0fad56SMarko Kovacevic
1343d0fad56SMarko Kovacevic  * cryptodev: The name of the target DPDK Crypto device to be validated.
1353d0fad56SMarko Kovacevic
1363d0fad56SMarko Kovacevic  * cryptodev-id: The id of the target DPDK Crypto device to be validated.
1373d0fad56SMarko Kovacevic
1383d0fad56SMarko Kovacevic  * path-is-folder: If presented the application expects req-file and rsp-file
1393d0fad56SMarko Kovacevic    are folder paths.
1403d0fad56SMarko Kovacevic
141952e10cdSFan Zhang  * mbuf-dataroom: By default the application creates mbuf pool with maximum
142952e10cdSFan Zhang    possible data room (65535 bytes). If the user wants to test scatter-gather
143952e10cdSFan Zhang    list feature of the PMD he or she may set this value to reduce the dataroom
1449c30a6f3SHenry Nadeau    size so that the input data may be divided into multiple chained mbufs.
145952e10cdSFan Zhang
1463d0fad56SMarko Kovacevic
147218c4e68SBruce RichardsonTo run the application in linux environment to test one AES FIPS test data
1483d0fad56SMarko Kovacevicfile for crypto_aesni_mb PMD, issue the command:
1493d0fad56SMarko Kovacevic
1503d0fad56SMarko Kovacevic.. code-block:: console
1513d0fad56SMarko Kovacevic
152e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_mb --
1533d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE.req --rsp-file ./PATH/TO/RESPONSE/FILE.rsp
1543d0fad56SMarko Kovacevic    --cryptodev crypto_aesni_mb
1553d0fad56SMarko Kovacevic
156218c4e68SBruce RichardsonTo run the application in linux environment to test all AES-GCM FIPS test
1573d0fad56SMarko Kovacevicdata files in one folder for crypto_aesni_gcm PMD, issue the command:
1583d0fad56SMarko Kovacevic
1593d0fad56SMarko Kovacevic.. code-block:: console
1603d0fad56SMarko Kovacevic
161e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_gcm0 --
1623d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE/FOLDER/
1633d0fad56SMarko Kovacevic    --rsp-file ./PATH/TO/RESPONSE/FILE/FOLDER/
1643d0fad56SMarko Kovacevic    --cryptodev-id 0 --path-is-folder
165