summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-04-28 18:14:48 +0200
committerSimon Josefsson <simon@josefsson.org>2008-04-28 18:14:48 +0200
commitd9dc2a9f8771bcbf6ec239cbcd92c144006e6587 (patch)
tree5afa7aac183c25dda4b4286677108b27bcd5dcd8 /lib
parent02393bd4ef0c2ee7864c356f70623f3950f372f0 (diff)
parent0024cce1f30126e690c1a37a09202486910fd1b1 (diff)
downloadgnutls-d9dc2a9f8771bcbf6ec239cbcd92c144006e6587.tar.gz
Merge branch 'master' of ssh://jas@git.sv.gnu.org/srv/git/gnutls
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto.c11
-rw-r--r--lib/random.c3
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/crypto.c b/lib/crypto.c
index 89bed4724b..92b999bca8 100644
--- a/lib/crypto.c
+++ b/lib/crypto.c
@@ -77,7 +77,6 @@ algo_list* last_cl = al;
cl->next = NULL;
last_cl->next = cl;
-
return 0;
}
@@ -88,7 +87,7 @@ cipher_list* cl;
/* look if there is any cipher with lowest priority. In that case do not add.
*/
- cl = al;
+ cl = al->next;
while( cl && cl->alg_data) {
if (cl->algorithm == algo) {
return cl->alg_data;
@@ -140,6 +139,8 @@ void _gnutls_crypto_deregister(void)
* algorithms have priority of 90. The algorithm with the lowest
* priority will be used by gnutls.
*
+ * This function should be called before gnutls_global_init().
+ *
* Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
*
**/
@@ -164,6 +165,8 @@ gnutls_crypto_cipher_st *_gnutls_get_crypto_cipher( gnutls_cipher_algorithm_t al
* generators have priority of 90. The generator with the lowest
* priority will be used by gnutls.
*
+ * This function should be called before gnutls_global_init().
+ *
* Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
*
**/
@@ -189,6 +192,8 @@ gnutls_crypto_rnd_st *_gnutls_get_crypto_rnd()
* algorithms have priority of 90. The algorithm with the lowest
* priority will be used by gnutls.
*
+ * This function should be called before gnutls_global_init().
+ *
* Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
*
**/
@@ -214,6 +219,8 @@ gnutls_crypto_mac_st *_gnutls_get_crypto_mac( gnutls_mac_algorithm_t algo)
* algorithms have priority of 90. The algorithm with the lowest
* priority will be used by gnutls.
*
+ * This function should be called before gnutls_global_init().
+ *
* Returns: %GNUTLS_E_SUCCESS on success, otherwise an error.
*
**/
diff --git a/lib/random.c b/lib/random.c
index 25353cabac..82340c60b7 100644
--- a/lib/random.c
+++ b/lib/random.c
@@ -40,6 +40,7 @@ _gnutls_rnd_init ()
/* check if a digest has been registered
*/
cc = _gnutls_get_crypto_rnd();
+
if (cc != NULL) {
if (cc->init(& rnd_ctx) < 0) {
gnutls_assert();
@@ -69,6 +70,7 @@ _gnutls_rnd (int level, void *data, int len)
int ret = GC_OK;
if (len > 0) {
+
if (cc != NULL) {
return cc->rnd( rnd_ctx, level, data, len);
}
@@ -77,7 +79,6 @@ int ret = GC_OK;
ret = gc_nonce (data, len);
else
ret = gc_pseudo_random( data, len);
-
}
if (ret == GC_OK) return 0;