+ EVP_PKEY_CTX_free(ctx);
+ ctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
+ if (ctx == NULL) {
+ ERR_print_errors(bio_err);
+ BIO_printf(bio_err,
+ "Error, DSA key generation context allocation failed\n");
+ goto end;
+ }
+ if (!EVP_PKEY_keygen_init(ctx)) {
+ BIO_printf(bio_err, "unable to initialise for key generation\n");
+ ERR_print_errors(bio_err);
+ goto end;
+ }
+ if (!EVP_PKEY_keygen(ctx, &pkey)) {
+ BIO_printf(bio_err, "unable to generate key\n");
+ ERR_print_errors(bio_err);