tree-wide: switch dlopen hooks over to DLSYM_PROTOTYPE()/DLSYM_FUNCTION()

We have these pretty macros, let's use them everywhere (so far we mostly
used them for newer additions only).

This PR is mostly an excercise in "perl -p -i -e", but there are some
special cases:

* idn-util.c exposes a function whose prototype in the official library
  headers is marked with the "const" attribute, and this apparently does
  not propagate along typeof() correctly and then
  __builtin_types_compatible_p() fails later because it detects that
  prototype and original function don't match in prototype.

* libbpf removed some symbols in newer versions, hence we need to define
  some prototypes manually to still be able to build.

* libcryptsetup marked a symbol as deprecated we want to use (knowing it
  is deprecated). By using the macros this is detected by the compiler.
  We work around it via the usual warning off macros.

Note by using these macros we assume that all symbols are known during
build time. Which might not be the case. We might need to revert this
commit for some symbols if this trips up builds on older distros.
This commit is contained in:
Lennart Poettering
2024-03-01 10:12:48 +01:00
committed by Luca Boccassi
parent 96069e57a0
commit 9dbabd0a8b
21 changed files with 427 additions and 427 deletions

View File

@@ -9,20 +9,11 @@
#if HAVE_XKBCOMMON
static void *xkbcommon_dl = NULL;
struct xkb_context* (*sym_xkb_context_new)(enum xkb_context_flags flags);
void (*sym_xkb_context_unref)(struct xkb_context *context);
void (*sym_xkb_context_set_log_fn)(
struct xkb_context *context,
void (*log_fn)(
struct xkb_context *context,
enum xkb_log_level level,
const char *format,
va_list args));
struct xkb_keymap* (*sym_xkb_keymap_new_from_names)(
struct xkb_context *context,
const struct xkb_rule_names *names,
enum xkb_keymap_compile_flags flags);
void (*sym_xkb_keymap_unref)(struct xkb_keymap *keymap);
DLSYM_FUNCTION(xkb_context_new);
DLSYM_FUNCTION(xkb_context_unref);
DLSYM_FUNCTION(xkb_context_set_log_fn);
DLSYM_FUNCTION(xkb_keymap_new_from_names);
DLSYM_FUNCTION(xkb_keymap_unref);
static int dlopen_xkbcommon(void) {
return dlopen_many_sym_or_warn(

View File

@@ -1,23 +1,16 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "dlfcn-util.h"
#if HAVE_XKBCOMMON
#include <xkbcommon/xkbcommon.h>
extern struct xkb_context* (*sym_xkb_context_new)(enum xkb_context_flags flags);
extern void (*sym_xkb_context_unref)(struct xkb_context *context);
extern void (*sym_xkb_context_set_log_fn)(
struct xkb_context *context,
void (*log_fn)(
struct xkb_context *context,
enum xkb_log_level level,
const char *format,
va_list args));
extern struct xkb_keymap* (*sym_xkb_keymap_new_from_names)(
struct xkb_context *context,
const struct xkb_rule_names *names,
enum xkb_keymap_compile_flags flags);
extern void (*sym_xkb_keymap_unref)(struct xkb_keymap *keymap);
DLSYM_PROTOTYPE(xkb_context_new);
DLSYM_PROTOTYPE(xkb_context_unref);
DLSYM_PROTOTYPE(xkb_context_set_log_fn);
DLSYM_PROTOTYPE(xkb_keymap_new_from_names);
DLSYM_PROTOTYPE(xkb_keymap_unref);
int verify_xkb_rmlvo(const char *model, const char *layout, const char *variant, const char *options);

View File

@@ -18,26 +18,28 @@
#define MODERN_LIBBPF 0
#endif
struct bpf_link* (*sym_bpf_program__attach_cgroup)(const struct bpf_program *, int);
struct bpf_link* (*sym_bpf_program__attach_lsm)(const struct bpf_program *);
int (*sym_bpf_link__fd)(const struct bpf_link *);
int (*sym_bpf_link__destroy)(struct bpf_link *);
int (*sym_bpf_map__fd)(const struct bpf_map *);
const char* (*sym_bpf_map__name)(const struct bpf_map *);
DLSYM_FUNCTION(bpf_program__attach_cgroup);
DLSYM_FUNCTION(bpf_program__attach_lsm);
DLSYM_FUNCTION(bpf_link__fd);
DLSYM_FUNCTION(bpf_link__destroy);
DLSYM_FUNCTION(bpf_map__fd);
DLSYM_FUNCTION(bpf_map__name);
DLSYM_FUNCTION(bpf_map__set_max_entries);
DLSYM_FUNCTION(bpf_map_update_elem);
DLSYM_FUNCTION(bpf_map_delete_elem);
DLSYM_FUNCTION(bpf_map__set_inner_map_fd);
DLSYM_FUNCTION(bpf_object__open_skeleton);
DLSYM_FUNCTION(bpf_object__load_skeleton);
DLSYM_FUNCTION(bpf_object__attach_skeleton);
DLSYM_FUNCTION(bpf_object__detach_skeleton);
DLSYM_FUNCTION(bpf_object__destroy_skeleton);
DLSYM_FUNCTION(bpf_program__name);
DLSYM_FUNCTION(libbpf_set_print);
DLSYM_FUNCTION(libbpf_get_error);
/* new symbols available from libbpf 0.7.0 */
int (*sym_bpf_map_create)(enum bpf_map_type, const char *, __u32, __u32, __u32, const struct bpf_map_create_opts *);
int (*sym_bpf_map__set_max_entries)(struct bpf_map *, __u32);
int (*sym_bpf_map_update_elem)(int, const void *, const void *, __u64);
int (*sym_bpf_map_delete_elem)(int, const void *);
int (*sym_bpf_map__set_inner_map_fd)(struct bpf_map *, int);
int (*sym_bpf_object__open_skeleton)(struct bpf_object_skeleton *, const struct bpf_object_open_opts *);
int (*sym_bpf_object__load_skeleton)(struct bpf_object_skeleton *);
int (*sym_bpf_object__attach_skeleton)(struct bpf_object_skeleton *);
void (*sym_bpf_object__detach_skeleton)(struct bpf_object_skeleton *);
void (*sym_bpf_object__destroy_skeleton)(struct bpf_object_skeleton *);
int (*sym_libbpf_probe_bpf_prog_type)(enum bpf_prog_type, const void *);
const char* (*sym_bpf_program__name)(const struct bpf_program *);
libbpf_print_fn_t (*sym_libbpf_set_print)(libbpf_print_fn_t);
long (*sym_libbpf_get_error)(const void *);
/* compat symbols removed in libbpf 1.0 */
int (*sym_bpf_create_map)(enum bpf_map_type, int key_size, int value_size, int max_entries, __u32 map_flags);

View File

@@ -7,27 +7,28 @@
#include <bpf/libbpf.h>
#include "bpf-compat.h"
#include "dlfcn-util.h"
extern struct bpf_link* (*sym_bpf_program__attach_cgroup)(const struct bpf_program *, int);
extern struct bpf_link* (*sym_bpf_program__attach_lsm)(const struct bpf_program *);
extern int (*sym_bpf_link__fd)(const struct bpf_link *);
extern int (*sym_bpf_link__destroy)(struct bpf_link *);
extern int (*sym_bpf_map__fd)(const struct bpf_map *);
extern const char* (*sym_bpf_map__name)(const struct bpf_map *);
extern int (*sym_bpf_map__set_max_entries)(struct bpf_map *, __u32);
extern int (*sym_bpf_map_update_elem)(int, const void *, const void *, __u64);
extern int (*sym_bpf_map_delete_elem)(int, const void *);
extern int (*sym_bpf_map__set_inner_map_fd)(struct bpf_map *, int);
DLSYM_PROTOTYPE(bpf_program__attach_cgroup);
DLSYM_PROTOTYPE(bpf_program__attach_lsm);
DLSYM_PROTOTYPE(bpf_link__fd);
DLSYM_PROTOTYPE(bpf_link__destroy);
DLSYM_PROTOTYPE(bpf_map__fd);
DLSYM_PROTOTYPE(bpf_map__name);
DLSYM_PROTOTYPE(bpf_map__set_max_entries);
DLSYM_PROTOTYPE(bpf_map_update_elem);
DLSYM_PROTOTYPE(bpf_map_delete_elem);
DLSYM_PROTOTYPE(bpf_map__set_inner_map_fd);
/* The *_skeleton APIs are autogenerated by bpftool, the targets can be found
* in ./build/src/core/bpf/socket_bind/socket-bind.skel.h */
extern int (*sym_bpf_object__open_skeleton)(struct bpf_object_skeleton *, const struct bpf_object_open_opts *);
extern int (*sym_bpf_object__load_skeleton)(struct bpf_object_skeleton *);
extern int (*sym_bpf_object__attach_skeleton)(struct bpf_object_skeleton *);
extern void (*sym_bpf_object__detach_skeleton)(struct bpf_object_skeleton *);
extern void (*sym_bpf_object__destroy_skeleton)(struct bpf_object_skeleton *);
extern const char* (*sym_bpf_program__name)(const struct bpf_program *);
extern libbpf_print_fn_t (*sym_libbpf_set_print)(libbpf_print_fn_t);
extern long (*sym_libbpf_get_error)(const void *);
DLSYM_PROTOTYPE(bpf_object__open_skeleton);
DLSYM_PROTOTYPE(bpf_object__load_skeleton);
DLSYM_PROTOTYPE(bpf_object__attach_skeleton);
DLSYM_PROTOTYPE(bpf_object__detach_skeleton);
DLSYM_PROTOTYPE(bpf_object__destroy_skeleton);
DLSYM_PROTOTYPE(bpf_program__name);
DLSYM_PROTOTYPE(libbpf_set_print);
DLSYM_PROTOTYPE(libbpf_get_error);
#endif

View File

@@ -9,58 +9,60 @@
#if HAVE_LIBCRYPTSETUP
static void *cryptsetup_dl = NULL;
int (*sym_crypt_activate_by_passphrase)(struct crypt_device *cd, const char *name, int keyslot, const char *passphrase, size_t passphrase_size, uint32_t flags);
DLSYM_FUNCTION(crypt_activate_by_passphrase);
#if HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY
int (*sym_crypt_activate_by_signed_key)(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size, const char *signature, size_t signature_size, uint32_t flags);
DLSYM_FUNCTION(crypt_activate_by_signed_key);
#endif
int (*sym_crypt_activate_by_volume_key)(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size, uint32_t flags);
int (*sym_crypt_deactivate_by_name)(struct crypt_device *cd, const char *name, uint32_t flags);
int (*sym_crypt_format)(struct crypt_device *cd, const char *type, const char *cipher, const char *cipher_mode, const char *uuid, const char *volume_key, size_t volume_key_size, void *params);
void (*sym_crypt_free)(struct crypt_device *cd);
const char *(*sym_crypt_get_cipher)(struct crypt_device *cd);
const char *(*sym_crypt_get_cipher_mode)(struct crypt_device *cd);
uint64_t (*sym_crypt_get_data_offset)(struct crypt_device *cd);
const char *(*sym_crypt_get_device_name)(struct crypt_device *cd);
const char *(*sym_crypt_get_dir)(void);
const char *(*sym_crypt_get_type)(struct crypt_device *cd);
const char *(*sym_crypt_get_uuid)(struct crypt_device *cd);
int (*sym_crypt_get_verity_info)(struct crypt_device *cd, struct crypt_params_verity *vp);
int (*sym_crypt_get_volume_key_size)(struct crypt_device *cd);
int (*sym_crypt_init)(struct crypt_device **cd, const char *device);
int (*sym_crypt_init_by_name)(struct crypt_device **cd, const char *name);
int (*sym_crypt_keyslot_add_by_volume_key)(struct crypt_device *cd, int keyslot, const char *volume_key, size_t volume_key_size, const char *passphrase, size_t passphrase_size);
int (*sym_crypt_keyslot_destroy)(struct crypt_device *cd, int keyslot);
int (*sym_crypt_keyslot_max)(const char *type);
int (*sym_crypt_load)(struct crypt_device *cd, const char *requested_type, void *params);
int (*sym_crypt_resize)(struct crypt_device *cd, const char *name, uint64_t new_size);
int (*sym_crypt_resume_by_passphrase)(struct crypt_device *cd, const char *name, int keyslot, const char *passphrase, size_t passphrase_size);
int (*sym_crypt_set_data_device)(struct crypt_device *cd, const char *device);
void (*sym_crypt_set_debug_level)(int level);
void (*sym_crypt_set_log_callback)(struct crypt_device *cd, void (*log)(int level, const char *msg, void *usrptr), void *usrptr);
DLSYM_FUNCTION(crypt_activate_by_volume_key);
DLSYM_FUNCTION(crypt_deactivate_by_name);
DLSYM_FUNCTION(crypt_format);
DLSYM_FUNCTION(crypt_free);
DLSYM_FUNCTION(crypt_get_cipher);
DLSYM_FUNCTION(crypt_get_cipher_mode);
DLSYM_FUNCTION(crypt_get_data_offset);
DLSYM_FUNCTION(crypt_get_device_name);
DLSYM_FUNCTION(crypt_get_dir);
DLSYM_FUNCTION(crypt_get_type);
DLSYM_FUNCTION(crypt_get_uuid);
DLSYM_FUNCTION(crypt_get_verity_info);
DLSYM_FUNCTION(crypt_get_volume_key_size);
DLSYM_FUNCTION(crypt_init);
DLSYM_FUNCTION(crypt_init_by_name);
DLSYM_FUNCTION(crypt_keyslot_add_by_volume_key);
DLSYM_FUNCTION(crypt_keyslot_destroy);
DLSYM_FUNCTION(crypt_keyslot_max);
DLSYM_FUNCTION(crypt_load);
DLSYM_FUNCTION(crypt_resize);
DLSYM_FUNCTION(crypt_resume_by_passphrase);
DLSYM_FUNCTION(crypt_set_data_device);
DLSYM_FUNCTION(crypt_set_debug_level);
DLSYM_FUNCTION(crypt_set_log_callback);
#if HAVE_CRYPT_SET_METADATA_SIZE
int (*sym_crypt_set_metadata_size)(struct crypt_device *cd, uint64_t metadata_size, uint64_t keyslots_size);
DLSYM_FUNCTION(crypt_set_metadata_size);
#endif
int (*sym_crypt_set_pbkdf_type)(struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf);
int (*sym_crypt_suspend)(struct crypt_device *cd, const char *name);
int (*sym_crypt_token_json_get)(struct crypt_device *cd, int token, const char **json);
int (*sym_crypt_token_json_set)(struct crypt_device *cd, int token, const char *json);
DLSYM_FUNCTION(crypt_set_pbkdf_type);
DLSYM_FUNCTION(crypt_suspend);
DLSYM_FUNCTION(crypt_token_json_get);
DLSYM_FUNCTION(crypt_token_json_set);
#if HAVE_CRYPT_TOKEN_MAX
int (*sym_crypt_token_max)(const char *type);
DLSYM_FUNCTION(crypt_token_max);
#endif
crypt_token_info (*sym_crypt_token_status)(struct crypt_device *cd, int token, const char **type);
int (*sym_crypt_volume_key_get)(struct crypt_device *cd, int keyslot, char *volume_key, size_t *volume_key_size, const char *passphrase, size_t passphrase_size);
DLSYM_FUNCTION(crypt_token_status);
DLSYM_FUNCTION(crypt_volume_key_get);
#if HAVE_CRYPT_REENCRYPT_INIT_BY_PASSPHRASE
int (*sym_crypt_reencrypt_init_by_passphrase)(struct crypt_device *cd, const char *name, const char *passphrase, size_t passphrase_size, int keyslot_old, int keyslot_new, const char *cipher, const char *cipher_mode, const struct crypt_params_reencrypt *params);
DLSYM_FUNCTION(crypt_reencrypt_init_by_passphrase);
#endif
#if HAVE_CRYPT_REENCRYPT
int (*sym_crypt_reencrypt)(struct crypt_device *cd, int (*progress)(uint64_t size, uint64_t offset, void *usrptr));
DISABLE_WARNING_DEPRECATED_DECLARATIONS;
DLSYM_FUNCTION(crypt_reencrypt);
REENABLE_WARNING;
#endif
int (*sym_crypt_metadata_locking)(struct crypt_device *cd, int enable);
DLSYM_FUNCTION(crypt_metadata_locking);
#if HAVE_CRYPT_SET_DATA_OFFSET
int (*sym_crypt_set_data_offset)(struct crypt_device *cd, uint64_t data_offset);
DLSYM_FUNCTION(crypt_set_data_offset);
#endif
int (*sym_crypt_header_restore)(struct crypt_device *cd, const char *requested_type, const char *backup_file);
int (*sym_crypt_volume_key_keyring)(struct crypt_device *cd, int enable);
DLSYM_FUNCTION(crypt_header_restore);
DLSYM_FUNCTION(crypt_volume_key_keyring);
/* Unfortunately libcryptsetup provides neither an environment variable to redirect where to look for token
* modules, nor does it have an API to change the token lookup path at runtime. The maintainers suggest using

View File

@@ -2,6 +2,7 @@
#pragma once
#include "alloc-util.h"
#include "dlfcn-util.h"
#include "json.h"
#include "macro.h"
@@ -16,43 +17,43 @@
#define CRYPT_ACTIVATE_NO_WRITE_WORKQUEUE (1 << 25)
#endif
extern int (*sym_crypt_activate_by_passphrase)(struct crypt_device *cd, const char *name, int keyslot, const char *passphrase, size_t passphrase_size, uint32_t flags);
DLSYM_PROTOTYPE(crypt_activate_by_passphrase);
#if HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY
extern int (*sym_crypt_activate_by_signed_key)(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size, const char *signature, size_t signature_size, uint32_t flags);
DLSYM_PROTOTYPE(crypt_activate_by_signed_key);
#endif
extern int (*sym_crypt_activate_by_volume_key)(struct crypt_device *cd, const char *name, const char *volume_key, size_t volume_key_size, uint32_t flags);
extern int (*sym_crypt_deactivate_by_name)(struct crypt_device *cd, const char *name, uint32_t flags);
extern int (*sym_crypt_format)(struct crypt_device *cd, const char *type, const char *cipher, const char *cipher_mode, const char *uuid, const char *volume_key, size_t volume_key_size, void *params);
extern void (*sym_crypt_free)(struct crypt_device *cd);
extern const char *(*sym_crypt_get_cipher)(struct crypt_device *cd);
extern const char *(*sym_crypt_get_cipher_mode)(struct crypt_device *cd);
extern uint64_t (*sym_crypt_get_data_offset)(struct crypt_device *cd);
extern const char *(*sym_crypt_get_device_name)(struct crypt_device *cd);
extern const char *(*sym_crypt_get_dir)(void);
extern const char *(*sym_crypt_get_type)(struct crypt_device *cd);
extern const char *(*sym_crypt_get_uuid)(struct crypt_device *cd);
extern int (*sym_crypt_get_verity_info)(struct crypt_device *cd, struct crypt_params_verity *vp);
extern int (*sym_crypt_get_volume_key_size)(struct crypt_device *cd);
extern int (*sym_crypt_init)(struct crypt_device **cd, const char *device);
extern int (*sym_crypt_init_by_name)(struct crypt_device **cd, const char *name);
extern int (*sym_crypt_keyslot_add_by_volume_key)(struct crypt_device *cd, int keyslot, const char *volume_key, size_t volume_key_size, const char *passphrase, size_t passphrase_size);
extern int (*sym_crypt_keyslot_destroy)(struct crypt_device *cd, int keyslot);
extern int (*sym_crypt_keyslot_max)(const char *type);
extern int (*sym_crypt_load)(struct crypt_device *cd, const char *requested_type, void *params);
extern int (*sym_crypt_resize)(struct crypt_device *cd, const char *name, uint64_t new_size);
extern int (*sym_crypt_resume_by_passphrase)(struct crypt_device *cd, const char *name, int keyslot, const char *passphrase, size_t passphrase_size);
extern int (*sym_crypt_set_data_device)(struct crypt_device *cd, const char *device);
extern void (*sym_crypt_set_debug_level)(int level);
extern void (*sym_crypt_set_log_callback)(struct crypt_device *cd, void (*log)(int level, const char *msg, void *usrptr), void *usrptr);
DLSYM_PROTOTYPE(crypt_activate_by_volume_key);
DLSYM_PROTOTYPE(crypt_deactivate_by_name);
DLSYM_PROTOTYPE(crypt_format);
DLSYM_PROTOTYPE(crypt_free);
DLSYM_PROTOTYPE(crypt_get_cipher);
DLSYM_PROTOTYPE(crypt_get_cipher_mode);
DLSYM_PROTOTYPE(crypt_get_data_offset);
DLSYM_PROTOTYPE(crypt_get_device_name);
DLSYM_PROTOTYPE(crypt_get_dir);
DLSYM_PROTOTYPE(crypt_get_type);
DLSYM_PROTOTYPE(crypt_get_uuid);
DLSYM_PROTOTYPE(crypt_get_verity_info);
DLSYM_PROTOTYPE(crypt_get_volume_key_size);
DLSYM_PROTOTYPE(crypt_init);
DLSYM_PROTOTYPE(crypt_init_by_name);
DLSYM_PROTOTYPE(crypt_keyslot_add_by_volume_key);
DLSYM_PROTOTYPE(crypt_keyslot_destroy);
DLSYM_PROTOTYPE(crypt_keyslot_max);
DLSYM_PROTOTYPE(crypt_load);
DLSYM_PROTOTYPE(crypt_resize);
DLSYM_PROTOTYPE(crypt_resume_by_passphrase);
DLSYM_PROTOTYPE(crypt_set_data_device);
DLSYM_PROTOTYPE(crypt_set_debug_level);
DLSYM_PROTOTYPE(crypt_set_log_callback);
#if HAVE_CRYPT_SET_METADATA_SIZE
extern int (*sym_crypt_set_metadata_size)(struct crypt_device *cd, uint64_t metadata_size, uint64_t keyslots_size);
DLSYM_PROTOTYPE(crypt_set_metadata_size);
#endif
extern int (*sym_crypt_set_pbkdf_type)(struct crypt_device *cd, const struct crypt_pbkdf_type *pbkdf);
extern int (*sym_crypt_suspend)(struct crypt_device *cd, const char *name);
extern int (*sym_crypt_token_json_get)(struct crypt_device *cd, int token, const char **json);
extern int (*sym_crypt_token_json_set)(struct crypt_device *cd, int token, const char *json);
DLSYM_PROTOTYPE(crypt_set_pbkdf_type);
DLSYM_PROTOTYPE(crypt_suspend);
DLSYM_PROTOTYPE(crypt_token_json_get);
DLSYM_PROTOTYPE(crypt_token_json_set);
#if HAVE_CRYPT_TOKEN_MAX
extern int (*sym_crypt_token_max)(const char *type);
DLSYM_PROTOTYPE(crypt_token_max);
#else
/* As a fallback, use the same hard-coded value libcryptsetup uses internally. */
static inline int crypt_token_max(_unused_ const char *type) {
@@ -62,20 +63,22 @@ static inline int crypt_token_max(_unused_ const char *type) {
}
#define sym_crypt_token_max(type) crypt_token_max(type)
#endif
extern crypt_token_info (*sym_crypt_token_status)(struct crypt_device *cd, int token, const char **type);
extern int (*sym_crypt_volume_key_get)(struct crypt_device *cd, int keyslot, char *volume_key, size_t *volume_key_size, const char *passphrase, size_t passphrase_size);
DLSYM_PROTOTYPE(crypt_token_status);
DLSYM_PROTOTYPE(crypt_volume_key_get);
#if HAVE_CRYPT_REENCRYPT_INIT_BY_PASSPHRASE
extern int (*sym_crypt_reencrypt_init_by_passphrase)(struct crypt_device *cd, const char *name, const char *passphrase, size_t passphrase_size, int keyslot_old, int keyslot_new, const char *cipher, const char *cipher_mode, const struct crypt_params_reencrypt *params);
DLSYM_PROTOTYPE(crypt_reencrypt_init_by_passphrase);
#endif
#if HAVE_CRYPT_REENCRYPT
extern int (*sym_crypt_reencrypt)(struct crypt_device *cd, int (*progress)(uint64_t size, uint64_t offset, void *usrptr));
DISABLE_WARNING_DEPRECATED_DECLARATIONS;
DLSYM_PROTOTYPE(crypt_reencrypt);
REENABLE_WARNING;
#endif
extern int (*sym_crypt_metadata_locking)(struct crypt_device *cd, int enable);
DLSYM_PROTOTYPE(crypt_metadata_locking);
#if HAVE_CRYPT_SET_DATA_OFFSET
extern int (*sym_crypt_set_data_offset)(struct crypt_device *cd, uint64_t data_offset);
DLSYM_PROTOTYPE(crypt_set_data_offset);
#endif
extern int (*sym_crypt_header_restore)(struct crypt_device *cd, const char *requested_type, const char *backup_file);
extern int (*sym_crypt_volume_key_keyring)(struct crypt_device *cd, int enable);
DLSYM_PROTOTYPE(crypt_header_restore);
DLSYM_PROTOTYPE(crypt_volume_key_keyring);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct crypt_device *, crypt_free, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(struct crypt_device *, sym_crypt_free, NULL);

View File

@@ -38,51 +38,51 @@ static void *dw_dl = NULL;
static void *elf_dl = NULL;
/* libdw symbols */
Dwarf_Attribute *(*sym_dwarf_attr_integrate)(Dwarf_Die *, unsigned int, Dwarf_Attribute *);
const char *(*sym_dwarf_diename)(Dwarf_Die *);
const char *(*sym_dwarf_formstring)(Dwarf_Attribute *);
int (*sym_dwarf_getscopes)(Dwarf_Die *, Dwarf_Addr, Dwarf_Die **);
int (*sym_dwarf_getscopes_die)(Dwarf_Die *, Dwarf_Die **);
Elf *(*sym_dwelf_elf_begin)(int);
static DLSYM_FUNCTION(dwarf_attr_integrate);
static DLSYM_FUNCTION(dwarf_diename);
static DLSYM_FUNCTION(dwarf_formstring);
static DLSYM_FUNCTION(dwarf_getscopes);
static DLSYM_FUNCTION(dwarf_getscopes_die);
static DLSYM_FUNCTION(dwelf_elf_begin);
#if HAVE_DWELF_ELF_E_MACHINE_STRING
const char *(*sym_dwelf_elf_e_machine_string)(int);
static DLSYM_FUNCTION(dwelf_elf_e_machine_string);
#endif
ssize_t (*sym_dwelf_elf_gnu_build_id)(Elf *, const void **);
int (*sym_dwarf_tag)(Dwarf_Die *);
Dwfl_Module *(*sym_dwfl_addrmodule)(Dwfl *, Dwarf_Addr);
Dwfl *(*sym_dwfl_begin)(const Dwfl_Callbacks *);
int (*sym_dwfl_build_id_find_elf)(Dwfl_Module *, void **, const char *, Dwarf_Addr, char **, Elf **);
int (*sym_dwfl_core_file_attach)(Dwfl *, Elf *);
int (*sym_dwfl_core_file_report)(Dwfl *, Elf *, const char *);
void (*sym_dwfl_end)(Dwfl *);
const char *(*sym_dwfl_errmsg)(int);
int (*sym_dwfl_errno)(void);
bool (*sym_dwfl_frame_pc)(Dwfl_Frame *, Dwarf_Addr *, bool *);
ptrdiff_t (*sym_dwfl_getmodules)(Dwfl *, int (*)(Dwfl_Module *, void **, const char *, Dwarf_Addr, void *), void *, ptrdiff_t);
int (*sym_dwfl_getthreads)(Dwfl *, int (*)(Dwfl_Thread *, void *), void *);
Dwarf_Die *(*sym_dwfl_module_addrdie)(Dwfl_Module *, Dwarf_Addr, Dwarf_Addr *);
const char *(*sym_dwfl_module_addrname)(Dwfl_Module *, GElf_Addr);
int (*sym_dwfl_module_build_id)(Dwfl_Module *, const unsigned char **, GElf_Addr *);
Elf *(*sym_dwfl_module_getelf)(Dwfl_Module *, GElf_Addr *);
const char *(*sym_dwfl_module_info)(Dwfl_Module *, void ***, Dwarf_Addr *, Dwarf_Addr *, Dwarf_Addr *, Dwarf_Addr *, const char **, const char **);
int (*sym_dwfl_offline_section_address)(Dwfl_Module *, void **, const char *, Dwarf_Addr, const char *, GElf_Word, const GElf_Shdr *, Dwarf_Addr *);
int (*sym_dwfl_report_end)(Dwfl *, int (*)(Dwfl_Module *, void *, const char *, Dwarf_Addr, void *), void *);
int (*sym_dwfl_standard_find_debuginfo)(Dwfl_Module *, void **, const char *, Dwarf_Addr, const char *, const char *, GElf_Word, char **);
int (*sym_dwfl_thread_getframes)(Dwfl_Thread *, int (*)(Dwfl_Frame *, void *), void *);
pid_t (*sym_dwfl_thread_tid)(Dwfl_Thread *);
static DLSYM_FUNCTION(dwelf_elf_gnu_build_id);
static DLSYM_FUNCTION(dwarf_tag);
static DLSYM_FUNCTION(dwfl_addrmodule);
static DLSYM_FUNCTION(dwfl_begin);
static DLSYM_FUNCTION(dwfl_build_id_find_elf);
static DLSYM_FUNCTION(dwfl_core_file_attach);
static DLSYM_FUNCTION(dwfl_core_file_report);
static DLSYM_FUNCTION(dwfl_end);
static DLSYM_FUNCTION(dwfl_errmsg);
static DLSYM_FUNCTION(dwfl_errno);
static DLSYM_FUNCTION(dwfl_frame_pc);
static DLSYM_FUNCTION(dwfl_getmodules);
static DLSYM_FUNCTION(dwfl_getthreads);
static DLSYM_FUNCTION(dwfl_module_addrdie);
static DLSYM_FUNCTION(dwfl_module_addrname);
static DLSYM_FUNCTION(dwfl_module_build_id);
static DLSYM_FUNCTION(dwfl_module_getelf);
static DLSYM_FUNCTION(dwfl_module_info);
static DLSYM_FUNCTION(dwfl_offline_section_address);
static DLSYM_FUNCTION(dwfl_report_end);
static DLSYM_FUNCTION(dwfl_standard_find_debuginfo);
static DLSYM_FUNCTION(dwfl_thread_getframes);
static DLSYM_FUNCTION(dwfl_thread_tid);
/* libelf symbols */
Elf *(*sym_elf_begin)(int, Elf_Cmd, Elf *);
int (*sym_elf_end)(Elf *);
Elf_Data *(*sym_elf_getdata_rawchunk)(Elf *, int64_t, size_t, Elf_Type);
GElf_Ehdr *(*sym_gelf_getehdr)(Elf *, GElf_Ehdr *);
int (*sym_elf_getphdrnum)(Elf *, size_t *);
const char *(*sym_elf_errmsg)(int);
int (*sym_elf_errno)(void);
Elf *(*sym_elf_memory)(char *, size_t);
unsigned int (*sym_elf_version)(unsigned int);
GElf_Phdr *(*sym_gelf_getphdr)(Elf *, int, GElf_Phdr *);
size_t (*sym_gelf_getnote)(Elf_Data *, size_t, GElf_Nhdr *, size_t *, size_t *);
static DLSYM_FUNCTION(elf_begin);
static DLSYM_FUNCTION(elf_end);
static DLSYM_FUNCTION(elf_getdata_rawchunk);
static DLSYM_FUNCTION(gelf_getehdr);
static DLSYM_FUNCTION(elf_getphdrnum);
static DLSYM_FUNCTION(elf_errmsg);
static DLSYM_FUNCTION(elf_errno);
static DLSYM_FUNCTION(elf_memory);
static DLSYM_FUNCTION(elf_version);
static DLSYM_FUNCTION(gelf_getphdr);
static DLSYM_FUNCTION(gelf_getnote);
int dlopen_dw(void) {
int r;

View File

@@ -16,9 +16,9 @@ static void* idn_dl = NULL;
#endif
#if HAVE_LIBIDN2
int (*sym_idn2_lookup_u8)(const uint8_t* src, uint8_t** lookupname, int flags) = NULL;
DLSYM_FUNCTION(idn2_lookup_u8);
const char *(*sym_idn2_strerror)(int rc) _const_ = NULL;
int (*sym_idn2_to_unicode_8z8z)(const char * input, char ** output, int flags) = NULL;
DLSYM_FUNCTION(idn2_to_unicode_8z8z);
int dlopen_idn(void) {
return dlopen_many_sym_or_warn(
@@ -30,10 +30,10 @@ int dlopen_idn(void) {
#endif
#if HAVE_LIBIDN
int (*sym_idna_to_ascii_4i)(const uint32_t * in, size_t inlen, char *out, int flags);
int (*sym_idna_to_unicode_44i)(const uint32_t * in, size_t inlen, uint32_t * out, size_t * outlen, int flags);
char* (*sym_stringprep_ucs4_to_utf8)(const uint32_t * str, ssize_t len, size_t * items_read, size_t * items_written);
uint32_t* (*sym_stringprep_utf8_to_ucs4)(const char *str, ssize_t len, size_t *items_written);
DLSYM_FUNCTION(idna_to_ascii_4i);
DLSYM_FUNCTION(idna_to_unicode_44i);
DLSYM_FUNCTION(stringprep_ucs4_to_utf8);
DLSYM_FUNCTION(stringprep_utf8_to_ucs4);
int dlopen_idn(void) {
_cleanup_(dlclosep) void *dl = NULL;

View File

@@ -11,6 +11,8 @@
#include <inttypes.h>
#if HAVE_LIBIDN2 || HAVE_LIBIDN
#include "dlfcn-util.h"
int dlopen_idn(void);
#else
static inline int dlopen_idn(void) {
@@ -19,14 +21,14 @@ static inline int dlopen_idn(void) {
#endif
#if HAVE_LIBIDN2
extern int (*sym_idn2_lookup_u8)(const uint8_t* src, uint8_t** lookupname, int flags);
DLSYM_PROTOTYPE(idn2_lookup_u8);
extern const char *(*sym_idn2_strerror)(int rc) _const_;
extern int (*sym_idn2_to_unicode_8z8z)(const char * input, char ** output, int flags);
DLSYM_PROTOTYPE(idn2_to_unicode_8z8z);
#endif
#if HAVE_LIBIDN
extern int (*sym_idna_to_ascii_4i)(const uint32_t * in, size_t inlen, char *out, int flags);
extern int (*sym_idna_to_unicode_44i)(const uint32_t * in, size_t inlen,uint32_t * out, size_t * outlen, int flags);
extern char* (*sym_stringprep_ucs4_to_utf8)(const uint32_t * str, ssize_t len, size_t * items_read, size_t * items_written);
extern uint32_t* (*sym_stringprep_utf8_to_ucs4)(const char *str, ssize_t len, size_t *items_written);
DLSYM_PROTOTYPE(idna_to_ascii_4i);
DLSYM_PROTOTYPE(idna_to_unicode_44i);
DLSYM_PROTOTYPE(stringprep_ucs4_to_utf8);
DLSYM_PROTOTYPE(stringprep_utf8_to_ucs4);
#endif

View File

@@ -16,53 +16,53 @@
static void *libfido2_dl = NULL;
int (*sym_fido_assert_allow_cred)(fido_assert_t *, const unsigned char *, size_t) = NULL;
void (*sym_fido_assert_free)(fido_assert_t **) = NULL;
size_t (*sym_fido_assert_hmac_secret_len)(const fido_assert_t *, size_t) = NULL;
const unsigned char* (*sym_fido_assert_hmac_secret_ptr)(const fido_assert_t *, size_t) = NULL;
fido_assert_t* (*sym_fido_assert_new)(void) = NULL;
int (*sym_fido_assert_set_clientdata_hash)(fido_assert_t *, const unsigned char *, size_t) = NULL;
int (*sym_fido_assert_set_extensions)(fido_assert_t *, int) = NULL;
int (*sym_fido_assert_set_hmac_salt)(fido_assert_t *, const unsigned char *, size_t) = NULL;
int (*sym_fido_assert_set_rp)(fido_assert_t *, const char *) = NULL;
int (*sym_fido_assert_set_up)(fido_assert_t *, fido_opt_t) = NULL;
int (*sym_fido_assert_set_uv)(fido_assert_t *, fido_opt_t) = NULL;
size_t (*sym_fido_cbor_info_extensions_len)(const fido_cbor_info_t *) = NULL;
char **(*sym_fido_cbor_info_extensions_ptr)(const fido_cbor_info_t *) = NULL;
void (*sym_fido_cbor_info_free)(fido_cbor_info_t **) = NULL;
fido_cbor_info_t* (*sym_fido_cbor_info_new)(void) = NULL;
size_t (*sym_fido_cbor_info_options_len)(const fido_cbor_info_t *) = NULL;
char** (*sym_fido_cbor_info_options_name_ptr)(const fido_cbor_info_t *) = NULL;
const bool* (*sym_fido_cbor_info_options_value_ptr)(const fido_cbor_info_t *) = NULL;
void (*sym_fido_cred_free)(fido_cred_t **) = NULL;
size_t (*sym_fido_cred_id_len)(const fido_cred_t *) = NULL;
const unsigned char* (*sym_fido_cred_id_ptr)(const fido_cred_t *) = NULL;
fido_cred_t* (*sym_fido_cred_new)(void) = NULL;
int (*sym_fido_cred_set_clientdata_hash)(fido_cred_t *, const unsigned char *, size_t) = NULL;
int (*sym_fido_cred_set_extensions)(fido_cred_t *, int) = NULL;
int (*sym_fido_cred_set_rk)(fido_cred_t *, fido_opt_t) = NULL;
int (*sym_fido_cred_set_rp)(fido_cred_t *, const char *, const char *) = NULL;
int (*sym_fido_cred_set_type)(fido_cred_t *, int) = NULL;
int (*sym_fido_cred_set_user)(fido_cred_t *, const unsigned char *, size_t, const char *, const char *, const char *) = NULL;
int (*sym_fido_cred_set_uv)(fido_cred_t *, fido_opt_t) = NULL;
void (*sym_fido_dev_free)(fido_dev_t **) = NULL;
int (*sym_fido_dev_get_assert)(fido_dev_t *, fido_assert_t *, const char *) = NULL;
int (*sym_fido_dev_get_cbor_info)(fido_dev_t *, fido_cbor_info_t *) = NULL;
void (*sym_fido_dev_info_free)(fido_dev_info_t **, size_t) = NULL;
int (*sym_fido_dev_info_manifest)(fido_dev_info_t *, size_t, size_t *) = NULL;
const char* (*sym_fido_dev_info_manufacturer_string)(const fido_dev_info_t *) = NULL;
const char* (*sym_fido_dev_info_product_string)(const fido_dev_info_t *) = NULL;
fido_dev_info_t* (*sym_fido_dev_info_new)(size_t) = NULL;
const char* (*sym_fido_dev_info_path)(const fido_dev_info_t *) = NULL;
const fido_dev_info_t* (*sym_fido_dev_info_ptr)(const fido_dev_info_t *, size_t) = NULL;
bool (*sym_fido_dev_is_fido2)(const fido_dev_t *) = NULL;
int (*sym_fido_dev_make_cred)(fido_dev_t *, fido_cred_t *, const char *) = NULL;
fido_dev_t* (*sym_fido_dev_new)(void) = NULL;
int (*sym_fido_dev_open)(fido_dev_t *, const char *) = NULL;
int (*sym_fido_dev_close)(fido_dev_t *) = NULL;
void (*sym_fido_init)(int) = NULL;
void (*sym_fido_set_log_handler)(fido_log_handler_t *) = NULL;
const char* (*sym_fido_strerr)(int) = NULL;
DLSYM_FUNCTION(fido_assert_allow_cred);
DLSYM_FUNCTION(fido_assert_free);
DLSYM_FUNCTION(fido_assert_hmac_secret_len);
DLSYM_FUNCTION(fido_assert_hmac_secret_ptr);
DLSYM_FUNCTION(fido_assert_new);
DLSYM_FUNCTION(fido_assert_set_clientdata_hash);
DLSYM_FUNCTION(fido_assert_set_extensions);
DLSYM_FUNCTION(fido_assert_set_hmac_salt);
DLSYM_FUNCTION(fido_assert_set_rp);
DLSYM_FUNCTION(fido_assert_set_up);
DLSYM_FUNCTION(fido_assert_set_uv);
DLSYM_FUNCTION(fido_cbor_info_extensions_len);
DLSYM_FUNCTION(fido_cbor_info_extensions_ptr);
DLSYM_FUNCTION(fido_cbor_info_free);
DLSYM_FUNCTION(fido_cbor_info_new);
DLSYM_FUNCTION(fido_cbor_info_options_len);
DLSYM_FUNCTION(fido_cbor_info_options_name_ptr);
DLSYM_FUNCTION(fido_cbor_info_options_value_ptr);
DLSYM_FUNCTION(fido_cred_free);
DLSYM_FUNCTION(fido_cred_id_len);
DLSYM_FUNCTION(fido_cred_id_ptr);
DLSYM_FUNCTION(fido_cred_new);
DLSYM_FUNCTION(fido_cred_set_clientdata_hash);
DLSYM_FUNCTION(fido_cred_set_extensions);
DLSYM_FUNCTION(fido_cred_set_rk);
DLSYM_FUNCTION(fido_cred_set_rp);
DLSYM_FUNCTION(fido_cred_set_type);
DLSYM_FUNCTION(fido_cred_set_user);
DLSYM_FUNCTION(fido_cred_set_uv);
DLSYM_FUNCTION(fido_dev_free);
DLSYM_FUNCTION(fido_dev_get_assert);
DLSYM_FUNCTION(fido_dev_get_cbor_info);
DLSYM_FUNCTION(fido_dev_info_free);
DLSYM_FUNCTION(fido_dev_info_manifest);
DLSYM_FUNCTION(fido_dev_info_manufacturer_string);
DLSYM_FUNCTION(fido_dev_info_product_string);
DLSYM_FUNCTION(fido_dev_info_new);
DLSYM_FUNCTION(fido_dev_info_path);
DLSYM_FUNCTION(fido_dev_info_ptr);
DLSYM_FUNCTION(fido_dev_is_fido2);
DLSYM_FUNCTION(fido_dev_make_cred);
DLSYM_FUNCTION(fido_dev_new);
DLSYM_FUNCTION(fido_dev_open);
DLSYM_FUNCTION(fido_dev_close);
DLSYM_FUNCTION(fido_init);
DLSYM_FUNCTION(fido_set_log_handler);
DLSYM_FUNCTION(fido_strerr);
static void fido_log_propagate_handler(const char *s) {
log_debug("libfido2: %s", strempty(s));

View File

@@ -17,53 +17,55 @@ typedef enum Fido2EnrollFlags {
#if HAVE_LIBFIDO2
#include <fido.h>
extern int (*sym_fido_assert_allow_cred)(fido_assert_t *, const unsigned char *, size_t);
extern void (*sym_fido_assert_free)(fido_assert_t **);
extern size_t (*sym_fido_assert_hmac_secret_len)(const fido_assert_t *, size_t);
extern const unsigned char* (*sym_fido_assert_hmac_secret_ptr)(const fido_assert_t *, size_t);
extern fido_assert_t* (*sym_fido_assert_new)(void);
extern int (*sym_fido_assert_set_clientdata_hash)(fido_assert_t *, const unsigned char *, size_t);
extern int (*sym_fido_assert_set_extensions)(fido_assert_t *, int);
extern int (*sym_fido_assert_set_hmac_salt)(fido_assert_t *, const unsigned char *, size_t);
extern int (*sym_fido_assert_set_rp)(fido_assert_t *, const char *);
extern int (*sym_fido_assert_set_up)(fido_assert_t *, fido_opt_t);
extern int (*sym_fido_assert_set_uv)(fido_assert_t *, fido_opt_t);
extern size_t (*sym_fido_cbor_info_extensions_len)(const fido_cbor_info_t *);
extern char **(*sym_fido_cbor_info_extensions_ptr)(const fido_cbor_info_t *);
extern void (*sym_fido_cbor_info_free)(fido_cbor_info_t **);
extern fido_cbor_info_t* (*sym_fido_cbor_info_new)(void);
extern size_t (*sym_fido_cbor_info_options_len)(const fido_cbor_info_t *);
extern char** (*sym_fido_cbor_info_options_name_ptr)(const fido_cbor_info_t *);
extern const bool* (*sym_fido_cbor_info_options_value_ptr)(const fido_cbor_info_t *);
extern void (*sym_fido_cred_free)(fido_cred_t **);
extern size_t (*sym_fido_cred_id_len)(const fido_cred_t *);
extern const unsigned char* (*sym_fido_cred_id_ptr)(const fido_cred_t *);
extern fido_cred_t* (*sym_fido_cred_new)(void);
extern int (*sym_fido_cred_set_clientdata_hash)(fido_cred_t *, const unsigned char *, size_t);
extern int (*sym_fido_cred_set_extensions)(fido_cred_t *, int);
extern int (*sym_fido_cred_set_rk)(fido_cred_t *, fido_opt_t);
extern int (*sym_fido_cred_set_rp)(fido_cred_t *, const char *, const char *);
extern int (*sym_fido_cred_set_type)(fido_cred_t *, int);
extern int (*sym_fido_cred_set_user)(fido_cred_t *, const unsigned char *, size_t, const char *, const char *, const char *);
extern int (*sym_fido_cred_set_uv)(fido_cred_t *, fido_opt_t);
extern void (*sym_fido_dev_free)(fido_dev_t **);
extern int (*sym_fido_dev_get_assert)(fido_dev_t *, fido_assert_t *, const char *);
extern int (*sym_fido_dev_get_cbor_info)(fido_dev_t *, fido_cbor_info_t *);
extern void (*sym_fido_dev_info_free)(fido_dev_info_t **, size_t);
extern int (*sym_fido_dev_info_manifest)(fido_dev_info_t *, size_t, size_t *);
extern const char* (*sym_fido_dev_info_manufacturer_string)(const fido_dev_info_t *);
extern const char* (*sym_fido_dev_info_product_string)(const fido_dev_info_t *);
extern fido_dev_info_t* (*sym_fido_dev_info_new)(size_t);
extern const char* (*sym_fido_dev_info_path)(const fido_dev_info_t *);
extern const fido_dev_info_t* (*sym_fido_dev_info_ptr)(const fido_dev_info_t *, size_t);
extern bool (*sym_fido_dev_is_fido2)(const fido_dev_t *);
extern int (*sym_fido_dev_make_cred)(fido_dev_t *, fido_cred_t *, const char *);
extern fido_dev_t* (*sym_fido_dev_new)(void);
extern int (*sym_fido_dev_open)(fido_dev_t *, const char *);
extern int (*sym_fido_dev_close)(fido_dev_t *);
extern void (*sym_fido_init)(int);
extern void (*sym_fido_set_log_handler)(fido_log_handler_t *);
extern const char* (*sym_fido_strerr)(int);
#include "dlfcn-util.h"
DLSYM_PROTOTYPE(fido_assert_allow_cred);
DLSYM_PROTOTYPE(fido_assert_free);
DLSYM_PROTOTYPE(fido_assert_hmac_secret_len);
DLSYM_PROTOTYPE(fido_assert_hmac_secret_ptr);
DLSYM_PROTOTYPE(fido_assert_new);
DLSYM_PROTOTYPE(fido_assert_set_clientdata_hash);
DLSYM_PROTOTYPE(fido_assert_set_extensions);
DLSYM_PROTOTYPE(fido_assert_set_hmac_salt);
DLSYM_PROTOTYPE(fido_assert_set_rp);
DLSYM_PROTOTYPE(fido_assert_set_up);
DLSYM_PROTOTYPE(fido_assert_set_uv);
DLSYM_PROTOTYPE(fido_cbor_info_extensions_len);
DLSYM_PROTOTYPE(fido_cbor_info_extensions_ptr);
DLSYM_PROTOTYPE(fido_cbor_info_free);
DLSYM_PROTOTYPE(fido_cbor_info_new);
DLSYM_PROTOTYPE(fido_cbor_info_options_len);
DLSYM_PROTOTYPE(fido_cbor_info_options_name_ptr);
DLSYM_PROTOTYPE(fido_cbor_info_options_value_ptr);
DLSYM_PROTOTYPE(fido_cred_free);
DLSYM_PROTOTYPE(fido_cred_id_len);
DLSYM_PROTOTYPE(fido_cred_id_ptr);
DLSYM_PROTOTYPE(fido_cred_new);
DLSYM_PROTOTYPE(fido_cred_set_clientdata_hash);
DLSYM_PROTOTYPE(fido_cred_set_extensions);
DLSYM_PROTOTYPE(fido_cred_set_rk);
DLSYM_PROTOTYPE(fido_cred_set_rp);
DLSYM_PROTOTYPE(fido_cred_set_type);
DLSYM_PROTOTYPE(fido_cred_set_user);
DLSYM_PROTOTYPE(fido_cred_set_uv);
DLSYM_PROTOTYPE(fido_dev_free);
DLSYM_PROTOTYPE(fido_dev_get_assert);
DLSYM_PROTOTYPE(fido_dev_get_cbor_info);
DLSYM_PROTOTYPE(fido_dev_info_free);
DLSYM_PROTOTYPE(fido_dev_info_manifest);
DLSYM_PROTOTYPE(fido_dev_info_manufacturer_string);
DLSYM_PROTOTYPE(fido_dev_info_product_string);
DLSYM_PROTOTYPE(fido_dev_info_new);
DLSYM_PROTOTYPE(fido_dev_info_path);
DLSYM_PROTOTYPE(fido_dev_info_ptr);
DLSYM_PROTOTYPE(fido_dev_is_fido2);
DLSYM_PROTOTYPE(fido_dev_make_cred);
DLSYM_PROTOTYPE(fido_dev_new);
DLSYM_PROTOTYPE(fido_dev_open);
DLSYM_PROTOTYPE(fido_dev_close);
DLSYM_PROTOTYPE(fido_init);
DLSYM_PROTOTYPE(fido_set_log_handler);
DLSYM_PROTOTYPE(fido_strerr);
int dlopen_libfido2(void);

View File

@@ -12,12 +12,12 @@
static void *passwdqc_dl = NULL;
void (*sym_passwdqc_params_reset)(passwdqc_params_t *params);
int (*sym_passwdqc_params_load)(passwdqc_params_t *params, char **reason, const char *pathname);
int (*sym_passwdqc_params_parse)(passwdqc_params_t *params, char **reason, int argc, const char *const *argv);
void (*sym_passwdqc_params_free)(passwdqc_params_t *params);
const char *(*sym_passwdqc_check)(const passwdqc_params_qc_t *params, const char *newpass, const char *oldpass, const struct passwd *pw);
char *(*sym_passwdqc_random)(const passwdqc_params_qc_t *params);
DLSYM_FUNCTION(passwdqc_params_reset);
DLSYM_FUNCTION(passwdqc_params_load);
DLSYM_FUNCTION(passwdqc_params_parse);
DLSYM_FUNCTION(passwdqc_params_free);
DLSYM_FUNCTION(passwdqc_check);
DLSYM_FUNCTION(passwdqc_random);
int dlopen_passwdqc(void) {
return dlopen_many_sym_or_warn(

View File

@@ -6,12 +6,12 @@
#if HAVE_PASSWDQC
#include <passwdqc.h>
extern void (*sym_passwdqc_params_reset)(passwdqc_params_t *params);
extern int (*sym_passwdqc_params_load)(passwdqc_params_t *params, char **reason, const char *pathname);
extern int (*sym_passwdqc_params_parse)(passwdqc_params_t *params, char **reason, int argc, const char *const *argv);
extern void (*sym_passwdqc_params_free)(passwdqc_params_t *params);
extern const char *(*sym_passwdqc_check)(const passwdqc_params_qc_t *params, const char *newpass, const char *oldpass, const struct passwd *pw);
extern char *(*sym_passwdqc_random)(const passwdqc_params_qc_t *params);
DLSYM_PROTOTYPE(passwdqc_params_reset);
DLSYM_PROTOTYPE(passwdqc_params_load);
DLSYM_PROTOTYPE(passwdqc_params_parse);
DLSYM_PROTOTYPE(passwdqc_params_free);
DLSYM_PROTOTYPE(passwdqc_check);
DLSYM_PROTOTYPE(passwdqc_random);
int dlopen_passwdqc(void);

View File

@@ -14,14 +14,14 @@
static void *pwquality_dl = NULL;
int (*sym_pwquality_check)(pwquality_settings_t *pwq, const char *password, const char *oldpassword, const char *user, void **auxerror);
pwquality_settings_t *(*sym_pwquality_default_settings)(void);
void (*sym_pwquality_free_settings)(pwquality_settings_t *pwq);
int (*sym_pwquality_generate)(pwquality_settings_t *pwq, int entropy_bits, char **password);
int (*sym_pwquality_get_str_value)(pwquality_settings_t *pwq, int setting, const char **value);
int (*sym_pwquality_read_config)(pwquality_settings_t *pwq, const char *cfgfile, void **auxerror);
int (*sym_pwquality_set_int_value)(pwquality_settings_t *pwq, int setting, int value);
const char* (*sym_pwquality_strerror)(char *buf, size_t len, int errcode, void *auxerror);
DLSYM_FUNCTION(pwquality_check);
DLSYM_FUNCTION(pwquality_default_settings);
DLSYM_FUNCTION(pwquality_free_settings);
DLSYM_FUNCTION(pwquality_generate);
DLSYM_FUNCTION(pwquality_get_str_value);
DLSYM_FUNCTION(pwquality_read_config);
DLSYM_FUNCTION(pwquality_set_int_value);
DLSYM_FUNCTION(pwquality_strerror);
int dlopen_pwquality(void) {
return dlopen_many_sym_or_warn(

View File

@@ -8,14 +8,16 @@
#include <sys/types.h>
#include <pwquality.h>
extern int (*sym_pwquality_check)(pwquality_settings_t *pwq, const char *password, const char *oldpassword, const char *user, void **auxerror);
extern pwquality_settings_t *(*sym_pwquality_default_settings)(void);
extern void (*sym_pwquality_free_settings)(pwquality_settings_t *pwq);
extern int (*sym_pwquality_generate)(pwquality_settings_t *pwq, int entropy_bits, char **password);
extern int (*sym_pwquality_get_str_value)(pwquality_settings_t *pwq, int setting, const char **value);
extern int (*sym_pwquality_read_config)(pwquality_settings_t *pwq, const char *cfgfile, void **auxerror);
extern int (*sym_pwquality_set_int_value)(pwquality_settings_t *pwq, int setting, int value);
extern const char* (*sym_pwquality_strerror)(char *buf, size_t len, int errcode, void *auxerror);
#include "dlfcn-util.h"
DLSYM_PROTOTYPE(pwquality_check);
DLSYM_PROTOTYPE(pwquality_default_settings);
DLSYM_PROTOTYPE(pwquality_free_settings);
DLSYM_PROTOTYPE(pwquality_generate);
DLSYM_PROTOTYPE(pwquality_get_str_value);
DLSYM_PROTOTYPE(pwquality_read_config);
DLSYM_PROTOTYPE(pwquality_set_int_value);
DLSYM_PROTOTYPE(pwquality_strerror);
int dlopen_pwquality(void);

View File

@@ -7,13 +7,13 @@
#if HAVE_PCRE2
static void *pcre2_dl = NULL;
pcre2_match_data* (*sym_pcre2_match_data_create)(uint32_t, pcre2_general_context *);
void (*sym_pcre2_match_data_free)(pcre2_match_data *);
void (*sym_pcre2_code_free)(pcre2_code *);
pcre2_code* (*sym_pcre2_compile)(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, pcre2_compile_context *);
int (*sym_pcre2_get_error_message)(int, PCRE2_UCHAR *, PCRE2_SIZE);
int (*sym_pcre2_match)(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, pcre2_match_data *, pcre2_match_context *);
PCRE2_SIZE* (*sym_pcre2_get_ovector_pointer)(pcre2_match_data *);
DLSYM_FUNCTION(pcre2_match_data_create);
DLSYM_FUNCTION(pcre2_match_data_free);
DLSYM_FUNCTION(pcre2_code_free);
DLSYM_FUNCTION(pcre2_compile);
DLSYM_FUNCTION(pcre2_get_error_message);
DLSYM_FUNCTION(pcre2_match);
DLSYM_FUNCTION(pcre2_get_ovector_pointer);
DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
pcre2_code_hash_ops_free,

View File

@@ -6,16 +6,18 @@
#if HAVE_PCRE2
#include "dlfcn-util.h"
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
extern pcre2_match_data* (*sym_pcre2_match_data_create)(uint32_t, pcre2_general_context *);
extern void (*sym_pcre2_match_data_free)(pcre2_match_data *);
extern void (*sym_pcre2_code_free)(pcre2_code *);
extern pcre2_code* (*sym_pcre2_compile)(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, pcre2_compile_context *);
extern int (*sym_pcre2_get_error_message)(int, PCRE2_UCHAR *, PCRE2_SIZE);
extern int (*sym_pcre2_match)(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, pcre2_match_data *, pcre2_match_context *);
extern PCRE2_SIZE* (*sym_pcre2_get_ovector_pointer)(pcre2_match_data *);
DLSYM_PROTOTYPE(pcre2_match_data_create);
DLSYM_PROTOTYPE(pcre2_match_data_free);
DLSYM_PROTOTYPE(pcre2_code_free);
DLSYM_PROTOTYPE(pcre2_compile);
DLSYM_PROTOTYPE(pcre2_get_error_message);
DLSYM_PROTOTYPE(pcre2_match);
DLSYM_PROTOTYPE(pcre2_get_ovector_pointer);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_match_data*, sym_pcre2_match_data_free, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_code*, sym_pcre2_code_free, NULL);

View File

@@ -43,22 +43,22 @@ bool pkcs11_uri_valid(const char *uri) {
static void *p11kit_dl = NULL;
char *(*sym_p11_kit_module_get_name)(CK_FUNCTION_LIST *module);
void (*sym_p11_kit_modules_finalize_and_release)(CK_FUNCTION_LIST **modules);
CK_FUNCTION_LIST **(*sym_p11_kit_modules_load_and_initialize)(int flags);
const char *(*sym_p11_kit_strerror)(CK_RV rv);
int (*sym_p11_kit_uri_format)(P11KitUri *uri, P11KitUriType uri_type, char **string);
void (*sym_p11_kit_uri_free)(P11KitUri *uri);
CK_ATTRIBUTE_PTR (*sym_p11_kit_uri_get_attributes)(P11KitUri *uri, CK_ULONG *n_attrs);
CK_ATTRIBUTE_PTR (*sym_p11_kit_uri_get_attribute)(P11KitUri *uri, CK_ATTRIBUTE_TYPE attr_type);
int (*sym_p11_kit_uri_set_attribute)(P11KitUri *uri, CK_ATTRIBUTE_PTR attr);
CK_INFO_PTR (*sym_p11_kit_uri_get_module_info)(P11KitUri *uri);
CK_SLOT_INFO_PTR (*sym_p11_kit_uri_get_slot_info)(P11KitUri *uri);
CK_TOKEN_INFO_PTR (*sym_p11_kit_uri_get_token_info)(P11KitUri *uri);
int (*sym_p11_kit_uri_match_token_info)(const P11KitUri *uri, const CK_TOKEN_INFO *token_info);
const char *(*sym_p11_kit_uri_message)(int code);
P11KitUri *(*sym_p11_kit_uri_new)(void);
int (*sym_p11_kit_uri_parse)(const char *string, P11KitUriType uri_type, P11KitUri *uri);
DLSYM_FUNCTION(p11_kit_module_get_name);
DLSYM_FUNCTION(p11_kit_modules_finalize_and_release);
DLSYM_FUNCTION(p11_kit_modules_load_and_initialize);
DLSYM_FUNCTION(p11_kit_strerror);
DLSYM_FUNCTION(p11_kit_uri_format);
DLSYM_FUNCTION(p11_kit_uri_free);
DLSYM_FUNCTION(p11_kit_uri_get_attributes);
DLSYM_FUNCTION(p11_kit_uri_get_attribute);
DLSYM_FUNCTION(p11_kit_uri_set_attribute);
DLSYM_FUNCTION(p11_kit_uri_get_module_info);
DLSYM_FUNCTION(p11_kit_uri_get_slot_info);
DLSYM_FUNCTION(p11_kit_uri_get_token_info);
DLSYM_FUNCTION(p11_kit_uri_match_token_info);
DLSYM_FUNCTION(p11_kit_uri_message);
DLSYM_FUNCTION(p11_kit_uri_new);
DLSYM_FUNCTION(p11_kit_uri_parse);
int dlopen_p11kit(void) {
return dlopen_many_sym_or_warn(

View File

@@ -13,29 +13,29 @@
#endif
#include "ask-password-api.h"
#include "dlfcn-util.h"
#include "macro.h"
#include "time-util.h"
bool pkcs11_uri_valid(const char *uri);
#if HAVE_P11KIT
extern char *(*sym_p11_kit_module_get_name)(CK_FUNCTION_LIST *module);
extern void (*sym_p11_kit_modules_finalize_and_release)(CK_FUNCTION_LIST **modules);
extern CK_FUNCTION_LIST **(*sym_p11_kit_modules_load_and_initialize)(int flags);
extern const char *(*sym_p11_kit_strerror)(CK_RV rv);
extern int (*sym_p11_kit_uri_format)(P11KitUri *uri, P11KitUriType uri_type, char **string);
extern void (*sym_p11_kit_uri_free)(P11KitUri *uri);
extern CK_ATTRIBUTE_PTR (*sym_p11_kit_uri_get_attributes)(P11KitUri *uri, CK_ULONG *n_attrs);
extern CK_ATTRIBUTE_PTR (*sym_p11_kit_uri_get_attribute)(P11KitUri *uri, CK_ATTRIBUTE_TYPE attr_type);
extern int (*sym_p11_kit_uri_set_attribute)(P11KitUri *uri, CK_ATTRIBUTE_PTR attr);
extern CK_INFO_PTR (*sym_p11_kit_uri_get_module_info)(P11KitUri *uri);
extern CK_SLOT_INFO_PTR (*sym_p11_kit_uri_get_slot_info)(P11KitUri *uri);
extern CK_TOKEN_INFO_PTR (*sym_p11_kit_uri_get_token_info)(P11KitUri *uri);
extern int (*sym_p11_kit_uri_match_token_info)(const P11KitUri *uri, const CK_TOKEN_INFO *token_info);
extern const char *(*sym_p11_kit_uri_message)(int code);
extern P11KitUri *(*sym_p11_kit_uri_new)(void);
extern int (*sym_p11_kit_uri_parse)(const char *string, P11KitUriType uri_type, P11KitUri *uri);
DLSYM_PROTOTYPE(p11_kit_module_get_name);
DLSYM_PROTOTYPE(p11_kit_modules_finalize_and_release);
DLSYM_PROTOTYPE(p11_kit_modules_load_and_initialize);
DLSYM_PROTOTYPE(p11_kit_strerror);
DLSYM_PROTOTYPE(p11_kit_uri_format);
DLSYM_PROTOTYPE(p11_kit_uri_free);
DLSYM_PROTOTYPE(p11_kit_uri_get_attributes);
DLSYM_PROTOTYPE(p11_kit_uri_get_attribute);
DLSYM_PROTOTYPE(p11_kit_uri_set_attribute);
DLSYM_PROTOTYPE(p11_kit_uri_get_module_info);
DLSYM_PROTOTYPE(p11_kit_uri_get_slot_info);
DLSYM_PROTOTYPE(p11_kit_uri_get_token_info);
DLSYM_PROTOTYPE(p11_kit_uri_match_token_info);
DLSYM_PROTOTYPE(p11_kit_uri_message);
DLSYM_PROTOTYPE(p11_kit_uri_new);
DLSYM_PROTOTYPE(p11_kit_uri_parse);
int uri_from_string(const char *p, P11KitUri **ret);

View File

@@ -18,8 +18,8 @@
static void *qrcode_dl = NULL;
static QRcode* (*sym_QRcode_encodeString)(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive) = NULL;
static void (*sym_QRcode_free)(QRcode *qrcode) = NULL;
static DLSYM_FUNCTION(QRcode_encodeString);
static DLSYM_FUNCTION(QRcode_free);
int dlopen_qrencode(void) {
int r;

Some files were not shown because too many files have changed in this diff Show More