2016-05-17 19:38:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2002-12-08 05:24:31 +00:00
|
|
|
*
|
2018-12-06 12:36:05 +00:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-17 19:38:09 +00:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2002-12-08 05:24:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* This file contains deprecated functions as wrappers to the new ones */
|
|
|
|
|
2016-01-05 04:00:33 +00:00
|
|
|
#include <openssl/opensslconf.h>
|
2018-11-29 23:05:03 +00:00
|
|
|
#if OPENSSL_API_0_9_8
|
2016-01-31 18:08:23 +00:00
|
|
|
NON_EMPTY_TRANSLATION_UNIT
|
|
|
|
#else
|
2002-12-08 05:24:31 +00:00
|
|
|
|
2016-01-31 18:08:23 +00:00
|
|
|
# include <stdio.h>
|
|
|
|
# include "internal/cryptlib.h"
|
|
|
|
# include <openssl/bn.h>
|
|
|
|
# include <openssl/dh.h>
|
2003-10-29 04:06:50 +00:00
|
|
|
|
2002-12-08 05:24:31 +00:00
|
|
|
DH *DH_generate_parameters(int prime_len, int generator,
|
2015-01-22 03:40:55 +00:00
|
|
|
void (*callback) (int, int, void *), void *cb_arg)
|
|
|
|
{
|
|
|
|
BN_GENCB *cb;
|
|
|
|
DH *ret = NULL;
|
2002-12-08 05:24:31 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
if ((ret = DH_new()) == NULL)
|
|
|
|
return NULL;
|
|
|
|
cb = BN_GENCB_new();
|
2015-10-30 11:12:26 +00:00
|
|
|
if (cb == NULL) {
|
2015-01-22 03:40:55 +00:00
|
|
|
DH_free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
2002-12-08 05:24:31 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
BN_GENCB_set_old(cb, callback, cb_arg);
|
2002-12-08 05:24:31 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
if (DH_generate_parameters_ex(ret, prime_len, generator, cb)) {
|
|
|
|
BN_GENCB_free(cb);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
BN_GENCB_free(cb);
|
|
|
|
DH_free(ret);
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-10-29 04:06:50 +00:00
|
|
|
#endif
|