core: fix right shift in sm3_process()

Replaces right shift operations on 32-bit integers by more than 31 bits
with 0.

This fixes coverity scan:
CID 1501844 (#1 of 1): Bad bit shift operation (BAD_SHIFT)

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/core/crypto/sm3.c b/core/crypto/sm3.c
index b881933..0a66d26 100644
--- a/core/crypto/sm3.c
+++ b/core/crypto/sm3.c
@@ -83,7 +83,8 @@
 #define GG1(x, y, z)	(((x) & (y)) | ((~(x)) & (z)))
 
 #define SHL(x, n)	((x) << (n))
-#define ROTL(x, n)	(SHL((x), (n) & 0x1F) | ((x) >> (32 - ((n) & 0x1F))))
+#define SHR(x, n)	((n) > 31 ? 0 : (x) >> (32 - (n)))
+#define ROTL(x, n)	(SHL((x), (n) & 0x1F) | SHR((x), (n) & 0x1F))
 
 #define P0(x)	((x) ^ ROTL((x), 9) ^ ROTL((x), 17))
 #define P1(x)	((x) ^ ROTL((x), 15) ^ ROTL((x), 23))