Commit graph

23 commits

Author SHA1 Message Date
Gerard Marull-Paretas 1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Flavio Ceolin d2a56c5047 drivers: crypto: Add multipart hash support
Add a new API to support multipart hash calculation. The API allows
split the data input to be split in small chunks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin 64f6a5ec37 drivers: crypto: mtls: Add support for hashing
Add support for hashing on mtls driver.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin 981ea3042e drivers: crypto: Keep namespace consistent
The API to set a callback has the namespace cipher but the driver
function pointer was using the namespace crypto. As this API belongs
to the cipher subgroup, just rename the function pointer in the driver
to be consistent.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin df3d1f83f7 drivers: crypto: Rename cipher file
This file defines the crypto driver API, cipher is supposed to be just
one type of capability (other can be hash) of these drivers, just
change the file name to be consistent with it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin d1628ba035 drivers: crypto: Add cipher namespace in some API
Add 'cipher' namespace in some in the driver API since these
operations are for cipher.

Set a namespace to make it clear that these are cipher operations,
this allow further functionalities, like hash, to be added in this
driver API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Gerard Marull-Paretas 20e6048a49 drivers: crypto: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:58 -04:00
Kumar Gala 50b52279e9 drivers: crypto: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:01:58 -05:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Robert Lubos 2c2771970e modules: mbedtls: Update mbedTLS commit and apply fixes
Update mbedTLS commit along with the following fixes:

* Fix naming inconsistencies in some cipher modes, to match core mbedTLS
  configs
* Add Kconfig to enable CTR cipher mode

Fixes #22421

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-05-07 23:46:08 -05:00
Flavio Ceolin 86087f202a drivers: crypto: mbedtls: Remove dead code
mtls_session_setup checks early if the given mode is valid and return
an error if not. CRYPTO_CIPHER_MODE_CTR is not a valid one so there is
no needed to have it in the switch.

CID: 20600

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-10 14:51:33 +02:00
Markus Fuchs ad8f011dcf drivers: crypto: crypto_mtls_shim: Add AES-GCM support
Add support for AES Galois/Counter Mode (GCM) of operation to the
mbed TLS shim driver.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2020-02-08 13:40:33 +02:00
Siddharth Chandrasekaran 1ab39e7c52 drivers/crypto: mbedTLS_shim add support for CAP_NO_IV_PREFIX
Add support for `CAP_NO_IV_PREFIX` in mbedTLS_shim and advertise this as
one of its capabilities. When this flag is active, the IV passed is
preserved to allow applications to reuse the IV buffer.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-01-16 18:34:20 +01:00
Siddharth Chandrasekaran 850f355be1 drivers/crypto: Add macro to simplify access to ctx->drv_sessn_state
The conversion of struct cipher_ctx * to mtls_aes_context * happens in
a bunch of places. Add a macro MTLS_GET_CTX() to simplify this.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2019-12-18 22:10:29 +01:00
Siddharth Chandrasekaran 5fbaf9f0e5 drivers/crypto: Add support for AES ECB mode in mbedTLS shim
Add support for AES ECB mode of operation in mbedTLS shim driver.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2019-12-18 22:10:29 +01:00
Siddharth Chandrasekaran 30f0b3a37c drivers/crypto: Add support for AES CBC mode in mbedTLS shim
Add support for AES CBC mode of operation in mbedTLS shim driver.
Refactor mtls_session_setup() to allow multiple cipher modes to
co-exist.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2019-12-18 22:10:29 +01:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Anas Nashif 3da714193f drivers: crypto: move to new logger
Move to new logger subsystem.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Leandro Pereira ab16853b26 drivers: crypto: crypto_mtls_shim: Set output length for all operations
The out_len member in struct cipher_pkt was not set.

Fixes #4684.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-05-16 23:30:11 +03:00
Ramakrishna Pallala bb5a2985d1 drivers: crypto: Fix mbedtls Kconfig dependencies
Fix mbedtls shim driver Kconfig dependencies.

Limit the scope of crypto_driver_api functions to driver file only.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-03 14:27:41 -04:00
Tomasz Bursztyka 7abf3c5307 drivers/crypto: Add mbedTLS shim crypto driver
This exposes the CCM operations through generic Crypto API.

Change-Id: I09346e77bf8821c208305a7aa2805cf49cb42d71
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-17 22:20:23 -04:00