From 484525ad76009e0395d9ba81b4a41c1276bd2f0e Mon Sep 17 00:00:00 2001 From: jsing Date: Sun, 13 Jul 2014 16:33:01 +0000 Subject: [PATCH] Expand the tlsext_sigalg macros. The end result is about the same number of lines and much more readable. ok miod@ --- lib/libssl/src/ssl/t1_lib.c | 35 +++++++++++++++++++---------------- lib/libssl/t1_lib.c | 35 +++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/lib/libssl/src/ssl/t1_lib.c b/lib/libssl/src/ssl/t1_lib.c index d82573fdb63..0966e78b4d1 100644 --- a/lib/libssl/src/ssl/t1_lib.c +++ b/lib/libssl/src/ssl/t1_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_lib.c,v 1.51 2014/07/13 16:03:10 beck Exp $ */ +/* $OpenBSD: t1_lib.c,v 1.52 2014/07/13 16:33:01 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -346,28 +346,31 @@ tls1_ec_nid2curve_id(int nid) } } - -/* List of supported signature algorithms and hashes. Should make this +/* + * List of supported signature algorithms and hashes. Should make this * customisable at some point, for now include everything we support. */ -#define tlsext_sigalg_rsa(md) md, TLSEXT_signature_rsa, +static unsigned char tls12_sigalgs[] = { + TLSEXT_hash_sha512, TLSEXT_signature_rsa, + TLSEXT_hash_sha512, TLSEXT_signature_dsa, + TLSEXT_hash_sha512, TLSEXT_signature_ecdsa, -#define tlsext_sigalg_dsa(md) md, TLSEXT_signature_dsa, + TLSEXT_hash_sha384, TLSEXT_signature_rsa, + TLSEXT_hash_sha384, TLSEXT_signature_dsa, + TLSEXT_hash_sha384, TLSEXT_signature_ecdsa, -#define tlsext_sigalg_ecdsa(md) md, TLSEXT_signature_ecdsa, + TLSEXT_hash_sha256, TLSEXT_signature_rsa, + TLSEXT_hash_sha256, TLSEXT_signature_dsa, + TLSEXT_hash_sha256, TLSEXT_signature_ecdsa, -#define tlsext_sigalg(md) \ - tlsext_sigalg_rsa(md) \ - tlsext_sigalg_dsa(md) \ - tlsext_sigalg_ecdsa(md) + TLSEXT_hash_sha224, TLSEXT_signature_rsa, + TLSEXT_hash_sha224, TLSEXT_signature_dsa, + TLSEXT_hash_sha224, TLSEXT_signature_ecdsa, -static unsigned char tls12_sigalgs[] = { - tlsext_sigalg(TLSEXT_hash_sha512) - tlsext_sigalg(TLSEXT_hash_sha384) - tlsext_sigalg(TLSEXT_hash_sha256) - tlsext_sigalg(TLSEXT_hash_sha224) - tlsext_sigalg(TLSEXT_hash_sha1) + TLSEXT_hash_sha1, TLSEXT_signature_rsa, + TLSEXT_hash_sha1, TLSEXT_signature_dsa, + TLSEXT_hash_sha1, TLSEXT_signature_ecdsa, }; int diff --git a/lib/libssl/t1_lib.c b/lib/libssl/t1_lib.c index d82573fdb63..0966e78b4d1 100644 --- a/lib/libssl/t1_lib.c +++ b/lib/libssl/t1_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_lib.c,v 1.51 2014/07/13 16:03:10 beck Exp $ */ +/* $OpenBSD: t1_lib.c,v 1.52 2014/07/13 16:33:01 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -346,28 +346,31 @@ tls1_ec_nid2curve_id(int nid) } } - -/* List of supported signature algorithms and hashes. Should make this +/* + * List of supported signature algorithms and hashes. Should make this * customisable at some point, for now include everything we support. */ -#define tlsext_sigalg_rsa(md) md, TLSEXT_signature_rsa, +static unsigned char tls12_sigalgs[] = { + TLSEXT_hash_sha512, TLSEXT_signature_rsa, + TLSEXT_hash_sha512, TLSEXT_signature_dsa, + TLSEXT_hash_sha512, TLSEXT_signature_ecdsa, -#define tlsext_sigalg_dsa(md) md, TLSEXT_signature_dsa, + TLSEXT_hash_sha384, TLSEXT_signature_rsa, + TLSEXT_hash_sha384, TLSEXT_signature_dsa, + TLSEXT_hash_sha384, TLSEXT_signature_ecdsa, -#define tlsext_sigalg_ecdsa(md) md, TLSEXT_signature_ecdsa, + TLSEXT_hash_sha256, TLSEXT_signature_rsa, + TLSEXT_hash_sha256, TLSEXT_signature_dsa, + TLSEXT_hash_sha256, TLSEXT_signature_ecdsa, -#define tlsext_sigalg(md) \ - tlsext_sigalg_rsa(md) \ - tlsext_sigalg_dsa(md) \ - tlsext_sigalg_ecdsa(md) + TLSEXT_hash_sha224, TLSEXT_signature_rsa, + TLSEXT_hash_sha224, TLSEXT_signature_dsa, + TLSEXT_hash_sha224, TLSEXT_signature_ecdsa, -static unsigned char tls12_sigalgs[] = { - tlsext_sigalg(TLSEXT_hash_sha512) - tlsext_sigalg(TLSEXT_hash_sha384) - tlsext_sigalg(TLSEXT_hash_sha256) - tlsext_sigalg(TLSEXT_hash_sha224) - tlsext_sigalg(TLSEXT_hash_sha1) + TLSEXT_hash_sha1, TLSEXT_signature_rsa, + TLSEXT_hash_sha1, TLSEXT_signature_dsa, + TLSEXT_hash_sha1, TLSEXT_signature_ecdsa, }; int -- 2.20.1