From 022a7fc40a6f04858498b77aab240388d4047d19 Mon Sep 17 00:00:00 2001 From: Tomasz Swierczek Date: Fri, 11 Sep 2020 14:39:10 +0200 Subject: Add error checking of PKCS5_PBKDF2_HMAC_SHA1 function Change-Id: I937c1bf7764d2de16ddecf6c540ef3d88ac5c225 --- srcs/SecCryptoSvc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/srcs/SecCryptoSvc.c b/srcs/SecCryptoSvc.c index 95861de..d5452e3 100644 --- a/srcs/SecCryptoSvc.c +++ b/srcs/SecCryptoSvc.c @@ -1,7 +1,7 @@ /* * libcryptsvc - device unique key * - * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2000 - 2020 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -233,7 +233,10 @@ char *GetDuid(int idSize) goto exit; } - PKCS5_PBKDF2_HMAC_SHA1(info, 8, pKey, idSize, 1, idSize, pDuid); + if (!PKCS5_PBKDF2_HMAC_SHA1(info, 8, pKey, idSize, 1, idSize, pDuid)) { + SLOGE("Error in PKCS5_PBKDF2_HMAC_SHA1"); + goto exit; + } if (!(pId = Base64Encoding((char *)pDuid, idSize))) { SLOGE("Failed to convert to base64 string"); -- cgit v1.2.3