summaryrefslogtreecommitdiff
path: root/lib/gnutls_algorithms.c
diff options
context:
space:
mode:
authorJonathan Bastien-Filiatrault <joe@x2a.org>2009-08-01 13:41:57 -0400
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-03 19:35:41 +0200
commit8aaf546f1c1b8a198f3bf69bb380bff9a47713fd (patch)
treeb00102e7ca576e63991d2e560688ef813a63c58d /lib/gnutls_algorithms.c
parentd1518b15a5da9ab713d14c8d7ccd2e7753ab1f8a (diff)
downloadgnutls-8aaf546f1c1b8a198f3bf69bb380bff9a47713fd.tar.gz
Do not rely on version ordering; use switch..case instead.
Diffstat (limited to 'lib/gnutls_algorithms.c')
-rw-r--r--lib/gnutls_algorithms.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/lib/gnutls_algorithms.c b/lib/gnutls_algorithms.c
index f8f908749b..1e0cefcd64 100644
--- a/lib/gnutls_algorithms.c
+++ b/lib/gnutls_algorithms.c
@@ -1279,6 +1279,7 @@ _gnutls_version_has_selectable_prf (gnutls_protocol_t version)
return version == GNUTLS_TLS1_2;
}
+
/* This function determines if the version specified has selectable
signature/hash functions for certificate authentification. */
int
@@ -1292,7 +1293,12 @@ _gnutls_version_has_selectable_sighash (gnutls_protocol_t version)
int
_gnutls_version_has_selectable_sighash (gnutls_protocol_t version)
{
- return version >= GNUTLS_TLS1_2;
+ switch(version) {
+ case GNUTLS_TLS1_2:
+ return 1;
+ default:
+ return 0;
+ }
}
/* This function determines if the version specified has support for
@@ -1300,6 +1306,7 @@ _gnutls_version_has_selectable_sighash (gnutls_protocol_t version)
int
_gnutls_version_has_extensions (gnutls_protocol_t version)
{
+<<<<<<< HEAD:lib/gnutls_algorithms.c
switch (version)
{
case GNUTLS_TLS1_0:
@@ -1340,6 +1347,16 @@ _gnutls_version_has_variable_padding (gnutls_protocol_t version)
default:
return 0;
}
+=======
+ switch(version) {
+ case GNUTLS_TLS1_0:
+ case GNUTLS_TLS1_1:
+ case GNUTLS_TLS1_2:
+ return 1;
+ default:
+ return 0;
+ }
+>>>>>>> Do not rely on version ordering; use switch..case instead.:lib/gnutls_algorithms.c
}
/* This function determines if the version specified has explicit IVs
@@ -1347,14 +1364,27 @@ _gnutls_version_has_variable_padding (gnutls_protocol_t version)
int
_gnutls_version_has_explicit_iv (gnutls_protocol_t version)
{
- return version >= GNUTLS_TLS1_1;
+ switch(version) {
+ case GNUTLS_TLS1_1:
+ case GNUTLS_TLS1_2:
+ return 1;
+ default:
+ return 0;
+ }
}
/* This function determines if the version specified can have
non-minimal padding. */
int _gnutls_version_has_variable_padding (gnutls_protocol_t version)
{
- return version >= GNUTLS_TLS1_0;
+ switch(version) {
+ case GNUTLS_TLS1_0:
+ case GNUTLS_TLS1_1:
+ case GNUTLS_TLS1_2:
+ return 1;
+ default:
+ return 0;
+ }
}
/* Type to KX mappings */