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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
if not ssl.found()
subdir_done()
endif
ssl_passphrase_callback_sources = files(
'ssl_passphrase_func.c',
)
if host_system == 'windows'
ssl_passphrase_callback_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
'--NAME', 'ssl_passphrase_func',
'--FILEDESC', 'callback function to provide a passphrase',])
endif
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
ssl_passphrase_callback_sources,
kwargs: pg_test_mod_args + {
'dependencies': [ssl, pg_mod_args['dependencies']],
},
)
test_install_libs += ssl_passphrase_callback
# Targets to generate or remove the ssl certificate and key. Need to be copied
# to the source afterwards. Normally not needed.
if openssl.found()
cert = custom_target('server.crt',
output: ['server.crt', 'server.ckey'],
command: [openssl, 'req', '-new', '-x509', '-days', '10000', '-nodes', '-out', '@OUTPUT0@',
'-keyout', '@OUTPUT1@', '-subj', '/CN=localhost'],
build_by_default: false,
install: false,
)
# needs to agree with what's in the test script
pass = 'FooBaR1'
custom_target('server.key',
input: [cert[1]],
output: ['server.key'],
command: [openssl, 'rsa', '-aes256', '-in', '@INPUT0@', '-out', '@OUTPUT0@', '-passout', 'pass:@0@'.format(pass)]
)
endif
tests += {
'name': 'ssl_passphrase_callback',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'tap': {
'tests': [
't/001_testfunc.pl',
],
'env': {'with_ssl': 'openssl'},
},
}
|