comparison libtomcrypt/src/misc/crypt/crypt_unregister_prng.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents f849a5ca2efc
children
comparison
equal deleted inserted replaced
1470:8bba51a55704 1471:6dba84798cd5
3 * LibTomCrypt is a library that provides various cryptographic 3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 *
9 * Tom St Denis, [email protected], http://libtom.org
10 */ 8 */
11 #include "tomcrypt.h" 9 #include "tomcrypt.h"
12 10
13 /** 11 /**
14 @file crypt_unregister_prng.c 12 @file crypt_unregister_prng.c
23 int unregister_prng(const struct ltc_prng_descriptor *prng) 21 int unregister_prng(const struct ltc_prng_descriptor *prng)
24 { 22 {
25 int x; 23 int x;
26 24
27 LTC_ARGCHK(prng != NULL); 25 LTC_ARGCHK(prng != NULL);
28 26
29 /* is it already registered? */ 27 /* is it already registered? */
30 LTC_MUTEX_LOCK(&ltc_prng_mutex); 28 LTC_MUTEX_LOCK(&ltc_prng_mutex);
31 for (x = 0; x < TAB_SIZE; x++) { 29 for (x = 0; x < TAB_SIZE; x++) {
32 if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) != 0) { 30 if (XMEMCMP(&prng_descriptor[x], prng, sizeof(struct ltc_prng_descriptor)) == 0) {
33 prng_descriptor[x].name = NULL; 31 prng_descriptor[x].name = NULL;
34 LTC_MUTEX_UNLOCK(&ltc_prng_mutex); 32 LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
35 return CRYPT_OK; 33 return CRYPT_OK;
36 } 34 }
37 } 35 }
38 LTC_MUTEX_UNLOCK(&ltc_prng_mutex); 36 LTC_MUTEX_UNLOCK(&ltc_prng_mutex);
39 return CRYPT_ERROR; 37 return CRYPT_ERROR;
40 } 38 }
41 39
42 /* $Source$ */ 40 /* ref: $Format:%D$ */
43 /* $Revision$ */ 41 /* git commit: $Format:%H$ */
44 /* $Date$ */ 42 /* commit time: $Format:%ai$ */