summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/s3_lib.c416
-rw-r--r--src/lib/libssl/ssl_asn1.c18
-rw-r--r--src/lib/libssl/ssl_ciph.c56
-rw-r--r--src/lib/libssl/ssl_ciphers.c20
-rw-r--r--src/lib/libssl/ssl_clnt.c8
-rw-r--r--src/lib/libssl/ssl_local.h12
-rw-r--r--src/lib/libssl/ssl_pkt.c4
-rw-r--r--src/lib/libssl/ssl_sess.c6
-rw-r--r--src/lib/libssl/ssl_srvr.c15
-rw-r--r--src/lib/libssl/ssl_txt.c8
-rw-r--r--src/lib/libssl/tls13_client.c4
-rw-r--r--src/lib/libssl/tls13_server.c4
12 files changed, 179 insertions, 392 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 38e7ba7f19..d30eb6deb7 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.255 2024/07/19 08:54:31 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.256 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -171,12 +171,12 @@
171/* list of available SSLv3 ciphers (sorted by id) */ 171/* list of available SSLv3 ciphers (sorted by id) */
172const SSL_CIPHER ssl3_ciphers[] = { 172const SSL_CIPHER ssl3_ciphers[] = {
173 173
174 /* The RSA ciphers */ 174 /*
175 /* Cipher 01 */ 175 * SSLv3 RSA cipher suites (RFC 6101, appendix A.6).
176 */
176 { 177 {
177 .valid = 1, 178 .value = 0x0001,
178 .name = SSL3_TXT_RSA_NULL_MD5, 179 .name = SSL3_TXT_RSA_NULL_MD5,
179 .id = SSL3_CK_RSA_NULL_MD5,
180 .algorithm_mkey = SSL_kRSA, 180 .algorithm_mkey = SSL_kRSA,
181 .algorithm_auth = SSL_aRSA, 181 .algorithm_auth = SSL_aRSA,
182 .algorithm_enc = SSL_eNULL, 182 .algorithm_enc = SSL_eNULL,
@@ -187,12 +187,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
187 .strength_bits = 0, 187 .strength_bits = 0,
188 .alg_bits = 0, 188 .alg_bits = 0,
189 }, 189 },
190
191 /* Cipher 02 */
192 { 190 {
193 .valid = 1, 191 .value = 0x0002,
194 .name = SSL3_TXT_RSA_NULL_SHA, 192 .name = SSL3_TXT_RSA_NULL_SHA,
195 .id = SSL3_CK_RSA_NULL_SHA,
196 .algorithm_mkey = SSL_kRSA, 193 .algorithm_mkey = SSL_kRSA,
197 .algorithm_auth = SSL_aRSA, 194 .algorithm_auth = SSL_aRSA,
198 .algorithm_enc = SSL_eNULL, 195 .algorithm_enc = SSL_eNULL,
@@ -203,12 +200,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
203 .strength_bits = 0, 200 .strength_bits = 0,
204 .alg_bits = 0, 201 .alg_bits = 0,
205 }, 202 },
206
207 /* Cipher 04 */
208 { 203 {
209 .valid = 1, 204 .value = 0x0004,
210 .name = SSL3_TXT_RSA_RC4_128_MD5, 205 .name = SSL3_TXT_RSA_RC4_128_MD5,
211 .id = SSL3_CK_RSA_RC4_128_MD5,
212 .algorithm_mkey = SSL_kRSA, 206 .algorithm_mkey = SSL_kRSA,
213 .algorithm_auth = SSL_aRSA, 207 .algorithm_auth = SSL_aRSA,
214 .algorithm_enc = SSL_RC4, 208 .algorithm_enc = SSL_RC4,
@@ -219,12 +213,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
219 .strength_bits = 128, 213 .strength_bits = 128,
220 .alg_bits = 128, 214 .alg_bits = 128,
221 }, 215 },
222
223 /* Cipher 05 */
224 { 216 {
225 .valid = 1, 217 .value = 0x0005,
226 .name = SSL3_TXT_RSA_RC4_128_SHA, 218 .name = SSL3_TXT_RSA_RC4_128_SHA,
227 .id = SSL3_CK_RSA_RC4_128_SHA,
228 .algorithm_mkey = SSL_kRSA, 219 .algorithm_mkey = SSL_kRSA,
229 .algorithm_auth = SSL_aRSA, 220 .algorithm_auth = SSL_aRSA,
230 .algorithm_enc = SSL_RC4, 221 .algorithm_enc = SSL_RC4,
@@ -235,12 +226,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
235 .strength_bits = 128, 226 .strength_bits = 128,
236 .alg_bits = 128, 227 .alg_bits = 128,
237 }, 228 },
238
239 /* Cipher 0A */
240 { 229 {
241 .valid = 1, 230 .value = 0x000a,
242 .name = SSL3_TXT_RSA_DES_192_CBC3_SHA, 231 .name = SSL3_TXT_RSA_DES_192_CBC3_SHA,
243 .id = SSL3_CK_RSA_DES_192_CBC3_SHA,
244 .algorithm_mkey = SSL_kRSA, 232 .algorithm_mkey = SSL_kRSA,
245 .algorithm_auth = SSL_aRSA, 233 .algorithm_auth = SSL_aRSA,
246 .algorithm_enc = SSL_3DES, 234 .algorithm_enc = SSL_3DES,
@@ -253,14 +241,11 @@ const SSL_CIPHER ssl3_ciphers[] = {
253 }, 241 },
254 242
255 /* 243 /*
256 * Ephemeral DH (DHE) ciphers. 244 * SSLv3 DHE cipher suites (RFC 6101, appendix A.6).
257 */ 245 */
258
259 /* Cipher 16 */
260 { 246 {
261 .valid = 1, 247 .value = 0x0016,
262 .name = SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA, 248 .name = SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA,
263 .id = SSL3_CK_EDH_RSA_DES_192_CBC3_SHA,
264 .algorithm_mkey = SSL_kDHE, 249 .algorithm_mkey = SSL_kDHE,
265 .algorithm_auth = SSL_aRSA, 250 .algorithm_auth = SSL_aRSA,
266 .algorithm_enc = SSL_3DES, 251 .algorithm_enc = SSL_3DES,
@@ -271,12 +256,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
271 .strength_bits = 112, 256 .strength_bits = 112,
272 .alg_bits = 168, 257 .alg_bits = 168,
273 }, 258 },
274
275 /* Cipher 18 */
276 { 259 {
277 .valid = 1, 260 .value = 0x0018,
278 .name = SSL3_TXT_ADH_RC4_128_MD5, 261 .name = SSL3_TXT_ADH_RC4_128_MD5,
279 .id = SSL3_CK_ADH_RC4_128_MD5,
280 .algorithm_mkey = SSL_kDHE, 262 .algorithm_mkey = SSL_kDHE,
281 .algorithm_auth = SSL_aNULL, 263 .algorithm_auth = SSL_aNULL,
282 .algorithm_enc = SSL_RC4, 264 .algorithm_enc = SSL_RC4,
@@ -287,12 +269,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
287 .strength_bits = 128, 269 .strength_bits = 128,
288 .alg_bits = 128, 270 .alg_bits = 128,
289 }, 271 },
290
291 /* Cipher 1B */
292 { 272 {
293 .valid = 1, 273 .value = 0x001b,
294 .name = SSL3_TXT_ADH_DES_192_CBC_SHA, 274 .name = SSL3_TXT_ADH_DES_192_CBC_SHA,
295 .id = SSL3_CK_ADH_DES_192_CBC_SHA,
296 .algorithm_mkey = SSL_kDHE, 275 .algorithm_mkey = SSL_kDHE,
297 .algorithm_auth = SSL_aNULL, 276 .algorithm_auth = SSL_aNULL,
298 .algorithm_enc = SSL_3DES, 277 .algorithm_enc = SSL_3DES,
@@ -305,14 +284,11 @@ const SSL_CIPHER ssl3_ciphers[] = {
305 }, 284 },
306 285
307 /* 286 /*
308 * AES ciphersuites. 287 * TLSv1.0 AES cipher suites (RFC 3268).
309 */ 288 */
310
311 /* Cipher 2F */
312 { 289 {
313 .valid = 1, 290 .value = 0x002f,
314 .name = TLS1_TXT_RSA_WITH_AES_128_SHA, 291 .name = TLS1_TXT_RSA_WITH_AES_128_SHA,
315 .id = TLS1_CK_RSA_WITH_AES_128_SHA,
316 .algorithm_mkey = SSL_kRSA, 292 .algorithm_mkey = SSL_kRSA,
317 .algorithm_auth = SSL_aRSA, 293 .algorithm_auth = SSL_aRSA,
318 .algorithm_enc = SSL_AES128, 294 .algorithm_enc = SSL_AES128,
@@ -323,12 +299,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
323 .strength_bits = 128, 299 .strength_bits = 128,
324 .alg_bits = 128, 300 .alg_bits = 128,
325 }, 301 },
326
327 /* Cipher 33 */
328 { 302 {
329 .valid = 1, 303 .value = 0x0033,
330 .name = TLS1_TXT_DHE_RSA_WITH_AES_128_SHA, 304 .name = TLS1_TXT_DHE_RSA_WITH_AES_128_SHA,
331 .id = TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
332 .algorithm_mkey = SSL_kDHE, 305 .algorithm_mkey = SSL_kDHE,
333 .algorithm_auth = SSL_aRSA, 306 .algorithm_auth = SSL_aRSA,
334 .algorithm_enc = SSL_AES128, 307 .algorithm_enc = SSL_AES128,
@@ -339,12 +312,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
339 .strength_bits = 128, 312 .strength_bits = 128,
340 .alg_bits = 128, 313 .alg_bits = 128,
341 }, 314 },
342
343 /* Cipher 34 */
344 { 315 {
345 .valid = 1, 316 .value = 0x0034,
346 .name = TLS1_TXT_ADH_WITH_AES_128_SHA, 317 .name = TLS1_TXT_ADH_WITH_AES_128_SHA,
347 .id = TLS1_CK_ADH_WITH_AES_128_SHA,
348 .algorithm_mkey = SSL_kDHE, 318 .algorithm_mkey = SSL_kDHE,
349 .algorithm_auth = SSL_aNULL, 319 .algorithm_auth = SSL_aNULL,
350 .algorithm_enc = SSL_AES128, 320 .algorithm_enc = SSL_AES128,
@@ -355,12 +325,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
355 .strength_bits = 128, 325 .strength_bits = 128,
356 .alg_bits = 128, 326 .alg_bits = 128,
357 }, 327 },
358
359 /* Cipher 35 */
360 { 328 {
361 .valid = 1, 329 .value = 0x0035,
362 .name = TLS1_TXT_RSA_WITH_AES_256_SHA, 330 .name = TLS1_TXT_RSA_WITH_AES_256_SHA,
363 .id = TLS1_CK_RSA_WITH_AES_256_SHA,
364 .algorithm_mkey = SSL_kRSA, 331 .algorithm_mkey = SSL_kRSA,
365 .algorithm_auth = SSL_aRSA, 332 .algorithm_auth = SSL_aRSA,
366 .algorithm_enc = SSL_AES256, 333 .algorithm_enc = SSL_AES256,
@@ -371,12 +338,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
371 .strength_bits = 256, 338 .strength_bits = 256,
372 .alg_bits = 256, 339 .alg_bits = 256,
373 }, 340 },
374
375 /* Cipher 39 */
376 { 341 {
377 .valid = 1, 342 .value = 0x0039,
378 .name = TLS1_TXT_DHE_RSA_WITH_AES_256_SHA, 343 .name = TLS1_TXT_DHE_RSA_WITH_AES_256_SHA,
379 .id = TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
380 .algorithm_mkey = SSL_kDHE, 344 .algorithm_mkey = SSL_kDHE,
381 .algorithm_auth = SSL_aRSA, 345 .algorithm_auth = SSL_aRSA,
382 .algorithm_enc = SSL_AES256, 346 .algorithm_enc = SSL_AES256,
@@ -387,12 +351,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
387 .strength_bits = 256, 351 .strength_bits = 256,
388 .alg_bits = 256, 352 .alg_bits = 256,
389 }, 353 },
390
391 /* Cipher 3A */
392 { 354 {
393 .valid = 1, 355 .value = 0x003a,
394 .name = TLS1_TXT_ADH_WITH_AES_256_SHA, 356 .name = TLS1_TXT_ADH_WITH_AES_256_SHA,
395 .id = TLS1_CK_ADH_WITH_AES_256_SHA,
396 .algorithm_mkey = SSL_kDHE, 357 .algorithm_mkey = SSL_kDHE,
397 .algorithm_auth = SSL_aNULL, 358 .algorithm_auth = SSL_aNULL,
398 .algorithm_enc = SSL_AES256, 359 .algorithm_enc = SSL_AES256,
@@ -404,12 +365,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
404 .alg_bits = 256, 365 .alg_bits = 256,
405 }, 366 },
406 367
407 /* TLS v1.2 ciphersuites */ 368 /*
408 /* Cipher 3B */ 369 * TLSv1.2 RSA cipher suites (RFC 5246, appendix A.5).
370 */
409 { 371 {
410 .valid = 1, 372 .value = 0x003b,
411 .name = TLS1_TXT_RSA_WITH_NULL_SHA256, 373 .name = TLS1_TXT_RSA_WITH_NULL_SHA256,
412 .id = TLS1_CK_RSA_WITH_NULL_SHA256,
413 .algorithm_mkey = SSL_kRSA, 374 .algorithm_mkey = SSL_kRSA,
414 .algorithm_auth = SSL_aRSA, 375 .algorithm_auth = SSL_aRSA,
415 .algorithm_enc = SSL_eNULL, 376 .algorithm_enc = SSL_eNULL,
@@ -420,12 +381,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
420 .strength_bits = 0, 381 .strength_bits = 0,
421 .alg_bits = 0, 382 .alg_bits = 0,
422 }, 383 },
423
424 /* Cipher 3C */
425 { 384 {
426 .valid = 1, 385 .value = 0x003c,
427 .name = TLS1_TXT_RSA_WITH_AES_128_SHA256, 386 .name = TLS1_TXT_RSA_WITH_AES_128_SHA256,
428 .id = TLS1_CK_RSA_WITH_AES_128_SHA256,
429 .algorithm_mkey = SSL_kRSA, 387 .algorithm_mkey = SSL_kRSA,
430 .algorithm_auth = SSL_aRSA, 388 .algorithm_auth = SSL_aRSA,
431 .algorithm_enc = SSL_AES128, 389 .algorithm_enc = SSL_AES128,
@@ -436,12 +394,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
436 .strength_bits = 128, 394 .strength_bits = 128,
437 .alg_bits = 128, 395 .alg_bits = 128,
438 }, 396 },
439
440 /* Cipher 3D */
441 { 397 {
442 .valid = 1, 398 .value = 0x003d,
443 .name = TLS1_TXT_RSA_WITH_AES_256_SHA256, 399 .name = TLS1_TXT_RSA_WITH_AES_256_SHA256,
444 .id = TLS1_CK_RSA_WITH_AES_256_SHA256,
445 .algorithm_mkey = SSL_kRSA, 400 .algorithm_mkey = SSL_kRSA,
446 .algorithm_auth = SSL_aRSA, 401 .algorithm_auth = SSL_aRSA,
447 .algorithm_enc = SSL_AES256, 402 .algorithm_enc = SSL_AES256,
@@ -454,13 +409,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
454 }, 409 },
455 410
456#ifndef OPENSSL_NO_CAMELLIA 411#ifndef OPENSSL_NO_CAMELLIA
457 /* Camellia ciphersuites from RFC4132 (128-bit portion) */ 412 /*
458 413 * TLSv1.0 Camellia 128 bit cipher suites (RFC 4132).
459 /* Cipher 41 */ 414 */
460 { 415 {
461 .valid = 1, 416 .value = 0x0041,
462 .name = TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA, 417 .name = TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA,
463 .id = TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA,
464 .algorithm_mkey = SSL_kRSA, 418 .algorithm_mkey = SSL_kRSA,
465 .algorithm_auth = SSL_aRSA, 419 .algorithm_auth = SSL_aRSA,
466 .algorithm_enc = SSL_CAMELLIA128, 420 .algorithm_enc = SSL_CAMELLIA128,
@@ -471,12 +425,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
471 .strength_bits = 128, 425 .strength_bits = 128,
472 .alg_bits = 128, 426 .alg_bits = 128,
473 }, 427 },
474
475 /* Cipher 45 */
476 { 428 {
477 .valid = 1, 429 .value = 0x0045,
478 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA, 430 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
479 .id = TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
480 .algorithm_mkey = SSL_kDHE, 431 .algorithm_mkey = SSL_kDHE,
481 .algorithm_auth = SSL_aRSA, 432 .algorithm_auth = SSL_aRSA,
482 .algorithm_enc = SSL_CAMELLIA128, 433 .algorithm_enc = SSL_CAMELLIA128,
@@ -487,12 +438,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
487 .strength_bits = 128, 438 .strength_bits = 128,
488 .alg_bits = 128, 439 .alg_bits = 128,
489 }, 440 },
490
491 /* Cipher 46 */
492 { 441 {
493 .valid = 1, 442 .value = 0x0046,
494 .name = TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA, 443 .name = TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA,
495 .id = TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA,
496 .algorithm_mkey = SSL_kDHE, 444 .algorithm_mkey = SSL_kDHE,
497 .algorithm_auth = SSL_aNULL, 445 .algorithm_auth = SSL_aNULL,
498 .algorithm_enc = SSL_CAMELLIA128, 446 .algorithm_enc = SSL_CAMELLIA128,
@@ -505,12 +453,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
505 }, 453 },
506#endif /* OPENSSL_NO_CAMELLIA */ 454#endif /* OPENSSL_NO_CAMELLIA */
507 455
508 /* TLS v1.2 ciphersuites */ 456 /*
509 /* Cipher 67 */ 457 * TLSv1.2 DHE cipher suites (RFC 5246, appendix A.5).
458 */
510 { 459 {
511 .valid = 1, 460 .value = 0x0067,
512 .name = TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256, 461 .name = TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256,
513 .id = TLS1_CK_DHE_RSA_WITH_AES_128_SHA256,
514 .algorithm_mkey = SSL_kDHE, 462 .algorithm_mkey = SSL_kDHE,
515 .algorithm_auth = SSL_aRSA, 463 .algorithm_auth = SSL_aRSA,
516 .algorithm_enc = SSL_AES128, 464 .algorithm_enc = SSL_AES128,
@@ -521,12 +469,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
521 .strength_bits = 128, 469 .strength_bits = 128,
522 .alg_bits = 128, 470 .alg_bits = 128,
523 }, 471 },
524
525 /* Cipher 6B */
526 { 472 {
527 .valid = 1, 473 .value = 0x006b,
528 .name = TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256, 474 .name = TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256,
529 .id = TLS1_CK_DHE_RSA_WITH_AES_256_SHA256,
530 .algorithm_mkey = SSL_kDHE, 475 .algorithm_mkey = SSL_kDHE,
531 .algorithm_auth = SSL_aRSA, 476 .algorithm_auth = SSL_aRSA,
532 .algorithm_enc = SSL_AES256, 477 .algorithm_enc = SSL_AES256,
@@ -537,12 +482,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
537 .strength_bits = 256, 482 .strength_bits = 256,
538 .alg_bits = 256, 483 .alg_bits = 256,
539 }, 484 },
540
541 /* Cipher 6C */
542 { 485 {
543 .valid = 1, 486 .value = 0x006c,
544 .name = TLS1_TXT_ADH_WITH_AES_128_SHA256, 487 .name = TLS1_TXT_ADH_WITH_AES_128_SHA256,
545 .id = TLS1_CK_ADH_WITH_AES_128_SHA256,
546 .algorithm_mkey = SSL_kDHE, 488 .algorithm_mkey = SSL_kDHE,
547 .algorithm_auth = SSL_aNULL, 489 .algorithm_auth = SSL_aNULL,
548 .algorithm_enc = SSL_AES128, 490 .algorithm_enc = SSL_AES128,
@@ -553,12 +495,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
553 .strength_bits = 128, 495 .strength_bits = 128,
554 .alg_bits = 128, 496 .alg_bits = 128,
555 }, 497 },
556
557 /* Cipher 6D */
558 { 498 {
559 .valid = 1, 499 .value = 0x006d,
560 .name = TLS1_TXT_ADH_WITH_AES_256_SHA256, 500 .name = TLS1_TXT_ADH_WITH_AES_256_SHA256,
561 .id = TLS1_CK_ADH_WITH_AES_256_SHA256,
562 .algorithm_mkey = SSL_kDHE, 501 .algorithm_mkey = SSL_kDHE,
563 .algorithm_auth = SSL_aNULL, 502 .algorithm_auth = SSL_aNULL,
564 .algorithm_enc = SSL_AES256, 503 .algorithm_enc = SSL_AES256,
@@ -571,13 +510,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
571 }, 510 },
572 511
573#ifndef OPENSSL_NO_CAMELLIA 512#ifndef OPENSSL_NO_CAMELLIA
574 /* Camellia ciphersuites from RFC4132 (256-bit portion) */ 513 /*
575 514 * TLSv1.0 Camellia 256 bit cipher suites (RFC 4132).
576 /* Cipher 84 */ 515 */
577 { 516 {
578 .valid = 1, 517 .value = 0x0084,
579 .name = TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA, 518 .name = TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA,
580 .id = TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA,
581 .algorithm_mkey = SSL_kRSA, 519 .algorithm_mkey = SSL_kRSA,
582 .algorithm_auth = SSL_aRSA, 520 .algorithm_auth = SSL_aRSA,
583 .algorithm_enc = SSL_CAMELLIA256, 521 .algorithm_enc = SSL_CAMELLIA256,
@@ -588,12 +526,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
588 .strength_bits = 256, 526 .strength_bits = 256,
589 .alg_bits = 256, 527 .alg_bits = 256,
590 }, 528 },
591
592 /* Cipher 88 */
593 { 529 {
594 .valid = 1, 530 .value = 0x0088,
595 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA, 531 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
596 .id = TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
597 .algorithm_mkey = SSL_kDHE, 532 .algorithm_mkey = SSL_kDHE,
598 .algorithm_auth = SSL_aRSA, 533 .algorithm_auth = SSL_aRSA,
599 .algorithm_enc = SSL_CAMELLIA256, 534 .algorithm_enc = SSL_CAMELLIA256,
@@ -604,12 +539,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
604 .strength_bits = 256, 539 .strength_bits = 256,
605 .alg_bits = 256, 540 .alg_bits = 256,
606 }, 541 },
607
608 /* Cipher 89 */
609 { 542 {
610 .valid = 1, 543 .value = 0x0089,
611 .name = TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA, 544 .name = TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA,
612 .id = TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA,
613 .algorithm_mkey = SSL_kDHE, 545 .algorithm_mkey = SSL_kDHE,
614 .algorithm_auth = SSL_aNULL, 546 .algorithm_auth = SSL_aNULL,
615 .algorithm_enc = SSL_CAMELLIA256, 547 .algorithm_enc = SSL_CAMELLIA256,
@@ -623,14 +555,11 @@ const SSL_CIPHER ssl3_ciphers[] = {
623#endif /* OPENSSL_NO_CAMELLIA */ 555#endif /* OPENSSL_NO_CAMELLIA */
624 556
625 /* 557 /*
626 * GCM ciphersuites from RFC5288. 558 * TLSv1.2 AES GCM cipher suites (RFC 5288).
627 */ 559 */
628
629 /* Cipher 9C */
630 { 560 {
631 .valid = 1, 561 .value = 0x009c,
632 .name = TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256, 562 .name = TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256,
633 .id = TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
634 .algorithm_mkey = SSL_kRSA, 563 .algorithm_mkey = SSL_kRSA,
635 .algorithm_auth = SSL_aRSA, 564 .algorithm_auth = SSL_aRSA,
636 .algorithm_enc = SSL_AES128GCM, 565 .algorithm_enc = SSL_AES128GCM,
@@ -641,12 +570,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
641 .strength_bits = 128, 570 .strength_bits = 128,
642 .alg_bits = 128, 571 .alg_bits = 128,
643 }, 572 },
644
645 /* Cipher 9D */
646 { 573 {
647 .valid = 1, 574 .value = 0x009d,
648 .name = TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384, 575 .name = TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384,
649 .id = TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
650 .algorithm_mkey = SSL_kRSA, 576 .algorithm_mkey = SSL_kRSA,
651 .algorithm_auth = SSL_aRSA, 577 .algorithm_auth = SSL_aRSA,
652 .algorithm_enc = SSL_AES256GCM, 578 .algorithm_enc = SSL_AES256GCM,
@@ -657,12 +583,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
657 .strength_bits = 256, 583 .strength_bits = 256,
658 .alg_bits = 256, 584 .alg_bits = 256,
659 }, 585 },
660
661 /* Cipher 9E */
662 { 586 {
663 .valid = 1, 587 .value = 0x009e,
664 .name = TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256, 588 .name = TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256,
665 .id = TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256,
666 .algorithm_mkey = SSL_kDHE, 589 .algorithm_mkey = SSL_kDHE,
667 .algorithm_auth = SSL_aRSA, 590 .algorithm_auth = SSL_aRSA,
668 .algorithm_enc = SSL_AES128GCM, 591 .algorithm_enc = SSL_AES128GCM,
@@ -673,12 +596,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
673 .strength_bits = 128, 596 .strength_bits = 128,
674 .alg_bits = 128, 597 .alg_bits = 128,
675 }, 598 },
676
677 /* Cipher 9F */
678 { 599 {
679 .valid = 1, 600 .value = 0x009f,
680 .name = TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384, 601 .name = TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384,
681 .id = TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
682 .algorithm_mkey = SSL_kDHE, 602 .algorithm_mkey = SSL_kDHE,
683 .algorithm_auth = SSL_aRSA, 603 .algorithm_auth = SSL_aRSA,
684 .algorithm_enc = SSL_AES256GCM, 604 .algorithm_enc = SSL_AES256GCM,
@@ -689,12 +609,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
689 .strength_bits = 256, 609 .strength_bits = 256,
690 .alg_bits = 256, 610 .alg_bits = 256,
691 }, 611 },
692
693 /* Cipher A6 */
694 { 612 {
695 .valid = 1, 613 .value = 0x00a6,
696 .name = TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256, 614 .name = TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256,
697 .id = TLS1_CK_ADH_WITH_AES_128_GCM_SHA256,
698 .algorithm_mkey = SSL_kDHE, 615 .algorithm_mkey = SSL_kDHE,
699 .algorithm_auth = SSL_aNULL, 616 .algorithm_auth = SSL_aNULL,
700 .algorithm_enc = SSL_AES128GCM, 617 .algorithm_enc = SSL_AES128GCM,
@@ -705,12 +622,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
705 .strength_bits = 128, 622 .strength_bits = 128,
706 .alg_bits = 128, 623 .alg_bits = 128,
707 }, 624 },
708
709 /* Cipher A7 */
710 { 625 {
711 .valid = 1, 626 .value = 0x00a7,
712 .name = TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384, 627 .name = TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384,
713 .id = TLS1_CK_ADH_WITH_AES_256_GCM_SHA384,
714 .algorithm_mkey = SSL_kDHE, 628 .algorithm_mkey = SSL_kDHE,
715 .algorithm_auth = SSL_aNULL, 629 .algorithm_auth = SSL_aNULL,
716 .algorithm_enc = SSL_AES256GCM, 630 .algorithm_enc = SSL_AES256GCM,
@@ -723,13 +637,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
723 }, 637 },
724 638
725#ifndef OPENSSL_NO_CAMELLIA 639#ifndef OPENSSL_NO_CAMELLIA
726 /* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ 640 /*
727 641 * TLSv1.2 Camellia SHA-256 cipher suites (RFC 5932).
728 /* Cipher BA */ 642 */
729 { 643 {
730 .valid = 1, 644 .value = 0x00ba,
731 .name = TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256, 645 .name = TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256,
732 .id = TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256,
733 .algorithm_mkey = SSL_kRSA, 646 .algorithm_mkey = SSL_kRSA,
734 .algorithm_auth = SSL_aRSA, 647 .algorithm_auth = SSL_aRSA,
735 .algorithm_enc = SSL_CAMELLIA128, 648 .algorithm_enc = SSL_CAMELLIA128,
@@ -740,12 +653,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
740 .strength_bits = 128, 653 .strength_bits = 128,
741 .alg_bits = 128, 654 .alg_bits = 128,
742 }, 655 },
743
744 /* Cipher BE */
745 { 656 {
746 .valid = 1, 657 .value = 0x000be,
747 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256, 658 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
748 .id = TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256,
749 .algorithm_mkey = SSL_kDHE, 659 .algorithm_mkey = SSL_kDHE,
750 .algorithm_auth = SSL_aRSA, 660 .algorithm_auth = SSL_aRSA,
751 .algorithm_enc = SSL_CAMELLIA128, 661 .algorithm_enc = SSL_CAMELLIA128,
@@ -756,12 +666,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
756 .strength_bits = 128, 666 .strength_bits = 128,
757 .alg_bits = 128, 667 .alg_bits = 128,
758 }, 668 },
759
760 /* Cipher BF */
761 { 669 {
762 .valid = 1, 670 .value = 0x00bf,
763 .name = TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256, 671 .name = TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256,
764 .id = TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256,
765 .algorithm_mkey = SSL_kDHE, 672 .algorithm_mkey = SSL_kDHE,
766 .algorithm_auth = SSL_aNULL, 673 .algorithm_auth = SSL_aNULL,
767 .algorithm_enc = SSL_CAMELLIA128, 674 .algorithm_enc = SSL_CAMELLIA128,
@@ -772,12 +679,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
772 .strength_bits = 128, 679 .strength_bits = 128,
773 .alg_bits = 128, 680 .alg_bits = 128,
774 }, 681 },
775
776 /* Cipher C0 */
777 { 682 {
778 .valid = 1, 683 .value = 0x00c0,
779 .name = TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256, 684 .name = TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256,
780 .id = TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256,
781 .algorithm_mkey = SSL_kRSA, 685 .algorithm_mkey = SSL_kRSA,
782 .algorithm_auth = SSL_aRSA, 686 .algorithm_auth = SSL_aRSA,
783 .algorithm_enc = SSL_CAMELLIA256, 687 .algorithm_enc = SSL_CAMELLIA256,
@@ -788,12 +692,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
788 .strength_bits = 256, 692 .strength_bits = 256,
789 .alg_bits = 256, 693 .alg_bits = 256,
790 }, 694 },
791
792 /* Cipher C4 */
793 { 695 {
794 .valid = 1, 696 .value = 0x00c4,
795 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256, 697 .name = TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
796 .id = TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256,
797 .algorithm_mkey = SSL_kDHE, 698 .algorithm_mkey = SSL_kDHE,
798 .algorithm_auth = SSL_aRSA, 699 .algorithm_auth = SSL_aRSA,
799 .algorithm_enc = SSL_CAMELLIA256, 700 .algorithm_enc = SSL_CAMELLIA256,
@@ -804,12 +705,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
804 .strength_bits = 256, 705 .strength_bits = 256,
805 .alg_bits = 256, 706 .alg_bits = 256,
806 }, 707 },
807
808 /* Cipher C5 */
809 { 708 {
810 .valid = 1, 709 .value = 0x00c5,
811 .name = TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256, 710 .name = TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256,
812 .id = TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256,
813 .algorithm_mkey = SSL_kDHE, 711 .algorithm_mkey = SSL_kDHE,
814 .algorithm_auth = SSL_aNULL, 712 .algorithm_auth = SSL_aNULL,
815 .algorithm_enc = SSL_CAMELLIA256, 713 .algorithm_enc = SSL_CAMELLIA256,
@@ -822,16 +720,13 @@ const SSL_CIPHER ssl3_ciphers[] = {
822 }, 720 },
823#endif /* OPENSSL_NO_CAMELLIA */ 721#endif /* OPENSSL_NO_CAMELLIA */
824 722
723#ifdef LIBRESSL_HAS_TLS1_3
825 /* 724 /*
826 * TLSv1.3 cipher suites. 725 * TLSv1.3 cipher suites (RFC 8446).
827 */ 726 */
828
829#ifdef LIBRESSL_HAS_TLS1_3
830 /* Cipher 1301 */
831 { 727 {
832 .valid = 1, 728 .value = 0x1301,
833 .name = TLS1_3_RFC_AES_128_GCM_SHA256, 729 .name = TLS1_3_RFC_AES_128_GCM_SHA256,
834 .id = TLS1_3_CK_AES_128_GCM_SHA256,
835 .algorithm_mkey = SSL_kTLS1_3, 730 .algorithm_mkey = SSL_kTLS1_3,
836 .algorithm_auth = SSL_aTLS1_3, 731 .algorithm_auth = SSL_aTLS1_3,
837 .algorithm_enc = SSL_AES128GCM, 732 .algorithm_enc = SSL_AES128GCM,
@@ -842,12 +737,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
842 .strength_bits = 128, 737 .strength_bits = 128,
843 .alg_bits = 128, 738 .alg_bits = 128,
844 }, 739 },
845
846 /* Cipher 1302 */
847 { 740 {
848 .valid = 1, 741 .value = 0x1302,
849 .name = TLS1_3_RFC_AES_256_GCM_SHA384, 742 .name = TLS1_3_RFC_AES_256_GCM_SHA384,
850 .id = TLS1_3_CK_AES_256_GCM_SHA384,
851 .algorithm_mkey = SSL_kTLS1_3, 743 .algorithm_mkey = SSL_kTLS1_3,
852 .algorithm_auth = SSL_aTLS1_3, 744 .algorithm_auth = SSL_aTLS1_3,
853 .algorithm_enc = SSL_AES256GCM, 745 .algorithm_enc = SSL_AES256GCM,
@@ -858,12 +750,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
858 .strength_bits = 256, 750 .strength_bits = 256,
859 .alg_bits = 256, 751 .alg_bits = 256,
860 }, 752 },
861
862 /* Cipher 1303 */
863 { 753 {
864 .valid = 1, 754 .value = 0x1303,
865 .name = TLS1_3_RFC_CHACHA20_POLY1305_SHA256, 755 .name = TLS1_3_RFC_CHACHA20_POLY1305_SHA256,
866 .id = TLS1_3_CK_CHACHA20_POLY1305_SHA256,
867 .algorithm_mkey = SSL_kTLS1_3, 756 .algorithm_mkey = SSL_kTLS1_3,
868 .algorithm_auth = SSL_aTLS1_3, 757 .algorithm_auth = SSL_aTLS1_3,
869 .algorithm_enc = SSL_CHACHA20POLY1305, 758 .algorithm_enc = SSL_CHACHA20POLY1305,
@@ -876,11 +765,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
876 }, 765 },
877#endif 766#endif
878 767
879 /* Cipher C006 */ 768 /*
769 * TLSv1.0 Elliptic Curve cipher suites (RFC 4492, section 6).
770 */
880 { 771 {
881 .valid = 1, 772 .value = 0xc006,
882 .name = TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA, 773 .name = TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA,
883 .id = TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA,
884 .algorithm_mkey = SSL_kECDHE, 774 .algorithm_mkey = SSL_kECDHE,
885 .algorithm_auth = SSL_aECDSA, 775 .algorithm_auth = SSL_aECDSA,
886 .algorithm_enc = SSL_eNULL, 776 .algorithm_enc = SSL_eNULL,
@@ -891,12 +781,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
891 .strength_bits = 0, 781 .strength_bits = 0,
892 .alg_bits = 0, 782 .alg_bits = 0,
893 }, 783 },
894
895 /* Cipher C007 */
896 { 784 {
897 .valid = 1, 785 .value = 0xc007,
898 .name = TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA, 786 .name = TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA,
899 .id = TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA,
900 .algorithm_mkey = SSL_kECDHE, 787 .algorithm_mkey = SSL_kECDHE,
901 .algorithm_auth = SSL_aECDSA, 788 .algorithm_auth = SSL_aECDSA,
902 .algorithm_enc = SSL_RC4, 789 .algorithm_enc = SSL_RC4,
@@ -907,12 +794,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
907 .strength_bits = 128, 794 .strength_bits = 128,
908 .alg_bits = 128, 795 .alg_bits = 128,
909 }, 796 },
910
911 /* Cipher C008 */
912 { 797 {
913 .valid = 1, 798 .value = 0xc008,
914 .name = TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA, 799 .name = TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
915 .id = TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
916 .algorithm_mkey = SSL_kECDHE, 800 .algorithm_mkey = SSL_kECDHE,
917 .algorithm_auth = SSL_aECDSA, 801 .algorithm_auth = SSL_aECDSA,
918 .algorithm_enc = SSL_3DES, 802 .algorithm_enc = SSL_3DES,
@@ -923,12 +807,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
923 .strength_bits = 112, 807 .strength_bits = 112,
924 .alg_bits = 168, 808 .alg_bits = 168,
925 }, 809 },
926
927 /* Cipher C009 */
928 { 810 {
929 .valid = 1, 811 .value = 0xc009,
930 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 812 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
931 .id = TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
932 .algorithm_mkey = SSL_kECDHE, 813 .algorithm_mkey = SSL_kECDHE,
933 .algorithm_auth = SSL_aECDSA, 814 .algorithm_auth = SSL_aECDSA,
934 .algorithm_enc = SSL_AES128, 815 .algorithm_enc = SSL_AES128,
@@ -939,12 +820,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
939 .strength_bits = 128, 820 .strength_bits = 128,
940 .alg_bits = 128, 821 .alg_bits = 128,
941 }, 822 },
942
943 /* Cipher C00A */
944 { 823 {
945 .valid = 1, 824 .value = 0xc00a,
946 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 825 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
947 .id = TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
948 .algorithm_mkey = SSL_kECDHE, 826 .algorithm_mkey = SSL_kECDHE,
949 .algorithm_auth = SSL_aECDSA, 827 .algorithm_auth = SSL_aECDSA,
950 .algorithm_enc = SSL_AES256, 828 .algorithm_enc = SSL_AES256,
@@ -955,12 +833,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
955 .strength_bits = 256, 833 .strength_bits = 256,
956 .alg_bits = 256, 834 .alg_bits = 256,
957 }, 835 },
958
959 /* Cipher C010 */
960 { 836 {
961 .valid = 1, 837 .value = 0xc010,
962 .name = TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA, 838 .name = TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA,
963 .id = TLS1_CK_ECDHE_RSA_WITH_NULL_SHA,
964 .algorithm_mkey = SSL_kECDHE, 839 .algorithm_mkey = SSL_kECDHE,
965 .algorithm_auth = SSL_aRSA, 840 .algorithm_auth = SSL_aRSA,
966 .algorithm_enc = SSL_eNULL, 841 .algorithm_enc = SSL_eNULL,
@@ -971,12 +846,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
971 .strength_bits = 0, 846 .strength_bits = 0,
972 .alg_bits = 0, 847 .alg_bits = 0,
973 }, 848 },
974
975 /* Cipher C011 */
976 { 849 {
977 .valid = 1, 850 .value = 0xc011,
978 .name = TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA, 851 .name = TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA,
979 .id = TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA,
980 .algorithm_mkey = SSL_kECDHE, 852 .algorithm_mkey = SSL_kECDHE,
981 .algorithm_auth = SSL_aRSA, 853 .algorithm_auth = SSL_aRSA,
982 .algorithm_enc = SSL_RC4, 854 .algorithm_enc = SSL_RC4,
@@ -987,12 +859,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
987 .strength_bits = 128, 859 .strength_bits = 128,
988 .alg_bits = 128, 860 .alg_bits = 128,
989 }, 861 },
990
991 /* Cipher C012 */
992 { 862 {
993 .valid = 1, 863 .value = 0xc012,
994 .name = TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA, 864 .name = TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
995 .id = TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
996 .algorithm_mkey = SSL_kECDHE, 865 .algorithm_mkey = SSL_kECDHE,
997 .algorithm_auth = SSL_aRSA, 866 .algorithm_auth = SSL_aRSA,
998 .algorithm_enc = SSL_3DES, 867 .algorithm_enc = SSL_3DES,
@@ -1003,12 +872,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1003 .strength_bits = 112, 872 .strength_bits = 112,
1004 .alg_bits = 168, 873 .alg_bits = 168,
1005 }, 874 },
1006
1007 /* Cipher C013 */
1008 { 875 {
1009 .valid = 1, 876 .value = 0xc013,
1010 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA, 877 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA,
1011 .id = TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
1012 .algorithm_mkey = SSL_kECDHE, 878 .algorithm_mkey = SSL_kECDHE,
1013 .algorithm_auth = SSL_aRSA, 879 .algorithm_auth = SSL_aRSA,
1014 .algorithm_enc = SSL_AES128, 880 .algorithm_enc = SSL_AES128,
@@ -1019,12 +885,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1019 .strength_bits = 128, 885 .strength_bits = 128,
1020 .alg_bits = 128, 886 .alg_bits = 128,
1021 }, 887 },
1022
1023 /* Cipher C014 */
1024 { 888 {
1025 .valid = 1, 889 .value = 0xc014,
1026 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA, 890 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA,
1027 .id = TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
1028 .algorithm_mkey = SSL_kECDHE, 891 .algorithm_mkey = SSL_kECDHE,
1029 .algorithm_auth = SSL_aRSA, 892 .algorithm_auth = SSL_aRSA,
1030 .algorithm_enc = SSL_AES256, 893 .algorithm_enc = SSL_AES256,
@@ -1035,12 +898,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1035 .strength_bits = 256, 898 .strength_bits = 256,
1036 .alg_bits = 256, 899 .alg_bits = 256,
1037 }, 900 },
1038
1039 /* Cipher C015 */
1040 { 901 {
1041 .valid = 1, 902 .value = 0xc015,
1042 .name = TLS1_TXT_ECDH_anon_WITH_NULL_SHA, 903 .name = TLS1_TXT_ECDH_anon_WITH_NULL_SHA,
1043 .id = TLS1_CK_ECDH_anon_WITH_NULL_SHA,
1044 .algorithm_mkey = SSL_kECDHE, 904 .algorithm_mkey = SSL_kECDHE,
1045 .algorithm_auth = SSL_aNULL, 905 .algorithm_auth = SSL_aNULL,
1046 .algorithm_enc = SSL_eNULL, 906 .algorithm_enc = SSL_eNULL,
@@ -1051,12 +911,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1051 .strength_bits = 0, 911 .strength_bits = 0,
1052 .alg_bits = 0, 912 .alg_bits = 0,
1053 }, 913 },
1054
1055 /* Cipher C016 */
1056 { 914 {
1057 .valid = 1, 915 .value = 0xc016,
1058 .name = TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA, 916 .name = TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA,
1059 .id = TLS1_CK_ECDH_anon_WITH_RC4_128_SHA,
1060 .algorithm_mkey = SSL_kECDHE, 917 .algorithm_mkey = SSL_kECDHE,
1061 .algorithm_auth = SSL_aNULL, 918 .algorithm_auth = SSL_aNULL,
1062 .algorithm_enc = SSL_RC4, 919 .algorithm_enc = SSL_RC4,
@@ -1067,12 +924,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1067 .strength_bits = 128, 924 .strength_bits = 128,
1068 .alg_bits = 128, 925 .alg_bits = 128,
1069 }, 926 },
1070
1071 /* Cipher C017 */
1072 { 927 {
1073 .valid = 1, 928 .value = 0xc017,
1074 .name = TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA, 929 .name = TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA,
1075 .id = TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA,
1076 .algorithm_mkey = SSL_kECDHE, 930 .algorithm_mkey = SSL_kECDHE,
1077 .algorithm_auth = SSL_aNULL, 931 .algorithm_auth = SSL_aNULL,
1078 .algorithm_enc = SSL_3DES, 932 .algorithm_enc = SSL_3DES,
@@ -1083,12 +937,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1083 .strength_bits = 112, 937 .strength_bits = 112,
1084 .alg_bits = 168, 938 .alg_bits = 168,
1085 }, 939 },
1086
1087 /* Cipher C018 */
1088 { 940 {
1089 .valid = 1, 941 .value = 0xc018,
1090 .name = TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA, 942 .name = TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA,
1091 .id = TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA,
1092 .algorithm_mkey = SSL_kECDHE, 943 .algorithm_mkey = SSL_kECDHE,
1093 .algorithm_auth = SSL_aNULL, 944 .algorithm_auth = SSL_aNULL,
1094 .algorithm_enc = SSL_AES128, 945 .algorithm_enc = SSL_AES128,
@@ -1099,12 +950,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1099 .strength_bits = 128, 950 .strength_bits = 128,
1100 .alg_bits = 128, 951 .alg_bits = 128,
1101 }, 952 },
1102
1103 /* Cipher C019 */
1104 { 953 {
1105 .valid = 1, 954 .value = 0xc019,
1106 .name = TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA, 955 .name = TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA,
1107 .id = TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA,
1108 .algorithm_mkey = SSL_kECDHE, 956 .algorithm_mkey = SSL_kECDHE,
1109 .algorithm_auth = SSL_aNULL, 957 .algorithm_auth = SSL_aNULL,
1110 .algorithm_enc = SSL_AES256, 958 .algorithm_enc = SSL_AES256,
@@ -1116,14 +964,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
1116 .alg_bits = 256, 964 .alg_bits = 256,
1117 }, 965 },
1118 966
1119 967 /*
1120 /* HMAC based TLS v1.2 ciphersuites from RFC5289 */ 968 * TLSv1.2 Elliptic Curve HMAC cipher suites (RFC 5289, section 3.1).
1121 969 */
1122 /* Cipher C023 */
1123 { 970 {
1124 .valid = 1, 971 .value = 0xc023,
1125 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256, 972 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256,
1126 .id = TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256,
1127 .algorithm_mkey = SSL_kECDHE, 973 .algorithm_mkey = SSL_kECDHE,
1128 .algorithm_auth = SSL_aECDSA, 974 .algorithm_auth = SSL_aECDSA,
1129 .algorithm_enc = SSL_AES128, 975 .algorithm_enc = SSL_AES128,
@@ -1134,12 +980,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1134 .strength_bits = 128, 980 .strength_bits = 128,
1135 .alg_bits = 128, 981 .alg_bits = 128,
1136 }, 982 },
1137
1138 /* Cipher C024 */
1139 { 983 {
1140 .valid = 1, 984 .value = 0xc024,
1141 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384, 985 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384,
1142 .id = TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384,
1143 .algorithm_mkey = SSL_kECDHE, 986 .algorithm_mkey = SSL_kECDHE,
1144 .algorithm_auth = SSL_aECDSA, 987 .algorithm_auth = SSL_aECDSA,
1145 .algorithm_enc = SSL_AES256, 988 .algorithm_enc = SSL_AES256,
@@ -1150,12 +993,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1150 .strength_bits = 256, 993 .strength_bits = 256,
1151 .alg_bits = 256, 994 .alg_bits = 256,
1152 }, 995 },
1153
1154 /* Cipher C027 */
1155 { 996 {
1156 .valid = 1, 997 .value = 0xc027,
1157 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256, 998 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256,
1158 .id = TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256,
1159 .algorithm_mkey = SSL_kECDHE, 999 .algorithm_mkey = SSL_kECDHE,
1160 .algorithm_auth = SSL_aRSA, 1000 .algorithm_auth = SSL_aRSA,
1161 .algorithm_enc = SSL_AES128, 1001 .algorithm_enc = SSL_AES128,
@@ -1166,12 +1006,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1166 .strength_bits = 128, 1006 .strength_bits = 128,
1167 .alg_bits = 128, 1007 .alg_bits = 128,
1168 }, 1008 },
1169
1170 /* Cipher C028 */
1171 { 1009 {
1172 .valid = 1, 1010 .value = 0xc028,
1173 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384, 1011 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384,
1174 .id = TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384,
1175 .algorithm_mkey = SSL_kECDHE, 1012 .algorithm_mkey = SSL_kECDHE,
1176 .algorithm_auth = SSL_aRSA, 1013 .algorithm_auth = SSL_aRSA,
1177 .algorithm_enc = SSL_AES256, 1014 .algorithm_enc = SSL_AES256,
@@ -1183,13 +1020,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
1183 .alg_bits = 256, 1020 .alg_bits = 256,
1184 }, 1021 },
1185 1022
1186 /* GCM based TLS v1.2 ciphersuites from RFC5289 */ 1023 /*
1187 1024 * TLSv1.2 Elliptic Curve GCM cipher suites (RFC 5289, section 3.2).
1188 /* Cipher C02B */ 1025 */
1189 { 1026 {
1190 .valid = 1, 1027 .value = 0xc02b,
1191 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 1028 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
1192 .id = TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
1193 .algorithm_mkey = SSL_kECDHE, 1029 .algorithm_mkey = SSL_kECDHE,
1194 .algorithm_auth = SSL_aECDSA, 1030 .algorithm_auth = SSL_aECDSA,
1195 .algorithm_enc = SSL_AES128GCM, 1031 .algorithm_enc = SSL_AES128GCM,
@@ -1200,12 +1036,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1200 .strength_bits = 128, 1036 .strength_bits = 128,
1201 .alg_bits = 128, 1037 .alg_bits = 128,
1202 }, 1038 },
1203
1204 /* Cipher C02C */
1205 { 1039 {
1206 .valid = 1, 1040 .value = 0xc02c,
1207 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 1041 .name = TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
1208 .id = TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
1209 .algorithm_mkey = SSL_kECDHE, 1042 .algorithm_mkey = SSL_kECDHE,
1210 .algorithm_auth = SSL_aECDSA, 1043 .algorithm_auth = SSL_aECDSA,
1211 .algorithm_enc = SSL_AES256GCM, 1044 .algorithm_enc = SSL_AES256GCM,
@@ -1216,12 +1049,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1216 .strength_bits = 256, 1049 .strength_bits = 256,
1217 .alg_bits = 256, 1050 .alg_bits = 256,
1218 }, 1051 },
1219
1220 /* Cipher C02F */
1221 { 1052 {
1222 .valid = 1, 1053 .value = 0xc02f,
1223 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 1054 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
1224 .id = TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
1225 .algorithm_mkey = SSL_kECDHE, 1055 .algorithm_mkey = SSL_kECDHE,
1226 .algorithm_auth = SSL_aRSA, 1056 .algorithm_auth = SSL_aRSA,
1227 .algorithm_enc = SSL_AES128GCM, 1057 .algorithm_enc = SSL_AES128GCM,
@@ -1232,12 +1062,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1232 .strength_bits = 128, 1062 .strength_bits = 128,
1233 .alg_bits = 128, 1063 .alg_bits = 128,
1234 }, 1064 },
1235
1236 /* Cipher C030 */
1237 { 1065 {
1238 .valid = 1, 1066 .value = 0xc030,
1239 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 1067 .name = TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
1240 .id = TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
1241 .algorithm_mkey = SSL_kECDHE, 1068 .algorithm_mkey = SSL_kECDHE,
1242 .algorithm_auth = SSL_aRSA, 1069 .algorithm_auth = SSL_aRSA,
1243 .algorithm_enc = SSL_AES256GCM, 1070 .algorithm_enc = SSL_AES256GCM,
@@ -1249,11 +1076,12 @@ const SSL_CIPHER ssl3_ciphers[] = {
1249 .alg_bits = 256, 1076 .alg_bits = 256,
1250 }, 1077 },
1251 1078
1252 /* Cipher CCA8 */ 1079 /*
1080 * TLSv1.2 ChaCha20-Poly1305 cipher suites (RFC 7905).
1081 */
1253 { 1082 {
1254 .valid = 1, 1083 .value = 0xcca8,
1255 .name = TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305, 1084 .name = TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305,
1256 .id = TLS1_CK_ECDHE_RSA_CHACHA20_POLY1305,
1257 .algorithm_mkey = SSL_kECDHE, 1085 .algorithm_mkey = SSL_kECDHE,
1258 .algorithm_auth = SSL_aRSA, 1086 .algorithm_auth = SSL_aRSA,
1259 .algorithm_enc = SSL_CHACHA20POLY1305, 1087 .algorithm_enc = SSL_CHACHA20POLY1305,
@@ -1264,12 +1092,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1264 .strength_bits = 256, 1092 .strength_bits = 256,
1265 .alg_bits = 256, 1093 .alg_bits = 256,
1266 }, 1094 },
1267
1268 /* Cipher CCA9 */
1269 { 1095 {
1270 .valid = 1, 1096 .value = 0xcca9,
1271 .name = TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, 1097 .name = TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
1272 .id = TLS1_CK_ECDHE_ECDSA_CHACHA20_POLY1305,
1273 .algorithm_mkey = SSL_kECDHE, 1098 .algorithm_mkey = SSL_kECDHE,
1274 .algorithm_auth = SSL_aECDSA, 1099 .algorithm_auth = SSL_aECDSA,
1275 .algorithm_enc = SSL_CHACHA20POLY1305, 1100 .algorithm_enc = SSL_CHACHA20POLY1305,
@@ -1280,12 +1105,9 @@ const SSL_CIPHER ssl3_ciphers[] = {
1280 .strength_bits = 256, 1105 .strength_bits = 256,
1281 .alg_bits = 256, 1106 .alg_bits = 256,
1282 }, 1107 },
1283
1284 /* Cipher CCAA */
1285 { 1108 {
1286 .valid = 1, 1109 .value = 0xccaa,
1287 .name = TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305, 1110 .name = TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305,
1288 .id = TLS1_CK_DHE_RSA_CHACHA20_POLY1305,
1289 .algorithm_mkey = SSL_kDHE, 1111 .algorithm_mkey = SSL_kDHE,
1290 .algorithm_auth = SSL_aRSA, 1112 .algorithm_auth = SSL_aRSA,
1291 .algorithm_enc = SSL_CHACHA20POLY1305, 1113 .algorithm_enc = SSL_CHACHA20POLY1305,
@@ -1296,8 +1118,6 @@ const SSL_CIPHER ssl3_ciphers[] = {
1296 .strength_bits = 256, 1118 .strength_bits = 256,
1297 .alg_bits = 256, 1119 .alg_bits = 256,
1298 }, 1120 },
1299
1300 /* end of list */
1301}; 1121};
1302 1122
1303int 1123int
@@ -1316,37 +1136,19 @@ ssl3_get_cipher(unsigned int u)
1316} 1136}
1317 1137
1318static int 1138static int
1319ssl3_cipher_id_cmp(const void *id, const void *cipher) 1139ssl3_cipher_value_cmp(const void *value, const void *cipher)
1320{ 1140{
1321 unsigned long a = *(const unsigned long *)id; 1141 uint16_t a = *(const uint16_t *)value;
1322 unsigned long b = ((const SSL_CIPHER *)cipher)->id; 1142 uint16_t b = ((const SSL_CIPHER *)cipher)->value;
1323 1143
1324 return a < b ? -1 : a > b; 1144 return a < b ? -1 : a > b;
1325} 1145}
1326 1146
1327const SSL_CIPHER * 1147const SSL_CIPHER *
1328ssl3_get_cipher_by_id(unsigned long id)
1329{
1330 const SSL_CIPHER *cipher;
1331
1332 cipher = bsearch(&id, ssl3_ciphers, SSL3_NUM_CIPHERS, sizeof(*cipher),
1333 ssl3_cipher_id_cmp);
1334 if (cipher != NULL && cipher->valid == 1)
1335 return cipher;
1336
1337 return NULL;
1338}
1339
1340const SSL_CIPHER *
1341ssl3_get_cipher_by_value(uint16_t value) 1148ssl3_get_cipher_by_value(uint16_t value)
1342{ 1149{
1343 return ssl3_get_cipher_by_id(SSL3_CK_ID | value); 1150 return bsearch(&value, ssl3_ciphers, SSL3_NUM_CIPHERS,
1344} 1151 sizeof(ssl3_ciphers[0]), ssl3_cipher_value_cmp);
1345
1346uint16_t
1347ssl3_cipher_get_value(const SSL_CIPHER *c)
1348{
1349 return (c->id & SSL3_CK_VALUE_MASK);
1350} 1152}
1351 1153
1352int 1154int
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c
index ef34cbdb04..fcf4631a59 100644
--- a/src/lib/libssl/ssl_asn1.c
+++ b/src/lib/libssl/ssl_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_asn1.c,v 1.68 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_asn1.c,v 1.69 2024/07/22 14:47:15 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2016 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -51,7 +51,6 @@ SSL_SESSION_encode(SSL_SESSION *s, unsigned char **out, size_t *out_len,
51 CBB peer_cert, sidctx, verify_result, hostname, lifetime, ticket, value; 51 CBB peer_cert, sidctx, verify_result, hostname, lifetime, ticket, value;
52 unsigned char *peer_cert_bytes = NULL; 52 unsigned char *peer_cert_bytes = NULL;
53 int len, rv = 0; 53 int len, rv = 0;
54 uint16_t cid;
55 54
56 if (!CBB_init(&cbb, 0)) 55 if (!CBB_init(&cbb, 0))
57 goto err; 56 goto err;
@@ -69,11 +68,10 @@ SSL_SESSION_encode(SSL_SESSION *s, unsigned char **out, size_t *out_len,
69 if (!CBB_add_asn1_uint64(&session, s->ssl_version)) 68 if (!CBB_add_asn1_uint64(&session, s->ssl_version))
70 goto err; 69 goto err;
71 70
72 /* Cipher suite ID. */ 71 /* Cipher suite value. */
73 cid = (uint16_t)(s->cipher_id & SSL3_CK_VALUE_MASK);
74 if (!CBB_add_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING)) 72 if (!CBB_add_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING))
75 goto err; 73 goto err;
76 if (!CBB_add_u16(&cipher_suite, cid)) 74 if (!CBB_add_u16(&cipher_suite, s->cipher_value))
77 goto err; 75 goto err;
78 76
79 /* Session ID - zero length for a ticket. */ 77 /* Session ID - zero length for a ticket. */
@@ -193,7 +191,7 @@ SSL_SESSION_ticket(SSL_SESSION *ss, unsigned char **out, size_t *out_len)
193 if (ss == NULL) 191 if (ss == NULL)
194 return 0; 192 return 0;
195 193
196 if (ss->cipher_id == 0) 194 if (ss->cipher_value == 0)
197 return 0; 195 return 0;
198 196
199 return SSL_SESSION_encode(ss, out, out_len, 1); 197 return SSL_SESSION_encode(ss, out, out_len, 1);
@@ -209,7 +207,7 @@ i2d_SSL_SESSION(SSL_SESSION *ss, unsigned char **pp)
209 if (ss == NULL) 207 if (ss == NULL)
210 return 0; 208 return 0;
211 209
212 if (ss->cipher_id == 0) 210 if (ss->cipher_value == 0)
213 return 0; 211 return 0;
214 212
215 if (!SSL_SESSION_encode(ss, &data, &data_len, 0)) 213 if (!SSL_SESSION_encode(ss, &data, &data_len, 0))
@@ -244,7 +242,6 @@ d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length)
244 CBS hostname, ticket; 242 CBS hostname, ticket;
245 uint64_t version, tls_version, stime, timeout, verify_result, lifetime; 243 uint64_t version, tls_version, stime, timeout, verify_result, lifetime;
246 const unsigned char *peer_cert_bytes; 244 const unsigned char *peer_cert_bytes;
247 uint16_t cipher_value;
248 SSL_SESSION *s = NULL; 245 SSL_SESSION *s = NULL;
249 size_t data_len; 246 size_t data_len;
250 int present; 247 int present;
@@ -277,14 +274,13 @@ d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length)
277 goto err; 274 goto err;
278 s->ssl_version = (int)tls_version; 275 s->ssl_version = (int)tls_version;
279 276
280 /* Cipher suite. */ 277 /* Cipher suite value. */
281 if (!CBS_get_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING)) 278 if (!CBS_get_asn1(&session, &cipher_suite, CBS_ASN1_OCTETSTRING))
282 goto err; 279 goto err;
283 if (!CBS_get_u16(&cipher_suite, &cipher_value)) 280 if (!CBS_get_u16(&cipher_suite, &s->cipher_value))
284 goto err; 281 goto err;
285 if (CBS_len(&cipher_suite) != 0) 282 if (CBS_len(&cipher_suite) != 0)
286 goto err; 283 goto err;
287 s->cipher_id = SSL3_CK_ID | cipher_value;
288 284
289 /* Session ID. */ 285 /* Session ID. */
290 if (!CBS_get_asn1(&session, &session_id, CBS_ASN1_OCTETSTRING)) 286 if (!CBS_get_asn1(&session, &session_id, CBS_ASN1_OCTETSTRING))
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 7c32354902..dce141101d 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.145 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.146 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -373,21 +373,18 @@ static const SSL_CIPHER cipher_aliases[] = {
373 /* cipher suite aliases */ 373 /* cipher suite aliases */
374#ifdef LIBRESSL_HAS_TLS1_3 374#ifdef LIBRESSL_HAS_TLS1_3
375 { 375 {
376 .valid = 1, 376 .value = 0x1301,
377 .name = "TLS_AES_128_GCM_SHA256", 377 .name = "TLS_AES_128_GCM_SHA256",
378 .id = TLS1_3_CK_AES_128_GCM_SHA256,
379 .algorithm_ssl = SSL_TLSV1_3, 378 .algorithm_ssl = SSL_TLSV1_3,
380 }, 379 },
381 { 380 {
382 .valid = 1, 381 .value = 0x1302,
383 .name = "TLS_AES_256_GCM_SHA384", 382 .name = "TLS_AES_256_GCM_SHA384",
384 .id = TLS1_3_CK_AES_256_GCM_SHA384,
385 .algorithm_ssl = SSL_TLSV1_3, 383 .algorithm_ssl = SSL_TLSV1_3,
386 }, 384 },
387 { 385 {
388 .valid = 1, 386 .value = 0x1303,
389 .name = "TLS_CHACHA20_POLY1305_SHA256", 387 .name = "TLS_CHACHA20_POLY1305_SHA256",
390 .id = TLS1_3_CK_CHACHA20_POLY1305_SHA256,
391 .algorithm_ssl = SSL_TLSV1_3, 388 .algorithm_ssl = SSL_TLSV1_3,
392 }, 389 },
393#endif 390#endif
@@ -619,7 +616,7 @@ ssl_cipher_collect_ciphers(const SSL_METHOD *ssl_method, int num_of_ciphers,
619 * Drop any invalid ciphers and any which use unavailable 616 * Drop any invalid ciphers and any which use unavailable
620 * algorithms. 617 * algorithms.
621 */ 618 */
622 if ((c != NULL) && c->valid && 619 if ((c != NULL) &&
623 !(c->algorithm_mkey & disabled_mkey) && 620 !(c->algorithm_mkey & disabled_mkey) &&
624 !(c->algorithm_auth & disabled_auth) && 621 !(c->algorithm_auth & disabled_auth) &&
625 !(c->algorithm_enc & disabled_enc) && 622 !(c->algorithm_enc & disabled_enc) &&
@@ -725,7 +722,7 @@ ssl_cipher_collect_aliases(const SSL_CIPHER **ca_list, int num_of_group_aliases,
725} 722}
726 723
727static void 724static void
728ssl_cipher_apply_rule(unsigned long cipher_id, unsigned long alg_mkey, 725ssl_cipher_apply_rule(uint16_t cipher_value, unsigned long alg_mkey,
729 unsigned long alg_auth, unsigned long alg_enc, unsigned long alg_mac, 726 unsigned long alg_auth, unsigned long alg_enc, unsigned long alg_mac,
730 unsigned long alg_ssl, unsigned long algo_strength, int rule, 727 unsigned long alg_ssl, unsigned long algo_strength, int rule,
731 int strength_bits, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) 728 int strength_bits, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p)
@@ -757,7 +754,7 @@ ssl_cipher_apply_rule(unsigned long cipher_id, unsigned long alg_mkey,
757 754
758 cp = curr->cipher; 755 cp = curr->cipher;
759 756
760 if (cipher_id && cp->id != cipher_id) 757 if (cipher_value != 0 && cp->value != cipher_value)
761 continue; 758 continue;
762 759
763 /* 760 /*
@@ -882,7 +879,7 @@ ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p,
882 unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl; 879 unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl;
883 unsigned long algo_strength; 880 unsigned long algo_strength;
884 int j, multi, found, rule, retval, ok, buflen; 881 int j, multi, found, rule, retval, ok, buflen;
885 unsigned long cipher_id = 0; 882 uint16_t cipher_value = 0;
886 const char *l, *buf; 883 const char *l, *buf;
887 char ch; 884 char ch;
888 885
@@ -974,7 +971,7 @@ ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p,
974 * '\0' terminated.) 971 * '\0' terminated.)
975 */ 972 */
976 j = found = 0; 973 j = found = 0;
977 cipher_id = 0; 974 cipher_value = 0;
978 while (ca_list[j]) { 975 while (ca_list[j]) {
979 if (!strncmp(buf, ca_list[j]->name, buflen) && 976 if (!strncmp(buf, ca_list[j]->name, buflen) &&
980 (ca_list[j]->name[buflen] == '\0')) { 977 (ca_list[j]->name[buflen] == '\0')) {
@@ -1047,13 +1044,13 @@ ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p,
1047 SSL_STRONG_MASK; 1044 SSL_STRONG_MASK;
1048 } 1045 }
1049 1046
1050 if (ca_list[j]->valid) { 1047 if (ca_list[j]->value != 0) {
1051 /* 1048 /*
1052 * explicit ciphersuite found; its protocol 1049 * explicit ciphersuite found; its protocol
1053 * version does not become part of the search 1050 * version does not become part of the search
1054 * pattern! 1051 * pattern!
1055 */ 1052 */
1056 cipher_id = ca_list[j]->id; 1053 cipher_value = ca_list[j]->value;
1057 if (ca_list[j]->algorithm_ssl == SSL_TLSV1_3) 1054 if (ca_list[j]->algorithm_ssl == SSL_TLSV1_3)
1058 *tls13_seen = 1; 1055 *tls13_seen = 1;
1059 } else { 1056 } else {
@@ -1109,7 +1106,7 @@ ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p,
1109 } else if (found) { 1106 } else if (found) {
1110 if (alg_ssl == SSL_TLSV1_3) 1107 if (alg_ssl == SSL_TLSV1_3)
1111 *tls13_seen = 1; 1108 *tls13_seen = 1;
1112 ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, 1109 ssl_cipher_apply_rule(cipher_value, alg_mkey, alg_auth,
1113 alg_enc, alg_mac, alg_ssl, algo_strength, rule, 1110 alg_enc, alg_mac, alg_ssl, algo_strength, rule,
1114 -1, head_p, tail_p); 1111 -1, head_p, tail_p);
1115 } else { 1112 } else {
@@ -1470,24 +1467,23 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
1470LSSL_ALIAS(SSL_CIPHER_description); 1467LSSL_ALIAS(SSL_CIPHER_description);
1471 1468
1472const char * 1469const char *
1473SSL_CIPHER_get_version(const SSL_CIPHER *c) 1470SSL_CIPHER_get_version(const SSL_CIPHER *cipher)
1474{ 1471{
1475 if (c == NULL) 1472 if (cipher == NULL)
1476 return("(NONE)"); 1473 return "(NONE)";
1477 if ((c->id >> 24) == 3) 1474
1478 return("TLSv1/SSLv3"); 1475 return "TLSv1/SSLv3";
1479 else
1480 return("unknown");
1481} 1476}
1482LSSL_ALIAS(SSL_CIPHER_get_version); 1477LSSL_ALIAS(SSL_CIPHER_get_version);
1483 1478
1484/* return the actual cipher being used */ 1479/* return the actual cipher being used */
1485const char * 1480const char *
1486SSL_CIPHER_get_name(const SSL_CIPHER *c) 1481SSL_CIPHER_get_name(const SSL_CIPHER *cipher)
1487{ 1482{
1488 if (c != NULL) 1483 if (cipher == NULL)
1489 return (c->name); 1484 return "(NONE)";
1490 return("(NONE)"); 1485
1486 return cipher->name;
1491} 1487}
1492LSSL_ALIAS(SSL_CIPHER_get_name); 1488LSSL_ALIAS(SSL_CIPHER_get_name);
1493 1489
@@ -1507,16 +1503,16 @@ SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits)
1507LSSL_ALIAS(SSL_CIPHER_get_bits); 1503LSSL_ALIAS(SSL_CIPHER_get_bits);
1508 1504
1509unsigned long 1505unsigned long
1510SSL_CIPHER_get_id(const SSL_CIPHER *c) 1506SSL_CIPHER_get_id(const SSL_CIPHER *cipher)
1511{ 1507{
1512 return c->id; 1508 return SSL3_CK_ID | cipher->value;
1513} 1509}
1514LSSL_ALIAS(SSL_CIPHER_get_id); 1510LSSL_ALIAS(SSL_CIPHER_get_id);
1515 1511
1516uint16_t 1512uint16_t
1517SSL_CIPHER_get_value(const SSL_CIPHER *c) 1513SSL_CIPHER_get_value(const SSL_CIPHER *cipher)
1518{ 1514{
1519 return ssl3_cipher_get_value(c); 1515 return cipher->value;
1520} 1516}
1521LSSL_ALIAS(SSL_CIPHER_get_value); 1517LSSL_ALIAS(SSL_CIPHER_get_value);
1522 1518
diff --git a/src/lib/libssl/ssl_ciphers.c b/src/lib/libssl/ssl_ciphers.c
index 4ec1b099bc..503ef9d03c 100644
--- a/src/lib/libssl/ssl_ciphers.c
+++ b/src/lib/libssl/ssl_ciphers.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciphers.c,v 1.17 2022/11/26 16:08:55 tb Exp $ */ 1/* $OpenBSD: ssl_ciphers.c,v 1.18 2024/07/22 14:47:15 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2015-2017 Doug Hogan <doug@openbsd.org> 3 * Copyright (c) 2015-2017 Doug Hogan <doug@openbsd.org>
4 * Copyright (c) 2015-2018, 2020 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2015-2018, 2020 Joel Sing <jsing@openbsd.org>
@@ -28,7 +28,7 @@ ssl_cipher_in_list(STACK_OF(SSL_CIPHER) *ciphers, const SSL_CIPHER *cipher)
28 int i; 28 int i;
29 29
30 for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) { 30 for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
31 if (sk_SSL_CIPHER_value(ciphers, i)->id == cipher->id) 31 if (sk_SSL_CIPHER_value(ciphers, i)->value == cipher->value)
32 return 1; 32 return 1;
33 } 33 }
34 34
@@ -72,7 +72,7 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *ciphers, CBB *cbb)
72 continue; 72 continue;
73 if (!ssl_security_cipher_check(s, cipher)) 73 if (!ssl_security_cipher_check(s, cipher))
74 continue; 74 continue;
75 if (!CBB_add_u16(cbb, ssl3_cipher_get_value(cipher))) 75 if (!CBB_add_u16(cbb, cipher->value))
76 return 0; 76 return 0;
77 77
78 num_ciphers++; 78 num_ciphers++;
@@ -165,34 +165,34 @@ ssl_bytes_to_cipher_list(SSL *s, CBS *cbs)
165struct ssl_tls13_ciphersuite { 165struct ssl_tls13_ciphersuite {
166 const char *name; 166 const char *name;
167 const char *alias; 167 const char *alias;
168 unsigned long cid; 168 uint16_t value;
169}; 169};
170 170
171static const struct ssl_tls13_ciphersuite ssl_tls13_ciphersuites[] = { 171static const struct ssl_tls13_ciphersuite ssl_tls13_ciphersuites[] = {
172 { 172 {
173 .name = TLS1_3_RFC_AES_128_GCM_SHA256, 173 .name = TLS1_3_RFC_AES_128_GCM_SHA256,
174 .alias = TLS1_3_TXT_AES_128_GCM_SHA256, 174 .alias = TLS1_3_TXT_AES_128_GCM_SHA256,
175 .cid = TLS1_3_CK_AES_128_GCM_SHA256, 175 .value = 0x1301,
176 }, 176 },
177 { 177 {
178 .name = TLS1_3_RFC_AES_256_GCM_SHA384, 178 .name = TLS1_3_RFC_AES_256_GCM_SHA384,
179 .alias = TLS1_3_TXT_AES_256_GCM_SHA384, 179 .alias = TLS1_3_TXT_AES_256_GCM_SHA384,
180 .cid = TLS1_3_CK_AES_256_GCM_SHA384, 180 .value = 0x1302,
181 }, 181 },
182 { 182 {
183 .name = TLS1_3_RFC_CHACHA20_POLY1305_SHA256, 183 .name = TLS1_3_RFC_CHACHA20_POLY1305_SHA256,
184 .alias = TLS1_3_TXT_CHACHA20_POLY1305_SHA256, 184 .alias = TLS1_3_TXT_CHACHA20_POLY1305_SHA256,
185 .cid = TLS1_3_CK_CHACHA20_POLY1305_SHA256, 185 .value = 0x1303,
186 }, 186 },
187 { 187 {
188 .name = TLS1_3_RFC_AES_128_CCM_SHA256, 188 .name = TLS1_3_RFC_AES_128_CCM_SHA256,
189 .alias = TLS1_3_TXT_AES_128_CCM_SHA256, 189 .alias = TLS1_3_TXT_AES_128_CCM_SHA256,
190 .cid = TLS1_3_CK_AES_128_CCM_SHA256, 190 .value = 0x1304,
191 }, 191 },
192 { 192 {
193 .name = TLS1_3_RFC_AES_128_CCM_8_SHA256, 193 .name = TLS1_3_RFC_AES_128_CCM_8_SHA256,
194 .alias = TLS1_3_TXT_AES_128_CCM_8_SHA256, 194 .alias = TLS1_3_TXT_AES_128_CCM_8_SHA256,
195 .cid = TLS1_3_CK_AES_128_CCM_8_SHA256, 195 .value = 0x1305,
196 }, 196 },
197 { 197 {
198 .name = NULL, 198 .name = NULL,
@@ -234,7 +234,7 @@ ssl_parse_ciphersuites(STACK_OF(SSL_CIPHER) **out_ciphers, const char *str)
234 goto err; 234 goto err;
235 235
236 /* We know about the cipher suite, but it is not supported. */ 236 /* We know about the cipher suite, but it is not supported. */
237 if ((cipher = ssl3_get_cipher_by_id(ciphersuite->cid)) == NULL) 237 if ((cipher = ssl3_get_cipher_by_value(ciphersuite->value)) == NULL)
238 continue; 238 continue;
239 239
240 if (!sk_SSL_CIPHER_push(ciphers, cipher)) 240 if (!sk_SSL_CIPHER_push(ciphers, cipher))
diff --git a/src/lib/libssl/ssl_clnt.c b/src/lib/libssl/ssl_clnt.c
index 7b2e05d23d..593ed553d3 100644
--- a/src/lib/libssl/ssl_clnt.c
+++ b/src/lib/libssl/ssl_clnt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_clnt.c,v 1.167 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_clnt.c,v 1.168 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -481,7 +481,7 @@ ssl3_connect(SSL *s)
481 481
482 s->s3->hs.state = SSL3_ST_CW_FINISHED_A; 482 s->s3->hs.state = SSL3_ST_CW_FINISHED_A;
483 s->init_num = 0; 483 s->init_num = 0;
484 s->session->cipher_id = s->s3->hs.cipher->id; 484 s->session->cipher_value = s->s3->hs.cipher->value;
485 485
486 if (!tls1_setup_key_block(s)) { 486 if (!tls1_setup_key_block(s)) {
487 ret = -1; 487 ret = -1;
@@ -1016,13 +1016,13 @@ ssl3_get_server_hello(SSL *s)
1016 * and/or cipher_id values may not be set. Make sure that 1016 * and/or cipher_id values may not be set. Make sure that
1017 * cipher_id is set and use it for comparison. 1017 * cipher_id is set and use it for comparison.
1018 */ 1018 */
1019 if (s->hit && (s->session->cipher_id != cipher->id)) { 1019 if (s->hit && (s->session->cipher_value != cipher->value)) {
1020 al = SSL_AD_ILLEGAL_PARAMETER; 1020 al = SSL_AD_ILLEGAL_PARAMETER;
1021 SSLerror(s, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED); 1021 SSLerror(s, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED);
1022 goto fatal_err; 1022 goto fatal_err;
1023 } 1023 }
1024 s->s3->hs.cipher = cipher; 1024 s->s3->hs.cipher = cipher;
1025 s->session->cipher_id = cipher->id; 1025 s->session->cipher_value = cipher->value;
1026 1026
1027 if (!tls1_transcript_hash_init(s)) 1027 if (!tls1_transcript_hash_init(s))
1028 goto err; 1028 goto err;
diff --git a/src/lib/libssl/ssl_local.h b/src/lib/libssl/ssl_local.h
index 79f41e6dc3..34197e5920 100644
--- a/src/lib/libssl/ssl_local.h
+++ b/src/lib/libssl/ssl_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_local.h,v 1.21 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_local.h,v 1.22 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -339,9 +339,9 @@ struct ssl_comp_st {
339}; 339};
340 340
341struct ssl_cipher_st { 341struct ssl_cipher_st {
342 int valid; 342 uint16_t value; /* Cipher suite value. */
343
343 const char *name; /* text name */ 344 const char *name; /* text name */
344 unsigned long id; /* id, 4 bytes, first is version */
345 345
346 unsigned long algorithm_mkey; /* key exchange algorithm */ 346 unsigned long algorithm_mkey; /* key exchange algorithm */
347 unsigned long algorithm_auth; /* server authentication */ 347 unsigned long algorithm_auth; /* server authentication */
@@ -438,9 +438,7 @@ struct ssl_session_st {
438 time_t time; 438 time_t time;
439 int references; 439 int references;
440 440
441 unsigned long cipher_id; /* when ASN.1 loaded, this 441 uint16_t cipher_value;
442 * needs to be used to load
443 * the 'cipher' structure */
444 442
445 char *tlsext_hostname; 443 char *tlsext_hostname;
446 444
@@ -1293,9 +1291,7 @@ int ssl3_get_req_cert_types(SSL *s, CBB *cbb);
1293int ssl3_get_message(SSL *s, int st1, int stn, int mt, long max); 1291int ssl3_get_message(SSL *s, int st1, int stn, int mt, long max);
1294int ssl3_num_ciphers(void); 1292int ssl3_num_ciphers(void);
1295const SSL_CIPHER *ssl3_get_cipher(unsigned int u); 1293const SSL_CIPHER *ssl3_get_cipher(unsigned int u);
1296const SSL_CIPHER *ssl3_get_cipher_by_id(unsigned long id);
1297const SSL_CIPHER *ssl3_get_cipher_by_value(uint16_t value); 1294const SSL_CIPHER *ssl3_get_cipher_by_value(uint16_t value);
1298uint16_t ssl3_cipher_get_value(const SSL_CIPHER *c);
1299int ssl3_renegotiate(SSL *ssl); 1295int ssl3_renegotiate(SSL *ssl);
1300 1296
1301int ssl3_renegotiate_check(SSL *ssl); 1297int ssl3_renegotiate_check(SSL *ssl);
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c
index 7d6785a3de..740fe97192 100644
--- a/src/lib/libssl/ssl_pkt.c
+++ b/src/lib/libssl/ssl_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_pkt.c,v 1.67 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_pkt.c,v 1.68 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1235,7 +1235,7 @@ ssl3_do_change_cipher_spec(SSL *s)
1235 return (0); 1235 return (0);
1236 } 1236 }
1237 1237
1238 s->session->cipher_id = s->s3->hs.cipher->id; 1238 s->session->cipher_value = s->s3->hs.cipher->value;
1239 1239
1240 if (!tls1_setup_key_block(s)) 1240 if (!tls1_setup_key_block(s))
1241 return (0); 1241 return (0);
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c
index c2bd1bf135..5aea990278 100644
--- a/src/lib/libssl/ssl_sess.c
+++ b/src/lib/libssl/ssl_sess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sess.c,v 1.127 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_sess.c,v 1.128 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -287,7 +287,7 @@ ssl_session_dup(SSL_SESSION *sess, int include_ticket)
287 copy->time = sess->time; 287 copy->time = sess->time;
288 copy->references = 1; 288 copy->references = 1;
289 289
290 copy->cipher_id = sess->cipher_id; 290 copy->cipher_value = sess->cipher_value;
291 291
292 if (sess->tlsext_hostname != NULL) { 292 if (sess->tlsext_hostname != NULL) {
293 copy->tlsext_hostname = strdup(sess->tlsext_hostname); 293 copy->tlsext_hostname = strdup(sess->tlsext_hostname);
@@ -984,7 +984,7 @@ LSSL_ALIAS(SSL_SESSION_get_protocol_version);
984const SSL_CIPHER * 984const SSL_CIPHER *
985SSL_SESSION_get0_cipher(const SSL_SESSION *s) 985SSL_SESSION_get0_cipher(const SSL_SESSION *s)
986{ 986{
987 return ssl3_get_cipher_by_id(s->cipher_id); 987 return ssl3_get_cipher_by_value(s->cipher_value);
988} 988}
989LSSL_ALIAS(SSL_SESSION_get0_cipher); 989LSSL_ALIAS(SSL_SESSION_get0_cipher);
990 990
diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c
index be6bd7402c..302b6bdf0f 100644
--- a/src/lib/libssl/ssl_srvr.c
+++ b/src/lib/libssl/ssl_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_srvr.c,v 1.164 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_srvr.c,v 1.165 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -651,7 +651,7 @@ ssl3_accept(SSL *s)
651 goto end; 651 goto end;
652 s->s3->hs.state = SSL3_ST_SW_FINISHED_A; 652 s->s3->hs.state = SSL3_ST_SW_FINISHED_A;
653 s->init_num = 0; 653 s->init_num = 0;
654 s->session->cipher_id = s->s3->hs.cipher->id; 654 s->session->cipher_value = s->s3->hs.cipher->value;
655 655
656 if (!tls1_setup_key_block(s)) { 656 if (!tls1_setup_key_block(s)) {
657 ret = -1; 657 ret = -1;
@@ -781,7 +781,6 @@ ssl3_get_client_hello(SSL *s)
781 uint8_t comp_method; 781 uint8_t comp_method;
782 int comp_null; 782 int comp_null;
783 int i, j, al, ret, cookie_valid = 0; 783 int i, j, al, ret, cookie_valid = 0;
784 unsigned long id;
785 SSL_CIPHER *c; 784 SSL_CIPHER *c;
786 STACK_OF(SSL_CIPHER) *ciphers = NULL; 785 STACK_OF(SSL_CIPHER) *ciphers = NULL;
787 const SSL_METHOD *method; 786 const SSL_METHOD *method;
@@ -978,11 +977,10 @@ ssl3_get_client_hello(SSL *s)
978 /* XXX - CBS_len(&cipher_suites) will always be zero here... */ 977 /* XXX - CBS_len(&cipher_suites) will always be zero here... */
979 if (s->hit && CBS_len(&cipher_suites) > 0) { 978 if (s->hit && CBS_len(&cipher_suites) > 0) {
980 j = 0; 979 j = 0;
981 id = s->session->cipher_id;
982 980
983 for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) { 981 for (i = 0; i < sk_SSL_CIPHER_num(ciphers); i++) {
984 c = sk_SSL_CIPHER_value(ciphers, i); 982 c = sk_SSL_CIPHER_value(ciphers, i);
985 if (c->id == id) { 983 if (c->value == s->session->cipher_value) {
986 j = 1; 984 j = 1;
987 break; 985 break;
988 } 986 }
@@ -1127,9 +1125,9 @@ ssl3_get_client_hello(SSL *s)
1127 goto fatal_err; 1125 goto fatal_err;
1128 } 1126 }
1129 s->s3->hs.cipher = c; 1127 s->s3->hs.cipher = c;
1130 s->session->cipher_id = s->s3->hs.cipher->id; 1128 s->session->cipher_value = s->s3->hs.cipher->value;
1131 } else { 1129 } else {
1132 s->s3->hs.cipher = ssl3_get_cipher_by_id(s->session->cipher_id); 1130 s->s3->hs.cipher = ssl3_get_cipher_by_value(s->session->cipher_value);
1133 if (s->s3->hs.cipher == NULL) 1131 if (s->s3->hs.cipher == NULL)
1134 goto fatal_err; 1132 goto fatal_err;
1135 } 1133 }
@@ -1269,8 +1267,7 @@ ssl3_send_server_hello(SSL *s)
1269 goto err; 1267 goto err;
1270 1268
1271 /* Cipher suite. */ 1269 /* Cipher suite. */
1272 if (!CBB_add_u16(&server_hello, 1270 if (!CBB_add_u16(&server_hello, s->s3->hs.cipher->value))
1273 ssl3_cipher_get_value(s->s3->hs.cipher)))
1274 goto err; 1271 goto err;
1275 1272
1276 /* Compression method (null). */ 1273 /* Compression method (null). */
diff --git a/src/lib/libssl/ssl_txt.c b/src/lib/libssl/ssl_txt.c
index 26b631d5ab..4ed76c95ab 100644
--- a/src/lib/libssl/ssl_txt.c
+++ b/src/lib/libssl/ssl_txt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_txt.c,v 1.38 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: ssl_txt.c,v 1.39 2024/07/22 14:47:15 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -122,9 +122,9 @@ SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
122 ssl_version_string(x->ssl_version)) <= 0) 122 ssl_version_string(x->ssl_version)) <= 0)
123 goto err; 123 goto err;
124 124
125 if ((cipher = ssl3_get_cipher_by_id(x->cipher_id)) == NULL) { 125 if ((cipher = ssl3_get_cipher_by_value(x->cipher_value)) == NULL) {
126 if (BIO_printf(bp, " Cipher : %04lX\n", 126 if (BIO_printf(bp, " Cipher : %04X\n",
127 x->cipher_id & SSL3_CK_VALUE_MASK) <= 0) 127 x->cipher_value) <= 0)
128 goto err; 128 goto err;
129 } else { 129 } else {
130 const char *cipher_name = "unknown"; 130 const char *cipher_name = "unknown";
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c
index 8f6894fd88..901b38f860 100644
--- a/src/lib/libssl/tls13_client.c
+++ b/src/lib/libssl/tls13_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_client.c,v 1.103 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: tls13_client.c,v 1.104 2024/07/22 14:47:15 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -347,7 +347,7 @@ tls13_client_engage_record_protection(struct tls13_ctx *ctx)
347 &shared_key_len)) 347 &shared_key_len))
348 goto err; 348 goto err;
349 349
350 s->session->cipher_id = ctx->hs->cipher->id; 350 s->session->cipher_value = ctx->hs->cipher->value;
351 s->session->ssl_version = ctx->hs->tls13.server_version; 351 s->session->ssl_version = ctx->hs->tls13.server_version;
352 352
353 if ((ctx->aead = tls13_cipher_aead(ctx->hs->cipher)) == NULL) 353 if ((ctx->aead = tls13_cipher_aead(ctx->hs->cipher)) == NULL)
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c
index 6bd2993cf3..63b7d92093 100644
--- a/src/lib/libssl/tls13_server.c
+++ b/src/lib/libssl/tls13_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_server.c,v 1.108 2024/07/20 04:04:23 jsing Exp $ */ 1/* $OpenBSD: tls13_server.c,v 1.109 2024/07/22 14:47:15 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2020 Bob Beck <beck@openbsd.org>
@@ -383,7 +383,7 @@ tls13_server_engage_record_protection(struct tls13_ctx *ctx)
383 &shared_key_len)) 383 &shared_key_len))
384 goto err; 384 goto err;
385 385
386 s->session->cipher_id = ctx->hs->cipher->id; 386 s->session->cipher_value = ctx->hs->cipher->value;
387 387
388 if ((ctx->aead = tls13_cipher_aead(ctx->hs->cipher)) == NULL) 388 if ((ctx->aead = tls13_cipher_aead(ctx->hs->cipher)) == NULL)
389 goto err; 389 goto err;