stun: Rename a symbol to avoid a naming clash with OpenSSL
authorCurieux Tres <trescurieux@yahoo.fr>
Mon, 27 Oct 2014 11:32:17 +0000 (11:32 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 27 Oct 2014 11:32:17 +0000 (11:32 +0000)
The symbol is not exported, but nevertheless leaks in the static version
of libnice, due to limitations on symbol visibilities with static
libraries. OpenSSL has a symbol named RAND_bytes(), which ours clashes
with if the two are linked together statically.

Avoid this by prefixing ours with ‘nice_’.

stun/rand.c
stun/rand.h
stun/stunhmac.c

index 0de7f6e..fd08283 100644 (file)
@@ -45,7 +45,7 @@
 #include <windows.h>
 #include <wincrypt.h>
 
-void RAND_bytes (uint8_t *dst, int len)
+void nice_RAND_bytes (uint8_t *dst, int len)
 {
   HCRYPTPROV hCryptProv;
   LPCSTR container = "Libnice key container";
@@ -215,7 +215,7 @@ static unsigned long genrand_int32(void)
 
 static int initialized = 0;
 
-void RAND_bytes (uint8_t *dst, int len)
+void nice_RAND_bytes (uint8_t *dst, int len)
 {
   int i;
 
index 07c5fb5..0ed0263 100644 (file)
@@ -45,6 +45,6 @@
 #include <stdint.h>
 #endif
 
-void RAND_bytes (uint8_t *dst, int len);
+void nice_RAND_bytes (uint8_t *dst, int len);
 
 #endif /* RAND_H */
index db6fb16..df5deb6 100644 (file)
@@ -122,5 +122,5 @@ void stun_hash_creds (const uint8_t *realm, size_t realm_len,
 
 void stun_make_transid (StunTransactionId id)
 {
-  RAND_bytes (id, 16);
+  nice_RAND_bytes (id, 16);
 }