summaryrefslogtreecommitdiff
path: root/drivers/builtin_openssl2/crypto/o_str.c
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-11 23:16:31 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-11 23:16:31 +0200
commit925aa086a27fc06d7dacc866fed975046652cf23 (patch)
tree2b8b62259a10351b224a43444ff08592f446efff /drivers/builtin_openssl2/crypto/o_str.c
parent89fcd529f3966a2f4977402f9d8f1ec25dfeb53e (diff)
parentc860574d8ba246b5e2c59578f24accd2ace5e9bc (diff)
Merge pull request #4275 from mrezai/openssl-1.0.1s
Update OpenSSL to version 1.0.1s
Diffstat (limited to 'drivers/builtin_openssl2/crypto/o_str.c')
-rw-r--r--drivers/builtin_openssl2/crypto/o_str.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/drivers/builtin_openssl2/crypto/o_str.c b/drivers/builtin_openssl2/crypto/o_str.c
index d233afd46b..fd4087ffe3 100644
--- a/drivers/builtin_openssl2/crypto/o_str.c
+++ b/drivers/builtin_openssl2/crypto/o_str.c
@@ -1,6 +1,7 @@
-/* crypto/o_str.c -*- mode:C; c-file-style: "eay" -*- */
-/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
- * project 2003.
+/* crypto/o_str.c */
+/*
+ * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project
+ * 2003.
*/
/* ====================================================================
* Copyright (c) 2003 The OpenSSL Project. All rights reserved.
@@ -10,7 +11,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -63,53 +64,53 @@
#if !defined(OPENSSL_IMPLEMENTS_strncasecmp) && \
!defined(OPENSSL_SYSNAME_WIN32) && \
!defined(NETWARE_CLIB)
-#ifdef _WIN32
-#include <string.h>
-#else
-#include <strings.h>
-#endif
+# include <strings.h>
#endif
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
- {
+{
#if defined(OPENSSL_IMPLEMENTS_strncasecmp)
- while (*str1 && *str2 && n)
- {
- int res = toupper(*str1) - toupper(*str2);
- if (res) return res < 0 ? -1 : 1;
- str1++;
- str2++;
- n--;
- }
- if (n == 0)
- return 0;
- if (*str1)
- return 1;
- if (*str2)
- return -1;
- return 0;
+ while (*str1 && *str2 && n) {
+ int res = toupper(*str1) - toupper(*str2);
+ if (res)
+ return res < 0 ? -1 : 1;
+ str1++;
+ str2++;
+ n--;
+ }
+ if (n == 0)
+ return 0;
+ if (*str1)
+ return 1;
+ if (*str2)
+ return -1;
+ return 0;
#else
- /* Recursion hazard warning! Whenever strncasecmp is #defined as
- * OPENSSL_strncasecmp, OPENSSL_IMPLEMENTS_strncasecmp must be
- * defined as well. */
- return strncasecmp(str1, str2, n);
+ /*
+ * Recursion hazard warning! Whenever strncasecmp is #defined as
+ * OPENSSL_strncasecmp, OPENSSL_IMPLEMENTS_strncasecmp must be defined as
+ * well.
+ */
+ return strncasecmp(str1, str2, n);
#endif
- }
+}
+
int OPENSSL_strcasecmp(const char *str1, const char *str2)
- {
+{
#if defined(OPENSSL_IMPLEMENTS_strncasecmp)
- return OPENSSL_strncasecmp(str1, str2, (size_t)-1);
+ return OPENSSL_strncasecmp(str1, str2, (size_t)-1);
#else
- return strcasecmp(str1, str2);
+ return strcasecmp(str1, str2);
#endif
- }
+}
-int OPENSSL_memcmp(const void *v1,const void *v2,size_t n)
- {
- const unsigned char *c1=v1,*c2=v2;
- int ret=0;
+int OPENSSL_memcmp(const void *v1, const void *v2, size_t n)
+{
+ const unsigned char *c1 = v1, *c2 = v2;
+ int ret = 0;
- while(n && (ret=*c1-*c2)==0) n--,c1++,c2++;
+ while (n && (ret = *c1 - *c2) == 0)
+ n--, c1++, c2++;
- return ret;
- }
+ return ret;
+}