1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * Copyright 2017 BaishanCloud. All rights reserved. 4e1051a39Sopenharmony_ci * 5e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"); 6e1051a39Sopenharmony_ci * you may not use this file except in compliance with the License. 7e1051a39Sopenharmony_ci * You may obtain a copy of the License at 8e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 9e1051a39Sopenharmony_ci * or in the file LICENSE in the source distribution. 10e1051a39Sopenharmony_ci */ 11e1051a39Sopenharmony_ci 12e1051a39Sopenharmony_ci#include <stdio.h> 13e1051a39Sopenharmony_ci#include <string.h> 14e1051a39Sopenharmony_ci 15e1051a39Sopenharmony_ci#include <openssl/opensslconf.h> 16e1051a39Sopenharmony_ci#include <openssl/err.h> 17e1051a39Sopenharmony_ci#include <openssl/e_os2.h> 18e1051a39Sopenharmony_ci#include <openssl/ssl.h> 19e1051a39Sopenharmony_ci#include <openssl/ssl3.h> 20e1051a39Sopenharmony_ci#include <openssl/tls1.h> 21e1051a39Sopenharmony_ci 22e1051a39Sopenharmony_ci#include "internal/nelem.h" 23e1051a39Sopenharmony_ci#include "testutil.h" 24e1051a39Sopenharmony_ci 25e1051a39Sopenharmony_citypedef struct cipher_id_name { 26e1051a39Sopenharmony_ci int id; 27e1051a39Sopenharmony_ci const char *name; 28e1051a39Sopenharmony_ci} CIPHER_ID_NAME; 29e1051a39Sopenharmony_ci 30e1051a39Sopenharmony_ci/* Cipher suites, copied from t1_trce.c */ 31e1051a39Sopenharmony_cistatic CIPHER_ID_NAME cipher_names[] = { 32e1051a39Sopenharmony_ci {0x0000, "TLS_NULL_WITH_NULL_NULL"}, 33e1051a39Sopenharmony_ci {0x0001, "TLS_RSA_WITH_NULL_MD5"}, 34e1051a39Sopenharmony_ci {0x0002, "TLS_RSA_WITH_NULL_SHA"}, 35e1051a39Sopenharmony_ci {0x0003, "TLS_RSA_EXPORT_WITH_RC4_40_MD5"}, 36e1051a39Sopenharmony_ci {0x0004, "TLS_RSA_WITH_RC4_128_MD5"}, 37e1051a39Sopenharmony_ci {0x0005, "TLS_RSA_WITH_RC4_128_SHA"}, 38e1051a39Sopenharmony_ci {0x0006, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5"}, 39e1051a39Sopenharmony_ci {0x0007, "TLS_RSA_WITH_IDEA_CBC_SHA"}, 40e1051a39Sopenharmony_ci {0x0008, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA"}, 41e1051a39Sopenharmony_ci {0x0009, "TLS_RSA_WITH_DES_CBC_SHA"}, 42e1051a39Sopenharmony_ci {0x000A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA"}, 43e1051a39Sopenharmony_ci {0x000B, "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA"}, 44e1051a39Sopenharmony_ci {0x000C, "TLS_DH_DSS_WITH_DES_CBC_SHA"}, 45e1051a39Sopenharmony_ci {0x000D, "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA"}, 46e1051a39Sopenharmony_ci {0x000E, "TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA"}, 47e1051a39Sopenharmony_ci {0x000F, "TLS_DH_RSA_WITH_DES_CBC_SHA"}, 48e1051a39Sopenharmony_ci {0x0010, "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA"}, 49e1051a39Sopenharmony_ci {0x0011, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"}, 50e1051a39Sopenharmony_ci {0x0012, "TLS_DHE_DSS_WITH_DES_CBC_SHA"}, 51e1051a39Sopenharmony_ci {0x0013, "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA"}, 52e1051a39Sopenharmony_ci {0x0014, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA"}, 53e1051a39Sopenharmony_ci {0x0015, "TLS_DHE_RSA_WITH_DES_CBC_SHA"}, 54e1051a39Sopenharmony_ci {0x0016, "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA"}, 55e1051a39Sopenharmony_ci {0x0017, "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5"}, 56e1051a39Sopenharmony_ci {0x0018, "TLS_DH_anon_WITH_RC4_128_MD5"}, 57e1051a39Sopenharmony_ci {0x0019, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA"}, 58e1051a39Sopenharmony_ci {0x001A, "TLS_DH_anon_WITH_DES_CBC_SHA"}, 59e1051a39Sopenharmony_ci {0x001B, "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA"}, 60e1051a39Sopenharmony_ci {0x001D, "SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA"}, 61e1051a39Sopenharmony_ci {0x001E, "SSL_FORTEZZA_KEA_WITH_RC4_128_SHA"}, 62e1051a39Sopenharmony_ci {0x001F, "TLS_KRB5_WITH_3DES_EDE_CBC_SHA"}, 63e1051a39Sopenharmony_ci {0x0020, "TLS_KRB5_WITH_RC4_128_SHA"}, 64e1051a39Sopenharmony_ci {0x0021, "TLS_KRB5_WITH_IDEA_CBC_SHA"}, 65e1051a39Sopenharmony_ci {0x0022, "TLS_KRB5_WITH_DES_CBC_MD5"}, 66e1051a39Sopenharmony_ci {0x0023, "TLS_KRB5_WITH_3DES_EDE_CBC_MD5"}, 67e1051a39Sopenharmony_ci {0x0024, "TLS_KRB5_WITH_RC4_128_MD5"}, 68e1051a39Sopenharmony_ci {0x0025, "TLS_KRB5_WITH_IDEA_CBC_MD5"}, 69e1051a39Sopenharmony_ci {0x0026, "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA"}, 70e1051a39Sopenharmony_ci {0x0027, "TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA"}, 71e1051a39Sopenharmony_ci {0x0028, "TLS_KRB5_EXPORT_WITH_RC4_40_SHA"}, 72e1051a39Sopenharmony_ci {0x0029, "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5"}, 73e1051a39Sopenharmony_ci {0x002A, "TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5"}, 74e1051a39Sopenharmony_ci {0x002B, "TLS_KRB5_EXPORT_WITH_RC4_40_MD5"}, 75e1051a39Sopenharmony_ci {0x002C, "TLS_PSK_WITH_NULL_SHA"}, 76e1051a39Sopenharmony_ci {0x002D, "TLS_DHE_PSK_WITH_NULL_SHA"}, 77e1051a39Sopenharmony_ci {0x002E, "TLS_RSA_PSK_WITH_NULL_SHA"}, 78e1051a39Sopenharmony_ci {0x002F, "TLS_RSA_WITH_AES_128_CBC_SHA"}, 79e1051a39Sopenharmony_ci {0x0030, "TLS_DH_DSS_WITH_AES_128_CBC_SHA"}, 80e1051a39Sopenharmony_ci {0x0031, "TLS_DH_RSA_WITH_AES_128_CBC_SHA"}, 81e1051a39Sopenharmony_ci {0x0032, "TLS_DHE_DSS_WITH_AES_128_CBC_SHA"}, 82e1051a39Sopenharmony_ci {0x0033, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA"}, 83e1051a39Sopenharmony_ci {0x0034, "TLS_DH_anon_WITH_AES_128_CBC_SHA"}, 84e1051a39Sopenharmony_ci {0x0035, "TLS_RSA_WITH_AES_256_CBC_SHA"}, 85e1051a39Sopenharmony_ci {0x0036, "TLS_DH_DSS_WITH_AES_256_CBC_SHA"}, 86e1051a39Sopenharmony_ci {0x0037, "TLS_DH_RSA_WITH_AES_256_CBC_SHA"}, 87e1051a39Sopenharmony_ci {0x0038, "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"}, 88e1051a39Sopenharmony_ci {0x0039, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA"}, 89e1051a39Sopenharmony_ci {0x003A, "TLS_DH_anon_WITH_AES_256_CBC_SHA"}, 90e1051a39Sopenharmony_ci {0x003B, "TLS_RSA_WITH_NULL_SHA256"}, 91e1051a39Sopenharmony_ci {0x003C, "TLS_RSA_WITH_AES_128_CBC_SHA256"}, 92e1051a39Sopenharmony_ci {0x003D, "TLS_RSA_WITH_AES_256_CBC_SHA256"}, 93e1051a39Sopenharmony_ci {0x003E, "TLS_DH_DSS_WITH_AES_128_CBC_SHA256"}, 94e1051a39Sopenharmony_ci {0x003F, "TLS_DH_RSA_WITH_AES_128_CBC_SHA256"}, 95e1051a39Sopenharmony_ci {0x0040, "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256"}, 96e1051a39Sopenharmony_ci {0x0041, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA"}, 97e1051a39Sopenharmony_ci {0x0042, "TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA"}, 98e1051a39Sopenharmony_ci {0x0043, "TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA"}, 99e1051a39Sopenharmony_ci {0x0044, "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA"}, 100e1051a39Sopenharmony_ci {0x0045, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA"}, 101e1051a39Sopenharmony_ci {0x0046, "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA"}, 102e1051a39Sopenharmony_ci {0x0067, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256"}, 103e1051a39Sopenharmony_ci {0x0068, "TLS_DH_DSS_WITH_AES_256_CBC_SHA256"}, 104e1051a39Sopenharmony_ci {0x0069, "TLS_DH_RSA_WITH_AES_256_CBC_SHA256"}, 105e1051a39Sopenharmony_ci {0x006A, "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"}, 106e1051a39Sopenharmony_ci {0x006B, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256"}, 107e1051a39Sopenharmony_ci {0x006C, "TLS_DH_anon_WITH_AES_128_CBC_SHA256"}, 108e1051a39Sopenharmony_ci {0x006D, "TLS_DH_anon_WITH_AES_256_CBC_SHA256"}, 109e1051a39Sopenharmony_ci {0x0084, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA"}, 110e1051a39Sopenharmony_ci {0x0085, "TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA"}, 111e1051a39Sopenharmony_ci {0x0086, "TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA"}, 112e1051a39Sopenharmony_ci {0x0087, "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA"}, 113e1051a39Sopenharmony_ci {0x0088, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA"}, 114e1051a39Sopenharmony_ci {0x0089, "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA"}, 115e1051a39Sopenharmony_ci {0x008A, "TLS_PSK_WITH_RC4_128_SHA"}, 116e1051a39Sopenharmony_ci {0x008B, "TLS_PSK_WITH_3DES_EDE_CBC_SHA"}, 117e1051a39Sopenharmony_ci {0x008C, "TLS_PSK_WITH_AES_128_CBC_SHA"}, 118e1051a39Sopenharmony_ci {0x008D, "TLS_PSK_WITH_AES_256_CBC_SHA"}, 119e1051a39Sopenharmony_ci {0x008E, "TLS_DHE_PSK_WITH_RC4_128_SHA"}, 120e1051a39Sopenharmony_ci {0x008F, "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA"}, 121e1051a39Sopenharmony_ci {0x0090, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA"}, 122e1051a39Sopenharmony_ci {0x0091, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA"}, 123e1051a39Sopenharmony_ci {0x0092, "TLS_RSA_PSK_WITH_RC4_128_SHA"}, 124e1051a39Sopenharmony_ci {0x0093, "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA"}, 125e1051a39Sopenharmony_ci {0x0094, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA"}, 126e1051a39Sopenharmony_ci {0x0095, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA"}, 127e1051a39Sopenharmony_ci {0x0096, "TLS_RSA_WITH_SEED_CBC_SHA"}, 128e1051a39Sopenharmony_ci {0x0097, "TLS_DH_DSS_WITH_SEED_CBC_SHA"}, 129e1051a39Sopenharmony_ci {0x0098, "TLS_DH_RSA_WITH_SEED_CBC_SHA"}, 130e1051a39Sopenharmony_ci {0x0099, "TLS_DHE_DSS_WITH_SEED_CBC_SHA"}, 131e1051a39Sopenharmony_ci {0x009A, "TLS_DHE_RSA_WITH_SEED_CBC_SHA"}, 132e1051a39Sopenharmony_ci {0x009B, "TLS_DH_anon_WITH_SEED_CBC_SHA"}, 133e1051a39Sopenharmony_ci {0x009C, "TLS_RSA_WITH_AES_128_GCM_SHA256"}, 134e1051a39Sopenharmony_ci {0x009D, "TLS_RSA_WITH_AES_256_GCM_SHA384"}, 135e1051a39Sopenharmony_ci {0x009E, "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"}, 136e1051a39Sopenharmony_ci {0x009F, "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384"}, 137e1051a39Sopenharmony_ci {0x00A0, "TLS_DH_RSA_WITH_AES_128_GCM_SHA256"}, 138e1051a39Sopenharmony_ci {0x00A1, "TLS_DH_RSA_WITH_AES_256_GCM_SHA384"}, 139e1051a39Sopenharmony_ci {0x00A2, "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256"}, 140e1051a39Sopenharmony_ci {0x00A3, "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384"}, 141e1051a39Sopenharmony_ci {0x00A4, "TLS_DH_DSS_WITH_AES_128_GCM_SHA256"}, 142e1051a39Sopenharmony_ci {0x00A5, "TLS_DH_DSS_WITH_AES_256_GCM_SHA384"}, 143e1051a39Sopenharmony_ci {0x00A6, "TLS_DH_anon_WITH_AES_128_GCM_SHA256"}, 144e1051a39Sopenharmony_ci {0x00A7, "TLS_DH_anon_WITH_AES_256_GCM_SHA384"}, 145e1051a39Sopenharmony_ci {0x00A8, "TLS_PSK_WITH_AES_128_GCM_SHA256"}, 146e1051a39Sopenharmony_ci {0x00A9, "TLS_PSK_WITH_AES_256_GCM_SHA384"}, 147e1051a39Sopenharmony_ci {0x00AA, "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256"}, 148e1051a39Sopenharmony_ci {0x00AB, "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384"}, 149e1051a39Sopenharmony_ci {0x00AC, "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256"}, 150e1051a39Sopenharmony_ci {0x00AD, "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384"}, 151e1051a39Sopenharmony_ci {0x00AE, "TLS_PSK_WITH_AES_128_CBC_SHA256"}, 152e1051a39Sopenharmony_ci {0x00AF, "TLS_PSK_WITH_AES_256_CBC_SHA384"}, 153e1051a39Sopenharmony_ci {0x00B0, "TLS_PSK_WITH_NULL_SHA256"}, 154e1051a39Sopenharmony_ci {0x00B1, "TLS_PSK_WITH_NULL_SHA384"}, 155e1051a39Sopenharmony_ci {0x00B2, "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256"}, 156e1051a39Sopenharmony_ci {0x00B3, "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384"}, 157e1051a39Sopenharmony_ci {0x00B4, "TLS_DHE_PSK_WITH_NULL_SHA256"}, 158e1051a39Sopenharmony_ci {0x00B5, "TLS_DHE_PSK_WITH_NULL_SHA384"}, 159e1051a39Sopenharmony_ci {0x00B6, "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256"}, 160e1051a39Sopenharmony_ci {0x00B7, "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384"}, 161e1051a39Sopenharmony_ci {0x00B8, "TLS_RSA_PSK_WITH_NULL_SHA256"}, 162e1051a39Sopenharmony_ci {0x00B9, "TLS_RSA_PSK_WITH_NULL_SHA384"}, 163e1051a39Sopenharmony_ci {0x00BA, "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256"}, 164e1051a39Sopenharmony_ci {0x00BB, "TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256"}, 165e1051a39Sopenharmony_ci {0x00BC, "TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256"}, 166e1051a39Sopenharmony_ci {0x00BD, "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256"}, 167e1051a39Sopenharmony_ci {0x00BE, "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256"}, 168e1051a39Sopenharmony_ci {0x00BF, "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256"}, 169e1051a39Sopenharmony_ci {0x00C0, "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256"}, 170e1051a39Sopenharmony_ci {0x00C1, "TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256"}, 171e1051a39Sopenharmony_ci {0x00C2, "TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256"}, 172e1051a39Sopenharmony_ci {0x00C3, "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256"}, 173e1051a39Sopenharmony_ci {0x00C4, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256"}, 174e1051a39Sopenharmony_ci {0x00C5, "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256"}, 175e1051a39Sopenharmony_ci {0x00FF, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV"}, 176e1051a39Sopenharmony_ci {0x5600, "TLS_FALLBACK_SCSV"}, 177e1051a39Sopenharmony_ci {0xC001, "TLS_ECDH_ECDSA_WITH_NULL_SHA"}, 178e1051a39Sopenharmony_ci {0xC002, "TLS_ECDH_ECDSA_WITH_RC4_128_SHA"}, 179e1051a39Sopenharmony_ci {0xC003, "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA"}, 180e1051a39Sopenharmony_ci {0xC004, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA"}, 181e1051a39Sopenharmony_ci {0xC005, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA"}, 182e1051a39Sopenharmony_ci {0xC006, "TLS_ECDHE_ECDSA_WITH_NULL_SHA"}, 183e1051a39Sopenharmony_ci {0xC007, "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA"}, 184e1051a39Sopenharmony_ci {0xC008, "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA"}, 185e1051a39Sopenharmony_ci {0xC009, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA"}, 186e1051a39Sopenharmony_ci {0xC00A, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA"}, 187e1051a39Sopenharmony_ci {0xC00B, "TLS_ECDH_RSA_WITH_NULL_SHA"}, 188e1051a39Sopenharmony_ci {0xC00C, "TLS_ECDH_RSA_WITH_RC4_128_SHA"}, 189e1051a39Sopenharmony_ci {0xC00D, "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA"}, 190e1051a39Sopenharmony_ci {0xC00E, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA"}, 191e1051a39Sopenharmony_ci {0xC00F, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA"}, 192e1051a39Sopenharmony_ci {0xC010, "TLS_ECDHE_RSA_WITH_NULL_SHA"}, 193e1051a39Sopenharmony_ci {0xC011, "TLS_ECDHE_RSA_WITH_RC4_128_SHA"}, 194e1051a39Sopenharmony_ci {0xC012, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA"}, 195e1051a39Sopenharmony_ci {0xC013, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"}, 196e1051a39Sopenharmony_ci {0xC014, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA"}, 197e1051a39Sopenharmony_ci {0xC015, "TLS_ECDH_anon_WITH_NULL_SHA"}, 198e1051a39Sopenharmony_ci {0xC016, "TLS_ECDH_anon_WITH_RC4_128_SHA"}, 199e1051a39Sopenharmony_ci {0xC017, "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA"}, 200e1051a39Sopenharmony_ci {0xC018, "TLS_ECDH_anon_WITH_AES_128_CBC_SHA"}, 201e1051a39Sopenharmony_ci {0xC019, "TLS_ECDH_anon_WITH_AES_256_CBC_SHA"}, 202e1051a39Sopenharmony_ci {0xC01A, "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA"}, 203e1051a39Sopenharmony_ci {0xC01B, "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA"}, 204e1051a39Sopenharmony_ci {0xC01C, "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA"}, 205e1051a39Sopenharmony_ci {0xC01D, "TLS_SRP_SHA_WITH_AES_128_CBC_SHA"}, 206e1051a39Sopenharmony_ci {0xC01E, "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA"}, 207e1051a39Sopenharmony_ci {0xC01F, "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA"}, 208e1051a39Sopenharmony_ci {0xC020, "TLS_SRP_SHA_WITH_AES_256_CBC_SHA"}, 209e1051a39Sopenharmony_ci {0xC021, "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA"}, 210e1051a39Sopenharmony_ci {0xC022, "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA"}, 211e1051a39Sopenharmony_ci {0xC023, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256"}, 212e1051a39Sopenharmony_ci {0xC024, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384"}, 213e1051a39Sopenharmony_ci {0xC025, "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256"}, 214e1051a39Sopenharmony_ci {0xC026, "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384"}, 215e1051a39Sopenharmony_ci {0xC027, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"}, 216e1051a39Sopenharmony_ci {0xC028, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384"}, 217e1051a39Sopenharmony_ci {0xC029, "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256"}, 218e1051a39Sopenharmony_ci {0xC02A, "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384"}, 219e1051a39Sopenharmony_ci {0xC02B, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"}, 220e1051a39Sopenharmony_ci {0xC02C, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"}, 221e1051a39Sopenharmony_ci {0xC02D, "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256"}, 222e1051a39Sopenharmony_ci {0xC02E, "TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384"}, 223e1051a39Sopenharmony_ci {0xC02F, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"}, 224e1051a39Sopenharmony_ci {0xC030, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"}, 225e1051a39Sopenharmony_ci {0xC031, "TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256"}, 226e1051a39Sopenharmony_ci {0xC032, "TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384"}, 227e1051a39Sopenharmony_ci {0xC033, "TLS_ECDHE_PSK_WITH_RC4_128_SHA"}, 228e1051a39Sopenharmony_ci {0xC034, "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA"}, 229e1051a39Sopenharmony_ci {0xC035, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA"}, 230e1051a39Sopenharmony_ci {0xC036, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA"}, 231e1051a39Sopenharmony_ci {0xC037, "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256"}, 232e1051a39Sopenharmony_ci {0xC038, "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384"}, 233e1051a39Sopenharmony_ci {0xC039, "TLS_ECDHE_PSK_WITH_NULL_SHA"}, 234e1051a39Sopenharmony_ci {0xC03A, "TLS_ECDHE_PSK_WITH_NULL_SHA256"}, 235e1051a39Sopenharmony_ci {0xC03B, "TLS_ECDHE_PSK_WITH_NULL_SHA384"}, 236e1051a39Sopenharmony_ci {0xC03C, "TLS_RSA_WITH_ARIA_128_CBC_SHA256"}, 237e1051a39Sopenharmony_ci {0xC03D, "TLS_RSA_WITH_ARIA_256_CBC_SHA384"}, 238e1051a39Sopenharmony_ci {0xC03E, "TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256"}, 239e1051a39Sopenharmony_ci {0xC03F, "TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384"}, 240e1051a39Sopenharmony_ci {0xC040, "TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256"}, 241e1051a39Sopenharmony_ci {0xC041, "TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384"}, 242e1051a39Sopenharmony_ci {0xC042, "TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256"}, 243e1051a39Sopenharmony_ci {0xC043, "TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384"}, 244e1051a39Sopenharmony_ci {0xC044, "TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256"}, 245e1051a39Sopenharmony_ci {0xC045, "TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384"}, 246e1051a39Sopenharmony_ci {0xC046, "TLS_DH_anon_WITH_ARIA_128_CBC_SHA256"}, 247e1051a39Sopenharmony_ci {0xC047, "TLS_DH_anon_WITH_ARIA_256_CBC_SHA384"}, 248e1051a39Sopenharmony_ci {0xC048, "TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256"}, 249e1051a39Sopenharmony_ci {0xC049, "TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384"}, 250e1051a39Sopenharmony_ci {0xC04A, "TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256"}, 251e1051a39Sopenharmony_ci {0xC04B, "TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384"}, 252e1051a39Sopenharmony_ci {0xC04C, "TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256"}, 253e1051a39Sopenharmony_ci {0xC04D, "TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384"}, 254e1051a39Sopenharmony_ci {0xC04E, "TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256"}, 255e1051a39Sopenharmony_ci {0xC04F, "TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384"}, 256e1051a39Sopenharmony_ci {0xC050, "TLS_RSA_WITH_ARIA_128_GCM_SHA256"}, 257e1051a39Sopenharmony_ci {0xC051, "TLS_RSA_WITH_ARIA_256_GCM_SHA384"}, 258e1051a39Sopenharmony_ci {0xC052, "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256"}, 259e1051a39Sopenharmony_ci {0xC053, "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384"}, 260e1051a39Sopenharmony_ci {0xC054, "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256"}, 261e1051a39Sopenharmony_ci {0xC055, "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384"}, 262e1051a39Sopenharmony_ci {0xC056, "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256"}, 263e1051a39Sopenharmony_ci {0xC057, "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384"}, 264e1051a39Sopenharmony_ci {0xC058, "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256"}, 265e1051a39Sopenharmony_ci {0xC059, "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384"}, 266e1051a39Sopenharmony_ci {0xC05A, "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256"}, 267e1051a39Sopenharmony_ci {0xC05B, "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384"}, 268e1051a39Sopenharmony_ci {0xC05C, "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256"}, 269e1051a39Sopenharmony_ci {0xC05D, "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384"}, 270e1051a39Sopenharmony_ci {0xC05E, "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256"}, 271e1051a39Sopenharmony_ci {0xC05F, "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384"}, 272e1051a39Sopenharmony_ci {0xC060, "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256"}, 273e1051a39Sopenharmony_ci {0xC061, "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384"}, 274e1051a39Sopenharmony_ci {0xC062, "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256"}, 275e1051a39Sopenharmony_ci {0xC063, "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384"}, 276e1051a39Sopenharmony_ci {0xC064, "TLS_PSK_WITH_ARIA_128_CBC_SHA256"}, 277e1051a39Sopenharmony_ci {0xC065, "TLS_PSK_WITH_ARIA_256_CBC_SHA384"}, 278e1051a39Sopenharmony_ci {0xC066, "TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256"}, 279e1051a39Sopenharmony_ci {0xC067, "TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384"}, 280e1051a39Sopenharmony_ci {0xC068, "TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256"}, 281e1051a39Sopenharmony_ci {0xC069, "TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384"}, 282e1051a39Sopenharmony_ci {0xC06A, "TLS_PSK_WITH_ARIA_128_GCM_SHA256"}, 283e1051a39Sopenharmony_ci {0xC06B, "TLS_PSK_WITH_ARIA_256_GCM_SHA384"}, 284e1051a39Sopenharmony_ci {0xC06C, "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256"}, 285e1051a39Sopenharmony_ci {0xC06D, "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384"}, 286e1051a39Sopenharmony_ci {0xC06E, "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256"}, 287e1051a39Sopenharmony_ci {0xC06F, "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384"}, 288e1051a39Sopenharmony_ci {0xC070, "TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256"}, 289e1051a39Sopenharmony_ci {0xC071, "TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384"}, 290e1051a39Sopenharmony_ci {0xC072, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256"}, 291e1051a39Sopenharmony_ci {0xC073, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384"}, 292e1051a39Sopenharmony_ci {0xC074, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256"}, 293e1051a39Sopenharmony_ci {0xC075, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384"}, 294e1051a39Sopenharmony_ci {0xC076, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256"}, 295e1051a39Sopenharmony_ci {0xC077, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384"}, 296e1051a39Sopenharmony_ci {0xC078, "TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256"}, 297e1051a39Sopenharmony_ci {0xC079, "TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384"}, 298e1051a39Sopenharmony_ci {0xC07A, "TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256"}, 299e1051a39Sopenharmony_ci {0xC07B, "TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384"}, 300e1051a39Sopenharmony_ci {0xC07C, "TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256"}, 301e1051a39Sopenharmony_ci {0xC07D, "TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384"}, 302e1051a39Sopenharmony_ci {0xC07E, "TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256"}, 303e1051a39Sopenharmony_ci {0xC07F, "TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384"}, 304e1051a39Sopenharmony_ci {0xC080, "TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256"}, 305e1051a39Sopenharmony_ci {0xC081, "TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384"}, 306e1051a39Sopenharmony_ci {0xC082, "TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256"}, 307e1051a39Sopenharmony_ci {0xC083, "TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384"}, 308e1051a39Sopenharmony_ci {0xC084, "TLS_DH_anon_WITH_CAMELLIA_128_GCM_SHA256"}, 309e1051a39Sopenharmony_ci {0xC085, "TLS_DH_anon_WITH_CAMELLIA_256_GCM_SHA384"}, 310e1051a39Sopenharmony_ci {0xC086, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256"}, 311e1051a39Sopenharmony_ci {0xC087, "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384"}, 312e1051a39Sopenharmony_ci {0xC088, "TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256"}, 313e1051a39Sopenharmony_ci {0xC089, "TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384"}, 314e1051a39Sopenharmony_ci {0xC08A, "TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256"}, 315e1051a39Sopenharmony_ci {0xC08B, "TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384"}, 316e1051a39Sopenharmony_ci {0xC08C, "TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256"}, 317e1051a39Sopenharmony_ci {0xC08D, "TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384"}, 318e1051a39Sopenharmony_ci {0xC08E, "TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256"}, 319e1051a39Sopenharmony_ci {0xC08F, "TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384"}, 320e1051a39Sopenharmony_ci {0xC090, "TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256"}, 321e1051a39Sopenharmony_ci {0xC091, "TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384"}, 322e1051a39Sopenharmony_ci {0xC092, "TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256"}, 323e1051a39Sopenharmony_ci {0xC093, "TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384"}, 324e1051a39Sopenharmony_ci {0xC094, "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256"}, 325e1051a39Sopenharmony_ci {0xC095, "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384"}, 326e1051a39Sopenharmony_ci {0xC096, "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256"}, 327e1051a39Sopenharmony_ci {0xC097, "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384"}, 328e1051a39Sopenharmony_ci {0xC098, "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256"}, 329e1051a39Sopenharmony_ci {0xC099, "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384"}, 330e1051a39Sopenharmony_ci {0xC09A, "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256"}, 331e1051a39Sopenharmony_ci {0xC09B, "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384"}, 332e1051a39Sopenharmony_ci {0xC09C, "TLS_RSA_WITH_AES_128_CCM"}, 333e1051a39Sopenharmony_ci {0xC09D, "TLS_RSA_WITH_AES_256_CCM"}, 334e1051a39Sopenharmony_ci {0xC09E, "TLS_DHE_RSA_WITH_AES_128_CCM"}, 335e1051a39Sopenharmony_ci {0xC09F, "TLS_DHE_RSA_WITH_AES_256_CCM"}, 336e1051a39Sopenharmony_ci {0xC0A0, "TLS_RSA_WITH_AES_128_CCM_8"}, 337e1051a39Sopenharmony_ci {0xC0A1, "TLS_RSA_WITH_AES_256_CCM_8"}, 338e1051a39Sopenharmony_ci {0xC0A2, "TLS_DHE_RSA_WITH_AES_128_CCM_8"}, 339e1051a39Sopenharmony_ci {0xC0A3, "TLS_DHE_RSA_WITH_AES_256_CCM_8"}, 340e1051a39Sopenharmony_ci {0xC0A4, "TLS_PSK_WITH_AES_128_CCM"}, 341e1051a39Sopenharmony_ci {0xC0A5, "TLS_PSK_WITH_AES_256_CCM"}, 342e1051a39Sopenharmony_ci {0xC0A6, "TLS_DHE_PSK_WITH_AES_128_CCM"}, 343e1051a39Sopenharmony_ci {0xC0A7, "TLS_DHE_PSK_WITH_AES_256_CCM"}, 344e1051a39Sopenharmony_ci {0xC0A8, "TLS_PSK_WITH_AES_128_CCM_8"}, 345e1051a39Sopenharmony_ci {0xC0A9, "TLS_PSK_WITH_AES_256_CCM_8"}, 346e1051a39Sopenharmony_ci {0xC0AA, "TLS_PSK_DHE_WITH_AES_128_CCM_8"}, 347e1051a39Sopenharmony_ci {0xC0AB, "TLS_PSK_DHE_WITH_AES_256_CCM_8"}, 348e1051a39Sopenharmony_ci {0xC0AC, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM"}, 349e1051a39Sopenharmony_ci {0xC0AD, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM"}, 350e1051a39Sopenharmony_ci {0xC0AE, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8"}, 351e1051a39Sopenharmony_ci {0xC0AF, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8"}, 352e1051a39Sopenharmony_ci {0xCCA8, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256"}, 353e1051a39Sopenharmony_ci {0xCCA9, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256"}, 354e1051a39Sopenharmony_ci {0xCCAA, "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256"}, 355e1051a39Sopenharmony_ci {0xCCAB, "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256"}, 356e1051a39Sopenharmony_ci {0xCCAC, "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256"}, 357e1051a39Sopenharmony_ci {0xCCAD, "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256"}, 358e1051a39Sopenharmony_ci {0xCCAE, "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256"}, 359e1051a39Sopenharmony_ci {0x1301, "TLS_AES_128_GCM_SHA256"}, 360e1051a39Sopenharmony_ci {0x1302, "TLS_AES_256_GCM_SHA384"}, 361e1051a39Sopenharmony_ci {0x1303, "TLS_CHACHA20_POLY1305_SHA256"}, 362e1051a39Sopenharmony_ci {0x1304, "TLS_AES_128_CCM_SHA256"}, 363e1051a39Sopenharmony_ci {0x1305, "TLS_AES_128_CCM_8_SHA256"}, 364e1051a39Sopenharmony_ci {0xFEFE, "SSL_RSA_FIPS_WITH_DES_CBC_SHA"}, 365e1051a39Sopenharmony_ci {0xFEFF, "SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA"}, 366e1051a39Sopenharmony_ci}; 367e1051a39Sopenharmony_ci 368e1051a39Sopenharmony_cistatic const char *get_std_name_by_id(int id) 369e1051a39Sopenharmony_ci{ 370e1051a39Sopenharmony_ci size_t i; 371e1051a39Sopenharmony_ci 372e1051a39Sopenharmony_ci for (i = 0; i < OSSL_NELEM(cipher_names); i++) 373e1051a39Sopenharmony_ci if (cipher_names[i].id == id) 374e1051a39Sopenharmony_ci return cipher_names[i].name; 375e1051a39Sopenharmony_ci 376e1051a39Sopenharmony_ci return NULL; 377e1051a39Sopenharmony_ci} 378e1051a39Sopenharmony_ci 379e1051a39Sopenharmony_cistatic int test_cipher_name(void) 380e1051a39Sopenharmony_ci{ 381e1051a39Sopenharmony_ci SSL_CTX *ctx = NULL; 382e1051a39Sopenharmony_ci SSL *ssl = NULL; 383e1051a39Sopenharmony_ci const SSL_CIPHER *c; 384e1051a39Sopenharmony_ci STACK_OF(SSL_CIPHER) *sk = NULL; 385e1051a39Sopenharmony_ci const char *ciphers = "ALL:eNULL", *p, *q, *r; 386e1051a39Sopenharmony_ci int i, id = 0, ret = 0; 387e1051a39Sopenharmony_ci 388e1051a39Sopenharmony_ci /* tests for invalid input */ 389e1051a39Sopenharmony_ci p = SSL_CIPHER_standard_name(NULL); 390e1051a39Sopenharmony_ci if (!TEST_str_eq(p, "(NONE)")) { 391e1051a39Sopenharmony_ci TEST_info("test_cipher_name(std) failed: NULL input doesn't return \"(NONE)\"\n"); 392e1051a39Sopenharmony_ci goto err; 393e1051a39Sopenharmony_ci } 394e1051a39Sopenharmony_ci 395e1051a39Sopenharmony_ci p = OPENSSL_cipher_name(NULL); 396e1051a39Sopenharmony_ci if (!TEST_str_eq(p, "(NONE)")) { 397e1051a39Sopenharmony_ci TEST_info("test_cipher_name(ossl) failed: NULL input doesn't return \"(NONE)\"\n"); 398e1051a39Sopenharmony_ci goto err; 399e1051a39Sopenharmony_ci } 400e1051a39Sopenharmony_ci 401e1051a39Sopenharmony_ci p = OPENSSL_cipher_name("This is not a valid cipher"); 402e1051a39Sopenharmony_ci if (!TEST_str_eq(p, "(NONE)")) { 403e1051a39Sopenharmony_ci TEST_info("test_cipher_name(ossl) failed: invalid input doesn't return \"(NONE)\"\n"); 404e1051a39Sopenharmony_ci goto err; 405e1051a39Sopenharmony_ci } 406e1051a39Sopenharmony_ci 407e1051a39Sopenharmony_ci /* tests for valid input */ 408e1051a39Sopenharmony_ci ctx = SSL_CTX_new(TLS_server_method()); 409e1051a39Sopenharmony_ci if (ctx == NULL) { 410e1051a39Sopenharmony_ci TEST_info("test_cipher_name failed: internal error\n"); 411e1051a39Sopenharmony_ci goto err; 412e1051a39Sopenharmony_ci } 413e1051a39Sopenharmony_ci 414e1051a39Sopenharmony_ci if (!SSL_CTX_set_cipher_list(ctx, ciphers)) { 415e1051a39Sopenharmony_ci TEST_info("test_cipher_name failed: internal error\n"); 416e1051a39Sopenharmony_ci goto err; 417e1051a39Sopenharmony_ci } 418e1051a39Sopenharmony_ci 419e1051a39Sopenharmony_ci ssl = SSL_new(ctx); 420e1051a39Sopenharmony_ci if (ssl == NULL) { 421e1051a39Sopenharmony_ci TEST_info("test_cipher_name failed: internal error\n"); 422e1051a39Sopenharmony_ci goto err; 423e1051a39Sopenharmony_ci } 424e1051a39Sopenharmony_ci 425e1051a39Sopenharmony_ci sk = SSL_get_ciphers(ssl); 426e1051a39Sopenharmony_ci if (sk == NULL) { 427e1051a39Sopenharmony_ci TEST_info("test_cipher_name failed: internal error\n"); 428e1051a39Sopenharmony_ci goto err; 429e1051a39Sopenharmony_ci } 430e1051a39Sopenharmony_ci 431e1051a39Sopenharmony_ci for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) { 432e1051a39Sopenharmony_ci c = sk_SSL_CIPHER_value(sk, i); 433e1051a39Sopenharmony_ci id = SSL_CIPHER_get_id(c) & 0xFFFF; 434e1051a39Sopenharmony_ci if ((id == 0xC102) || (id == 0xFF85) ||(id == 0xFF87)) 435e1051a39Sopenharmony_ci /* skip GOST2012-GOST8912-GOST891 and GOST2012-NULL-GOST12 */ 436e1051a39Sopenharmony_ci continue; 437e1051a39Sopenharmony_ci p = SSL_CIPHER_standard_name(c); 438e1051a39Sopenharmony_ci q = get_std_name_by_id(id); 439e1051a39Sopenharmony_ci if (!TEST_ptr(p)) { 440e1051a39Sopenharmony_ci TEST_info("test_cipher_name failed: expected %s, got NULL, cipher %x\n", 441e1051a39Sopenharmony_ci q, id); 442e1051a39Sopenharmony_ci goto err; 443e1051a39Sopenharmony_ci } 444e1051a39Sopenharmony_ci /* check if p is a valid standard name */ 445e1051a39Sopenharmony_ci if (!TEST_str_eq(p, q)) { 446e1051a39Sopenharmony_ci TEST_info("test_cipher_name(std) failed: expected %s, got %s, cipher %x\n", 447e1051a39Sopenharmony_ci q, p, id); 448e1051a39Sopenharmony_ci goto err; 449e1051a39Sopenharmony_ci } 450e1051a39Sopenharmony_ci /* test OPENSSL_cipher_name */ 451e1051a39Sopenharmony_ci q = SSL_CIPHER_get_name(c); 452e1051a39Sopenharmony_ci r = OPENSSL_cipher_name(p); 453e1051a39Sopenharmony_ci if (!TEST_str_eq(r, q)) { 454e1051a39Sopenharmony_ci TEST_info("test_cipher_name(ossl) failed: expected %s, got %s, cipher %x\n", 455e1051a39Sopenharmony_ci q, r, id); 456e1051a39Sopenharmony_ci goto err; 457e1051a39Sopenharmony_ci } 458e1051a39Sopenharmony_ci } 459e1051a39Sopenharmony_ci ret = 1; 460e1051a39Sopenharmony_cierr: 461e1051a39Sopenharmony_ci SSL_CTX_free(ctx); 462e1051a39Sopenharmony_ci SSL_free(ssl); 463e1051a39Sopenharmony_ci return ret; 464e1051a39Sopenharmony_ci} 465e1051a39Sopenharmony_ci 466e1051a39Sopenharmony_ciint setup_tests(void) 467e1051a39Sopenharmony_ci{ 468e1051a39Sopenharmony_ci ADD_TEST(test_cipher_name); 469e1051a39Sopenharmony_ci return 1; 470e1051a39Sopenharmony_ci} 471