mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 10:10:07 +01:00
libnm/crypto: rework endianness detection for crypto_verify_pkcs12()
At other places, we already use __BYTE_ORDER define to detect endianness. We don't need multiple mechanisms. Also note that meson did not do the correct thing as AC_C_BIGENDIAN, so meson + nss + big-endian was possibly broken.
This commit is contained in:
parent
858d5c3e91
commit
08c80dd2e3
4 changed files with 16 additions and 31 deletions
|
|
@ -226,18 +226,6 @@
|
||||||
/* Define if you have iwd support */
|
/* Define if you have iwd support */
|
||||||
#mesondefine WITH_IWD
|
#mesondefine WITH_IWD
|
||||||
|
|
||||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
|
||||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
|
||||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
|
||||||
# if defined __BIG_ENDIAN__
|
|
||||||
# define WORDS_BIGENDIAN 1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# ifndef WORDS_BIGENDIAN
|
|
||||||
/* # undef WORDS_BIGENDIAN */
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define to 1 if on MINIX. */
|
/* Define to 1 if on MINIX. */
|
||||||
#mesondefine _MINIX
|
#mesondefine _MINIX
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,11 +109,6 @@ GETTEXT_PACKAGE=NetworkManager
|
||||||
AC_SUBST(GETTEXT_PACKAGE)
|
AC_SUBST(GETTEXT_PACKAGE)
|
||||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
|
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl Make sha1.c happy on big endian systems
|
|
||||||
dnl
|
|
||||||
AC_C_BIGENDIAN
|
|
||||||
|
|
||||||
# Add runstatedir if not specified manually in autoconf < 2.70
|
# Add runstatedir if not specified manually in autoconf < 2.70
|
||||||
AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run")
|
AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run")
|
||||||
AC_SUBST(runstatedir)
|
AC_SUBST(runstatedir)
|
||||||
|
|
|
||||||
|
|
@ -414,9 +414,6 @@ _nm_crypto_verify_pkcs12 (const guint8 *data,
|
||||||
SECStatus s;
|
SECStatus s;
|
||||||
gunichar2 *ucs2_password;
|
gunichar2 *ucs2_password;
|
||||||
long ucs2_chars = 0;
|
long ucs2_chars = 0;
|
||||||
#ifndef WORDS_BIGENDIAN
|
|
||||||
guint16 *p;
|
|
||||||
#endif /* WORDS_BIGENDIAN */
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
g_return_val_if_fail (*error == NULL, FALSE);
|
g_return_val_if_fail (*error == NULL, FALSE);
|
||||||
|
|
@ -446,10 +443,14 @@ _nm_crypto_verify_pkcs12 (const guint8 *data,
|
||||||
nm_explicit_bzero (ucs2_password, ucs2_chars);
|
nm_explicit_bzero (ucs2_password, ucs2_chars);
|
||||||
g_free (ucs2_password);
|
g_free (ucs2_password);
|
||||||
|
|
||||||
#ifndef WORDS_BIGENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
for (p = (guint16 *) pw.data; p < (guint16 *) (pw.data + pw.len); p++)
|
{
|
||||||
*p = GUINT16_SWAP_LE_BE (*p);
|
guint16 *p;
|
||||||
#endif /* WORDS_BIGENDIAN */
|
|
||||||
|
for (p = (guint16 *) pw.data; p < (guint16 *) (pw.data + pw.len); p++)
|
||||||
|
*p = GUINT16_SWAP_LE_BE (*p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* NULL password */
|
/* NULL password */
|
||||||
pw.data = NULL;
|
pw.data = NULL;
|
||||||
|
|
|
||||||
|
|
@ -442,9 +442,6 @@ crypto_verify_pkcs12 (const GByteArray *data,
|
||||||
SECStatus s;
|
SECStatus s;
|
||||||
char *ucs2_password;
|
char *ucs2_password;
|
||||||
long ucs2_chars = 0;
|
long ucs2_chars = 0;
|
||||||
#ifndef WORDS_BIGENDIAN
|
|
||||||
guint16 *p;
|
|
||||||
#endif /* WORDS_BIGENDIAN */
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
g_return_val_if_fail (*error == NULL, FALSE);
|
g_return_val_if_fail (*error == NULL, FALSE);
|
||||||
|
|
@ -470,10 +467,14 @@ crypto_verify_pkcs12 (const GByteArray *data,
|
||||||
memset (ucs2_password, 0, ucs2_chars);
|
memset (ucs2_password, 0, ucs2_chars);
|
||||||
g_free (ucs2_password);
|
g_free (ucs2_password);
|
||||||
|
|
||||||
#ifndef WORDS_BIGENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
for (p = (guint16 *) pw.data; p < (guint16 *) (pw.data + pw.len); p++)
|
{
|
||||||
*p = GUINT16_SWAP_LE_BE (*p);
|
guint16 *p;
|
||||||
#endif /* WORDS_BIGENDIAN */
|
|
||||||
|
for (p = (guint16 *) pw.data; p < (guint16 *) (pw.data + pw.len); p++)
|
||||||
|
*p = GUINT16_SWAP_LE_BE (*p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* NULL password */
|
/* NULL password */
|
||||||
pw.data = NULL;
|
pw.data = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue