You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2021/02/17 13:45:21 UTC
[mynewt-core] 01/03: crypto: k64f: rename to kinetis
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit a28ab7ea5d0ab64e2164c2f38ca25d2d1a2fa35e
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Tue Feb 9 10:11:19 2021 -0300
crypto: k64f: rename to kinetis
Make it clear this driver should work on other Kinetis family members as
well; the k64f uses a mmCAU which is one of the possible, and oldest, of
the acceleration units in those parts.
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
hw/bsp/frdm-k64f/pkg.yml | 2 +-
hw/bsp/frdm-k64f/src/hal_bsp.c | 4 +--
.../include/crypto_kinetis/crypto_kinetis.h} | 8 +++---
.../crypto/{crypto_k64f => crypto_kinetis}/pkg.yml | 4 +--
.../src/crypto_kinetis.c} | 32 +++++++++++-----------
.../src/crypto_kinetis_cau.c} | 2 +-
.../{crypto_k64f => crypto_kinetis}/syscfg.yml | 0
7 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/hw/bsp/frdm-k64f/pkg.yml b/hw/bsp/frdm-k64f/pkg.yml
index c1d234d..a6df39e 100644
--- a/hw/bsp/frdm-k64f/pkg.yml
+++ b/hw/bsp/frdm-k64f/pkg.yml
@@ -67,7 +67,7 @@ pkg.deps.TRNG:
- "@apache-mynewt-core/hw/drivers/trng/trng_kinetis"
pkg.deps.CRYPTO:
- - "@apache-mynewt-core/hw/drivers/crypto/crypto_k64f"
+ - "@apache-mynewt-core/hw/drivers/crypto/crypto_kinetis"
pkg.deps.ENC_FLASH_DEV:
- "@apache-mynewt-core/hw/drivers/flash/enc_flash/ef_crypto"
diff --git a/hw/bsp/frdm-k64f/src/hal_bsp.c b/hw/bsp/frdm-k64f/src/hal_bsp.c
index 84c5a97..a55a8e2 100644
--- a/hw/bsp/frdm-k64f/src/hal_bsp.c
+++ b/hw/bsp/frdm-k64f/src/hal_bsp.c
@@ -34,7 +34,7 @@
#endif
#if MYNEWT_VAL(CRYPTO)
#include "crypto/crypto.h"
-#include "crypto_k64f/crypto_k64f.h"
+#include "crypto_kinetis/crypto_kinetis.h"
#endif
#if MYNEWT_VAL(ENC_FLASH_DEV)
#include <ef_crypto/ef_crypto.h>
@@ -217,7 +217,7 @@ hal_bsp_init(void)
#if MYNEWT_VAL(CRYPTO)
rc = os_dev_create(&os_bsp_crypto.dev, "crypto",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- k64f_crypto_dev_init, NULL);
+ kinetis_crypto_dev_init, NULL);
assert(rc == 0);
#endif
diff --git a/hw/drivers/crypto/crypto_k64f/include/crypto_k64f/crypto_k64f.h b/hw/drivers/crypto/crypto_kinetis/include/crypto_kinetis/crypto_kinetis.h
similarity index 85%
rename from hw/drivers/crypto/crypto_k64f/include/crypto_k64f/crypto_k64f.h
rename to hw/drivers/crypto/crypto_kinetis/include/crypto_kinetis/crypto_kinetis.h
index 7442c8d..fde36cf 100644
--- a/hw/drivers/crypto/crypto_k64f/include/crypto_k64f/crypto_k64f.h
+++ b/hw/drivers/crypto/crypto_kinetis/include/crypto_kinetis/crypto_kinetis.h
@@ -17,8 +17,8 @@
* under the License.
*/
-#ifndef __CRYPTO_K64F_H__
-#define __CRYPTO_K64F_H__
+#ifndef __CRYPTO_KINETIS_H__
+#define __CRYPTO_KINETIS_H__
#include "crypto/crypto.h"
@@ -26,10 +26,10 @@
extern "C" {
#endif
-int k64f_crypto_dev_init(struct os_dev *dev, void *arg);
+int kinetis_crypto_dev_init(struct os_dev *dev, void *arg);
#ifdef __cplusplus
}
#endif
-#endif /* __CRYPTO_K64F_H__ */
+#endif /* __CRYPTO_KINETIS_H__ */
diff --git a/hw/drivers/crypto/crypto_k64f/pkg.yml b/hw/drivers/crypto/crypto_kinetis/pkg.yml
similarity index 91%
rename from hw/drivers/crypto/crypto_k64f/pkg.yml
rename to hw/drivers/crypto/crypto_kinetis/pkg.yml
index cbfd2f5..0180382 100644
--- a/hw/drivers/crypto/crypto_k64f/pkg.yml
+++ b/hw/drivers/crypto/crypto_kinetis/pkg.yml
@@ -17,8 +17,8 @@
# under the License.
#
-pkg.name: hw/drivers/crypto/crypto_k64f
-pkg.description: Crypto driver for NXP K64F
+pkg.name: hw/drivers/crypto/crypto_kinetis
+pkg.description: Crypto driver for NXP Kinetis Family
pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
diff --git a/hw/drivers/crypto/crypto_k64f/src/crypto_k64f.c b/hw/drivers/crypto/crypto_kinetis/src/crypto_kinetis.c
similarity index 78%
rename from hw/drivers/crypto/crypto_k64f/src/crypto_k64f.c
rename to hw/drivers/crypto/crypto_kinetis/src/crypto_kinetis.c
index ec1799f..8261f5f 100644
--- a/hw/drivers/crypto/crypto_k64f/src/crypto_k64f.c
+++ b/hw/drivers/crypto/crypto_kinetis/src/crypto_kinetis.c
@@ -22,7 +22,7 @@
#include <os/mynewt.h>
#include "crypto/crypto.h"
-#include "crypto_k64f/crypto_k64f.h"
+#include "crypto_kinetis/crypto_kinetis.h"
static struct os_mutex gmtx;
@@ -71,7 +71,7 @@ typedef void (* cau_aes_func_t)(const unsigned char *in,
unsigned char *out);
static uint32_t
-k64f_crypto_cau_aes_nr(cau_aes_func_t aes_func, const uint8_t *key,
+kinetis_crypto_cau_aes_nr(cau_aes_func_t aes_func, const uint8_t *key,
int keylen, const uint8_t *inbuf, uint8_t *outbuf, size_t len)
{
uint32_t i;
@@ -108,8 +108,8 @@ k64f_crypto_cau_aes_nr(cau_aes_func_t aes_func, const uint8_t *key,
}
static bool
-k64f_crypto_has_support(struct crypto_dev *crypto, uint8_t op, uint16_t algo,
- uint16_t mode, uint16_t keylen)
+kinetis_crypto_has_support(struct crypto_dev *crypto, uint8_t op,
+ uint16_t algo, uint16_t mode, uint16_t keylen)
{
(void)op;
@@ -129,37 +129,37 @@ k64f_crypto_has_support(struct crypto_dev *crypto, uint8_t op, uint16_t algo,
}
static uint32_t
-k64f_crypto_encrypt(struct crypto_dev *crypto, uint16_t algo, uint16_t mode,
+kinetis_crypto_encrypt(struct crypto_dev *crypto, uint16_t algo, uint16_t mode,
const uint8_t *key, uint16_t keylen, uint8_t *iv, const uint8_t *inbuf,
uint8_t *outbuf, uint32_t len)
{
(void)iv;
- if (!k64f_crypto_has_support(crypto, CRYPTO_OP_ENCRYPT, algo, mode, keylen)) {
+ if (!kinetis_crypto_has_support(crypto, CRYPTO_OP_ENCRYPT, algo, mode, keylen)) {
return 0;
}
- return k64f_crypto_cau_aes_nr(cau_aes_encrypt, key, keylen, inbuf,
+ return kinetis_crypto_cau_aes_nr(cau_aes_encrypt, key, keylen, inbuf,
outbuf, len);
}
static uint32_t
-k64f_crypto_decrypt(struct crypto_dev *crypto, uint16_t algo, uint16_t mode,
+kinetis_crypto_decrypt(struct crypto_dev *crypto, uint16_t algo, uint16_t mode,
const uint8_t *key, uint16_t keylen, uint8_t *iv, const uint8_t *inbuf,
uint8_t *outbuf, uint32_t len)
{
(void)iv;
- if (!k64f_crypto_has_support(crypto, CRYPTO_OP_ENCRYPT, algo, mode, keylen)) {
+ if (!kinetis_crypto_has_support(crypto, CRYPTO_OP_ENCRYPT, algo, mode, keylen)) {
return 0;
}
- return k64f_crypto_cau_aes_nr(cau_aes_decrypt, key, keylen, inbuf,
+ return kinetis_crypto_cau_aes_nr(cau_aes_decrypt, key, keylen, inbuf,
outbuf, len);
}
static int
-k64f_crypto_dev_open(struct os_dev *dev, uint32_t wait, void *arg)
+kinetis_crypto_dev_open(struct os_dev *dev, uint32_t wait, void *arg)
{
struct crypto_dev *crypto;
@@ -174,20 +174,20 @@ k64f_crypto_dev_open(struct os_dev *dev, uint32_t wait, void *arg)
}
int
-k64f_crypto_dev_init(struct os_dev *dev, void *arg)
+kinetis_crypto_dev_init(struct os_dev *dev, void *arg)
{
struct crypto_dev *crypto;
crypto = (struct crypto_dev *)dev;
assert(crypto);
- OS_DEV_SETHANDLERS(dev, k64f_crypto_dev_open, NULL);
+ OS_DEV_SETHANDLERS(dev, kinetis_crypto_dev_open, NULL);
assert(os_mutex_init(&gmtx) == 0);
- crypto->interface.encrypt = k64f_crypto_encrypt;
- crypto->interface.decrypt = k64f_crypto_decrypt;
- crypto->interface.has_support = k64f_crypto_has_support;
+ crypto->interface.encrypt = kinetis_crypto_encrypt;
+ crypto->interface.decrypt = kinetis_crypto_decrypt;
+ crypto->interface.has_support = kinetis_crypto_has_support;
return 0;
}
diff --git a/hw/drivers/crypto/crypto_k64f/src/crypto_k64f_cau.c b/hw/drivers/crypto/crypto_kinetis/src/crypto_kinetis_cau.c
similarity index 98%
rename from hw/drivers/crypto/crypto_k64f/src/crypto_k64f_cau.c
rename to hw/drivers/crypto/crypto_kinetis/src/crypto_kinetis_cau.c
index 41014af..e3124da 100644
--- a/hw/drivers/crypto/crypto_k64f/src/crypto_k64f_cau.c
+++ b/hw/drivers/crypto/crypto_kinetis/src/crypto_kinetis_cau.c
@@ -18,7 +18,7 @@
*/
#include <stdint.h>
-#include "crypto_k64f/crypto_k64f.h"
+#include "crypto_kinetis/crypto_kinetis.h"
/*
* CAU interface
diff --git a/hw/drivers/crypto/crypto_k64f/syscfg.yml b/hw/drivers/crypto/crypto_kinetis/syscfg.yml
similarity index 100%
rename from hw/drivers/crypto/crypto_k64f/syscfg.yml
rename to hw/drivers/crypto/crypto_kinetis/syscfg.yml