diff options
author | Hugo Beauzée-Luyssen <hugo@beauzee.fr> | 2019-02-18 17:12:54 +0100 |
---|---|---|
committer | Hugo Beauzée-Luyssen <hugo@beauzee.fr> | 2019-02-21 15:24:56 +0100 |
commit | 17e399701b9e03f0304c70b08b7aa9f2333dac6f (patch) | |
tree | 92a4eb3e63e480b380b4a472ff5a695bc3a605fb /lib | |
parent | 15912b1f0f9a485948b7f34304a1b20d2182e26f (diff) | |
download | gnutls-17e399701b9e03f0304c70b08b7aa9f2333dac6f.tar.gz |
iconv: Allow _gnutls_utf8_to_ucs2 to output little endian
Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/str-iconv.c | 5 | ||||
-rw-r--r-- | lib/system.h | 2 | ||||
-rw-r--r-- | lib/x509/pkcs12_encr.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/lib/str-iconv.c b/lib/str-iconv.c index f5e3943e21..9606613e48 100644 --- a/lib/str-iconv.c +++ b/lib/str-iconv.c @@ -117,9 +117,8 @@ int _gnutls_ucs2_to_utf8(const void *data, size_t size, return ret; } -/* This is big-endian output only */ int _gnutls_utf8_to_ucs2(const void *data, size_t size, - gnutls_datum_t * output) + gnutls_datum_t * output, unsigned be) { int ret; size_t dstlen, nrm_size = 0, tmp_size = 0; @@ -150,7 +149,7 @@ int _gnutls_utf8_to_ucs2(const void *data, size_t size, } /* convert to BE */ - change_u16_endianness(dst, (uint8_t*)tmp_dst, dstlen, 1); + change_u16_endianness(dst, (uint8_t*)tmp_dst, dstlen, be); dst[dstlen] = 0; dst[dstlen+1] = 0; diff --git a/lib/system.h b/lib/system.h index 2e77322e1d..ccae6475f8 100644 --- a/lib/system.h +++ b/lib/system.h @@ -100,7 +100,7 @@ int _gnutls_find_config_path(char *path, size_t max_size); int _gnutls_ucs2_to_utf8(const void *data, size_t size, gnutls_datum_t * output, unsigned bigendian); int _gnutls_utf8_to_ucs2(const void *data, size_t size, - gnutls_datum_t * output); + gnutls_datum_t * output, unsigned be); void _gnutls_global_set_gettime_function(gnutls_gettime_func gettime_func); diff --git a/lib/x509/pkcs12_encr.c b/lib/x509/pkcs12_encr.c index 9d9c1d64a9..76fbb4e8ab 100644 --- a/lib/x509/pkcs12_encr.c +++ b/lib/x509/pkcs12_encr.c @@ -96,7 +96,7 @@ _gnutls_pkcs12_string_to_key(const mac_entry_st * me, return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); ucs2.size = 2; } else { - rc = _gnutls_utf8_to_ucs2(pw, pwlen, &ucs2); + rc = _gnutls_utf8_to_ucs2(pw, pwlen, &ucs2, 1); if (rc < 0) return gnutls_assert_val(rc); |