1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00
Commit Graph

43 Commits

Author SHA1 Message Date
nnposter
3d99250c83 Allow crypto IVs with leading zero. Close #2928, fix #2640 2024-09-13 21:36:46 +00:00
dmiller
136e1c6ed7 Lua 5.4 change: userdata created with 1 uservalue by default. Set to 0 when possible 2024-06-20 20:47:10 +00:00
dmiller
19d440fccf Use BN_bn2mpi for ssh2. Add some tests. 2023-01-02 21:20:09 +00:00
dmiller
7332939768 Ensure crypto CTX objects are freed. Fixes #2550 2022-10-25 17:00:01 +00:00
dmiller
1641a291e9 Fix a double-free due to uninitialized should_free in bignum_data_t 2022-10-06 17:28:39 +00:00
dmiller
d6bea8dcde Build based on OpenSSL version, not API level. Fixes #2516 2022-09-06 22:39:34 +00:00
dmiller
9732e6979e Merge Nmap 7.93 release branch 2022-09-02 14:38:17 +00:00
dmiller
140dd72415 Fix build with OpenSSL 3.0
Updated all OpenSSL code to OpenSSL 3.0 API with no deprecated functions. Some
NSE functions were changed:
* openssl.rc4_options and openssl.rc4 were removed in favor of openssl.encrypt
* openssl.bignum_pseudo_rand is now an alias for openssl.bignum_rand
* openssl.bignum_is_prime and openssl.bignum_is_safe_prime will now ignore the
  nchecks parameter, using a secure default instead.
2022-08-25 14:51:59 +00:00
dmiller
a78fd44073 Silence LGTM warnings about weak crypto: these are compatibility, not security. 2021-07-21 00:59:42 +00:00
dmiller
f8846c2c39 Add a tostring metamethod for bignum objects. See #1876 2020-01-03 16:54:59 +00:00
dmiller
73ce19e7b6 Use Lua integers in more places where floats are unexpected. Fixes #1647 2019-06-26 20:13:43 +00:00
dmiller
ace7fbd0bd Fix a memory leak when getting SSL cert with RSA key in NSE 2019-06-20 23:11:10 +00:00
dmiller
a0f55317f3 Fix inclusion of Lua headers. See #1355
We will need to do something similar for Ncat.
2018-10-16 05:18:31 +00:00
dmiller
2e98e2081a Fix build with OpenSSL API 1.1.0, which doesn't have RAND_pseudo_bytes 2018-10-12 21:03:01 +00:00
dmiller
deea96de7c Make rand_bytes crypto-safe, use rand_pseudo_bytes for no-fail random 2018-09-08 17:07:02 +00:00
dmiller
a67e68b2d4 Avoid building RC4 bindings if RC4 is not available. Fixes #1094 2018-01-22 05:34:35 +00:00
dmiller
3abb4c7af3 Add BN_div function binding 2017-10-18 20:26:39 +00:00
dmiller
b7e213b5cb Fix compatibility with LibreSSL; new checks skipped initialization code 2017-02-07 20:10:02 +00:00
dmiller
9b86dadb58 Remove deprecated calls from OpenSSL 1.1 API. Closes #630 2017-01-11 15:38:08 +00:00
dmiller
71b55dd7f8 Factor out some OpenSSL feature checks
Instead of maintaining parallel blocks of code that do the same thing,
use preprocessor defines to unify the syntax. This way, functional
changes only need to happen in one place.
2016-09-09 14:08:49 +00:00
dmiller
182bcf8c1c Add compatibility with LibreSSL. Closes #543 2016-09-09 14:08:48 +00:00
vincent
aedd25c3a2 Add compatibility with OpenSSL 1.1.0 pre5 and previous versions
Add some checks to know which OpenSSL version is used, to be sure
the code follows the syntax of the version used (including 1.1.0).
2016-08-01 09:34:56 +00:00
batrick
7f5ec526fe Merge branch 'nse-lua53'
Lua 5.3 adds several awesome features of particular interest to nmap including
bitwise operators and integers, a utf8 library, and standard binary pack/unpack
functions.

In addition to adding Lua 5.3, this branch changes:

o Complete removal of the NSE bit library (in C), It has been replaced with
  a new Lua library wrapping Lua 5.3's bit-wise operators.

o Complete removal of the NSE bin library (in C). It has been replaced with a
  new Lua library wrapping Lua 5.3's string.pack|unpack functions.

o The bin.pack "B" format specifier (which has never worked correctly) is
  unimplemented.  All scripts/libraries which use it have been updated. Most
  usage of this option was to allow string based bit-wise operations which are no
  longer necessary now that Lua 5.3 provides integers and bit-wise operators.

o The base32/base64 libraries have been reimplemented using Lua 5.3's new
  bitwise operators. (This library was the main user of the bin.pack "B" format
  specifier.)

o A new "bits" library has been added for common bit hacks. Currently only has
  a reverse function.

Thanks to David Fifield, Daniel Miller, Jacek Wielemborek, and  Paulino
Calderon for testing this branch.
2016-07-02 17:02:27 +00:00
dmiller
59451640d1 Change deprecated RAND_pseudo_bytes call to RAND_bytes
Excellent discussion of the issues with RAND_pseudo_bytes here:
https://jbp.io/2014/01/16/openssl-rand-api/

