Changeset 481 for trunk/include
- Timestamp:
- Jul 18, 2015, 5:06:52 PM (9 years ago)
- Location:
- trunk/include
- Files:
-
- 7 added
- 4 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/rijndael-alg-fst.h
r230 r481 1 /* 2 * rijndael-alg-fst.h v2.3 April '2000 1 /* $NetBSD: rijndael-alg-fst.h,v 1.4 2005/12/11 12:20:52 christos Exp $ */ 2 /* $KAME: rijndael-alg-fst.h,v 1.5 2003/07/15 10:47:16 itojun Exp $ */ 3 /** 4 * rijndael-alg-fst.h 3 5 * 4 * Optimised ANSI C code6 * @version 3.0 (December 2000) 5 7 * 8 * Optimised ANSI C code for the Rijndael cipher (now AES) 9 * 10 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> 11 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> 12 * @author Paulo Barreto <paulo.barreto@terra.com.br> 13 * 14 * This code is hereby placed in the public domain. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS 17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6 27 */ 7 8 /*@-fixedformalarray@*/9 10 28 #ifndef __RIJNDAEL_ALG_FST_H 11 29 #define __RIJNDAEL_ALG_FST_H 12 30 13 #define MAXKC (256/32) 14 #define MAXROUNDS 14 15 16 /* USUAL_TYPES */ 17 #ifndef USUAL_TYPES 18 #define USUAL_TYPES 19 typedef unsigned char byte; 20 typedef unsigned char word8; 21 typedef unsigned short word16; 22 typedef unsigned int word32; 23 #endif 31 #define RIJNDAEL_MAXKC (256/32) 32 #define RIJNDAEL_MAXKB (256/8) 33 #define RIJNDAEL_MAXNR 14 24 34 25 35 #ifdef SH_ENCRYPT 26 36 27 int rijndaelKeySched(word8 k[MAXKC][4], word8 rk[MAXROUNDS+1][4][4], int ROUNDS); 28 29 int rijndaelKeyEncToDec(word8 W[MAXROUNDS+1][4][4], int ROUNDS); 30 31 int rijndaelEncrypt(word8 a[16], word8 b[16], word8 rk[MAXROUNDS+1][4][4], int ROUNDS); 32 33 34 int rijndaelDecrypt(word8 a[16], word8 b[16], word8 rk[MAXROUNDS+1][4][4], int ROUNDS); 35 36 #ifdef INTERMEDIATE_VALUE_KAT 37 int rijndaelEncryptRound(word8 a[4][4], word8 rk[MAXROUNDS+1][4][4], int ROUNDS, int rounds); 38 int rijndaelDecryptRound(word8 a[4][4], word8 rk[MAXROUNDS+1][4][4], int ROUNDS, int rounds); 39 #endif 37 int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); 38 int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); 39 void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]); 40 void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]); 40 41 41 42 /* SH_ENCRYPT */ 42 43 #endif 43 44 /* __RIJNDAEL_ALG_FST_H */ 45 #endif 46 44 #endif /* __RIJNDAEL_ALG_FST_H */ -
trunk/include/rijndael-api-fst.h
r230 r481 1 /* 2 * rijndael-api-fst.h v2.3 April '2000 1 /* $NetBSD: rijndael-api-fst.h,v 1.8 2007/01/21 23:00:08 cbiere Exp $ */ 2 3 /** 4 * rijndael-api-fst.h 3 5 * 4 * Optimised ANSI C code6 * @version 2.9 (December 2000) 5 7 * 8 * Optimised ANSI C code for the Rijndael cipher (now AES) 9 * 10 * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> 11 * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> 12 * @author Paulo Barreto <paulo.barreto@terra.com.br> 13 * 14 * This code is hereby placed in the public domain. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS 17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Acknowledgements: 29 * 30 * We are deeply indebted to the following people for their bug reports, 31 * fixes, and improvement suggestions to this implementation. Though we 32 * tried to list all contributions, we apologise in advance for any 33 * missing reference. 34 * 35 * Andrew Bales <Andrew.Bales@Honeywell.com> 36 * Markus Friedl <markus.friedl@informatik.uni-erlangen.de> 37 * John Skodon <skodonj@webquill.com> 6 38 */ 7 39 … … 9 41 #define __RIJNDAEL_API_FST_H 10 42 43 /* Blocksize: 16 * 8 = 128; 128 * 1 = 128 */ 44 #define B_SIZ 16 45 #define BNUM 1 46 47 48 #if defined(UINT32) 49 typedef unsigned char u8; 50 typedef UINT32 u32; 51 #else 52 53 typedef unsigned char u8; 54 #if defined(HAVE_INT_32) 55 typedef unsigned int u32; 56 #elif defined(HAVE_LONG_32) 57 typedef unsigned long u32; 58 #elif defined(HAVE_SHORT_32) 59 typedef unsigned short u32; 60 #else 61 #error "No 32 bit integer type found" 62 #endif 63 64 #endif 65 11 66 #include "rijndael-alg-fst.h" 12 67 13 /* Defines: 14 Add any additional defines you need 15 */ 16 17 #define BNUM 1 18 #define B_SIZ 16 19 #define STRICT_ALIGN 1 /* For safety */ 20 21 68 /* Generic Defines */ 22 69 #define DIR_ENCRYPT 0 /* Are we encrpyting? */ 23 70 #define DIR_DECRYPT 1 /* Are we decrpyting? */ … … 33 80 #define BITSPERBLOCK 128 /* Default number of bits in a cipher block */ 34 81 35 /* Error Codes - CHANGE POSSIBLE: inclusion of additional error codes */ 36 82 /* Error Codes */ 37 83 #define BAD_KEY_DIR -1 /* Key direction is invalid, e.g., unknown value */ 38 84 #define BAD_KEY_MAT -2 /* Key material not of correct length */ … … 45 91 #define BAD_OTHER -9 /* Unknown error */ 46 92 47 /* CHANGE POSSIBLE: inclusion of algorithm specific defines */48 #define MAX_KEY_SIZE 64 /* # of ASCII char's needed to represent a key */49 #define MAX_IV_SIZE 16 /* # bytes needed to represent an IV */93 /* Algorithm-specific Defines */ 94 #define RIJNDAEL_MAX_KEY_SIZE 64 /* # of ASCII char's needed to represent a key */ 95 #define RIJNDAEL_MAX_IV_SIZE 16 /* # bytes needed to represent an IV */ 50 96 51 97 #ifdef SH_ENCRYPT 52 98 53 /* Typedefs :99 /* Typedefs */ 54 100 55 Typedef'ed data storage elements. Add any algorithm specific 56 parameters at the bottom of the structs as appropriate. 57 */ 58 59 typedef unsigned char RIJ_BYTE; 101 typedef unsigned char BYTE; 60 102 61 103 /* The structure for key information */ 62 104 typedef struct { 63 RIJ_BYTE direction; /* Key used for encrypting or decrypting? */ 64 int keyLen; /* Length of the key */ 65 char keyMaterial[MAX_KEY_SIZE+1]; /* Raw key data in ASCII, e.g., user input or KAT values */ 66 /* The following parameters are algorithm dependent, replace or add as necessary */ 67 int ROUNDS; /* key-length-dependent number of rounds */ 68 int blockLen; /* block length */ 69 word8 keySched[MAXROUNDS+1][4][4]; /* key schedule */ 105 u32 rk[4*(RIJNDAEL_MAXNR + 1)]; /* key schedule */ 106 u32 ek[4*(RIJNDAEL_MAXNR + 1)]; /* CFB1 key schedule (encryption only) */ 107 BYTE direction; /* Key used for encrypting or decrypting? */ 108 int keyLen; /* Length of the key */ 109 char keyMaterial[RIJNDAEL_MAX_KEY_SIZE+1]; /* Raw key data in ASCII, e.g., user input or KAT values */ 110 int Nr; /* key-length-dependent number of rounds */ 70 111 } keyInstance; 71 112 72 113 /* The structure for cipher information */ 73 114 typedef struct { /* changed order of the components */ 74 RIJ_BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ 75 RIJ_BYTE IV[MAX_IV_SIZE]; /* A possible Initialization Vector for ciphering */ 76 /* Add any algorithm specific parameters needed here */ 77 int blockLen; /* Sample: Handles non-128 bit block sizes (if available) */ 115 u32 IV[RIJNDAEL_MAX_IV_SIZE / sizeof(u32)]; 116 /* A possible Initialization Vector for ciphering */ 117 BYTE mode; /* MODE_ECB, MODE_CBC, or MODE_CFB1 */ 78 118 } cipherInstance; 79 119 80 120 /* Function prototypes */ 81 /* CHANGED: nothing82 TODO: implement the following extensions to setup 192-bit and 256-bit block lengths:83 makeKeyEx(): parameter blockLen added84 -- this parameter is absolutely necessary if you want to85 setup the round keys in a variable block length setting86 cipherInitEx(): parameter blockLen added (for obvious reasons)87 */88 121 89 int makeKey(keyInstance *key, RIJ_BYTE direction, int keyLen, char *keyMaterial);122 int rijndael_makeKey(keyInstance *, BYTE, int, const char *); 90 123 91 int cipherInit(cipherInstance *cipher, RIJ_BYTE mode, char *IV);124 int rijndael_cipherInit(cipherInstance *, BYTE, const char *); 92 125 93 int blockEncrypt(cipherInstance *cipher, keyInstance *key, 94 RIJ_BYTE *input, int inputLen, RIJ_BYTE *outBuffer); 126 int rijndael_blockEncrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *); 95 127 96 int blockDecrypt(cipherInstance *cipher, keyInstance *key, 97 RIJ_BYTE *input, int inputLen, RIJ_BYTE *outBuffer); 98 #ifdef INTERMEDIATE_VALUE_KAT 99 int cipherUpdateRounds(cipherInstance *cipher, keyInstance *key, 100 RIJ_BYTE *input, int inputLen, RIJ_BYTE *outBuffer, int rounds); 101 #endif 128 int rijndael_padEncrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *); 129 130 int rijndael_blockDecrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *); 131 132 int rijndael_padDecrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *); 102 133 103 134 /* SH_ENCRYPT */ 104 135 #endif 105 106 /* __RIJNDAEL_API_FST_H */ 107 #endif 136 #endif /* __RIJNDAEL_API_FST_H */ -
trunk/include/samhain.h
r459 r481 28 28 #endif 29 29 30 #if defined(__GNUC__) && (__GNUC__ >= 4) 31 #define SH_GNUC_SENTINEL __attribute__((__sentinel__)) 32 #else 33 #define SH_GNUC_SENTINEL 34 #endif 35 36 #if defined(__GNUC__) && (__GNUC__ >= 3) 37 #undef SH_GNUC_PURE 38 #define SH_GNUC_PURE __attribute__((pure)) 39 #undef SH_GNUC_CONST 40 #define SH_GNUC_CONST __attribute__((const)) 41 #undef SH_GNUC_NORETURN 42 #define SH_GNUC_NORETURN __attribute__((noreturn)) 43 #undef SH_GNUC_MALLOC 44 #define SH_GNUC_MALLOC __attribute__((malloc)) 45 #else 46 #undef SH_GNUC_PURE 47 #define SH_GNUC_PURE 48 #undef SH_GNUC_CONST 49 #define SH_GNUC_CONST 50 #undef SH_GNUC_NORETURN 51 #define SH_GNUC_NORETURN 52 #undef SH_GNUC_MALLOC 53 #define SH_GNUC_MALLOC 54 #endif 55 30 56 /************************************************** 31 57 * … … 57 83 58 84 /* end IPv6 */ 59 60 #define REPLACE_OLD61 85 62 86 /* Standard buffer sizes. … … 101 125 #define PW_LEN 8 102 126 103 #undef GOOD104 #define GOOD 1105 #undef BAD106 #define BAD 0107 #undef ON108 #define ON 1109 #undef OFF110 #define OFF 0111 127 #undef S_TRUE 112 128 #define S_TRUE 1 113 129 #undef S_FALSE 114 130 #define S_FALSE 0 131 132 #undef GOOD 133 #define GOOD S_TRUE 134 #undef BAD 135 #define BAD S_FALSE 136 137 138 #ifdef HAVE_INTTYPES_H 139 #include <inttypes.h> 140 #endif 141 #ifdef HAVE_STDINT_H 142 #include <stdint.h> 143 #endif 144 145 #if !defined(HAVE_UINT16_T) 146 #define UINT16 unsigned short 147 #else 148 #define UINT16 uint16_t 149 #endif 150 151 #if !defined(HAVE_UINT32_T) 115 152 116 153 /* An unsigned integer guaranteed to be 32 bit. … … 129 166 #endif 130 167 131 #ifdef HAVE_INTTYPES_H 132 #include <inttypes.h> 133 #endif 134 #ifdef HAVE_STDINT_H 135 #include <stdint.h> 136 #endif 137 138 #if !defined(HAVE_UINT16_T) 139 #define UINT16 unsigned short 140 #else 141 #define UINT16 uint16_t 168 #else 169 #define UINT32 uint32_t 170 #define SINT32 int32_t 171 142 172 #endif 143 173 … … 305 335 int client_severity; /* TRUE if client severity used */ 306 336 int client_class; /* TRUE if client class used */ 337 int hidefile; /* TRUE if file not shown in log */ 338 int inotify; /* Flags for inotify */ 307 339 int audit; 308 340 unsigned long aud_mask; 309 int hidefile; /* TRUE if file not shown in log */310 int inotify; /* Flags for inotify */311 341 } sh_sh_flag; 312 342 … … 347 377 /*@null@*//*@out@*/ char * timezone; 348 378 379 int delayload; 380 349 381 #ifdef SCREW_IT_UP 350 382 int sigtrap_max_duration; 351 383 #endif 352 384 385 char * outpath; 353 386 } sh_struct; 354 387 … … 365 398 extern volatile int sig_termfast; /* SIGTERM */ 366 399 extern volatile int sig_force_check; /* SIGTTOU */ 400 extern volatile int sh_load_delta_flag; 367 401 368 402 extern long int eintr__result; … … 420 454 #endif 421 455 422 #if defined(__GNUC__) && (__GNUC__ >= 4)423 #define SH_GNUC_SENTINEL __attribute__((__sentinel__))424 #else425 #define SH_GNUC_SENTINEL426 #endif427 428 #if defined(__GNUC__) && (__GNUC__ >= 3)429 #undef SH_GNUC_PURE430 #define SH_GNUC_PURE __attribute__((pure))431 #undef SH_GNUC_CONST432 #define SH_GNUC_CONST __attribute__((const))433 #undef SH_GNUC_NORETURN434 #define SH_GNUC_NORETURN __attribute__((noreturn))435 #undef SH_GNUC_MALLOC436 #define SH_GNUC_MALLOC __attribute__((malloc))437 #else438 #undef SH_GNUC_PURE439 #define SH_GNUC_PURE440 #undef SH_GNUC_CONST441 #define SH_GNUC_CONST442 #undef SH_GNUC_NORETURN443 #define SH_GNUC_NORETURN444 #undef SH_GNUC_MALLOC445 #define SH_GNUC_MALLOC446 #endif447 456 448 457 … … 481 490 #ifdef USE_SUID 482 491 #define MLOCK(a, b) \ 483 if ((skey != NULL) && skey->mlock_failed == S L_FALSE){ \492 if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \ 484 493 (void) sl_set_suid(); \ 485 if (sh_unix_mlock(FIL__, __LINE__, a, b) < 0) skey->mlock_failed = S L_TRUE; \494 if (sh_unix_mlock(FIL__, __LINE__, a, b) < 0) skey->mlock_failed = S_TRUE; \ 486 495 (void) sl_unset_suid(); } 487 496 #else 488 497 #define MLOCK(a, b) \ 489 if ((skey != NULL) && skey->mlock_failed == S L_FALSE){ \490 if (sh_unix_mlock(FIL__, __LINE__, a, b) < 0) skey->mlock_failed = S L_TRUE; }498 if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \ 499 if (sh_unix_mlock(FIL__, __LINE__, a, b) < 0) skey->mlock_failed = S_TRUE; } 491 500 #endif 492 501 #else … … 498 507 #ifdef USE_SUID 499 508 #define MUNLOCK(a, b) \ 500 if ((skey != NULL) && skey->mlock_failed == S L_FALSE){ \509 if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \ 501 510 (void) sl_set_suid(); \ 502 511 (void) sh_unix_munlock( a, b );\ … … 504 513 #else 505 514 #define MUNLOCK(a, b) \ 506 if ((skey != NULL) && skey->mlock_failed == S L_FALSE){ \515 if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \ 507 516 (void) sh_unix_munlock( a, b ); } 508 517 #endif -
trunk/include/sh_calls.h
r317 r481 30 30 31 31 /*@-fixedformalarray@*/ 32 33 #include "config_xor.h" 34 #if defined(__GNUC__) && (__GNUC__ >= 3) 35 #undef SH_GNUC_NORETURN 36 #define SH_GNUC_NORETURN __attribute__((noreturn)) 37 #else 38 #undef SH_GNUC_NORETURN 39 #define SH_GNUC_NORETURN 40 #endif 41 32 42 33 43 /* Set aud functions … … 83 93 int * o_noatime); 84 94 /*@noreturn@*/ 85 void aud_exit (const char * file, int line, int fd) ;95 void aud_exit (const char * file, int line, int fd) SH_GNUC_NORETURN; 86 96 /*@noreturn@*/ 87 void aud__exit (const char * file, int line, int fd) ;97 void aud__exit (const char * file, int line, int fd) SH_GNUC_NORETURN; 88 98 pid_t aud_fork (const char * file, int line); 89 99 int aud_pipe (const char * file, int line, int modus[2]); -
trunk/include/sh_cat.h
r294 r481 75 75 MSG_CHECK_0, 76 76 MSG_CHECK_1, 77 MSG_CHECK_2, 77 78 MSG_STAMP, 78 79 … … 80 81 MSG_D_DSTART, 81 82 MSG_D_FAIL, 82 83 MSG_D_DELTAOK, 84 MSG_D_DELTAFAIL, 83 85 84 86 #ifndef HAVE_URANDOM … … 98 100 MSG_SUID_QREPORT, 99 101 MSG_SUID_ERROR, 100 #endif101 102 #ifdef SH_USE_KERN103 /* FreeBSD */104 MSG_KERN_POLICY,105 MSG_KERN_POL_CO,106 107 /* Linux */108 MSG_KERN_SYSCALL,109 MSG_KERN_PROC,110 MSG_KERN_IDT,111 MSG_KERN_GATE,112 102 #endif 113 103 -
trunk/include/sh_error.h
r410 r481 178 178 int sh_error_setdebug (char * debug_s); 179 179 180 /* error messages181 */182 /*@owned@*/char * sh_error_message (int tellme, char * str, size_t len);183 184 180 /* switch on/off log to file temporarily 185 181 */ … … 198 194 void reset_count_dev_console(void); 199 195 196 /* close the message queue [no-op if !defined(WITH_MESSAGE_QUEUE)] 197 */ 198 void close_ipc (void); 199 200 200 #ifdef WITH_MESSAGE_QUEUE 201 /* close the message queue202 */203 void close_ipc (void);204 205 201 /* enable message queue 206 202 */ -
trunk/include/sh_error_min.h
r272 r481 35 35 int sh_error_convert_level (const char * str_s); 36 36 37 /* error messages 38 */ 39 char * sh_error_message (int tellme, char * str, size_t len); 40 37 41 #endif -
trunk/include/sh_extern.h
r415 r481 42 42 * executes shell command 43 43 */ 44 int sh_ext_popen_init (sh_tas_t * task, c har * command, char * argv0, ...) SH_GNUC_SENTINEL;44 int sh_ext_popen_init (sh_tas_t * task, const char * command, char * argv0, ...) SH_GNUC_SENTINEL; 45 45 46 46 /* … … 52 52 * -- Execute command, return first line of output 53 53 */ 54 char * sh_ext_popen_str (c har * command);54 char * sh_ext_popen_str (const char * command); 55 55 56 56 /* -
trunk/include/sh_fifo.h
r272 r481 33 33 } SH_FIFO; 34 34 35 #define SH_FIFO_INITIALIZER { NULL, NULL, 0 } 36 35 37 /***************************************************** 36 38 * … … 42 44 * 43 45 */ 44 #define fifo_init(fifo_p) { fifo_p->fifo_cts = 0; fifo_p->head_ptr = NULL; \45 fifo_p->tail_ptr = NULL; }46 #define fifo_init(fifo_p) { (fifo_p)->fifo_cts = 0; (fifo_p)->head_ptr = NULL; \ 47 (fifo_p)->tail_ptr = NULL; } 46 48 47 49 … … 50 52 * Returns: -1 if the list is full, 0 on success 51 53 */ 52 int push_list (SH_FIFO * fifo, char * indat, int in_i, const char * in_str); 54 int push_list (SH_FIFO * fifo, const char * indat, int in_i, const char * in_str); 55 #define sh_fifo_push(a, b) push_list((a), (b), 0, NULL) 53 56 54 57 /* Push an item on the tail of the list. … … 56 59 * Returns: -1 if the list is full, 0 on success 57 60 */ 58 int push_tail_list (SH_FIFO * fifo, char * indat, int in_i, const char * in_str); 61 int push_tail_list (SH_FIFO * fifo, const char * indat, int in_i, const char * in_str); 62 #define sh_fifo_push_tail(a, b) push_tail_list((a), (b), 0, NULL) 59 63 60 64 /* pop an item from the tail of the list … … 64 68 */ 65 69 char * pop_list (SH_FIFO * fifo); 70 #define sh_fifo_pop(a) pop_list((a)) 66 71 72 /* ---- Special functions -------------------------------------------------*/ 67 73 74 /* This is for eMail where different recipients may be eligible for * 75 * different subsets of messages. We need to delete all that were sent * 76 * to all intended recipients, and keep all with at least one failure. */ 77 78 /* Iterate over list and check for each if it is valid for 'tag'; 79 * i.e. (item->s_extra == tag). If yes, add to the returned string. 80 * If (okNull == False) then item->s_xtra must be defined 81 */ 68 82 sh_string * tag_list (SH_FIFO * fifo, char * tag, 69 83 int(*check)(int, const char*, const char*, const void*), 70 84 const void * info, int okNull); 85 86 /* Flag all tagged as candidate to keep */ 71 87 void rollback_list (SH_FIFO * fifo); 88 /* Flag all tagged as candidate to delete */ 72 89 void mark_list (SH_FIFO * fifo); 90 /* Remove all flags */ 73 91 void reset_list (SH_FIFO * fifo); 92 /* Delete all marked for delete that are not flagged for keep */ 74 93 int commit_list (SH_FIFO * fifo); 75 94 -
trunk/include/sh_files.h
r457 r481 31 31 }; 32 32 33 /* Fix the check flags 34 */ 35 void sh_files_fixup_mask (int class, unsigned long * check_flags); 36 37 /* Dequote a filename in the config file 38 */ 39 char * sh_files_parse_input(const char * str_s, size_t * len); 40 33 41 /* Check whether a file is in the config 34 42 */ … … 233 241 int sh_files_redef_allignore(const char * str); 234 242 235 ShFileType sh_files_filecheck (int class, unsigned long check_ mask,243 ShFileType sh_files_filecheck (int class, unsigned long check_flags, 236 244 const char * dirName, 237 245 const char * infileName, … … 239 247 int rsrcflag); 240 248 241 int sh_files_checkdir (int iclass, unsigned long check_ mask,249 int sh_files_checkdir (int iclass, unsigned long check_flags, 242 250 int idepth, char * iname, 243 251 char * relativeName); 244 252 245 253 int sh_files_search_file(char * name, int * class, 246 unsigned long *check_ mask, int * reported);254 unsigned long *check_flags, int * reported); 247 255 int sh_files_search_dir(char * name, int * class, 248 unsigned long *check_ mask, int *reported,256 unsigned long *check_flags, int *reported, 249 257 int * rdepth); 250 258 void sh_files_set_file_reported(const char * name); -
trunk/include/sh_gpg.h
r347 r481 23 23 #define SH_GPG_H 24 24 25 #define SIG_CONF 1 26 #define SIG_DATA 2 27 25 28 /* Top level function to verify file. 26 29 */ … … 30 33 * and/or database cannot be verified; otherwise returns 0 31 34 */ 32 int sh_gpg_check_sign (long file _1, long file_2, int what);35 int sh_gpg_check_sign (long file, int what); 33 36 34 37 /* log successful startup -
trunk/include/sh_hash.h
r458 r481 28 28 #include "sh_error.h" 29 29 30 /* the report_checkflags flag 31 */ 32 int get_report_checkflags(); 33 34 /* whether to report checkflags 35 */ 36 int set_report_checkflags(const char * c); 37 30 38 /* convert to policy string 31 39 */ … … 40 48 int hashreport_missing( char *fullpath, int level); 41 49 50 /* remove internal db record for a file (checks for some flags). 51 */ 52 void sh_hash_remove (const char * path); 53 42 54 /* remove internal db record for a file 43 55 */ 44 void sh_hash_remove (const char * path); 45 46 /* write database to stdout 47 */ 48 int sh_hash_pushdata_stdout (const char * str); 49 50 /* version string for database 51 */ 52 int sh_hash_version_string(const char * str); 56 void sh_hash_remove_unconditional (const char * path); 57 58 /* Insert a "null" record in-memory (representing a missing file). 59 */ 60 void sh_hash_insert_null(char * str); 61 62 #ifdef SH_DBIO_INT_H 63 /* Check for "null" record 64 */ 65 int sh_hash_is_null_record(sh_filestore_t * theFile); 66 #endif 53 67 54 68 /* Dont report on ctm/mtm change for directories … … 56 70 int sh_hash_loosedircheck(const char * str); 57 71 58 /* List database content59 */60 int sh_hash_list_db (const char * db_file);61 62 72 /* List database content for a single file 63 73 */ 64 74 int set_list_file (const char * c); 65 75 76 /* Set the path of that file 77 */ 78 char * get_list_file(); 79 66 80 /* List database content with full detail 67 81 */ … … 75 89 */ 76 90 void sh_hash_init (void); 91 92 /* Check init status 93 */ 94 int sh_hash_get_initialized(); 95 96 /* Read the database from disk and fill sh.data.hash with checksum. 97 */ 98 void sh_hash_init_and_checksum(); 99 100 /* Set status to 'database is read in'. 101 */ 102 void sh_hash_set_initialized(); 77 103 78 104 /* Check whether a file is present in the database. -
trunk/include/sh_html.h
r1 r481 53 53 int encf_flag; 54 54 int ency_flag; 55 int ivst_flag; 55 56 int status_now; 56 57 int status_arr[CLT_MAX]; -
trunk/include/sh_inotify.h
r373 r481 32 32 33 33 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 34 int class, unsigned long check_ mask, int type, int rdepth);34 int class, unsigned long check_flags, int type, int rdepth); 35 35 36 36 int sh_inotify_add_watch_later(const char * filename, sh_watches * watches, 37 37 int * errnum, 38 int class, unsigned long check_ mask,38 int class, unsigned long check_flags, 39 39 int type, int rdepth); 40 40 41 41 char * sh_inotify_pop_dormant(sh_watches * watches, int * class, 42 unsigned long * check_ mask, int * type, int * rdepth);42 unsigned long * check_flags, int * type, int * rdepth); 43 43 44 44 void sh_inotify_purge_dormant(sh_watches * watches); … … 47 47 48 48 char * sh_inotify_search_item(sh_watches * watches, int watch, 49 int * class, unsigned long * check_ mask,49 int * class, unsigned long * check_flags, 50 50 int * type, int * rdepth); 51 51 ssize_t sh_inotify_read(char * buffer, size_t count); -
trunk/include/sh_prelink.h
r102 r481 6 6 * alert_timeout: timeout for read 7 7 */ 8 int sh_prelink_run (char * path, char * file_hash, int alert_timeout );8 int sh_prelink_run (char * path, char * file_hash, int alert_timeout, unsigned long mask); 9 9 10 10 /* return S_TRUE if ELF file, S_FALSE otherwise -
trunk/include/sh_socket.h
r200 r481 8 8 9 9 #if defined (SH_WITH_CLIENT) 10 void sh_socket_server_cmd(const char * srvcmd); 10 char * sh_socket_get_uuid(int * errflag, unsigned int * count, time_t * last); 11 int sh_socket_store_uuid(const char * cmd); 12 int sh_socket_return_uuid(const char * uuid, unsigned int count, time_t last); 13 void sh_socket_server_cmd(const char * srvcmd); 14 int set_delta_retry_interval(const char * str); 15 int set_delta_retry_count(const char * str); 11 16 #endif 12 17 -
trunk/include/sh_tiger.h
r170 r481 44 44 int sh_tiger_get_hashtype (void); 45 45 46 /* set the hash fuction in use in the mask 47 */ 48 void sh_tiger_get_mask_hashtype(unsigned long * mask); 49 50 51 /* reset the hash function to the one in the mask 52 */ 53 void sh_tiger_set_hashtype_mask(unsigned long mask); 54 46 55 /* GnuPG-like format, returns allocated memory 47 56 */ -
trunk/include/sh_tools.h
r295 r481 8 8 */ 9 9 #define SH_PROTO_SRP (1 << 0) 10 #define SH_PROTO_IVA (1 << 1) 10 11 #define SH_PROTO_MSG (1 << 2) 11 12 #define SH_PROTO_BIG (1 << 3) 12 13 #define SH_PROTO_END (1 << 4) 13 #define SH_PROTO_EN C(1 << 5)14 #define SH_PROTO_EN1 (1 << 5) 14 15 #define SH_PROTO_EN2 (1 << 6) 16 #define SH_PROTO_ENC (SH_PROTO_EN1|SH_PROTO_EN2) 15 17 #define SH_MASK_ENC (SH_PROTO_ENC|SH_PROTO_EN2) 16 18 … … 44 46 #if defined (SH_WITH_SERVER) 45 47 48 unsigned char sh_tools_probe_store(unsigned char protocol, int * probe_flag); 49 46 50 int get_open_max (void); 47 51 48 void put_header (/*@out@*/unsigned char * head, int protocol,52 void put_header (/*@out@*/unsigned char * head, const int protocol, 49 53 unsigned long * length, char * u); 50 54 … … 59 63 /* returns allocated buffer 60 64 */ 61 char * get_client_conf_file (c har * peer, unsigned long * length);65 char * get_client_conf_file (const char * peer, unsigned long * length); 62 66 63 67 /* returns allocated buffer 64 68 */ 65 char * get_client_data_file (c har * peer, unsigned long * length);69 char * get_client_data_file (const char * peer, unsigned long * length); 66 70 71 /* returns allocated buffer 72 */ 73 char * get_client_uuid_file (const char * peer, unsigned long * length, const char * uuid); 67 74 #endif 75 68 76 69 77 unsigned long read_port (int sockfd, char *buf, unsigned long nbytes, … … 72 80 73 81 #if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 82 83 void sh_tools_probe_reset(); 74 84 75 85 unsigned long write_port (int sockfd, char *buf, unsigned long nbytes, -
trunk/include/sh_trace.h
r1 r481 9 9 #define ASSERT(expr, expr1) \ 10 10 if (!(expr)) \ 11 fprintf(stderr, \ 11 { \ 12 fprintf(stderr, \ 12 13 SDG_AERRO, \ 13 FIL__, __LINE__, expr1 ); 14 FIL__, __LINE__, expr1 ); \ 15 abort(); \ 16 } 14 17 15 18 -
trunk/include/sh_unix.h
r425 r481 68 68 /* inode */ 69 69 #define MODI_INO (1 << 2) 70 70 71 /* user */ 71 72 #define MODI_USR (1 << 3) … … 74 75 /* mtime */ 75 76 #define MODI_MTM (1 << 5) 77 76 78 /* ctime */ 77 79 #define MODI_CTM (1 << 6) … … 80 82 /* size */ 81 83 #define MODI_SIZ (1 << 8) 84 82 85 /* file mode */ 83 86 #define MODI_MOD (1 << 9) … … 86 89 /* device type */ 87 90 #define MODI_RDEV (1 << 11) 91 88 92 /* size may grow */ 89 93 #define MODI_SGROW (1 << 12) 90 94 /* use prelink */ 91 95 #define MODI_PREL (1 << 13) 92 93 96 /* get content */ 94 97 #define MODI_TXT ((1 << 14)|MODI_CHK) … … 98 101 #define MODI_AUDIT (1 << 15) 99 102 #define MODI_AUDIT_ENABLED(a) (((a)&(1 << 15))!=0) 100 101 #define MODI_INIT 0xDA000000UL 102 #define MODI_INITIALIZED(a) (((a) & 0xFF000000UL) == MODI_INIT) 103 /* do not check */ 104 #define MODI_NOCHECK (1 << 16) 105 /* do not check */ 106 #define MODI_ALLIGNORE (1 << 17) 107 108 #define MODI_TIGER192 0x01000000UL 109 #define MODI_SHA1 0x02000000UL 110 #define MODI_MD5 0x03000000UL 111 #define MODI_SHA256 0x04000000UL 112 #define MODI_HASHTYPE 0x0F000000UL 113 114 #define MODI_INIT 0xD0000000UL 115 #define MODI_INITIALIZED(a) (((a) & 0xF0000000UL) == MODI_INIT) 116 117 #define MODI_SET(a, b) ((a) |= (b)) 118 #define MODI_CLEAR(a, b) ((a) &= ~(b)) 119 #define MODI_ISSET(a, b) (((a) & (b)) != 0) 103 120 104 121 #define SH_TXT_MAX 9200 … … 128 145 129 146 typedef struct file_struct { 130 unsigned long check_ mask;147 unsigned long check_flags; 131 148 int file_reported; 132 149 char fullpath[PATH_MAX]; … … 314 331 */ 315 332 int sh_check_rotated_log (const char * path, 316 UINT64 old_size, UINT64 old_inode, const char * old_hash );333 UINT64 old_size, UINT64 old_inode, const char * old_hash, unsigned long mask); 317 334 318 335 /* obtain file info -
trunk/include/slib.h
r428 r481 60 60 * TRUE, FALSE 61 61 */ 62 #define SL_TRUE 1 63 #define SL_FALSE 0 62 #if !defined(S_TRUE) 63 #define S_TRUE 1 64 #define S_FALSE 0 65 #endif 64 66 65 67 #define SH_GRBUF_SIZE 4096
Note:
See TracChangeset
for help on using the changeset viewer.