Skip to contentSkip to conversation

bluetooth:Fix error handling in the function aes_cmac

PATCH RESEND New Nicholas Krause 1 participant 1 message Jan 11, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 bluetooth:Fix error handling in the function aes_cmac

This fixes error handling in the function aes_cmac by properly checking if the call to the function crypto_hast_init failed by returning a error code and if so tell the user with BT_ERR that the crypto hash table initialization failed before returning the error code to signal to the caller of this particular function that their call of aes_cmac has failed.

---
 net/bluetooth/smp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/bluetooth/smp.c +5 -1
index ad82324..2f73bf9 100644
@@ -184,7 +184,11 @@ static int aes_cmac(struct crypto_hash *tfm, const u8 k[16], const u8 *m,
 	desc.tfm = tfm;
 	desc.flags = 0;
 
-	crypto_hash_init(&desc);
+	err = crypto_hash_init(&desc);
+	if (err) {
+		BT_ERR("crypto hash init failed: %d", err);
+		return err;
+	}
 
 	/* Swap key and message from LSB to MSB */
 	swap_buf(k, tmp, 16);
Signature · 1 line
2.1.4