For converting the 2 byte group id into an unsigned int.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2341)
# define TLS_CURVE_PRIME 0x0
# define TLS_CURVE_CHAR2 0x1
# define TLS_CURVE_CUSTOM 0x2
+
+#define bytestogroup(bytes) ((unsigned int)(bytes[0] << 8 | bytes[1]))
+
__owur int tls1_ec_curve_id2nid(int curve_id, unsigned int *pflags);
__owur int tls1_ec_nid2curve_id(int nid);
__owur int tls1_check_curve(SSL *s, const unsigned char *p, size_t len);
/* Find the first group we allow that is also in client's list */
for (i = 0, pcurvestmp = pcurves; i < num_curves;
i++, pcurvestmp += 2) {
- group_id = pcurvestmp[0] << 8 | pcurvestmp[1];
+ group_id = bytestogroup(pcurvestmp);
if (check_in_list(s, group_id, clntcurves, clnt_num_curves, 1))
break;
if (!tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED))
continue;
- curve_id = (pcurves[0] << 8) | pcurves[1];
+ curve_id = bytestogroup(pcurves);
break;
}
}
return 0;
}
for (i = 0; i < num_curves; i++, pcurves += 2) {
- if (group_id == (unsigned int)((pcurves[0] << 8) | pcurves[1]))
+ if (group_id == bytestogroup(pcurves))
break;
}
if (i >= num_curves