+static int load_certificates(char **key, char **cert, char **trust) {
+ int r;
+
+ r = read_full_file(arg_key ?: KEY_FILE, key, NULL);
+ if (r < 0) {
+ log_error("Failed to read key from file '%s': %s",
+ arg_key ?: KEY_FILE, strerror(-r));
+ return r;
+ }
+
+ r = read_full_file(arg_cert ?: CERT_FILE, cert, NULL);
+ if (r < 0) {
+ log_error("Failed to read certificate from file '%s': %s",
+ arg_cert ?: CERT_FILE, strerror(-r));
+ return r;
+ }
+
+ if (arg_trust_all)
+ log_info("Certificate checking disabled.");
+ else {
+ r = read_full_file(arg_trust ?: TRUST_FILE, trust, NULL);
+ if (r < 0) {
+ log_error("Failed to read CA certificate file '%s': %s",
+ arg_trust ?: TRUST_FILE, strerror(-r));
+ return r;
+ }
+ }
+
+ return 0;
+}
+