diff options
Diffstat (limited to 'libnm-util/crypto_nss.c')
| -rw-r--r-- | libnm-util/crypto_nss.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libnm-util/crypto_nss.c b/libnm-util/crypto_nss.c index b55af774..01bb28c3 100644 --- a/libnm-util/crypto_nss.c +++ b/libnm-util/crypto_nss.c @@ -441,10 +441,7 @@ crypto_verify_pkcs12 (const GByteArray *data, PK11SlotInfo *slot = NULL; SECStatus s; char *ucs2_password; - glong ucs2_chars = 0; -#ifndef WORDS_BIGENDIAN - guint16 *p; -#endif /* WORDS_BIGENDIAN */ + long ucs2_chars = 0; if (error) g_return_val_if_fail (*error == NULL, FALSE); @@ -470,10 +467,14 @@ crypto_verify_pkcs12 (const GByteArray *data, memset (ucs2_password, 0, ucs2_chars); g_free (ucs2_password); -#ifndef WORDS_BIGENDIAN - for (p = (guint16 *) pw.data; p < (guint16 *) (pw.data + pw.len); p++) - *p = GUINT16_SWAP_LE_BE (*p); -#endif /* WORDS_BIGENDIAN */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + { + guint16 *p; + + for (p = (guint16 *) pw.data; p < (guint16 *) (pw.data + pw.len); p++) + *p = GUINT16_SWAP_LE_BE (*p); + } +#endif } else { /* NULL password */ pw.data = NULL; |