annotate dbmalloc.h @ 1855:35d504d59c05

Implement server-side support for sk-ecdsa U2F-backed keys (#142) * Implement server-side support for sk-ecdsa U2F-backed keys * Fix out-of-bounds read on normal ecdsa-sha2-[identifier] keys * Fix one more potential out-of-bounds read * Check if nistp256 curve is used in sk-ecdsa-sha2- key It's the only allowed curve per PROTOCOL.u2f specification * Implement server-side support for sk-ed25519 FIDO2-backed keys * Keys with type sk-* make no sense as host keys, so they should be disabled * fix typo * Make sk-ecdsa call buf_ecdsa_verify This reduces code duplication, the SK code just handles the different message format. * Reduce sk specific code The application id can be stored in signkey, then we don't need to call sk-specific functions from svr-authpubkey * Remove debugging output, which causes compilation errors with DEBUG_TRACE disabled * Proper cleanup of sk_app Co-authored-by: Matt Johnston <[email protected]>
author egor-duda <egor-duda@users.noreply.github.com>
date Sat, 22 Jan 2022 16:53:04 +0300
parents 8dc43b30c6bf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #ifndef DBMALLOC_H_
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 #define DBMALLOC_H_
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3
1571
d4efb7801fcd Attempt to fix m_free for libtomcrypt/libtommath
Matt Johnston <matt@ucc.asn.au>
parents: 1569
diff changeset
4 #include "options.h"
1798
8dc43b30c6bf Define _GNU_SOURCE properly, other header fixes
Matt Johnston <matt@ucc.asn.au>
parents: 1571
diff changeset
5 #include <stdint.h>
8dc43b30c6bf Define _GNU_SOURCE properly, other header fixes
Matt Johnston <matt@ucc.asn.au>
parents: 1571
diff changeset
6 #include <stdlib.h>
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 void * m_malloc(size_t size);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 void * m_calloc(size_t nmemb, size_t size);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 void * m_strdup(const char * str);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
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
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 void m_free_direct(void* ptr);
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 void m_malloc_set_epoch(unsigned int epoch);
1378
7209a6e30932 linked list dbmalloc now
Matt Johnston <matt@ucc.asn.au>
parents: 1365
diff changeset
16 void m_malloc_free_epoch(unsigned int epoch, int dofree);
1361
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
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
f9f930e1a516 add dbmalloc epoch cleanup
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 #endif /* DBMALLOC_H_ */