Add support for application defined signature algorithms for use with
[openssl.git] / ssl / ssl_locl.h
index c340ac3ce70360d342656647e11489659bec1a6c..671b2dfe04d490255bd497bca11d121613649f03 100644 (file)
@@ -474,6 +474,15 @@ typedef struct cert_pkey_st
        const EVP_MD *digest;
        /* Chain for this certificate */
        STACK_OF(X509) *chain;
+#ifndef OPENSSL_NO_TLSEXT
+       /* authz/authz_length contain authz data for this certificate. The data
+        * is in wire format, specifically it's a series of records like:
+        *   uint8_t authz_type;  // (RFC 5878, AuthzDataFormat)
+        *   uint16_t length;
+        *   uint8_t data[length]; */
+       unsigned char *authz;
+       size_t authz_length;
+#endif
        } CERT_PKEY;
 
 typedef struct cert_st
@@ -508,10 +517,19 @@ typedef struct cert_st
 
        CERT_PKEY pkeys[SSL_PKEY_NUM];
 
-       /* Array of pairs of NIDs for signature algorithm extension */
-       TLS_SIGALGS *sigalgs;
+       /* signature algorithms peer reports: e.g. supported signature
+        * algorithms extension for server or as part of a certificate
+        * request for client.
+        */
+       TLS_SIGALGS *peer_sigalgs;
+       /* Size of above array */
+       size_t peer_sigalgslen;
+       /* configured signature algorithms (can be NULL for default).
+        * sent in signature algorithms extension or certificate request.
+        */
+       TLS_SIGALGS *conf_sigalgs;
        /* Size of above array */
-       size_t sigalgslen;
+       size_t conf_sigalgslen;
 
        int references; /* >1 only if SSL_copy_session_id is used */
        } CERT;
@@ -593,8 +611,8 @@ typedef struct ssl3_enc_method
        int (*export_keying_material)(SSL *, unsigned char *, size_t,
                                      const char *, size_t,
                                      const unsigned char *, size_t,
-                                     int use_context);
-       } SSL3_ENC_METHOD;
+                                     int use_context);
+       } SSL3_ENC_METHOD;
 
 #ifndef OPENSSL_NO_COMP
 /* Used for holding the relevant compression methods loaded into SSL_CTX */
@@ -822,6 +840,7 @@ int ssl_clear_bad_session(SSL *s);
 CERT *ssl_cert_new(void);
 CERT *ssl_cert_dup(CERT *cert);
 int ssl_cert_inst(CERT **o);
+void ssl_cert_clear_certs(CERT *c);
 void ssl_cert_free(CERT *c);
 SESS_CERT *ssl_sess_cert_new(void);
 void ssl_sess_cert_free(SESS_CERT *sc);
@@ -856,6 +875,7 @@ int ssl_undefined_function(SSL *s);
 int ssl_undefined_void_function(void);
 int ssl_undefined_const_function(const SSL *s);
 CERT_PKEY *ssl_get_server_send_pkey(SSL *);
+unsigned char *ssl_get_authz_data(SSL *s, size_t *authz_length);
 EVP_PKEY *ssl_get_sign_pkey(SSL *s,const SSL_CIPHER *c, const EVP_MD **pmd);
 int ssl_cert_type(X509 *x,EVP_PKEY *pkey);
 void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher);
@@ -1121,11 +1141,14 @@ int tls1_shared_list(SSL *s,
 unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 
 unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned char *limit); 
 int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n);
-int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n, int *al);
+int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, unsigned char *d, int n);
 int ssl_prepare_clienthello_tlsext(SSL *s);
 int ssl_prepare_serverhello_tlsext(SSL *s);
-int ssl_check_clienthello_tlsext(SSL *s);
-int ssl_check_serverhello_tlsext(SSL *s);
+
+/* server only */
+int tls1_send_server_supplemental_data(SSL *s);
+/* client only */
+int tls1_get_server_supplemental_data(SSL *s);
 
 #ifndef OPENSSL_NO_HEARTBEATS
 int tls1_heartbeat(SSL *s);
@@ -1147,6 +1170,9 @@ int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
 int tls12_get_sigid(const EVP_PKEY *pk);
 const EVP_MD *tls12_get_hash(unsigned char hash_alg);
 
+int tls1_set_sigalgs_list(CERT *c, const char *str);
+int tls1_set_sigalgs(CERT *c, const int *salg, size_t salglen);
+
 #endif
 EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash,const EVP_MD *md) ;
 void ssl_clear_hash_ctx(EVP_MD_CTX **hash);
@@ -1160,7 +1186,7 @@ int ssl_parse_clienthello_renegotiate_ext(SSL *s, unsigned char *d, int len,
                                          int *al);
 long ssl_get_algorithm2(SSL *s);
 int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize);
-int tls12_get_req_sig_algs(SSL *s, unsigned char *p);
+size_t tls12_get_sig_algs(SSL *s, unsigned char *p);
 
 int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, int *len, int maxlen);
 int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al);