mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
For interoprability reason. To enforce it, set "#define OPENSSL_NO_STDIO 1" All file access is done by reading/writing from/to BioByteArray() which is filled by QFile:readAll() Drop CRYPTO_malloc_debug / CRYPTO_mem_leaks which is unused and disabled since many years.
40 lines
618 B
C++
40 lines
618 B
C++
/* vi: set sw=4 ts=4:
|
|
*
|
|
* Copyright (C) 2001 Christian Hohnstaedt.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#include "func.h"
|
|
#include "dhgen.h"
|
|
#include "entropy.h"
|
|
#include "xfile.h"
|
|
#include "BioByteArray.h"
|
|
|
|
#include <openssl/rand.h>
|
|
#include <openssl/pem.h>
|
|
#include <openssl/dh.h>
|
|
|
|
void DHgen::run()
|
|
{
|
|
DH *dh = NULL;
|
|
BioByteArray b;
|
|
|
|
try {
|
|
dh = DH_new();
|
|
Q_CHECK_PTR(dh);
|
|
DH_generate_parameters_ex(dh, bits, 2, NULL);
|
|
openssl_error();
|
|
PEM_write_bio_DHparams(b, dh);
|
|
openssl_error();
|
|
} catch (errorEx &e) {
|
|
err = e;
|
|
}
|
|
XFile file(fname);
|
|
file.open_write();
|
|
file.write(b);
|
|
|
|
if (dh)
|
|
DH_free(dh);
|
|
}
|