/* Bits for algorithm_mkey (key exchange algorithm) */
/* RSA key exchange */
# define SSL_kRSA 0x00000001U
-/* DH cert, RSA CA cert */
-# define SSL_kDHr 0x00000002U
-/* DH cert, DSA CA cert */
-# define SSL_kDHd 0x00000004U
/* tmp DH key no DH cert */
-# define SSL_kDHE 0x00000008U
+# define SSL_kDHE 0x00000002U
/* synonym */
# define SSL_kEDH SSL_kDHE
/* ECDH cert, RSA CA cert */
-# define SSL_kECDHr 0x00000020U
+# define SSL_kECDHr 0x00000004U
/* ECDH cert, ECDSA CA cert */
-# define SSL_kECDHe 0x00000040U
+# define SSL_kECDHe 0x00000008U
/* ephemeral ECDH */
-# define SSL_kECDHE 0x00000080U
+# define SSL_kECDHE 0x00000010U
/* synonym */
# define SSL_kEECDH SSL_kECDHE
/* PSK */
-# define SSL_kPSK 0x00000100U
+# define SSL_kPSK 0x00000020U
/* GOST key exchange */
-# define SSL_kGOST 0x00000200U
+# define SSL_kGOST 0x00000040U
/* SRP */
-# define SSL_kSRP 0x00000400U
+# define SSL_kSRP 0x00000080U
-# define SSL_kRSAPSK 0x00000800U
-# define SSL_kECDHEPSK 0x00001000U
-# define SSL_kDHEPSK 0x00002000U
+# define SSL_kRSAPSK 0x00000100U
+# define SSL_kECDHEPSK 0x00000200U
+# define SSL_kDHEPSK 0x00000400U
/* all PSK */
# define SSL_aDSS 0x00000002U
/* no auth (i.e. use ADH or AECDH) */
# define SSL_aNULL 0x00000004U
-/* Fixed DH auth (kDHd or kDHr) */
-# define SSL_aDH 0x00000008U
/* Fixed ECDH auth (kECDHe or kECDHr) */
-# define SSL_aECDH 0x00000010U
+# define SSL_aECDH 0x00000008U
/* ECDSA auth*/
-# define SSL_aECDSA 0x00000040U
+# define SSL_aECDSA 0x00000010U
/* PSK auth */
-# define SSL_aPSK 0x00000080U
+# define SSL_aPSK 0x00000020U
/* GOST R 34.10-2001 signature auth */
-# define SSL_aGOST01 0x00000200U
+# define SSL_aGOST01 0x00000040U
/* SRP auth */
-# define SSL_aSRP 0x00000400U
+# define SSL_aSRP 0x00000080U
/* GOST R 34.10-2012 signature auth */
-# define SSL_aGOST12 0x00000800U
+# define SSL_aGOST12 0x00000100U
/* Bits for algorithm_enc (symmetric encryption) */
# define SSL_DES 0x00000001U
# define SSL_AES128CCM8 0x00010000U
# define SSL_AES256CCM8 0x00020000U
# define SSL_eGOST2814789CNT12 0x00040000U
+# define SSL_CHACHA20POLY1305 0x00080000U
# define SSL_AES (SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM|SSL_AES128CCM|SSL_AES256CCM|SSL_AES128CCM8|SSL_AES256CCM8)
# define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256)
*/
# define TLS1_STREAM_MAC 0x10000
-/*
- * Export and cipher strength information. For each cipher we have to decide
- * whether it is exportable or not. This information is likely to change
- * over time, since the export control rules are no static technical issue.
- *
- * Independent of the export flag the cipher strength is sorted into classes.
- * SSL_EXP40 was denoting the 40bit US export limit of past times, which now
- * is at 56bit (SSL_EXP56). If the exportable cipher class is going to change
- * again (eg. to 64bit) the use of "SSL_EXP*" becomes blurred even more,
- * since SSL_EXP64 could be similar to SSL_LOW.
- * For this reason SSL_MICRO and SSL_MINI macros are included to widen the
- * namespace of SSL_LOW-SSL_HIGH to lower values. As development of speed
- * and ciphers goes, another extension to SSL_SUPER and/or SSL_ULTRA would
- * be possible.
- */
-# define SSL_EXP_MASK 0x00000003U
-# define SSL_STRONG_MASK 0x000001fcU
-# define SSL_DEFAULT_MASK 0X00000200U
-
-# define SSL_NOT_EXP 0x00000001U
-# define SSL_EXPORT 0x00000002U
-
-# define SSL_STRONG_NONE 0x00000004U
-# define SSL_EXP40 0x00000008U
-# define SSL_MICRO (SSL_EXP40)
-# define SSL_EXP56 0x00000010U
-# define SSL_MINI (SSL_EXP56)
-# define SSL_LOW 0x00000020U
-# define SSL_MEDIUM 0x00000040U
-# define SSL_HIGH 0x00000080U
-# define SSL_FIPS 0x00000100U
+# define SSL_DEFAULT_MASK 0X00000020U
-# define SSL_NOT_DEFAULT 0x00000200U
+# define SSL_STRONG_NONE 0x00000001U
+# define SSL_LOW 0x00000002U
+# define SSL_MEDIUM 0x00000004U
+# define SSL_HIGH 0x00000008U
+# define SSL_FIPS 0x00000010U
+# define SSL_NOT_DEFAULT 0x00000020U
-/* we have used 000003ff - 22 bits left to go */
-
-/*-
- * Macros to check the export status and cipher strength for export ciphers.
- * Even though the macros for EXPORT and EXPORT40/56 have similar names,
- * their meaning is different:
- * *_EXPORT macros check the 'exportable' status.
- * *_EXPORT40/56 macros are used to check whether a certain cipher strength
- * is given.
- * Since the SSL_IS_EXPORT* and SSL_EXPORT* macros depend on the correct
- * algorithm structure element to be passed (algorithms, algo_strength) and no
- * typechecking can be done as they are all of type unsigned long, their
- * direct usage is discouraged.
- * Use the SSL_C_* macros instead.
- */
-# define SSL_IS_EXPORT(a) ((a)&SSL_EXPORT)
-# define SSL_IS_EXPORT56(a) ((a)&SSL_EXP56)
-# define SSL_IS_EXPORT40(a) ((a)&SSL_EXP40)
-# define SSL_C_IS_EXPORT(c) SSL_IS_EXPORT((c)->algo_strength)
-# define SSL_C_IS_EXPORT56(c) SSL_IS_EXPORT56((c)->algo_strength)
-# define SSL_C_IS_EXPORT40(c) SSL_IS_EXPORT40((c)->algo_strength)
-
-# define SSL_EXPORT_KEYLENGTH(a,s) (SSL_IS_EXPORT40(s) ? 5 : \
- (a) == SSL_DES ? 8 : 7)
-# define SSL_EXPORT_PKEYLENGTH(a) (SSL_IS_EXPORT40(a) ? 512 : 1024)
-# define SSL_C_EXPORT_KEYLENGTH(c) SSL_EXPORT_KEYLENGTH((c)->algorithm_enc, \
- (c)->algo_strength)
-# define SSL_C_EXPORT_PKEYLENGTH(c) SSL_EXPORT_PKEYLENGTH((c)->algo_strength)
+/* we have used 0000003f - 26 bits left to go */
/* Check if an SSL structure is using DTLS */
# define SSL_IS_DTLS(s) (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_DTLS)
# define SSL_PKEY_RSA_ENC 0
# define SSL_PKEY_RSA_SIGN 1
# define SSL_PKEY_DSA_SIGN 2
-# define SSL_PKEY_DH_RSA 3
-# define SSL_PKEY_DH_DSA 4
-# define SSL_PKEY_ECC 5
-# define SSL_PKEY_GOST01 7
-# define SSL_PKEY_GOST12_256 8
-# define SSL_PKEY_GOST12_512 9
-# define SSL_PKEY_NUM 10
+# define SSL_PKEY_ECC 3
+# define SSL_PKEY_GOST01 4
+# define SSL_PKEY_GOST12_256 5
+# define SSL_PKEY_GOST12_512 6
+# define SSL_PKEY_NUM 7
/*
* Pseudo-constant. GOST cipher suites can use different certs for 1
* SSL_CIPHER. So let's see which one we have in fact.
# define SSL_PKEY_GOST_EC SSL_PKEY_NUM+1
/*-
- * SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) |
- * <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN)
+ * SSL_kRSA <- RSA_ENC
* SSL_kDH <- DH_ENC & (RSA_ENC | RSA_SIGN | DSA_SIGN)
* SSL_kDHE <- RSA_ENC | RSA_SIGN | DSA_SIGN
* SSL_aRSA <- RSA_ENC | RSA_SIGN
/* flags for countermeasure against known-IV weakness */
int need_empty_fragments;
int empty_fragment_done;
- /* The value of 'extra' when the buffers were initialized */
- int init_extra;
/* used during startup, digest all incoming/outgoing packets */
BIO *handshake_buffer;
/*
DH *dh;
# endif
# ifndef OPENSSL_NO_EC
- EC_KEY *ecdh; /* holds short lived ECDH key */
+ EVP_PKEY *pkey; /* holds short lived ECDH key */
# endif
/* used for certificate requests */
int cert_req;
int ctype_num;
char ctype[SSL3_CT_NUMBER];
STACK_OF(X509_NAME) *ca_names;
- int use_rsa_tmp;
int key_block_length;
unsigned char *key_block;
const EVP_CIPHER *new_sym_enc;
*/
uint32_t mask_k;
uint32_t mask_a;
- uint32_t export_mask_k;
- uint32_t export_mask_a;
/* Client only */
uint32_t mask_ssl;
} tmp;
# endif /* !OPENSSL_NO_EC */
/* For clients: peer temporary key */
-# ifndef OPENSSL_NO_RSA
- RSA *peer_rsa_tmp;
-# endif
-# ifndef OPENSSL_NO_DH
- DH *peer_dh_tmp;
-# endif
-# ifndef OPENSSL_NO_EC
- EC_KEY *peer_ecdh_tmp;
+# if !defined(OPENSSL_NO_EC) || !defined(OPENSSL_NO_DH)
+ EVP_PKEY *peer_tmp;
# endif
} SSL3_STATE;
* an index, not a pointer.
*/
CERT_PKEY *key;
-# ifndef OPENSSL_NO_RSA
- RSA *rsa_tmp;
- RSA *(*rsa_tmp_cb) (SSL *ssl, int is_export, int keysize);
-# endif
# ifndef OPENSSL_NO_DH
DH *dh_tmp;
DH *(*dh_tmp_cb) (SSL *ssl, int is_export, int keysize);
int dh_tmp_auto;
-# endif
-# ifndef OPENSSL_NO_EC
- EC_KEY *ecdh_tmp;
- /* Callback for generating ephemeral ECDH keys */
- EC_KEY *(*ecdh_tmp_cb) (SSL *ssl, int is_export, int keysize);
- /* Select ECDH parameters automatically */
- int ecdh_tmp_auto;
# endif
/* Flags related to certificates */
uint32_t cert_flags;
__owur int ssl_fill_hello_random(SSL *s, int server, unsigned char *field, int len);
__owur int ssl_generate_master_secret(SSL *s, unsigned char *pms, size_t pmslen,
int free_pms);
+__owur EVP_PKEY *ssl_generate_pkey(EVP_PKEY *pm, int nid);
+__owur int ssl_derive(SSL *s, EVP_PKEY *privkey, EVP_PKEY *pubkey);
+__owur EVP_PKEY *ssl_dh_to_pkey(DH *dh);
__owur const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
__owur int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
__owur int dtls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length);
# endif
-__owur int tls1_process_ticket(SSL *s, const PACKET *ext,
- const PACKET *session_id, SSL_SESSION **ret);
+__owur int tls_check_serverhello_tlsext_early(SSL *s, const PACKET *ext,
+ const PACKET *session_id,
+ SSL_SESSION **ret);
__owur int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk,
const EVP_MD *md);