You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

514 lines
18 KiB

  1. /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  2. * All rights reserved.
  3. *
  4. * This package is an SSL implementation written
  5. * by Eric Young (eay@cryptsoft.com).
  6. * The implementation was written so as to conform with Netscapes SSL.
  7. *
  8. * This library is free for commercial and non-commercial use as long as
  9. * the following conditions are aheared to. The following conditions
  10. * apply to all code found in this distribution, be it the RC4, RSA,
  11. * lhash, DES, etc., code; not just the SSL code. The SSL documentation
  12. * included with this distribution is covered by the same copyright terms
  13. * except that the holder is Tim Hudson (tjh@cryptsoft.com).
  14. *
  15. * Copyright remains Eric Young's, and as such any Copyright notices in
  16. * the code are not to be removed.
  17. * If this package is used in a product, Eric Young should be given attribution
  18. * as the author of the parts of the library used.
  19. * This can be in the form of a textual message at program startup or
  20. * in documentation (online or textual) provided with the package.
  21. *
  22. * Redistribution and use in source and binary forms, with or without
  23. * modification, are permitted provided that the following conditions
  24. * are met:
  25. * 1. Redistributions of source code must retain the copyright
  26. * notice, this list of conditions and the following disclaimer.
  27. * 2. Redistributions in binary form must reproduce the above copyright
  28. * notice, this list of conditions and the following disclaimer in the
  29. * documentation and/or other materials provided with the distribution.
  30. * 3. All advertising materials mentioning features or use of this software
  31. * must display the following acknowledgement:
  32. * "This product includes cryptographic software written by
  33. * Eric Young (eay@cryptsoft.com)"
  34. * The word 'cryptographic' can be left out if the rouines from the library
  35. * being used are not cryptographic related :-).
  36. * 4. If you include any Windows specific code (or a derivative thereof) from
  37. * the apps directory (application code) you must include an acknowledgement:
  38. * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
  39. *
  40. * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  41. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  43. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  44. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  45. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  46. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  48. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  49. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  50. * SUCH DAMAGE.
  51. *
  52. * The licence and distribution terms for any publically available version or
  53. * derivative of this code cannot be changed. i.e. this code cannot simply be
  54. * copied and put under another distribution licence
  55. * [including the GNU Public Licence.]
  56. */
  57. /* ====================================================================
  58. * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
  59. *
  60. * Redistribution and use in source and binary forms, with or without
  61. * modification, are permitted provided that the following conditions
  62. * are met:
  63. *
  64. * 1. Redistributions of source code must retain the above copyright
  65. * notice, this list of conditions and the following disclaimer.
  66. *
  67. * 2. Redistributions in binary form must reproduce the above copyright
  68. * notice, this list of conditions and the following disclaimer in
  69. * the documentation and/or other materials provided with the
  70. * distribution.
  71. *
  72. * 3. All advertising materials mentioning features or use of this
  73. * software must display the following acknowledgment:
  74. * "This product includes software developed by the OpenSSL Project
  75. * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  76. *
  77. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  78. * endorse or promote products derived from this software without
  79. * prior written permission. For written permission, please contact
  80. * openssl-core@openssl.org.
  81. *
  82. * 5. Products derived from this software may not be called "OpenSSL"
  83. * nor may "OpenSSL" appear in their names without prior written
  84. * permission of the OpenSSL Project.
  85. *
  86. * 6. Redistributions of any form whatsoever must retain the following
  87. * acknowledgment:
  88. * "This product includes software developed by the OpenSSL Project
  89. * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  90. *
  91. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  92. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  93. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  94. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  95. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  96. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  97. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  98. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  99. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  100. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  101. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  102. * OF THE POSSIBILITY OF SUCH DAMAGE.
  103. * ====================================================================
  104. *
  105. * This product includes cryptographic software written by Eric Young
  106. * (eay@cryptsoft.com). This product includes software written by Tim
  107. * Hudson (tjh@cryptsoft.com). */
  108. #include <openssl/ssl.h>
  109. #include <assert.h>
  110. #include <string.h>
  111. #include <openssl/bytestring.h>
  112. #include <openssl/err.h>
  113. #include <openssl/mem.h>
  114. #include "internal.h"
  115. #include "../crypto/internal.h"
  116. /* kMaxEmptyRecords is the number of consecutive, empty records that will be
  117. * processed. Without this limit an attacker could send empty records at a
  118. * faster rate than we can process and cause record processing to loop
  119. * forever. */
  120. static const uint8_t kMaxEmptyRecords = 32;
  121. /* kMaxEarlyDataSkipped is the maximum number of rejected early data bytes that
  122. * will be skipped. Without this limit an attacker could send records at a
  123. * faster rate than we can process and cause trial decryption to loop forever.
  124. * This value should be slightly above kMaxEarlyDataAccepted, which is measured
  125. * in plaintext. */
  126. static const size_t kMaxEarlyDataSkipped = 16384;
  127. /* kMaxWarningAlerts is the number of consecutive warning alerts that will be
  128. * processed. */
  129. static const uint8_t kMaxWarningAlerts = 4;
  130. /* ssl_needs_record_splitting returns one if |ssl|'s current outgoing cipher
  131. * state needs record-splitting and zero otherwise. */
  132. static int ssl_needs_record_splitting(const SSL *ssl) {
  133. return ssl->s3->aead_write_ctx != NULL &&
  134. ssl->s3->aead_write_ctx->version < TLS1_1_VERSION &&
  135. (ssl->mode & SSL_MODE_CBC_RECORD_SPLITTING) != 0 &&
  136. SSL_CIPHER_is_block_cipher(ssl->s3->aead_write_ctx->cipher);
  137. }
  138. int ssl_record_sequence_update(uint8_t *seq, size_t seq_len) {
  139. for (size_t i = seq_len - 1; i < seq_len; i--) {
  140. ++seq[i];
  141. if (seq[i] != 0) {
  142. return 1;
  143. }
  144. }
  145. OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
  146. return 0;
  147. }
  148. size_t ssl_record_prefix_len(const SSL *ssl) {
  149. size_t header_len;
  150. if (SSL_is_dtls(ssl)) {
  151. header_len = DTLS1_RT_HEADER_LENGTH;
  152. } else {
  153. header_len = SSL3_RT_HEADER_LENGTH;
  154. }
  155. return header_len + SSL_AEAD_CTX_explicit_nonce_len(ssl->s3->aead_read_ctx);
  156. }
  157. size_t ssl_seal_align_prefix_len(const SSL *ssl) {
  158. if (SSL_is_dtls(ssl)) {
  159. return DTLS1_RT_HEADER_LENGTH +
  160. SSL_AEAD_CTX_explicit_nonce_len(ssl->s3->aead_write_ctx);
  161. }
  162. size_t ret = SSL3_RT_HEADER_LENGTH +
  163. SSL_AEAD_CTX_explicit_nonce_len(ssl->s3->aead_write_ctx);
  164. if (ssl_needs_record_splitting(ssl)) {
  165. ret += SSL3_RT_HEADER_LENGTH;
  166. ret += ssl_cipher_get_record_split_len(ssl->s3->aead_write_ctx->cipher);
  167. }
  168. return ret;
  169. }
  170. size_t SSL_max_seal_overhead(const SSL *ssl) {
  171. if (SSL_is_dtls(ssl)) {
  172. return dtls_max_seal_overhead(ssl, dtls1_use_current_epoch);
  173. }
  174. size_t ret = SSL3_RT_HEADER_LENGTH;
  175. ret += SSL_AEAD_CTX_max_overhead(ssl->s3->aead_write_ctx);
  176. /* TLS 1.3 needs an extra byte for the encrypted record type. */
  177. if (ssl->s3->aead_write_ctx != NULL &&
  178. ssl->s3->aead_write_ctx->version >= TLS1_3_VERSION) {
  179. ret += 1;
  180. }
  181. if (ssl_needs_record_splitting(ssl)) {
  182. ret *= 2;
  183. }
  184. return ret;
  185. }
  186. enum ssl_open_record_t tls_open_record(SSL *ssl, uint8_t *out_type, CBS *out,
  187. size_t *out_consumed, uint8_t *out_alert,
  188. uint8_t *in, size_t in_len) {
  189. *out_consumed = 0;
  190. CBS cbs;
  191. CBS_init(&cbs, in, in_len);
  192. /* Decode the record header. */
  193. uint8_t type;
  194. uint16_t version, ciphertext_len;
  195. if (!CBS_get_u8(&cbs, &type) ||
  196. !CBS_get_u16(&cbs, &version) ||
  197. !CBS_get_u16(&cbs, &ciphertext_len)) {
  198. *out_consumed = SSL3_RT_HEADER_LENGTH;
  199. return ssl_open_record_partial;
  200. }
  201. int version_ok;
  202. if (ssl->s3->aead_read_ctx == NULL) {
  203. /* Only check the first byte. Enforcing beyond that can prevent decoding
  204. * version negotiation failure alerts. */
  205. version_ok = (version >> 8) == SSL3_VERSION_MAJOR;
  206. } else if (ssl3_protocol_version(ssl) < TLS1_3_VERSION) {
  207. /* Earlier versions of TLS switch the record version. */
  208. version_ok = version == ssl->version;
  209. } else {
  210. /* Starting TLS 1.3, the version field is frozen at {3, 1}. */
  211. version_ok = version == TLS1_VERSION;
  212. }
  213. if (!version_ok) {
  214. OPENSSL_PUT_ERROR(SSL, SSL_R_WRONG_VERSION_NUMBER);
  215. *out_alert = SSL_AD_PROTOCOL_VERSION;
  216. return ssl_open_record_error;
  217. }
  218. /* Check the ciphertext length. */
  219. if (ciphertext_len > SSL3_RT_MAX_ENCRYPTED_LENGTH) {
  220. OPENSSL_PUT_ERROR(SSL, SSL_R_ENCRYPTED_LENGTH_TOO_LONG);
  221. *out_alert = SSL_AD_RECORD_OVERFLOW;
  222. return ssl_open_record_error;
  223. }
  224. /* Extract the body. */
  225. CBS body;
  226. if (!CBS_get_bytes(&cbs, &body, ciphertext_len)) {
  227. *out_consumed = SSL3_RT_HEADER_LENGTH + (size_t)ciphertext_len;
  228. return ssl_open_record_partial;
  229. }
  230. ssl_do_msg_callback(ssl, 0 /* read */, SSL3_RT_HEADER, in,
  231. SSL3_RT_HEADER_LENGTH);
  232. *out_consumed = in_len - CBS_len(&cbs);
  233. /* Skip early data received when expecting a second ClientHello if we rejected
  234. * 0RTT. */
  235. if (ssl->s3->skip_early_data &&
  236. ssl->s3->aead_read_ctx == NULL &&
  237. type == SSL3_RT_APPLICATION_DATA) {
  238. goto skipped_data;
  239. }
  240. /* Decrypt the body in-place. */
  241. if (!SSL_AEAD_CTX_open(ssl->s3->aead_read_ctx, out, type, version,
  242. ssl->s3->read_sequence, (uint8_t *)CBS_data(&body),
  243. CBS_len(&body))) {
  244. if (ssl->s3->skip_early_data &&
  245. ssl->s3->aead_read_ctx != NULL) {
  246. ERR_clear_error();
  247. goto skipped_data;
  248. }
  249. OPENSSL_PUT_ERROR(SSL, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
  250. *out_alert = SSL_AD_BAD_RECORD_MAC;
  251. return ssl_open_record_error;
  252. }
  253. ssl->s3->skip_early_data = 0;
  254. if (!ssl_record_sequence_update(ssl->s3->read_sequence, 8)) {
  255. *out_alert = SSL_AD_INTERNAL_ERROR;
  256. return ssl_open_record_error;
  257. }
  258. /* TLS 1.3 hides the record type inside the encrypted data. */
  259. if (ssl->s3->aead_read_ctx != NULL &&
  260. ssl->s3->aead_read_ctx->version >= TLS1_3_VERSION) {
  261. /* The outer record type is always application_data. */
  262. if (type != SSL3_RT_APPLICATION_DATA) {
  263. OPENSSL_PUT_ERROR(SSL, SSL_R_INVALID_OUTER_RECORD_TYPE);
  264. *out_alert = SSL_AD_DECODE_ERROR;
  265. return ssl_open_record_error;
  266. }
  267. do {
  268. if (!CBS_get_last_u8(out, &type)) {
  269. OPENSSL_PUT_ERROR(SSL, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
  270. *out_alert = SSL_AD_DECRYPT_ERROR;
  271. return ssl_open_record_error;
  272. }
  273. } while (type == 0);
  274. }
  275. /* Check the plaintext length. */
  276. if (CBS_len(out) > SSL3_RT_MAX_PLAIN_LENGTH) {
  277. OPENSSL_PUT_ERROR(SSL, SSL_R_DATA_LENGTH_TOO_LONG);
  278. *out_alert = SSL_AD_RECORD_OVERFLOW;
  279. return ssl_open_record_error;
  280. }
  281. /* Limit the number of consecutive empty records. */
  282. if (CBS_len(out) == 0) {
  283. ssl->s3->empty_record_count++;
  284. if (ssl->s3->empty_record_count > kMaxEmptyRecords) {
  285. OPENSSL_PUT_ERROR(SSL, SSL_R_TOO_MANY_EMPTY_FRAGMENTS);
  286. *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
  287. return ssl_open_record_error;
  288. }
  289. /* Apart from the limit, empty records are returned up to the caller. This
  290. * allows the caller to reject records of the wrong type. */
  291. } else {
  292. ssl->s3->empty_record_count = 0;
  293. }
  294. if (type == SSL3_RT_ALERT) {
  295. /* Return end_of_early_data alerts as-is for the caller to process. */
  296. if (CBS_len(out) == 2 &&
  297. CBS_data(out)[0] == SSL3_AL_WARNING &&
  298. CBS_data(out)[1] == TLS1_AD_END_OF_EARLY_DATA) {
  299. *out_type = type;
  300. return ssl_open_record_success;
  301. }
  302. return ssl_process_alert(ssl, out_alert, CBS_data(out), CBS_len(out));
  303. }
  304. ssl->s3->warning_alert_count = 0;
  305. *out_type = type;
  306. return ssl_open_record_success;
  307. skipped_data:
  308. ssl->s3->early_data_skipped += *out_consumed;
  309. if (ssl->s3->early_data_skipped < *out_consumed) {
  310. ssl->s3->early_data_skipped = kMaxEarlyDataSkipped + 1;
  311. }
  312. if (ssl->s3->early_data_skipped > kMaxEarlyDataSkipped) {
  313. OPENSSL_PUT_ERROR(SSL, SSL_R_TOO_MUCH_SKIPPED_EARLY_DATA);
  314. *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
  315. return ssl_open_record_error;
  316. }
  317. return ssl_open_record_discard;
  318. }
  319. static int do_seal_record(SSL *ssl, uint8_t *out, size_t *out_len,
  320. size_t max_out, uint8_t type, const uint8_t *in,
  321. size_t in_len) {
  322. assert(!buffers_alias(in, in_len, out, max_out));
  323. /* TLS 1.3 hides the actual record type inside the encrypted data. */
  324. if (ssl->s3->aead_write_ctx != NULL &&
  325. ssl->s3->aead_write_ctx->version >= TLS1_3_VERSION) {
  326. if (in_len > in_len + SSL3_RT_HEADER_LENGTH + 1 ||
  327. max_out < in_len + SSL3_RT_HEADER_LENGTH + 1) {
  328. OPENSSL_PUT_ERROR(SSL, SSL_R_BUFFER_TOO_SMALL);
  329. return 0;
  330. }
  331. OPENSSL_memcpy(out + SSL3_RT_HEADER_LENGTH, in, in_len);
  332. out[SSL3_RT_HEADER_LENGTH + in_len] = type;
  333. in = out + SSL3_RT_HEADER_LENGTH;
  334. type = SSL3_RT_APPLICATION_DATA;
  335. in_len++;
  336. }
  337. if (max_out < SSL3_RT_HEADER_LENGTH) {
  338. OPENSSL_PUT_ERROR(SSL, SSL_R_BUFFER_TOO_SMALL);
  339. return 0;
  340. }
  341. /* The TLS record-layer version number is meaningless and, starting in
  342. * TLS 1.3, is frozen at TLS 1.0. But for historical reasons, SSL 3.0
  343. * ClientHellos should use SSL 3.0 and pre-TLS-1.3 expects the version
  344. * to change after version negotiation. */
  345. uint16_t wire_version = TLS1_VERSION;
  346. if (ssl->version == SSL3_VERSION ||
  347. (ssl->s3->have_version && ssl3_protocol_version(ssl) < TLS1_3_VERSION)) {
  348. wire_version = ssl->version;
  349. }
  350. /* Write the non-length portions of the header. */
  351. out[0] = type;
  352. out[1] = wire_version >> 8;
  353. out[2] = wire_version & 0xff;
  354. out += 3;
  355. max_out -= 3;
  356. /* Write the ciphertext, leaving two bytes for the length. */
  357. size_t ciphertext_len;
  358. if (!SSL_AEAD_CTX_seal(ssl->s3->aead_write_ctx, out + 2, &ciphertext_len,
  359. max_out - 2, type, wire_version,
  360. ssl->s3->write_sequence, in, in_len) ||
  361. !ssl_record_sequence_update(ssl->s3->write_sequence, 8)) {
  362. return 0;
  363. }
  364. /* Fill in the length. */
  365. if (ciphertext_len >= 1 << 15) {
  366. OPENSSL_PUT_ERROR(SSL, ERR_R_OVERFLOW);
  367. return 0;
  368. }
  369. out[0] = ciphertext_len >> 8;
  370. out[1] = ciphertext_len & 0xff;
  371. *out_len = SSL3_RT_HEADER_LENGTH + ciphertext_len;
  372. ssl_do_msg_callback(ssl, 1 /* write */, SSL3_RT_HEADER, out,
  373. SSL3_RT_HEADER_LENGTH);
  374. return 1;
  375. }
  376. int tls_seal_record(SSL *ssl, uint8_t *out, size_t *out_len, size_t max_out,
  377. uint8_t type, const uint8_t *in, size_t in_len) {
  378. if (buffers_alias(in, in_len, out, max_out)) {
  379. OPENSSL_PUT_ERROR(SSL, SSL_R_OUTPUT_ALIASES_INPUT);
  380. return 0;
  381. }
  382. size_t frag_len = 0;
  383. if (type == SSL3_RT_APPLICATION_DATA && in_len > 1 &&
  384. ssl_needs_record_splitting(ssl)) {
  385. if (!do_seal_record(ssl, out, &frag_len, max_out, type, in, 1)) {
  386. return 0;
  387. }
  388. in++;
  389. in_len--;
  390. out += frag_len;
  391. max_out -= frag_len;
  392. #if !defined(BORINGSSL_UNSAFE_FUZZER_MODE)
  393. assert(SSL3_RT_HEADER_LENGTH + ssl_cipher_get_record_split_len(
  394. ssl->s3->aead_write_ctx->cipher) ==
  395. frag_len);
  396. #endif
  397. }
  398. if (!do_seal_record(ssl, out, out_len, max_out, type, in, in_len)) {
  399. return 0;
  400. }
  401. *out_len += frag_len;
  402. return 1;
  403. }
  404. enum ssl_open_record_t ssl_process_alert(SSL *ssl, uint8_t *out_alert,
  405. const uint8_t *in, size_t in_len) {
  406. /* Alerts records may not contain fragmented or multiple alerts. */
  407. if (in_len != 2) {
  408. *out_alert = SSL_AD_DECODE_ERROR;
  409. OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_ALERT);
  410. return ssl_open_record_error;
  411. }
  412. ssl_do_msg_callback(ssl, 0 /* read */, SSL3_RT_ALERT, in, in_len);
  413. const uint8_t alert_level = in[0];
  414. const uint8_t alert_descr = in[1];
  415. uint16_t alert = (alert_level << 8) | alert_descr;
  416. ssl_do_info_callback(ssl, SSL_CB_READ_ALERT, alert);
  417. if (alert_level == SSL3_AL_WARNING) {
  418. if (alert_descr == SSL_AD_CLOSE_NOTIFY) {
  419. ssl->s3->recv_shutdown = ssl_shutdown_close_notify;
  420. return ssl_open_record_close_notify;
  421. }
  422. /* Warning alerts do not exist in TLS 1.3. */
  423. if (ssl->s3->have_version &&
  424. ssl3_protocol_version(ssl) >= TLS1_3_VERSION) {
  425. *out_alert = SSL_AD_DECODE_ERROR;
  426. OPENSSL_PUT_ERROR(SSL, SSL_R_BAD_ALERT);
  427. return ssl_open_record_error;
  428. }
  429. ssl->s3->warning_alert_count++;
  430. if (ssl->s3->warning_alert_count > kMaxWarningAlerts) {
  431. *out_alert = SSL_AD_UNEXPECTED_MESSAGE;
  432. OPENSSL_PUT_ERROR(SSL, SSL_R_TOO_MANY_WARNING_ALERTS);
  433. return ssl_open_record_error;
  434. }
  435. return ssl_open_record_discard;
  436. }
  437. if (alert_level == SSL3_AL_FATAL) {
  438. ssl->s3->recv_shutdown = ssl_shutdown_fatal_alert;
  439. char tmp[16];
  440. OPENSSL_PUT_ERROR(SSL, SSL_AD_REASON_OFFSET + alert_descr);
  441. BIO_snprintf(tmp, sizeof(tmp), "%d", alert_descr);
  442. ERR_add_error_data(2, "SSL alert number ", tmp);
  443. return ssl_open_record_fatal_alert;
  444. }
  445. *out_alert = SSL_AD_ILLEGAL_PARAMETER;
  446. OPENSSL_PUT_ERROR(SSL, SSL_R_UNKNOWN_ALERT_TYPE);
  447. return ssl_open_record_error;
  448. }