summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-10 14:07:03 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-08-10 14:07:06 +0200
commitf246174d4221e11cdac2e9b73e41a127f71e597d (patch)
treeedaf4d7f54b0a437739b860a8f7ccb340b65e952
parent662a6a4c301f2a1ec8687b9ad5832c7cf6aa50f4 (diff)
downloadgnutls-f246174d4221e11cdac2e9b73e41a127f71e597d.tar.gz
gnutls_key_generate: fail if the state of the library is invalid
Suggested by Stephan Mueller.
-rw-r--r--lib/crypto-api.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/crypto-api.c b/lib/crypto-api.c
index 7d3d5ed8b5..e8fc7b9404 100644
--- a/lib/crypto-api.c
+++ b/lib/crypto-api.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2000-2012 Free Software Foundation, Inc.
+ * Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ * Copyright (C) 2016 Red Hat, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
@@ -592,6 +593,8 @@ int gnutls_key_generate(gnutls_datum_t * key, unsigned int key_size)
{
int ret;
+ FAIL_IF_LIB_ERROR;
+
#ifdef ENABLE_FIPS140
/* The FIPS140 approved RNGs are not allowed to be used
* to extract key sizes longer than their original seed.