Skip to content

Commit

Permalink
ltc: bugfix find_prng()
Browse files Browse the repository at this point in the history
When the prng_descriptor was changed to a pointer to descriptors in
7892cb1
"ltc: make prng_descriptor a pointer to descriptors"
wasn't the find_prng() updated properly.
This causes NULL pointer error if
the PRNG name isn't found before the list is exhausted. This patch
fixes this problem.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: David Brown <david.brown@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jenswi-linaro committed Jul 3, 2016
1 parent 8888520 commit c2f5808
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/lib/libtomcrypt/src/misc/crypt/crypt_find_prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int find_prng(const char *name)
LTC_ARGCHK(name != NULL);
LTC_MUTEX_LOCK(&ltc_prng_mutex);
for (x = 0; x < TAB_SIZE; x++) {
if ((prng_descriptor[x]->name != NULL) && XSTRCMP(prng_descriptor[x]->name, name) == 0) {
if ((prng_descriptor[x] != NULL) && XSTRCMP(prng_descriptor[x]->name, name) == 0) {
LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
return x;
}
Expand Down

0 comments on commit c2f5808

Please sign in to comment.