From 5539b7a823e3b01e32be0bf70565e46f2af77008 Mon Sep 17 00:00:00 2001 From: Patrice Levesque Date: Mon, 8 Feb 2016 16:14:33 -0500 Subject: [PATCH] Add missing header prototypes Fixes compiling errors with GCC using -Werror=missing-prototypes. --- SoObjects/Appointments/MSExchangeFreeBusy.h | 2 + .../Appointments/SOGoWebAppointmentFolder.h | 2 + SoObjects/SOGo/NSData+Crypto.m | 4 +- SoObjects/SOGo/lmhash.h | 69 +++++++++++++++++++ Tests/Unit/SOGoTest.h | 2 + 5 files changed, 77 insertions(+), 2 deletions(-) diff --git a/SoObjects/Appointments/MSExchangeFreeBusy.h b/SoObjects/Appointments/MSExchangeFreeBusy.h index 3d9c49c04..985fd8835 100644 --- a/SoObjects/Appointments/MSExchangeFreeBusy.h +++ b/SoObjects/Appointments/MSExchangeFreeBusy.h @@ -25,6 +25,8 @@ #include +size_t curl_body_function_freebusy(void *ptr, size_t size, size_t nmemb, void *inSelf); + @class MSExchangeFreeBusyResponse; @class MSExchangeFreeBusyView; diff --git a/SoObjects/Appointments/SOGoWebAppointmentFolder.h b/SoObjects/Appointments/SOGoWebAppointmentFolder.h index 736a6b461..ceb29fb5d 100644 --- a/SoObjects/Appointments/SOGoWebAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoWebAppointmentFolder.h @@ -23,6 +23,8 @@ #import "SOGoAppointmentFolder.h" +size_t curl_body_function(void *ptr, size_t size, size_t nmemb, void *buffer); + @interface SOGoWebAppointmentFolder : SOGoAppointmentFolder - (void) setUsername: (NSString *) username diff --git a/SoObjects/SOGo/NSData+Crypto.m b/SoObjects/SOGo/NSData+Crypto.m index 5c0a03a06..ad0affc2f 100644 --- a/SoObjects/SOGo/NSData+Crypto.m +++ b/SoObjects/SOGo/NSData+Crypto.m @@ -62,7 +62,7 @@ static unsigned charTo4Bits(char c); #if defined(HAVE_GNUTLS) -static BOOL check_gnutls_init(); +static BOOL check_gnutls_init(void); static void _nettle_md5_compress(uint32_t *digest, const uint8_t *input); #endif @@ -742,7 +742,7 @@ static unsigned charTo4Bits(char c) #if defined(HAVE_GNUTLS) static BOOL didGlobalInit = NO; -static BOOL check_gnutls_init() { +static BOOL check_gnutls_init(void) { if (!didGlobalInit) { /* Global system initialization*/ if (gnutls_global_init()) { diff --git a/SoObjects/SOGo/lmhash.h b/SoObjects/SOGo/lmhash.h index cfcece2a4..31d04b10d 100644 --- a/SoObjects/SOGo/lmhash.h +++ b/SoObjects/SOGo/lmhash.h @@ -92,4 +92,73 @@ uchar *auth_LMhash( uchar *dst, const uchar *pwd, const int pwdlen ); * * ------------------------------------------------------------------------ ** */ + +uchar *auth_DESkey8to7( uchar *dst, const uchar *key ); + /* ------------------------------------------------------------------------ ** + * Compress an 8-byte DES key to its 7-byte form. + * + * Input: dst - Pointer to a memory location (minimum 7 bytes) to accept + * the compressed key. + * key - Pointer to an 8-byte DES key. See the notes below. + * + * Output: A pointer to the compressed key (same as ) or NULL if + * either or were NULL. + * + * Notes: There are no checks done to ensure that and point + * to sufficient space. Please be carefull. + * + * The two pointers, and may point to the same + * memory location. Internally, a temporary buffer is used and + * the results are copied back to . + * + * The DES algorithm uses 8 byte keys by definition. The first + * step in the algorithm, however, involves removing every eigth + * bit to produce a 56-bit key (seven bytes). SMB authentication + * skips this step and uses 7-byte keys. The + * algorithm in this module expects 7-byte keys. This function + * is used to convert an 8-byte DES key into a 7-byte SMB DES key. + * + * ------------------------------------------------------------------------ ** + */ + +uchar *auth_DEShash( uchar *dst, const uchar *key, const uchar *src ); + /* ------------------------------------------------------------------------ ** + * DES encryption of the input data using the input key. + * + * Input: dst - Destination buffer. It *must* be at least eight bytes + * in length, to receive the encrypted result. + * key - Encryption key. Exactly seven bytes will be used. + * If your key is shorter, ensure that you pad it to seven + * bytes. + * src - Source data to be encrypted. Exactly eight bytes will + * be used. If your source data is shorter, ensure that + * you pad it to eight bytes. + * + * Output: A pointer to the encrpyted data (same as ). + * + * Notes: In SMB, the DES function is used as a hashing function rather + * than an encryption/decryption tool. When used for generating + * the LM hash the input is the known value "KGS!@#$%" and + * the key is derived from the password entered by the user. + * When used to generate the LM or NTLM response, the is + * derived from the LM or NTLM hash, and the challenge is used + * as the input. + * See: http://ubiqx.org/cifs/SMB.html#SMB.8.3 + * + * - This function is called "DEShash" rather than just "DES" + * because it is only used for creating LM hashes and the + * LM/NTLM responses. For all practical purposes, however, it + * is a full DES encryption implementation. + * + * - This DES implementation does not need to be fast, nor is a + * DES decryption function needed. The goal is to keep the + * code small, simple, and well documented. + * + * - The input values are copied and refiddled within the module + * and the result is not written to until the very last + * step, so it's okay if points to the same memory as + * or . + * + * ------------------------------------------------------------------------ ** + */ #endif diff --git a/Tests/Unit/SOGoTest.h b/Tests/Unit/SOGoTest.h index ed49be707..119cb7e34 100644 --- a/Tests/Unit/SOGoTest.h +++ b/Tests/Unit/SOGoTest.h @@ -54,6 +54,8 @@ - (BOOL) run; +NSString *_stringForCharacterAtIndex(NSUInteger index, NSString *str, NSUInteger length); + - (NSString*) stringFromDiffBetween: (NSString*) str1 and: (NSString*) str2; @end