+ /*
+ * Export ciphersuites may have temporary RSA keys if the public key in the
+ * server certificate is longer than the maximum export strength
+ */
+ if ((alg_k & SSL_kRSA) && SSL_C_IS_EXPORT(s->s3->tmp.new_cipher)) {
+ EVP_PKEY *pkey;
+
+ pkey = X509_get_pubkey(s->session->peer);
+ if (pkey == NULL)
+ return -1;
+
+ /*
+ * If the public key in the certificate is shorter than or equal to the
+ * maximum export strength then a temporary RSA key is not allowed
+ */
+ if (EVP_PKEY_bits(pkey)
+ <= SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher))
+ return 0;
+
+ EVP_PKEY_free(pkey);
+
+ return 1;
+ }
+
+ return 0;