summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s3_lib.c
diff options
context:
space:
mode:
authorjsing <>2021-07-03 16:06:45 +0000
committerjsing <>2021-07-03 16:06:45 +0000
commit70e6e6179f5b7c30c5e842ff74f348f67cedf838 (patch)
tree58fdc59b50658cb38625bc6b82f9d37d8af2cb2a /src/lib/libssl/s3_lib.c
parente79eb28078c0d90b4c659f0698359ae69f15f007 (diff)
downloadopenbsd-70e6e6179f5b7c30c5e842ff74f348f67cedf838.tar.gz
openbsd-70e6e6179f5b7c30c5e842ff74f348f67cedf838.tar.bz2
openbsd-70e6e6179f5b7c30c5e842ff74f348f67cedf838.zip
Do a first pass clean up of SSL_METHOD.
The num_ciphers, get_cipher_by_char and put_cipher_by_char function pointers use the same function for all methods - call ssl3_num_ciphers() directly, absorb ssl3_get_cipher_by_char() into SSL_CIPHER_find() and remove the unused ssl3_put_cipher_by_char() code. ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/s3_lib.c')
-rw-r--r--src/lib/libssl/s3_lib.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 125c108f02..b2d94629c2 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.212 2021/07/01 17:53:39 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.213 2021/07/03 16:06:44 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 *
@@ -2484,51 +2484,6 @@ ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
2484 return 0; 2484 return 0;
2485} 2485}
2486 2486
2487/*
2488 * This function needs to check if the ciphers required are actually available.
2489 */
2490const SSL_CIPHER *
2491ssl3_get_cipher_by_char(const unsigned char *p)
2492{
2493 uint16_t cipher_value;
2494 CBS cbs;
2495
2496 /* We have to assume it is at least 2 bytes due to existing API. */
2497 CBS_init(&cbs, p, 2);
2498 if (!CBS_get_u16(&cbs, &cipher_value))
2499 return NULL;
2500
2501 return ssl3_get_cipher_by_value(cipher_value);
2502}
2503
2504int
2505ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
2506{
2507 CBB cbb;
2508
2509 if (p == NULL)
2510 return (2);
2511
2512 if ((c->id & ~SSL3_CK_VALUE_MASK) != SSL3_CK_ID)
2513 return (0);
2514
2515 memset(&cbb, 0, sizeof(cbb));
2516
2517 /* We have to assume it is at least 2 bytes due to existing API. */
2518 if (!CBB_init_fixed(&cbb, p, 2))
2519 goto err;
2520 if (!CBB_add_u16(&cbb, ssl3_cipher_get_value(c)))
2521 goto err;
2522 if (!CBB_finish(&cbb, NULL, NULL))
2523 goto err;
2524
2525 return (2);
2526
2527 err:
2528 CBB_cleanup(&cbb);
2529 return (0);
2530}
2531
2532SSL_CIPHER * 2487SSL_CIPHER *
2533ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, 2488ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
2534 STACK_OF(SSL_CIPHER) *srvr) 2489 STACK_OF(SSL_CIPHER) *srvr)