comparison dbutil.h @ 1283:3017bc7d6238

move m_burn and function attributes to dbhelpers use m_burn for libtomcrypt zeromem() too
author Matt Johnston <matt@ucc.asn.au>
date Thu, 17 Mar 2016 23:21:33 +0800
parents 9169e4e7cbee
children 750ec4ec4cbe efad433418c4
comparison
equal deleted inserted replaced
1282:a3bb15115816 1283:3017bc7d6238
27 #define DROPBEAR_DBUTIL_H_ 27 #define DROPBEAR_DBUTIL_H_
28 28
29 #include "includes.h" 29 #include "includes.h"
30 #include "buffer.h" 30 #include "buffer.h"
31 #include "queue.h" 31 #include "queue.h"
32 #include "dbhelpers.h"
32 33
33 #ifndef DISABLE_SYSLOG 34 #ifndef DISABLE_SYSLOG
34 void startsyslog(const char *ident); 35 void startsyslog(const char *ident);
35 #endif
36
37 #ifdef __GNUC__
38 #define ATTRIB_PRINTF(fmt,args) __attribute__((format(printf, fmt, args)))
39 #define ATTRIB_NORETURN __attribute__((noreturn))
40 #define ATTRIB_SENTINEL __attribute__((sentinel))
41 #else
42 #define ATTRIB_PRINTF(fmt,args)
43 #define ATTRIB_NORETURN
44 #define ATTRIB_SENTINEL
45 #endif 36 #endif
46 37
47 extern void (*_dropbear_exit)(int exitcode, const char* format, va_list param) ATTRIB_NORETURN; 38 extern void (*_dropbear_exit)(int exitcode, const char* format, va_list param) ATTRIB_NORETURN;
48 extern void (*_dropbear_log)(int priority, const char* format, va_list param); 39 extern void (*_dropbear_log)(int priority, const char* format, va_list param);
49 40
77 void m_close(int fd); 68 void m_close(int fd);
78 void * m_malloc(size_t size); 69 void * m_malloc(size_t size);
79 void * m_strdup(const char * str); 70 void * m_strdup(const char * str);
80 void * m_realloc(void* ptr, size_t size); 71 void * m_realloc(void* ptr, size_t size);
81 #define m_free(X) do {free(X); (X) = NULL;} while (0) 72 #define m_free(X) do {free(X); (X) = NULL;} while (0)
82 void m_burn(void* data, unsigned int len);
83 void setnonblocking(int fd); 73 void setnonblocking(int fd);
84 void disallow_core(void); 74 void disallow_core(void);
85 int m_str_to_uint(const char* str, unsigned int *val); 75 int m_str_to_uint(const char* str, unsigned int *val);
86 76
87 /* Used to force mp_ints to be initialised */ 77 /* Used to force mp_ints to be initialised */