libtls: Add control flags and replace GENERIC_NULLOK purpose with one

This commit is contained in:
Tobias Brunner
2021-02-18 15:10:29 +01:00
parent 602947d48a
commit 11a4687930
13 changed files with 57 additions and 36 deletions
+19 -3
View File
@@ -40,6 +40,7 @@ typedef enum tls_version_t tls_version_t;
typedef enum tls_content_type_t tls_content_type_t;
typedef enum tls_handshake_type_t tls_handshake_type_t;
typedef enum tls_purpose_t tls_purpose_t;
typedef enum tls_flag_t tls_flag_t;
typedef struct tls_t tls_t;
#include <library.h>
@@ -130,8 +131,6 @@ enum tls_purpose_t {
TLS_PURPOSE_EAP_PEAP,
/** non-EAP TLS */
TLS_PURPOSE_GENERIC,
/** non-EAP TLS accepting NULL encryption */
TLS_PURPOSE_GENERIC_NULLOK,
/** EAP binding for TNC */
TLS_PURPOSE_EAP_TNC
};
@@ -202,6 +201,14 @@ enum tls_name_type_t {
TLS_NAME_TYPE_HOST_NAME = 0,
};
/**
* Flags that control the behavior of the stack
*/
enum tls_flag_t {
/** set if cipher suites with null encryption are acceptable */
TLS_FLAG_ENCRYPTION_OPTIONAL = 1,
};
/**
* Enum names for tls_extension_t
*/
@@ -318,6 +325,13 @@ struct tls_t {
*/
tls_purpose_t (*get_purpose)(tls_t *this);
/**
* Get the flags controlling this TLS stack instance.
*
* @return flags given during construction
*/
tls_flag_t (*get_flags)(tls_t *this);
/**
* Check if TLS negotiation completed successfully.
*
@@ -359,10 +373,12 @@ void libtls_init(void);
* @param purpose purpose this TLS stack instance is used for
* @param application higher layer application or NULL if none
* @param cache session cache to use, or NULL
* @param flags flags that control the behavior of the TLS stack
* @return TLS stack
*/
tls_t *tls_create(bool is_server, identification_t *server,
identification_t *peer, tls_purpose_t purpose,
tls_application_t *application, tls_cache_t *cache);
tls_application_t *application, tls_cache_t *cache,
tls_flag_t flags);
#endif /** TLS_H_ @}*/