summaryrefslogtreecommitdiff
path: root/build-aux/generate-dhparams-c
blob: 1884c99e1f04f72123701765deaa7c8660d7fd77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/sh -e

cat <<'EOF'
/* Generated automatically; do not modify!     -*- buffer-read-only: t -*-
 *
 * If you do need to regenerate this file, run "make generate-dhparams-c". */

#include <config.h>
#include "lib/dhparams.h"
#include "openvswitch/util.h"

static int
my_DH_set0_pqg(DH *dh, BIGNUM *p, const BIGNUM **q OVS_UNUSED, BIGNUM *g)
{
    ovs_assert(q == NULL);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
    dh->p = p;
    dh->g = g;
    return 1;
#else
    return DH_set0_pqg(dh, p, NULL, g);
#endif
}
EOF
(openssl dhparam -C -in lib/dh2048.pem -noout &&
openssl dhparam -C -in lib/dh4096.pem -noout) | sed '
    s/^static DH/DH/
    s/\(get_dh[0-9]*\)()/\1(void)/
    s/\(DH_set0_pqg\)/my_\1/
    s/[ 	]*$//
    s/	/        /g
'