Mercurial > dropbear
annotate dbmalloc.h @ 1790:42745af83b7d
Introduce extra delay before closing unauthenticated sessions
To make it harder for attackers, introduce a delay to keep an
unauthenticated session open a bit longer, thus blocking a connection
slot until after the delay.
Without this, while there is a limit on the amount of attempts an attacker
can make at the same time (MAX_UNAUTH_PER_IP), the time taken by dropbear to
handle one attempt is still short and thus for each of the allowed parallel
attempts many attempts can be chained one after the other. The attempt rate
is then:
"MAX_UNAUTH_PER_IP / <process time of one attempt>".
With the delay, this rate becomes:
"MAX_UNAUTH_PER_IP / UNAUTH_CLOSE_DELAY".
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Wed, 15 Feb 2017 13:53:04 +0100 |
parents | d4efb7801fcd |
children | 8dc43b30c6bf |
rev | line source |
---|---|
1361 | 1 #ifndef DBMALLOC_H_ |
2 #define DBMALLOC_H_ | |
3 | |
1571
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
4 #include "stdint.h" |
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
5 #include "stdlib.h" |
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
6 #include "options.h" |
1361 | 7 |
8 void * m_malloc(size_t size); | |
9 void * m_calloc(size_t nmemb, size_t size); | |
10 void * m_strdup(const char * str); | |
11 void * m_realloc(void* ptr, size_t size); | |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
12 |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
13 #if DROPBEAR_TRACKING_MALLOC |
1361 | 14 void m_free_direct(void* ptr); |
15 void m_malloc_set_epoch(unsigned int epoch); | |
1378 | 16 void m_malloc_free_epoch(unsigned int epoch, int dofree); |
1361 | 17 |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
18 #else |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
19 /* plain wrapper */ |
1571
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
20 #define m_free_direct free |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
21 |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
22 #endif |
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
23 |
1571
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
24 #define m_free(X) do {m_free_direct(X); (X) = NULL;} while (0) |
d4efb7801fcd
Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents:
1569
diff
changeset
|
25 |
1569
c42e8ff42bd1
Only use malloc wrapper if fuzzing
Matt Johnston <matt@ucc.asn.au>
parents:
1378
diff
changeset
|
26 |
1361 | 27 #endif /* DBMALLOC_H_ */ |