Add error checking of PKCS5_PBKDF2_HMAC_SHA1 function 77/243977/1
authorTomasz Swierczek <t.swierczek@samsung.com>
Fri, 11 Sep 2020 12:39:10 +0000 (14:39 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Fri, 11 Sep 2020 12:39:10 +0000 (14:39 +0200)
Change-Id: I937c1bf7764d2de16ddecf6c540ef3d88ac5c225

srcs/SecCryptoSvc.c

index 95861de..d5452e3 100644 (file)
@@ -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");