New upstream version 18.08
[deb_dpdk.git] / doc / guides / cryptodevs / kasumi.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2016 Intel Corporation.
3
4 KASUMI Crypto Poll Mode Driver
5 ===============================
6
7 The KASUMI PMD (**librte_pmd_kasumi**) provides poll mode crypto driver
8 support for utilizing Intel Libsso library, which implements F8 and F9 functions
9 for KASUMI UEA1 cipher and UIA1 hash algorithms.
10
11 Features
12 --------
13
14 KASUMI PMD has support for:
15
16 Cipher algorithm:
17
18 * RTE_CRYPTO_CIPHER_KASUMI_F8
19
20 Authentication algorithm:
21
22 * RTE_CRYPTO_AUTH_KASUMI_F9
23
24 Limitations
25 -----------
26
27 * Chained mbufs are not supported.
28 * KASUMI(F9) supported only if hash offset and length field is byte-aligned.
29 * In-place bit-level operations for KASUMI(F8) are not supported
30   (if length and/or offset of data to be ciphered is not byte-aligned).
31
32
33 Installation
34 ------------
35
36 To build DPDK with the KASUMI_PMD the user is required to download
37 the export controlled ``libsso_kasumi`` library, by registering in
38 `Intel Resource & Design Center <https://www.intel.com/content/www/us/en/design/resource-design-center.html>`_.
39 Once approval has been granted, the user needs to search for
40 *Kasumi F8 F9 3GPP cryptographic algorithms Software Library* to download the
41 library or directly through this `link <https://cdrdv2.intel.com/v1/dl/getContent/575866>`_.
42 After downloading the library, the user needs to unpack and compile it
43 on their system before building DPDK::
44
45    make
46
47 **Note**: When encrypting with KASUMI F8, by default the library
48 encrypts full blocks of 8 bytes, regardless the number of bytes to
49 be encrypted provided (which leads to a possible buffer overflow).
50 To avoid this situation, it is necessary not to pass
51 3GPP_SAFE_BUFFERS as a compilation flag.
52 Also, this is required when using chained operations
53 (cipher-then-auth/auth-then-cipher).
54 For this, in the Makefile of the library, make sure that this flag
55 is commented out::
56
57   #EXTRA_CFLAGS  += -D_3GPP_SAFE_BUFFERS
58
59 **Note**: To build the PMD as a shared library, the libsso_kasumi
60 library must be built as follows::
61
62   make KASUMI_CFLAGS=-DKASUMI_C
63
64
65 Initialization
66 --------------
67
68 In order to enable this virtual crypto PMD, user must:
69
70 * Export the environmental variable LIBSSO_KASUMI_PATH with the path where
71   the library was extracted (kasumi folder).
72
73 * Build the LIBSSO library (explained in Installation section).
74
75 * Set CONFIG_RTE_LIBRTE_PMD_KASUMI=y in config/common_base.
76
77 To use the PMD in an application, user must:
78
79 * Call rte_vdev_init("crypto_kasumi") within the application.
80
81 * Use --vdev="crypto_kasumi" in the EAL options, which will call rte_vdev_init() internally.
82
83 The following parameters (all optional) can be provided in the previous two calls:
84
85 * socket_id: Specify the socket where the memory for the device is going to be allocated
86   (by default, socket_id will be the socket where the core that is creating the PMD is running on).
87
88 * max_nb_queue_pairs: Specify the maximum number of queue pairs in the device (8 by default).
89
90 * max_nb_sessions: Specify the maximum number of sessions that can be created (2048 by default).
91
92 Example:
93
94 .. code-block:: console
95
96     ./l2fwd-crypto -l 1 -n 4 --vdev="crypto_kasumi,socket_id=0,max_nb_sessions=128" \
97     -- -p 1 --cdev SW --chain CIPHER_ONLY --cipher_algo "kasumi-f8"
98
99 Extra notes on KASUMI F9
100 ------------------------
101
102 When using KASUMI F9 authentication algorithm, the input buffer must be
103 constructed according to the 3GPP KASUMI specifications (section 4.4, page 13):
104 `<http://cryptome.org/3gpp/35201-900.pdf>`_.
105 Input buffer has to have COUNT (4 bytes), FRESH (4 bytes), MESSAGE and DIRECTION (1 bit)
106 concatenated. After the DIRECTION bit, a single '1' bit is appended, followed by
107 between 0 and 7 '0' bits, so that the total length of the buffer is multiple of 8 bits.
108 Note that the actual message can be any length, specified in bits.
109
110 Once this buffer is passed this way, when creating the crypto operation,
111 length of data to authenticate (op.sym.auth.data.length) must be the length
112 of all the items described above, including the padding at the end.
113 Also, offset of data to authenticate (op.sym.auth.data.offset)
114 must be such that points at the start of the COUNT bytes.