crypto: reduce duplication in handling TLS priority strings
The logic for setting the TLS priority string on a session object has a significant amount of logic duplication across the different credential types. By recording the extra priority string suffix against the credential class, we can introduce a common method for building the priority string. The TLS session can now set the priority string without caring about the credential type. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
fb8a0b0bfc
commit
e82fccb4a3
5 changed files with 41 additions and 51 deletions
|
|
@ -47,6 +47,7 @@ typedef bool (*CryptoTLSCredsReload)(QCryptoTLSCreds *, Error **);
|
|||
struct QCryptoTLSCredsClass {
|
||||
ObjectClass parent_class;
|
||||
CryptoTLSCredsReload reload;
|
||||
const char *prioritySuffix;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -64,4 +65,16 @@ bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds,
|
|||
QCryptoTLSCredsEndpoint endpoint,
|
||||
Error **errp);
|
||||
|
||||
|
||||
/**
|
||||
* qcrypto_tls_creds_get_priority:
|
||||
* @creds: pointer to a TLS credentials object
|
||||
*
|
||||
* Get the TLS credentials priority string. The caller
|
||||
* must free the returned string when no longer required.
|
||||
*
|
||||
* Returns: a non-NULL priority string
|
||||
*/
|
||||
char *qcrypto_tls_creds_get_priority(QCryptoTLSCreds *creds);
|
||||
|
||||
#endif /* QCRYPTO_TLSCREDS_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue