crypto: Added checks for initializations and buffer overflow.

Added checks for
 -Initializations of alg and mode values in qcedev.
 -Buffer overflow in qcrypto.

CRs-fixed: 313705
Change-Id: I20e285679af4967f989427ea50eb5a287df28cca
Signed-off-by: Ramesh Masavarapu <rameshm@codeaurora.org>
diff --git a/drivers/crypto/msm/qcrypto.c b/drivers/crypto/msm/qcrypto.c
index 73627d4..67301877 100644
--- a/drivers/crypto/msm/qcrypto.c
+++ b/drivers/crypto/msm/qcrypto.c
@@ -889,6 +889,9 @@
 	if (areq->assoclen)
 		qreq->nonce[0] |= 64;
 
+	if (i > MAX_NONCE)
+		return -EINVAL;
+
 	return aead_ccm_set_msg_len(qreq->nonce + 16 - i, qreq->cryptlen, i);
 }