@@ -3096,6 +3096,7 @@ int SSL_clear(SSL *ssl) {
3096
3096
}
3097
3097
3098
3098
ssl->client_cipher_suites .reset ();
3099
+ ssl->client_cipher_suites_arr .Reset ();
3099
3100
3100
3101
// In OpenSSL, reusing a client |SSL| with |SSL_clear| causes the previously
3101
3102
// established session to be offered the next time around. wpa_supplicant
@@ -3319,3 +3320,35 @@ int SSL_CTX_set1_curves_list(SSL_CTX *ctx, const char *curves) {
3319
3320
int SSL_set1_curves_list (SSL *ssl, const char *curves) {
3320
3321
return SSL_set1_groups_list (ssl, curves);
3321
3322
}
3323
+
3324
+ size_t SSL_client_hello_get0_ciphers (SSL *ssl, const unsigned char **out) {
3325
+ STACK_OF (SSL_CIPHER) *client_cipher_suites = SSL_get_client_ciphers (ssl);
3326
+ if (client_cipher_suites == nullptr ) {
3327
+ return 0 ;
3328
+ }
3329
+
3330
+ size_t num_ciphers = sk_SSL_CIPHER_num (client_cipher_suites);
3331
+ if (out != nullptr ) {
3332
+ // Hasn't been called before
3333
+ if (ssl->client_cipher_suites_arr .empty ()) {
3334
+ if (!ssl->client_cipher_suites_arr .Init (num_ciphers)) {
3335
+ OPENSSL_PUT_ERROR (SSL, ERR_R_MALLOC_FAILURE);
3336
+ return 0 ;
3337
+ }
3338
+
3339
+ // Construct list of cipherIDs
3340
+ for (size_t i = 0 ; i < num_ciphers; i++) {
3341
+ const SSL_CIPHER *cipher = sk_SSL_CIPHER_value (client_cipher_suites, i);
3342
+ uint16_t iana_id = SSL_CIPHER_get_protocol_id (cipher);
3343
+
3344
+ CRYPTO_store_u16_be (&ssl->client_cipher_suites_arr [i], iana_id);
3345
+ }
3346
+ }
3347
+
3348
+ assert (ssl->client_cipher_suites_arr .size () == num_ciphers);
3349
+ *out = reinterpret_cast <unsigned char *>(ssl->client_cipher_suites_arr .data ());
3350
+ }
3351
+
3352
+ // Return the size
3353
+ return num_ciphers;
3354
+ }
0 commit comments