return fr_hex2bin(psk, max_psk_len, buffer, hex_len);
}
+ if (!conf->psk_identity) {
+ DEBUG("No static PSK identity set. Rejecting the user");
+ return 0;
+ }
+
/*
* No REQUEST, or no dynamic query. Just look for a
* static identity.
return NULL;
}
- SSL_CTX_set_psk_server_callback(ctx, psk_server_callback);
+ /*
+ * Set the callback only if we can check things.
+ */
+ if (conf->psk_identity || conf->psk_query) {
+ SSL_CTX_set_psk_server_callback(ctx, psk_server_callback);
+ }
} else if (conf->psk_query) {
ERROR("Invalid PSK Configuration: psk_query cannot be used for outgoing connections");