/* Just make sure that the remote client supports uncompressed points, * Since that is all we support. Disable ECC cipher suites if it doesn't. */ SECStatus ssl3_HandleSupportedPointFormatsXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data) { int i; if (data->len < 2 || data->len > 255 || !data->data || data->len != (unsigned int)data->data[0] + 1) { return ssl3_DecodeError(ss); } for (i = data->len; --i > 0;) { if (data->data[i] == 0) { /* indicate that we should send a reply */ SECStatus rv; rv = ssl3_RegisterServerHelloExtensionSender(ss, ex_type, &ssl3_SendSupportedPointFormatsXtn); return rv; } } /* Poor client doesn't support uncompressed points. */ PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE); return SECFailure; }
void ssl3_ExtDecodeError(const sslSocket *ss) { (void)ssl3_DecodeError((sslSocket *)ss); }
static SECStatus ssl_UpdateSupportedGroups(sslSocket *ss, SECItem *data) { PRInt32 list_len; unsigned int i; const sslNamedGroupDef *enabled[SSL_NAMED_GROUP_COUNT] = { 0 }; PORT_Assert(SSL_NAMED_GROUP_COUNT == PR_ARRAY_SIZE(enabled)); if (!data->data || data->len < 4) { (void)ssl3_DecodeError(ss); return SECFailure; } /* get the length of elliptic_curve_list */ list_len = ssl3_ConsumeHandshakeNumber(ss, 2, &data->data, &data->len); if (list_len < 0 || data->len != list_len || (data->len % 2) != 0) { (void)ssl3_DecodeError(ss); return SECFailure; } /* disable all groups and remember the enabled groups */ for (i = 0; i < SSL_NAMED_GROUP_COUNT; ++i) { enabled[i] = ss->namedGroupPreferences[i]; ss->namedGroupPreferences[i] = NULL; } /* Read groups from data and enable if in |enabled| */ while (data->len) { const sslNamedGroupDef *group; PRInt32 curve_name = ssl3_ConsumeHandshakeNumber(ss, 2, &data->data, &data->len); if (curve_name < 0) { return SECFailure; /* fatal alert already sent */ } group = ssl_LookupNamedGroup(curve_name); if (group) { for (i = 0; i < SSL_NAMED_GROUP_COUNT; ++i) { if (enabled[i] && group == enabled[i]) { ss->namedGroupPreferences[i] = enabled[i]; break; } } } /* "Codepoints in the NamedCurve registry with a high byte of 0x01 (that * is, between 256 and 511 inclusive) are set aside for FFDHE groups," * -- https://tools.ietf.org/html/draft-ietf-tls-negotiated-ff-dhe-10 */ if ((curve_name & 0xff00) == 0x0100) { ss->ssl3.hs.peerSupportsFfdheGroups = PR_TRUE; } } /* Note: if ss->opt.requireDHENamedGroups is set, we disable DHE cipher * suites, but we do that in ssl3_config_match(). */ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3 && !ss->opt.requireDHENamedGroups && !ss->ssl3.hs.peerSupportsFfdheGroups) { /* If we don't require that DHE use named groups, and no FFDHE was * included, we pretend that they support all the FFDHE groups we do. */ for (i = 0; i < SSL_NAMED_GROUP_COUNT; ++i) { if (enabled[i] && enabled[i]->keaType == ssl_kea_dh) { ss->namedGroupPreferences[i] = enabled[i]; } } } return SECSuccess; }