mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 03:11:48 +00:00
Fix build with OpenSSL API 1.1.0, which doesn't have RAND_pseudo_bytes
This commit is contained in:
parent
bf0ad07e59
commit
2e98e2081a
1 changed files with 8 additions and 0 deletions
|
|
@ -39,6 +39,10 @@
|
|||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#if OPENSSL_API_COMPAT >= 0x10100000L
|
||||
/* Needed for get_random_bytes, since RAND_pseudo_bytes is gone */
|
||||
#include <nbase.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "nse_openssl.h"
|
||||
|
|
@ -258,7 +262,11 @@ static int l_rand_pseudo_bytes( lua_State *L ) /** rand_pseudo_bytes( number byt
|
|||
unsigned char * result = (unsigned char *) malloc( len );
|
||||
if (!result) return luaL_error( L, "Couldn't allocate memory.");
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
RAND_pseudo_bytes( result, len );
|
||||
#else
|
||||
get_random_bytes( result, len );
|
||||
#endif
|
||||
lua_pushlstring( L, (char *) result, len );
|
||||
free( result );
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue