group patch

This commit is contained in:
Hakase
2018-04-02 22:34:55 +09:00
parent 1fd4faa81c
commit 52a6a72200
8 changed files with 389 additions and 103 deletions
+52 -9
View File
@@ -599,9 +599,46 @@ DEFINE_LHASH_OF(X509_NAME);
# define TLSEXT_KEYNAME_LENGTH 16
/* ssl_cipher_preference_list_st contains a list of SSL_CIPHERs with
* equal-preference groups. For TLS clients, the groups are moot because the
* server picks the cipher and groups cannot be expressed on the wire. However,
* for servers, the equal-preference groups allow the client's preferences to
* be partially respected. (This only has an effect with
* SSL_OP_CIPHER_SERVER_PREFERENCE).
*
* The equal-preference groups are expressed by grouping SSL_CIPHERs together.
* All elements of a group have the same priority: no ordering is expressed
* within a group.
*
* The values in |ciphers| are in one-to-one correspondence with
* |in_group_flags|. (That is, sk_SSL_CIPHER_num(ciphers) is the number of
* bytes in |in_group_flags|.) The bytes in |in_group_flags| are either 1, to
* indicate that the corresponding SSL_CIPHER is not the last element of a
* group, or 0 to indicate that it is.
*
* For example, if |in_group_flags| contains all zeros then that indicates a
* traditional, fully-ordered preference. Every SSL_CIPHER is the last element
* of the group (i.e. they are all in a one-element group).
*
* For a more complex example, consider:
* ciphers: A B C D E F
* in_group_flags: 1 1 0 0 1 0
*
* That would express the following, order:
*
* A E
* B -> D -> F
* C
*/
struct ssl_cipher_preference_list_st {
STACK_OF(SSL_CIPHER) *ciphers;
uint8_t *in_group_flags;
};
struct ssl_ctx_st {
const SSL_METHOD *method;
STACK_OF(SSL_CIPHER) *cipher_list;
struct ssl_cipher_preference_list_st *cipher_list;
/* same as above but sorted for lookup */
STACK_OF(SSL_CIPHER) *cipher_list_by_id;
struct x509_store_st /* X509_STORE */ *cert_store;
@@ -935,7 +972,7 @@ struct ssl_st {
/* Per connection DANE state */
SSL_DANE dane;
/* crypto */
STACK_OF(SSL_CIPHER) *cipher_list;
struct ssl_cipher_preference_list_st *cipher_list;
STACK_OF(SSL_CIPHER) *cipher_list_by_id;
/*
* These are the ones being used, the ones in SSL_SESSION are the ones to
@@ -1802,12 +1839,18 @@ DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id);
__owur int ssl_cipher_ptr_id_cmp(const SSL_CIPHER *const *ap,
const SSL_CIPHER *const *bp);
__owur STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
STACK_OF(SSL_CIPHER) **pref,
STACK_OF(SSL_CIPHER)
**sorted,
const char *rule_str,
CERT *c);
struct ssl_cipher_preference_list_st **pref,
STACK_OF(SSL_CIPHER) **sorted,
const char *rule_str,
CERT *c);
void ssl_update_cache(SSL *s, int mode);
struct ssl_cipher_preference_list_st* ssl_cipher_preference_list_dup(
struct ssl_cipher_preference_list_st *cipher_list);
void ssl_cipher_preference_list_free(
struct ssl_cipher_preference_list_st *cipher_list);
struct ssl_cipher_preference_list_st* ssl_cipher_preference_list_from_ciphers(
STACK_OF(SSL_CIPHER) *ciphers);
struct ssl_cipher_preference_list_st* ssl_get_cipher_preferences(SSL *s);
__owur int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
const EVP_MD **md, int *mac_pkey_type,
int *mac_secret_size, SSL_COMP **comp,
@@ -1879,8 +1922,8 @@ __owur int ssl3_finish_mac(SSL *s, const unsigned char *buf, int len);
void ssl3_free_digest_list(SSL *s);
__owur unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk);
__owur const SSL_CIPHER *ssl3_choose_cipher(SSL *ssl,
STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *srvr);
STACK_OF(SSL_CIPHER) *clnt,
struct ssl_cipher_preference_list_st *srvr);
__owur int ssl3_digest_cached_records(SSL *s, int keep);
__owur int ssl3_new(SSL *s);
void ssl3_free(SSL *s);