* [PATCH 00/12] staging: ks7010: clean michael_mic header and source files
@ 2018-03-22 19:19 Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 01/12] staging: ks7010: use lower case names in michael_mic_t struct fields Sergio Paracuellos
` (11 more replies)
0 siblings, 12 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
The following patch series clean michael_mic source and header files. Changes are
as follows:
* avoid camel cases in some structs and function definitions
* replace macros with inline functions
* use u8 type replacing some uint8_t types and avoid some no more
needed casts.
Sergio Paracuellos (12):
staging: ks7010: use lower case names in michael_mic_t struct fields
staging: ks7010: avoid camel cases in MichaelMICFunction
staging: ks7010: avoid camel cases for MichaelInitFunction
staging: ks7010: avoid camel cases in MichaelAppend function
staging: ks7010: replace macro MichaelClear with inline function
staging: ks7010: avoid camel cases in MichaelGetMIC function
staging: ks7010: replace PutUInt32 macro with an inline function
staging: ks7010: replace GetUInt32 macro with inline function
staging: ks7010: replace MichaelBlockFunction macro with inline
function
staging: ks7010: replace uint8_t in favour of u8 in michael_init
staging: ks7010: replace uint8_t in favour of u8 in michael_append
staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic
drivers/staging/ks7010/ks_hostif.c | 28 +++----
drivers/staging/ks7010/michael_mic.c | 147 +++++++++++++++++------------------
drivers/staging/ks7010/michael_mic.h | 19 +++--
3 files changed, 96 insertions(+), 98 deletions(-)
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/12] staging: ks7010: use lower case names in michael_mic_t struct fields
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 02/12] staging: ks7010: avoid camel cases in MichaelMICFunction Sergio Paracuellos
` (10 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
Replace upper case fields and camel cases for fields included in
michael_mic_t structure
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/ks_hostif.c | 8 +++---
drivers/staging/ks7010/michael_mic.c | 54 ++++++++++++++++++------------------
drivers/staging/ks7010/michael_mic.h | 14 +++++-----
3 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 3ef9126..07795f6 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -349,9 +349,9 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv,
(uint8_t *)priv->rxp,
(int)priv->rx_size,
(uint8_t)0, /* priority */
- (uint8_t *)michael_mic.Result);
+ (uint8_t *)michael_mic.result);
}
- if (memcmp(michael_mic.Result, recv_mic, 8) != 0) {
+ if (memcmp(michael_mic.result, recv_mic, 8) != 0) {
now = jiffies;
mic_failure = &priv->wpa.mic_failure;
/* MIC FAILURE */
@@ -1174,8 +1174,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
(uint8_t *)&pp->data[0],
(int)skb_len,
(uint8_t)0, /* priority */
- (uint8_t *)michael_mic.Result);
- memcpy(p, michael_mic.Result, 8);
+ (uint8_t *)michael_mic.result);
+ memcpy(p, michael_mic.result, 8);
length += 8;
skb_len += 8;
p += 8;
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 1df4366..861721d 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -30,17 +30,17 @@ do { \
// Reset the state to the empty message.
#define MichaelClear(A) \
do { \
- A->L = A->K0; \
- A->R = A->K1; \
- A->nBytesInM = 0; \
+ A->l = A->k0; \
+ A->r = A->k1; \
+ A->m_bytes = 0; \
} while (0)
static
void MichaelInitializeFunction(struct michael_mic_t *Mic, uint8_t *key)
{
// Set the key
- Mic->K0 = getUInt32(key, 0);
- Mic->K1 = getUInt32(key, 4);
+ Mic->k0 = getUInt32(key, 0);
+ Mic->k1 = getUInt32(key, 4);
//clear();
MichaelClear(Mic);
@@ -63,61 +63,61 @@ void MichaelAppend(struct michael_mic_t *Mic, uint8_t *src, int nBytes)
{
int addlen;
- if (Mic->nBytesInM) {
- addlen = 4 - Mic->nBytesInM;
+ if (Mic->m_bytes) {
+ addlen = 4 - Mic->m_bytes;
if (addlen > nBytes)
addlen = nBytes;
- memcpy(&Mic->M[Mic->nBytesInM], src, addlen);
- Mic->nBytesInM += addlen;
+ memcpy(&Mic->m[Mic->m_bytes], src, addlen);
+ Mic->m_bytes += addlen;
src += addlen;
nBytes -= addlen;
- if (Mic->nBytesInM < 4)
+ if (Mic->m_bytes < 4)
return;
- Mic->L ^= getUInt32(Mic->M, 0);
- MichaelBlockFunction(Mic->L, Mic->R);
- Mic->nBytesInM = 0;
+ Mic->l ^= getUInt32(Mic->m, 0);
+ MichaelBlockFunction(Mic->l, Mic->r);
+ Mic->m_bytes = 0;
}
while (nBytes >= 4) {
- Mic->L ^= getUInt32(src, 0);
- MichaelBlockFunction(Mic->L, Mic->R);
+ Mic->l ^= getUInt32(src, 0);
+ MichaelBlockFunction(Mic->l, Mic->r);
src += 4;
nBytes -= 4;
}
if (nBytes > 0) {
- Mic->nBytesInM = nBytes;
- memcpy(Mic->M, src, nBytes);
+ Mic->m_bytes = nBytes;
+ memcpy(Mic->m, src, nBytes);
}
}
static
void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst)
{
- u8 *data = Mic->M;
+ u8 *data = Mic->m;
- switch (Mic->nBytesInM) {
+ switch (Mic->m_bytes) {
case 0:
- Mic->L ^= 0x5a;
+ Mic->l ^= 0x5a;
break;
case 1:
- Mic->L ^= data[0] | 0x5a00;
+ Mic->l ^= data[0] | 0x5a00;
break;
case 2:
- Mic->L ^= data[0] | (data[1] << 8) | 0x5a0000;
+ Mic->l ^= data[0] | (data[1] << 8) | 0x5a0000;
break;
case 3:
- Mic->L ^= data[0] | (data[1] << 8) | (data[2] << 16) |
+ Mic->l ^= data[0] | (data[1] << 8) | (data[2] << 16) |
0x5a000000;
break;
}
- MichaelBlockFunction(Mic->L, Mic->R);
- MichaelBlockFunction(Mic->L, Mic->R);
+ MichaelBlockFunction(Mic->l, Mic->r);
+ MichaelBlockFunction(Mic->l, Mic->r);
// The appendByte function has already computed the result.
- putUInt32(dst, 0, Mic->L);
- putUInt32(dst, 4, Mic->R);
+ putUInt32(dst, 0, Mic->l);
+ putUInt32(dst, 4, Mic->r);
// Reset to the empty message.
MichaelClear(Mic);
diff --git a/drivers/staging/ks7010/michael_mic.h b/drivers/staging/ks7010/michael_mic.h
index 758e429..64db7d1 100644
--- a/drivers/staging/ks7010/michael_mic.h
+++ b/drivers/staging/ks7010/michael_mic.h
@@ -11,13 +11,13 @@
/* MichaelMIC routine define */
struct michael_mic_t {
- u32 K0; // Key
- u32 K1; // Key
- u32 L; // Current state
- u32 R; // Current state
- u8 M[4]; // Message accumulator (single word)
- int nBytesInM; // # bytes in M
- u8 Result[8];
+ u32 k0; // Key
+ u32 k1; // Key
+ u32 l; // Current state
+ u32 r; // Current state
+ u8 m[4]; // Message accumulator (single word)
+ int m_bytes; // # bytes in M
+ u8 result[8];
};
void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key,
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 02/12] staging: ks7010: avoid camel cases in MichaelMICFunction
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 01/12] staging: ks7010: use lower case names in michael_mic_t struct fields Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 03/12] staging: ks7010: avoid camel cases for MichaelInitFunction Sergio Paracuellos
` (9 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replace camel cases for name and params used in
MichaelMICFunction. This improves a bit readability.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/ks_hostif.c | 24 ++++++++++++------------
drivers/staging/ks7010/michael_mic.c | 15 +++++++--------
drivers/staging/ks7010/michael_mic.h | 5 ++---
3 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
index 07795f6..fe20aca 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -344,12 +344,12 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv,
memcpy(&recv_mic[0], (priv->rxp) + ((priv->rx_size) - 8), 8);
priv->rx_size = priv->rx_size - 8;
if (auth_type > 0 && auth_type < 4) { /* auth_type check */
- MichaelMICFunction(&michael_mic,
- (uint8_t *)key->rx_mic_key,
- (uint8_t *)priv->rxp,
- (int)priv->rx_size,
- (uint8_t)0, /* priority */
- (uint8_t *)michael_mic.result);
+ michael_mic_function(&michael_mic,
+ (uint8_t *)key->rx_mic_key,
+ (uint8_t *)priv->rxp,
+ (int)priv->rx_size,
+ (uint8_t)0, /* priority */
+ (uint8_t *)michael_mic.result);
}
if (memcmp(michael_mic.result, recv_mic, 8) != 0) {
now = jiffies;
@@ -1169,12 +1169,12 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); /* no encryption */
} else {
if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) {
- MichaelMICFunction(&michael_mic,
- (uint8_t *)priv->wpa.key[0].tx_mic_key,
- (uint8_t *)&pp->data[0],
- (int)skb_len,
- (uint8_t)0, /* priority */
- (uint8_t *)michael_mic.result);
+ michael_mic_function(&michael_mic,
+ (uint8_t *)priv->wpa.key[0].tx_mic_key,
+ (uint8_t *)&pp->data[0],
+ (int)skb_len,
+ (uint8_t)0, /* priority */
+ (uint8_t *)michael_mic.result);
memcpy(p, michael_mic.result, 8);
length += 8;
skb_len += 8;
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 861721d..f795043 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -123,9 +123,8 @@ void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst)
MichaelClear(Mic);
}
-void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key,
- u8 *Data, int Len, u8 priority,
- u8 *Result)
+void michael_mic_function(struct michael_mic_t *mic, u8 *key,
+ u8 *data, int len, u8 priority, u8 *result)
{
u8 pad_data[4] = { priority, 0, 0, 0 };
// Compute the MIC value
@@ -138,9 +137,9 @@ void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key,
* |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7|
* +--+--+--------+--+----+--+--+--+--+--+--+--+--+
*/
- MichaelInitializeFunction(Mic, Key);
- MichaelAppend(Mic, (uint8_t *)Data, 12); /* |DA|SA| */
- MichaelAppend(Mic, pad_data, 4); /* |Priority|0|0|0| */
- MichaelAppend(Mic, (uint8_t *)(Data + 12), Len - 12); /* |Data| */
- MichaelGetMIC(Mic, Result);
+ MichaelInitializeFunction(mic, key);
+ MichaelAppend(mic, (uint8_t *)data, 12); /* |DA|SA| */
+ MichaelAppend(mic, pad_data, 4); /* |Priority|0|0|0| */
+ MichaelAppend(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
+ MichaelGetMIC(mic, result);
}
diff --git a/drivers/staging/ks7010/michael_mic.h b/drivers/staging/ks7010/michael_mic.h
index 64db7d1..894a8d4 100644
--- a/drivers/staging/ks7010/michael_mic.h
+++ b/drivers/staging/ks7010/michael_mic.h
@@ -20,6 +20,5 @@ struct michael_mic_t {
u8 result[8];
};
-void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key,
- u8 *Data, int Len, u8 priority,
- u8 *Result);
+void michael_mic_function(struct michael_mic_t *mic, u8 *key,
+ u8 *data, int len, u8 priority, u8 *result);
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 03/12] staging: ks7010: avoid camel cases for MichaelInitFunction
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 01/12] staging: ks7010: use lower case names in michael_mic_t struct fields Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 02/12] staging: ks7010: avoid camel cases in MichaelMICFunction Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 04/12] staging: ks7010: avoid camel cases in MichaelAppend function Sergio Paracuellos
` (8 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit avoid camel cases in MichaelInitFunction signature and params
renaming it to michael_init.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index f795043..bc92db1 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -35,15 +35,14 @@ do { \
A->m_bytes = 0; \
} while (0)
-static
-void MichaelInitializeFunction(struct michael_mic_t *Mic, uint8_t *key)
+static void michael_init(struct michael_mic_t *mic, uint8_t *key)
{
// Set the key
- Mic->k0 = getUInt32(key, 0);
- Mic->k1 = getUInt32(key, 4);
+ mic->k0 = getUInt32(key, 0);
+ mic->k1 = getUInt32(key, 4);
//clear();
- MichaelClear(Mic);
+ MichaelClear(mic);
}
#define MichaelBlockFunction(L, R) \
@@ -137,7 +136,7 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key,
* |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7|
* +--+--+--------+--+----+--+--+--+--+--+--+--+--+
*/
- MichaelInitializeFunction(mic, key);
+ michael_init(mic, key);
MichaelAppend(mic, (uint8_t *)data, 12); /* |DA|SA| */
MichaelAppend(mic, pad_data, 4); /* |Priority|0|0|0| */
MichaelAppend(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 04/12] staging: ks7010: avoid camel cases in MichaelAppend function
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (2 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 03/12] staging: ks7010: avoid camel cases for MichaelInitFunction Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 05/12] staging: ks7010: replace macro MichaelClear with inline function Sergio Paracuellos
` (7 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit avoid camel cases in MichaelAppend function and params
renaming it to michael_append.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 45 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index bc92db1..276ecd9 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -57,38 +57,37 @@ do { \
L += R; \
} while (0)
-static
-void MichaelAppend(struct michael_mic_t *Mic, uint8_t *src, int nBytes)
+static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
{
int addlen;
- if (Mic->m_bytes) {
- addlen = 4 - Mic->m_bytes;
- if (addlen > nBytes)
- addlen = nBytes;
- memcpy(&Mic->m[Mic->m_bytes], src, addlen);
- Mic->m_bytes += addlen;
+ if (mic->m_bytes) {
+ addlen = 4 - mic->m_bytes;
+ if (addlen > bytes)
+ addlen = bytes;
+ memcpy(&mic->m[mic->m_bytes], src, addlen);
+ mic->m_bytes += addlen;
src += addlen;
- nBytes -= addlen;
+ bytes -= addlen;
- if (Mic->m_bytes < 4)
+ if (mic->m_bytes < 4)
return;
- Mic->l ^= getUInt32(Mic->m, 0);
- MichaelBlockFunction(Mic->l, Mic->r);
- Mic->m_bytes = 0;
+ mic->l ^= getUInt32(mic->m, 0);
+ MichaelBlockFunction(mic->l, mic->r);
+ mic->m_bytes = 0;
}
- while (nBytes >= 4) {
- Mic->l ^= getUInt32(src, 0);
- MichaelBlockFunction(Mic->l, Mic->r);
+ while (bytes >= 4) {
+ mic->l ^= getUInt32(src, 0);
+ MichaelBlockFunction(mic->l, mic->r);
src += 4;
- nBytes -= 4;
+ bytes -= 4;
}
- if (nBytes > 0) {
- Mic->m_bytes = nBytes;
- memcpy(Mic->m, src, nBytes);
+ if (bytes > 0) {
+ mic->m_bytes = bytes;
+ memcpy(mic->m, src, bytes);
}
}
@@ -137,8 +136,8 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key,
* +--+--+--------+--+----+--+--+--+--+--+--+--+--+
*/
michael_init(mic, key);
- MichaelAppend(mic, (uint8_t *)data, 12); /* |DA|SA| */
- MichaelAppend(mic, pad_data, 4); /* |Priority|0|0|0| */
- MichaelAppend(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
+ michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */
+ michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */
+ michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
MichaelGetMIC(mic, result);
}
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 05/12] staging: ks7010: replace macro MichaelClear with inline function
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (3 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 04/12] staging: ks7010: avoid camel cases in MichaelAppend function Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 06/12] staging: ks7010: avoid camel cases in MichaelGetMIC function Sergio Paracuellos
` (6 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces MichaelClear macro with similar inline function
renaming it to michael_clear.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 276ecd9..af36b12d 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -28,12 +28,12 @@ do { \
} while (0)
// Reset the state to the empty message.
-#define MichaelClear(A) \
-do { \
- A->l = A->k0; \
- A->r = A->k1; \
- A->m_bytes = 0; \
-} while (0)
+static inline void michael_clear(struct michael_mic_t *mic)
+{
+ mic->l = mic->k0;
+ mic->r = mic->k1;
+ mic->m_bytes = 0;
+}
static void michael_init(struct michael_mic_t *mic, uint8_t *key)
{
@@ -42,7 +42,7 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
mic->k1 = getUInt32(key, 4);
//clear();
- MichaelClear(mic);
+ michael_clear(mic);
}
#define MichaelBlockFunction(L, R) \
@@ -118,7 +118,7 @@ void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst)
putUInt32(dst, 4, Mic->r);
// Reset to the empty message.
- MichaelClear(Mic);
+ michael_clear(Mic);
}
void michael_mic_function(struct michael_mic_t *mic, u8 *key,
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 06/12] staging: ks7010: avoid camel cases in MichaelGetMIC function
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (4 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 05/12] staging: ks7010: replace macro MichaelClear with inline function Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 07/12] staging: ks7010: replace PutUInt32 macro with an inline function Sergio Paracuellos
` (5 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit avoid camel cases in MichaelGetMIC function and params
renaming it to michael_get_mic.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index af36b12d..82ac122 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -91,34 +91,33 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
}
}
-static
-void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst)
+static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst)
{
- u8 *data = Mic->m;
+ u8 *data = mic->m;
- switch (Mic->m_bytes) {
+ switch (mic->m_bytes) {
case 0:
- Mic->l ^= 0x5a;
+ mic->l ^= 0x5a;
break;
case 1:
- Mic->l ^= data[0] | 0x5a00;
+ mic->l ^= data[0] | 0x5a00;
break;
case 2:
- Mic->l ^= data[0] | (data[1] << 8) | 0x5a0000;
+ mic->l ^= data[0] | (data[1] << 8) | 0x5a0000;
break;
case 3:
- Mic->l ^= data[0] | (data[1] << 8) | (data[2] << 16) |
+ mic->l ^= data[0] | (data[1] << 8) | (data[2] << 16) |
0x5a000000;
break;
}
- MichaelBlockFunction(Mic->l, Mic->r);
- MichaelBlockFunction(Mic->l, Mic->r);
+ MichaelBlockFunction(mic->l, mic->r);
+ MichaelBlockFunction(mic->l, mic->r);
// The appendByte function has already computed the result.
- putUInt32(dst, 0, Mic->l);
- putUInt32(dst, 4, Mic->r);
+ putUInt32(dst, 0, mic->l);
+ putUInt32(dst, 4, mic->r);
// Reset to the empty message.
- michael_clear(Mic);
+ michael_clear(mic);
}
void michael_mic_function(struct michael_mic_t *mic, u8 *key,
@@ -139,5 +138,5 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key,
michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */
michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */
michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
- MichaelGetMIC(mic, result);
+ michael_get_mic(mic, result);
}
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 07/12] staging: ks7010: replace PutUInt32 macro with an inline function
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (5 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 06/12] staging: ks7010: avoid camel cases in MichaelGetMIC function Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 08/12] staging: ks7010: replace GetUInt32 macro with " Sergio Paracuellos
` (4 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces PutUInt32 macro in favour of inline function
renaming it to put_uint32.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 82ac122..9de31b4 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -19,13 +19,13 @@
+ (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24))
// Convert from UInt32 to Byte[] in a portable way
-#define putUInt32(A, B, C) \
-do { \
- A[B + 0] = (uint8_t)(C & 0xff); \
- A[B + 1] = (uint8_t)((C >> 8) & 0xff); \
- A[B + 2] = (uint8_t)((C >> 16) & 0xff); \
- A[B + 3] = (uint8_t)((C >> 24) & 0xff); \
-} while (0)
+static inline void put_uint32(u8 *dst, u8 pos, u32 orig)
+{
+ dst[pos] = (u8)(orig & 0xff);
+ dst[pos + 1] = (u8)((orig >> 8) & 0xff);
+ dst[pos + 2] = (u8)((orig >> 16) & 0xff);
+ dst[pos + 3] = (u8)((orig >> 24) & 0xff);
+}
// Reset the state to the empty message.
static inline void michael_clear(struct michael_mic_t *mic)
@@ -113,8 +113,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst)
MichaelBlockFunction(mic->l, mic->r);
MichaelBlockFunction(mic->l, mic->r);
// The appendByte function has already computed the result.
- putUInt32(dst, 0, mic->l);
- putUInt32(dst, 4, mic->r);
+ put_uint32(dst, 0, mic->l);
+ put_uint32(dst, 4, mic->r);
// Reset to the empty message.
michael_clear(mic);
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 08/12] staging: ks7010: replace GetUInt32 macro with inline function
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (6 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 07/12] staging: ks7010: replace PutUInt32 macro with an inline function Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction " Sergio Paracuellos
` (3 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces GetUInt32 with inline function renaming
it to get_uint32.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 9de31b4..6829cb5 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -15,8 +15,11 @@
#include "michael_mic.h"
// Convert from Byte[] to UInt32 in a portable way
-#define getUInt32(A, B) ((uint32_t)(A[B + 0] << 0) \
- + (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24))
+static inline u32 get_uint32(const u8 *buf, u8 pos)
+{
+ return (u32)((buf[pos] << 0) + (buf[pos + 1] << 8) +
+ (buf[pos + 2] << 16) + (buf[pos + 3] << 24));
+}
// Convert from UInt32 to Byte[] in a portable way
static inline void put_uint32(u8 *dst, u8 pos, u32 orig)
@@ -38,8 +41,8 @@ static inline void michael_clear(struct michael_mic_t *mic)
static void michael_init(struct michael_mic_t *mic, uint8_t *key)
{
// Set the key
- mic->k0 = getUInt32(key, 0);
- mic->k1 = getUInt32(key, 4);
+ mic->k0 = get_uint32(key, 0);
+ mic->k1 = get_uint32(key, 4);
//clear();
michael_clear(mic);
@@ -73,13 +76,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
if (mic->m_bytes < 4)
return;
- mic->l ^= getUInt32(mic->m, 0);
+ mic->l ^= get_uint32(mic->m, 0);
MichaelBlockFunction(mic->l, mic->r);
mic->m_bytes = 0;
}
while (bytes >= 4) {
- mic->l ^= getUInt32(src, 0);
+ mic->l ^= get_uint32(src, 0);
MichaelBlockFunction(mic->l, mic->r);
src += 4;
bytes -= 4;
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (7 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 08/12] staging: ks7010: replace GetUInt32 macro with " Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-23 9:49 ` Dan Carpenter
2018-03-22 19:19 ` [PATCH 10/12] staging: ks7010: replace uint8_t in favour of u8 in michael_init Sergio Paracuellos
` (2 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces MichaelBlockFunction macro with similar inline function
renaming it to michael_block.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 6829cb5..07913d0 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
michael_clear(mic);
}
-#define MichaelBlockFunction(L, R) \
-do { \
- R ^= rol32(L, 17); \
- L += R; \
- R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); \
- L += R; \
- R ^= rol32(L, 3); \
- L += R; \
- R ^= ror32(L, 2); \
- L += R; \
-} while (0)
+static inline void michael_block(u32 *l, u32 *r)
+{
+ *l ^= rol32(*l, 17);
+ *l += *r;
+ *r ^= ((*l & 0xff00ff00) >> 8) | ((*l & 0x00ff00ff) << 8);
+ *l += *r;
+ *r ^= rol32(*l, 3);
+ *l += *r;
+ *r ^= ror32(*l, 2);
+ *l += *r;
+}
static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
{
@@ -77,13 +77,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
return;
mic->l ^= get_uint32(mic->m, 0);
- MichaelBlockFunction(mic->l, mic->r);
+ michael_block(&mic->l, &mic->r);
mic->m_bytes = 0;
}
while (bytes >= 4) {
mic->l ^= get_uint32(src, 0);
- MichaelBlockFunction(mic->l, mic->r);
+ michael_block(&mic->l, &mic->r);
src += 4;
bytes -= 4;
}
@@ -113,8 +113,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst)
0x5a000000;
break;
}
- MichaelBlockFunction(mic->l, mic->r);
- MichaelBlockFunction(mic->l, mic->r);
+ michael_block(&mic->l, &mic->r);
+ michael_block(&mic->l, &mic->r);
// The appendByte function has already computed the result.
put_uint32(dst, 0, mic->l);
put_uint32(dst, 4, mic->r);
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 10/12] staging: ks7010: replace uint8_t in favour of u8 in michael_init
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (8 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction " Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 12/12] staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic Sergio Paracuellos
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces uint8_t for preferred one u8 in parameter
of michael_init function.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 07913d0..69c1f39 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -38,7 +38,7 @@ static inline void michael_clear(struct michael_mic_t *mic)
mic->m_bytes = 0;
}
-static void michael_init(struct michael_mic_t *mic, uint8_t *key)
+static void michael_init(struct michael_mic_t *mic, u8 *key)
{
// Set the key
mic->k0 = get_uint32(key, 0);
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (9 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 10/12] staging: ks7010: replace uint8_t in favour of u8 in michael_init Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
2018-03-23 10:16 ` Dan Carpenter
2018-03-22 19:19 ` [PATCH 12/12] staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic Sergio Paracuellos
11 siblings, 1 reply; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces param which is uint8_t in michael_append
function in favour of preferred one u8.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 69c1f39..04831eaa 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -60,7 +60,7 @@ static inline void michael_block(u32 *l, u32 *r)
*l += *r;
}
-static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
+static void michael_append(struct michael_mic_t *mic, u8 *src, int bytes)
{
int addlen;
@@ -138,8 +138,8 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key,
* +--+--+--------+--+----+--+--+--+--+--+--+--+--+
*/
michael_init(mic, key);
- michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */
+ michael_append(mic, data, 12); /* |DA|SA| */
michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */
- michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
+ michael_append(mic, (data + 12), len - 12); /* |Data| */
michael_get_mic(mic, result);
}
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 12/12] staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
` (10 preceding siblings ...)
2018-03-22 19:19 ` [PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append Sergio Paracuellos
@ 2018-03-22 19:19 ` Sergio Paracuellos
11 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-22 19:19 UTC (permalink / raw)
To: gregkh; +Cc: driverdev-devel, wsa
This commit replaces uint8_t parameter for preferred one u8 in
michael_get_mic function.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/ks7010/michael_mic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
index 04831eaa..cb95146 100644
--- a/drivers/staging/ks7010/michael_mic.c
+++ b/drivers/staging/ks7010/michael_mic.c
@@ -94,7 +94,7 @@ static void michael_append(struct michael_mic_t *mic, u8 *src, int bytes)
}
}
-static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst)
+static void michael_get_mic(struct michael_mic_t *mic, u8 *dst)
{
u8 *data = mic->m;
--
2.7.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function
2018-03-22 19:19 ` [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction " Sergio Paracuellos
@ 2018-03-23 9:49 ` Dan Carpenter
2018-03-23 10:14 ` Sergio Paracuellos
0 siblings, 1 reply; 18+ messages in thread
From: Dan Carpenter @ 2018-03-23 9:49 UTC (permalink / raw)
To: Sergio Paracuellos; +Cc: gregkh, driverdev-devel, wsa
On Thu, Mar 22, 2018 at 08:19:20PM +0100, Sergio Paracuellos wrote:
> This commit replaces MichaelBlockFunction macro with similar inline function
> renaming it to michael_block.
>
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
> drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
> index 6829cb5..07913d0 100644
> --- a/drivers/staging/ks7010/michael_mic.c
> +++ b/drivers/staging/ks7010/michael_mic.c
> @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
> michael_clear(mic);
> }
>
> -#define MichaelBlockFunction(L, R) \
> -do { \
> - R ^= rol32(L, 17); \
> + *l ^= rol32(*l, 17);
It feels like this should be:
*r ^= rol32(*l, 17);
right?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function
2018-03-23 9:49 ` Dan Carpenter
@ 2018-03-23 10:14 ` Sergio Paracuellos
2018-03-23 10:56 ` Dan Carpenter
0 siblings, 1 reply; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-23 10:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Greg KH, driverdev-devel, wsa
On Fri, Mar 23, 2018 at 10:49 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> On Thu, Mar 22, 2018 at 08:19:20PM +0100, Sergio Paracuellos wrote:
>> This commit replaces MichaelBlockFunction macro with similar inline function
>> renaming it to michael_block.
>>
>> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> ---
>> drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++---------------
>> 1 file changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
>> index 6829cb5..07913d0 100644
>> --- a/drivers/staging/ks7010/michael_mic.c
>> +++ b/drivers/staging/ks7010/michael_mic.c
>> @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
>> michael_clear(mic);
>> }
>>
>> -#define MichaelBlockFunction(L, R) \
>> -do { \
>> - R ^= rol32(L, 17); \
>> + *l ^= rol32(*l, 17);
>
> It feels like this should be:
>
> *r ^= rol32(*l, 17);
>
> right?
True. Thanks for catching this. Should I resend v2 or whole patch
series or only for this patch?
Thanks in advance!
>
> regards,
> dan carpenter
>
Best regards,
Sergio Paracuellos
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append
2018-03-22 19:19 ` [PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append Sergio Paracuellos
@ 2018-03-23 10:16 ` Dan Carpenter
0 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2018-03-23 10:16 UTC (permalink / raw)
To: Sergio Paracuellos; +Cc: gregkh, driverdev-devel, wsa
On Thu, Mar 22, 2018 at 08:19:22PM +0100, Sergio Paracuellos wrote:
> This commit replaces param which is uint8_t in michael_append
> function in favour of preferred one u8.
>
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
> drivers/staging/ks7010/michael_mic.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
> index 69c1f39..04831eaa 100644
> --- a/drivers/staging/ks7010/michael_mic.c
> +++ b/drivers/staging/ks7010/michael_mic.c
> @@ -60,7 +60,7 @@ static inline void michael_block(u32 *l, u32 *r)
> *l += *r;
> }
>
> -static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes)
> +static void michael_append(struct michael_mic_t *mic, u8 *src, int bytes)
> {
> int addlen;
>
> @@ -138,8 +138,8 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key,
> * +--+--+--------+--+----+--+--+--+--+--+--+--+--+
> */
> michael_init(mic, key);
> - michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */
> + michael_append(mic, data, 12); /* |DA|SA| */
> michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */
> - michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */
> + michael_append(mic, (data + 12), len - 12); /* |Data| */
You may as well remove the parentheses as well.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function
2018-03-23 10:14 ` Sergio Paracuellos
@ 2018-03-23 10:56 ` Dan Carpenter
2018-03-23 11:39 ` Sergio Paracuellos
0 siblings, 1 reply; 18+ messages in thread
From: Dan Carpenter @ 2018-03-23 10:56 UTC (permalink / raw)
To: Sergio Paracuellos; +Cc: Greg KH, driverdev-devel, wsa
On Fri, Mar 23, 2018 at 11:14:59AM +0100, Sergio Paracuellos wrote:
> On Fri, Mar 23, 2018 at 10:49 AM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > On Thu, Mar 22, 2018 at 08:19:20PM +0100, Sergio Paracuellos wrote:
> >> This commit replaces MichaelBlockFunction macro with similar inline function
> >> renaming it to michael_block.
> >>
> >> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> >> ---
> >> drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++---------------
> >> 1 file changed, 15 insertions(+), 15 deletions(-)
> >>
> >> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
> >> index 6829cb5..07913d0 100644
> >> --- a/drivers/staging/ks7010/michael_mic.c
> >> +++ b/drivers/staging/ks7010/michael_mic.c
> >> @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
> >> michael_clear(mic);
> >> }
> >>
> >> -#define MichaelBlockFunction(L, R) \
> >> -do { \
> >> - R ^= rol32(L, 17); \
> >> + *l ^= rol32(*l, 17);
> >
> > It feels like this should be:
> >
> > *r ^= rol32(*l, 17);
> >
> > right?
>
> True. Thanks for catching this. Should I resend v2 or whole patch
> series or only for this patch?
>
I don't know? I think Greg prefers if you resend the whole thing.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function
2018-03-23 10:56 ` Dan Carpenter
@ 2018-03-23 11:39 ` Sergio Paracuellos
0 siblings, 0 replies; 18+ messages in thread
From: Sergio Paracuellos @ 2018-03-23 11:39 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Greg KH, driverdev-devel, wsa
On Fri, Mar 23, 2018 at 11:56 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> On Fri, Mar 23, 2018 at 11:14:59AM +0100, Sergio Paracuellos wrote:
>> On Fri, Mar 23, 2018 at 10:49 AM, Dan Carpenter
>> <dan.carpenter@oracle.com> wrote:
>> > On Thu, Mar 22, 2018 at 08:19:20PM +0100, Sergio Paracuellos wrote:
>> >> This commit replaces MichaelBlockFunction macro with similar inline function
>> >> renaming it to michael_block.
>> >>
>> >> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> >> ---
>> >> drivers/staging/ks7010/michael_mic.c | 30 +++++++++++++++---------------
>> >> 1 file changed, 15 insertions(+), 15 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
>> >> index 6829cb5..07913d0 100644
>> >> --- a/drivers/staging/ks7010/michael_mic.c
>> >> +++ b/drivers/staging/ks7010/michael_mic.c
>> >> @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key)
>> >> michael_clear(mic);
>> >> }
>> >>
>> >> -#define MichaelBlockFunction(L, R) \
>> >> -do { \
>> >> - R ^= rol32(L, 17); \
>> >> + *l ^= rol32(*l, 17);
>> >
>> > It feels like this should be:
>> >
>> > *r ^= rol32(*l, 17);
>> >
>> > right?
>>
>> True. Thanks for catching this. Should I resend v2 or whole patch
>> series or only for this patch?
>>
>
> I don't know? I think Greg prefers if you resend the whole thing.
Agreed. I'll fix things you pointed me out and resend v2 of whole series.
Thanks,
>
> regards,
> dan carpenter
>
Best regards,
Sergio Paracuellos
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2018-03-23 11:39 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 19:19 [PATCH 00/12] staging: ks7010: clean michael_mic header and source files Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 01/12] staging: ks7010: use lower case names in michael_mic_t struct fields Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 02/12] staging: ks7010: avoid camel cases in MichaelMICFunction Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 03/12] staging: ks7010: avoid camel cases for MichaelInitFunction Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 04/12] staging: ks7010: avoid camel cases in MichaelAppend function Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 05/12] staging: ks7010: replace macro MichaelClear with inline function Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 06/12] staging: ks7010: avoid camel cases in MichaelGetMIC function Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 07/12] staging: ks7010: replace PutUInt32 macro with an inline function Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 08/12] staging: ks7010: replace GetUInt32 macro with " Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 09/12] staging: ks7010: replace MichaelBlockFunction " Sergio Paracuellos
2018-03-23 9:49 ` Dan Carpenter
2018-03-23 10:14 ` Sergio Paracuellos
2018-03-23 10:56 ` Dan Carpenter
2018-03-23 11:39 ` Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 10/12] staging: ks7010: replace uint8_t in favour of u8 in michael_init Sergio Paracuellos
2018-03-22 19:19 ` [PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append Sergio Paracuellos
2018-03-23 10:16 ` Dan Carpenter
2018-03-22 19:19 ` [PATCH 12/12] staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic Sergio Paracuellos
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.