2.5.7 gnutls_x509_privkey_generate() returns GNUTLS_E_INVALID_REQUEST

Sam Varshavchik mrsam at courier-mta.com
Wed Sep 17 03:06:35 CEST 2008


The following short test program runs when compiled against 2.4.0. Compiling 
it against 2.5.7 causes it to report a GNUTLS_E_INVALID_REQUEST from the 
second call to gnutls_x509_privkey_generate().



#include <gcrypt.h>
#include <gnutls/gnutls.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

GCRY_THREAD_OPTION_PTHREAD_IMPL;

int main()
{
	int i;

	gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
	gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM);
	gnutls_global_init();

	for (i=0; i<2; i++)
	{
		gnutls_x509_privkey_t privkey;
		int err;

		gnutls_x509_privkey_init(&privkey);

		err=gnutls_x509_privkey_generate(privkey, GNUTLS_PK_RSA, 512,
						 0);

		if (err < 0)
		{
			fprintf(stderr, "Error %d\n", err);
			exit(1);
		}

		gnutls_x509_privkey_deinit(privkey);
	}
	return(0);
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: </pipermail/attachments/20080916/77ff62d3/attachment.pgp>


More information about the Gnutls-devel mailing list