Essentially, RAND_pseudo_bytes is the same function as RAND_bytes,
except with worse documentation and broken implementations in some
cases.
2016-06-26 14:37:21 +00:00
dmiller
056c48544a Factor out some code for returning bignums 2016-06-09 04:36:07 +00:00
dmiller
5c425fa6fd Add Miller-Rabin primality tests to NSE. Closes #190 2015-11-11 21:19:06 +00:00
dmiller
986f87be39 Remove call to deprecated BN_CTX_init http://seclists.org/nmap-dev/2015/q2/9 2015-04-06 12:27:17 +00:00
d33tah
a80c90608c sed -i 's/if ( /if (/g' *.cc *.h; sed -i 's/for ( /for (/g' *.cc *.h; sed -i 's/( /(/g' nmap_amigaos.h tcpip.h service_scan.cc
There's still quite a lot of code like this, nse_openssl.cc being most
messy IMHO. Also, I left out "if( something )" syntax.
2014-06-25 15:40:54 +00:00
d33tah
421176fc00 Get rid of double newline at the EOF I accidentally introduced in the
last commit.
2014-06-18 11:30:02 +00:00
dmiller
3f0d0c16f9 Spellcheck on Nmap, Nsock, Nbase source files 2014-02-20 18:44:12 +00:00
dmiller
c9714990c7 Remove trailing whitespace from C/C++ files
https://secwiki.org/w/Nmap/Code_Standards
2014-02-12 20:25:51 +00:00
batrick
1054c3abc7 RC4 cipher for work Ron is doing. 2012-07-19 02:47:01 +00:00
batrick
f404c78546 alphabetize includes 2012-07-18 22:46:38 +00:00
batrick
000f6dc4d9 Lua 5.2 upgrade [1] for NSE.
[1] http://seclists.org/nmap-dev/2012/q2/34
2012-05-27 08:53:32 +00:00
alex
5eeca041f8 Removed references to MD2, as OpenSSL 1.x.x doesn't support it anymore 2010-08-20 06:05:08 +00:00
david
36927f0810 Fix a problem in the changes to the openssl NSE library made in r17002
found by Patrik Karlsson. The second and subsequent times we call
EVP{Encrypt,Decrypt}Init_ex, we have to pass NULL for the type argument.
This allows setting to accumulate from previous calls.
2010-03-28 21:18:02 +00:00
david
181bb7ca93 Check the key and iv length before giving them to OpenSSL in l_encrypt
and l_decrypt. Otherwise, OpenSSL reads unallocated memory:

openssl.encrypt("DES", "key", "iv", "datadatadatadata")

==5691== Invalid read of size 1
==5691==    at 0x412F07D: DES_set_key_unchecked (in /usr/lib/libcrypto.so.0.9.8)
==5691==  Address 0x4bcc415 is 2 bytes after a block of size 19 alloc'd
==5691==    at 0x402598A: malloc (vg_replace_malloc.c:195)
==5691==    by 0x4025A16: realloc (vg_replace_malloc.c:476)
==5691==    by 0x80ED502: luaM_realloc_ (in /home/david/nmap/nmap)
==5691==    by 0x80F134B: luaS_newlstr (in /home/david/nmap/nmap)
==5691==    by 0x80F85FA: luaX_newstring (in /home/david/nmap/nmap)
==5691==    by 0x80F8FF6: llex (in /home/david/nmap/nmap)
==5691==    by 0x80F9861: luaX_next (in /home/david/nmap/nmap)
==5691==    by 0x80EDCAF: testnext (in /home/david/nmap/nmap)
==5691==    by 0x80EF718: explist1 (in /home/david/nmap/nmap)
==5691==    by 0x80EF7C0: funcargs (in /home/david/nmap/nmap)
==5691==    by 0x80EFA1C: primaryexp (in /home/david/nmap/nmap)
==5691==    by 0x80EEE16: subexpr (in /home/david/nmap/nmap)
2010-03-15 22:49:09 +00:00
patrik
16e0a8449f o Added the function bignum_add to the nse_openssl library to support BIGNUM
addition [Patrik]
2010-03-09 20:54:01 +00:00
batrick
07cfc5aee4 Corrected many #includes for header files (where they are included).
Moved the includes for Lua headers to the .cc files so they are
not needlessly, repeatedly included.

Similarly, moved some standard headers to the .cc files and reorganized
includes to be uniform for all nse_* source files.

Fixed whitespace (removed tabs).
2009-03-10 05:56:10 +00:00
sven
e9dd88b8a9 remove bignum_set_negative and bignum_is_negative because those functions are not available in older openssl versions 2008-10-30 13:10:01 +00:00
sven
841ab6647a show meaningful error messages on OpenSSL errors 2008-10-12 13:47:44 +00:00
david
e7cc30b6c2 Make some changes to allow a Windows build of the new openssl code. (Just
rearragement of some includes and defines.)
2008-10-08 22:58:29 +00:00
sven
d8714befb1 merging nse_openssl branch 2008-10-08 22:21:41 +00:00