Commit graph

22 commits

Author SHA1 Message Date
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 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
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Wentong Wu 94615a4f98 ext: lib: crypto: unify the API of CCM alogrith
unify the API of CCM alogrithm's implemation for TinyCrypt,
mbedTLS and cc2520 crypto device to make users easy to use.

Fixes #8339.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2019-04-02 21:02:00 -04: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
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Flavio Ceolin d775c2f504 drivers: crypto: Fix input len size for cbc decryption
do_cbc_decrypt() was not accounting IV's size in the input buffer.

Note that tinycrypt expects that IV and cipher text to be contiguous,
but input length must consider only the cipher text.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-08-02 19:18:58 +02:00
Leandro Pereira e61c48123c drivers: crypto: crypto_tc_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 4742f8e010 drivers: crypto: Fix TinyCrypt Kconfig dependencies
Fix TinyCrypt shim driver Kconfig dependencies.

Limit the scope of crypto_driver_api functions to driver file only.

Remove dead code from crypto_tc_shim_priv.h

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-03 14:27:41 -04:00
Leandro Pereira d5c283a82d drivers: crypto: Fix TinyCrypt shim
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-01 10:35:06 -04:00
Tomasz Bursztyka dc646b5f2e drivers/crypto: Fix a memory leak in tc shim driver
If setting up crypto context fails enough times, the sessions will all
end up "in use" though they will not. This will lock tc shim driver
altogether and no crypto context will be possible to run on it.

Change-Id: I72346854e52294f96afc32f30ac5bfd0c368812b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:34 +00:00
Tomasz Bursztyka aec8a03877 drivers/crypto: Use crypto init Kconfig option for tc shim driver
Instead of generic kernel init priority option.

Change-Id: I5b6ed89fdc9528b96f08b4368364256fa79d9c60
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:33 +00:00
Tomasz Bursztyka 4fdbac15cd drivers/crypto: Make tc shim number of sessions Kconfig based
Thus it is possible to reduce or raise such amount relevantly if
required.

Change-Id: Ib53131e10e69fcbf1bcd9d844703d5b8832ee224
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:32 +00:00
Tomasz Bursztyka bfc7fb5ea4 drivers/crypto: Use sys_log automatic newline addition in tinycrypt shim
All existing log entries add a line break, so let's just use the sys_log
way.

Change-Id: Ia94efa593700e9590e16b51262f0b5a2fe10ffa2
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:32 +00:00
Tomasz Bursztyka 5296cd2060 drivers/crypto: Prefix source code relevantly
As everywhere else in drivers, domain of driver should be used as name
prefix.

Change-Id: I1bb2284495c7a6b2648395b757a5f912e4410b15
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-27 13:06:31 +00:00
Renamed from drivers/crypto/tc_shim.c (Browse further)