Skip to contentSkip to conversation

crypto/sha256.c: fix sparse warnings

PATCH In review [email protected] 3 participants 5 messages Mar 19, 2005 – Mar 20, 2005 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 crypto/sha256.c: fix sparse warnings

---

 kj-domen/crypto/sha256.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
crypto/sha256.c renamed from crypto/sha256.c~sparse-crypto_sha256 +1 -1
diff -puN crypto/sha256.c~sparse-crypto_sha256 crypto/sha256.c
@@ -58,7 +58,7 @@ static inline u32 Maj(u32 x, u32 y, u32 
 
 static inline void LOAD_OP(int I, u32 *W, const u8 *input)
 {
-	W[I] = __be32_to_cpu( ((u32*)(input))[I] );
+	W[I] = __be32_to_cpu( ((__be32*)(input))[I] );
 }
 
 static inline void BLEND_OP(int I, u32 *W)

_

maintainer
#1 lore raw

crypto/sha256.c 2005-03-18 20:05:34.000000000 +0100 static inline u32 Maj(u32 x, u32 y, u32 · line 61

Quoted 10 lines · [email protected] wrote:

diff -puN crypto/sha256.c~sparse-crypto_sha256 crypto/sha256.c

crypto/sha256.c 2005-03-18 20:05:34.000000000 +0100 renamed from crypto/sha256.c~sparse-crypto_sha256 2005-03-18 20:05:34.000000000 +0100 +1 -1
@@ -58,7 +58,7 @@ static inline u32 Maj(u32 x, u32 y, u32 
 
 static inline void LOAD_OP(int I, u32 *W, const u8 *input)
 {
-       W[I] = __be32_to_cpu( ((u32*)(input))[I] );
+       W[I] = __be32_to_cpu( ((__be32*)(input))[I] );

I don't get any warnings here (sparse version dated 12/03/2005). What warnings are you getting exactly?

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 10 lines · Herbert Xu

crypto/sha256.c static inline u32 Maj(u32 x, u32 y, u32 · line 61

Quoted 6 lines · [email protected] wrote:

+++ kj-domen/crypto/sha256.c

static inline void LOAD_OP(int I, u32 *W, const u8 *input) {

crypto/sha256.c renamed from crypto/sha256.c~sparse-crypto_sha256 +1 -1
-       W[I] = __be32_to_cpu( ((u32*)(input))[I] );
+       W[I] = __be32_to_cpu( ((__be32*)(input))[I] );

I don't get any warnings here (sparse version dated 12/03/2005). What warnings are you getting exactly?

crypto/sha256.c:61:9: warning: cast to restricted type

Use CHECK="sparse -Wbitwise" to see it.

Alexey

maintainer
#3 lore raw
Quoted 4 lines · Alexey Dobriyan

crypto/sha256.c:61:9: warning: cast to restricted type

Use CHECK="sparse -Wbitwise" to see it.

Thanks. I've applied all four patches to crypto. I changed patch 4/4 slightly so that it reads

+#define u32_in(x) le32_to_cpu(*(const __le32 *)(x))

instead of le32_to_cpup(...) for the sake of minimising the changes.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
In reply to [email protected]

---

 kj-domen/crypto/sha256.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
crypto/sha256.c renamed from crypto/sha256.c~sparse-crypto_sha256 +1 -1
diff -puN crypto/sha256.c~sparse-crypto_sha256 crypto/sha256.c
@@ -58,7 +58,7 @@ static inline u32 Maj(u32 x, u32 y, u32 
 
 static inline void LOAD_OP(int I, u32 *W, const u8 *input)
 {
-	W[I] = __be32_to_cpu( ((u32*)(input))[I] );
+	W[I] = __be32_to_cpu( ((__be32*)(input))[I] );
 }
 
 static inline void BLEND_OP(int I, u32 *W)

_