Changeset 3710
- Timestamp:
- 08/11/07 12:40:01 (1 year ago)
- Files:
-
- trunk/Chat Core.xcodeproj/project.pbxproj (modified) (2 diffs)
- trunk/Chat Core/ICBPacket.m (modified) (1 diff)
- trunk/Chat Core/InterThreadMessaging.m (modified) (1 diff)
- trunk/Colloquy.xcodeproj/project.pbxproj (modified) (2 diffs)
- trunk/Frameworks/AGRegex/pcre-6.7/pcre_compile.c (modified) (1 diff)
- trunk/Frameworks/Acid/Acid.xcodeproj/project.pbxproj (modified) (6 diffs)
- trunk/Frameworks/Acid/expat/xmlparse.c (modified) (2 diffs)
- trunk/Frameworks/Acid/expat/xmltok.c (modified) (13 diffs)
- trunk/Frameworks/Acid/jabber/JabberID.m (modified) (1 diff)
- trunk/Frameworks/Acid/jabber/JabberRoster.m (modified) (1 diff)
- trunk/Frameworks/Acid/jabber/JabberStdAuthManager.m (modified) (1 diff)
- trunk/Frameworks/Acid/jabber/JabberSubscriptionRequest.m (modified) (3 diffs)
- trunk/Frameworks/Acid/utility/esession/base64.c (modified) (4 diffs)
- trunk/Frameworks/Acid/utility/esession/base64.h (added)
- trunk/Frameworks/Acid/utility/esession/buffer.c (modified) (4 diffs)
- trunk/Frameworks/Acid/utility/esession/esession.c (modified) (18 diffs)
- trunk/Frameworks/Acid/utility/esession/esession.h (modified) (1 diff)
- trunk/Frameworks/Acid/utility/esession/keycache.c (modified) (3 diffs)
- trunk/Frameworks/Acid/utility/esession/keycache.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Chat Core.xcodeproj/project.pbxproj
r3662 r3710 4 4 classes = { 5 5 }; 6 objectVersion = 4 3;6 objectVersion = 44; 7 7 objects = { 8 8 … … 824 824 i386, 825 825 ); 826 SDKROOT S= "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";826 SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; 827 827 SYMROOT = build; 828 828 }; trunk/Chat Core/ICBPacket.m
r3582 r3710 173 173 const NSString *f = [_fields objectAtIndex:i]; 174 174 175 length = strlcat(data, [f cString], maxDataLength);175 length = strlcat(data, [f UTF8String], maxDataLength); 176 176 if (i < [_fields count] - 1) 177 177 length = strlcat(data, "\x01", maxDataLength); trunk/Chat Core/InterThreadMessaging.m
r3709 r3710 180 180 + (void) threadDied:(NSNotification *)notification 181 181 { 182 NSThread *thread; 183 NSRunLoop *runLoop; 184 185 thread = [notification object]; 186 removeMessagePortForThread(thread); 182 removeMessagePortForThread([notification object]); 187 183 } 188 184 trunk/Colloquy.xcodeproj/project.pbxproj
r3662 r3710 4 4 classes = { 5 5 }; 6 objectVersion = 4 3;6 objectVersion = 44; 7 7 objects = { 8 8 … … 3076 3076 i386, 3077 3077 ); 3078 SDKROOT S= "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";3078 SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; 3079 3079 SYMROOT = build; 3080 3080 }; trunk/Frameworks/AGRegex/pcre-6.7/pcre_compile.c
r3642 r3710 806 806 thisname = ptr; 807 807 while (*ptr != '>') ptr++; 808 if (namelen == ptr - thisname && strncmp( name,thisname, namelen) == 0)808 if (namelen == ptr - thisname && strncmp((const char *)name, (const char *)thisname, namelen) == 0) 809 809 return count; 810 810 } trunk/Frameworks/Acid/Acid.xcodeproj/project.pbxproj
r3645 r3710 4 4 classes = { 5 5 }; 6 objectVersion = 4 2;6 objectVersion = 44; 7 7 objects = { 8 8 … … 59 59 /* Begin PBXFileReference section */ 60 60 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 61 1CF24BB60C6E2648006BD6A5 /* keycache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keycache.h; sourceTree = "<group>"; }; 62 1CF24BFC0C6E26F2006BD6A5 /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base64.h; sourceTree = "<group>"; }; 61 63 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 62 64 8DC2EF5B0486A6940098B216 /* Acid.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Acid.framework; sourceTree = BUILT_PRODUCTS_DIR; }; … … 306 308 children = ( 307 309 DD8ADFA50BD1741A009AB74D /* base64.c */, 310 1CF24BFC0C6E26F2006BD6A5 /* base64.h */, 308 311 DD8ADFA60BD1741A009AB74D /* buffer.c */, 309 312 DD8ADFA70BD1741A009AB74D /* buffer.h */, … … 311 314 DD8ADFA90BD1741A009AB74D /* esession.h */, 312 315 DD8ADFAA0BD1741A009AB74D /* keycache.c */, 316 1CF24BB60C6E2648006BD6A5 /* keycache.h */, 313 317 ); 314 318 path = esession; … … 404 408 projectDirPath = ""; 405 409 projectRoot = ""; 406 shouldCheckCompatibility = 1;407 410 targets = ( 408 411 8DC2EF4F0486A6940098B216 /* Acid */, … … 514 517 i386, 515 518 ); 516 SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;519 SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; 517 520 }; 518 521 name = "Release (Universal)"; trunk/Frameworks/Acid/expat/xmlparse.c
r3640 r3710 1318 1318 XML_T("unexpected parser state - please send a bug report") 1319 1319 }; 1320 if (code > 0 && code < sizeof(message)/sizeof(message[0]))1320 if (code > 0 && (unsigned int)code < sizeof(message)/sizeof(message[0])) 1321 1321 return message[code]; 1322 1322 return 0; … … 2735 2735 if (attlistDeclHandler) 2736 2736 { 2737 c har *prefix;2737 const char *prefix; 2738 2738 if (declAttributeType) { 2739 2739 prefix = "|"; trunk/Frameworks/Acid/expat/xmltok.c
r3640 r3710 170 170 E ## isInvalid3, \ 171 171 E ## isInvalid4 172 173 #define NULL_NORMAL_VTABLE() \ 174 NULL, \ 175 NULL, \ 176 NULL, \ 177 NULL, \ 178 NULL, \ 179 NULL, \ 180 NULL, \ 181 NULL, \ 182 NULL 172 183 173 184 static int checkCharRefNumber(int); … … 411 422 #include "latin1tab.h" 412 423 }, 413 STANDARD_VTABLE(sb_) 424 STANDARD_VTABLE(sb_) NULL_NORMAL_VTABLE() 414 425 }; 415 426 … … 424 435 #include "latin1tab.h" 425 436 }, 426 STANDARD_VTABLE(sb_) 437 STANDARD_VTABLE(sb_) NULL_NORMAL_VTABLE() 427 438 }; 428 439 … … 444 455 /* BT_NONXML == 0 */ 445 456 }, 446 STANDARD_VTABLE(sb_) 457 STANDARD_VTABLE(sb_) NULL_NORMAL_VTABLE() 447 458 }; 448 459 … … 457 468 /* BT_NONXML == 0 */ 458 469 }, 459 STANDARD_VTABLE(sb_) 470 STANDARD_VTABLE(sb_) NULL_NORMAL_VTABLE() 460 471 }; 461 472 … … 667 678 #include "latin1tab.h" 668 679 }, 669 STANDARD_VTABLE(little2_) 680 STANDARD_VTABLE(little2_) NULL_NORMAL_VTABLE() 670 681 }; 671 682 … … 686 697 #include "latin1tab.h" 687 698 }, 688 STANDARD_VTABLE(little2_) 699 STANDARD_VTABLE(little2_) NULL_NORMAL_VTABLE() 689 700 }; 690 701 … … 699 710 #include "latin1tab.h" 700 711 }, 701 STANDARD_VTABLE(little2_) 712 STANDARD_VTABLE(little2_) NULL_NORMAL_VTABLE() 702 713 }; 703 714 … … 712 723 #include "latin1tab.h" 713 724 }, 714 STANDARD_VTABLE(little2_) 725 STANDARD_VTABLE(little2_) NULL_NORMAL_VTABLE() 715 726 }; 716 727 … … 806 817 #include "latin1tab.h" 807 818 }, 808 STANDARD_VTABLE(big2_) 819 STANDARD_VTABLE(big2_) NULL_NORMAL_VTABLE() 809 820 }; 810 821 … … 825 836 #include "latin1tab.h" 826 837 }, 827 STANDARD_VTABLE(big2_) 838 STANDARD_VTABLE(big2_) NULL_NORMAL_VTABLE() 828 839 }; 829 840 … … 838 849 #include "latin1tab.h" 839 850 }, 840 STANDARD_VTABLE(big2_) 851 STANDARD_VTABLE(big2_) NULL_NORMAL_VTABLE() 841 852 }; 842 853 … … 851 862 #include "latin1tab.h" 852 863 }, 853 STANDARD_VTABLE(big2_) 864 STANDARD_VTABLE(big2_) NULL_NORMAL_VTABLE() 854 865 }; 855 866 trunk/Frameworks/Acid/jabber/JabberID.m
r3641 r3710 267 267 -(id) initWithEscapedString:(NSString*)jidstring 268 268 { 269 return [self initWithString:[XMLCData unescape:[jidstring cString] ofLength:[jidstring length]]]; 269 NSData *jidstringData = [jidstring dataUsingEncoding:NSUTF8StringEncoding]; 270 return [self initWithString:[XMLCData unescape:[jidstringData bytes] ofLength:[jidstringData length]]]; 270 271 } 271 272 trunk/Frameworks/Acid/jabber/JabberRoster.m
r3640 r3710 378 378 { 379 379 // XXX: There should probably be some code for handling errors here. 380 //NSLog(@"Roster update result: %@", n);381 380 } 382 381 trunk/Frameworks/Acid/jabber/JabberStdAuthManager.m
r3640 r3710 83 83 unsigned char digest[20]; 84 84 85 NSData *passwordData = [password dataUsingEncoding:NSUTF8StringEncoding]; 86 85 87 SHA1Init(&ctx); 86 SHA1Update(&ctx, (const unsigned char *)[password cString], [password cStringLength]);88 SHA1Update(&ctx, [passwordData bytes], [passwordData length]); 87 89 SHA1Final(digest, &ctx); 88 90 trunk/Frameworks/Acid/jabber/JabberSubscriptionRequest.m
r3641 r3710 56 56 QRY_MESSAGE = [[XPathQuery alloc] initWithPath:@"/presence/status"]; 57 57 PRESSUBTYPE = [[NSDictionary alloc] initWithObjectsAndKeys: 58 JSUBSCRIBE, @"subscribe",59 JSUBSCRIBED, "@subscribed",60 JUNSUBSCRIBE, "@unsubscribed",61 JUNSUBSCRIBED, "@unsubscribed", nil];58 [NSNumber numberWithLong:JSUBSCRIBE], @"subscribe", 59 [NSNumber numberWithLong:JSUBSCRIBED], "@subscribed", 60 [NSNumber numberWithLong:JUNSUBSCRIBE], "@unsubscribed", 61 [NSNumber numberWithLong:JUNSUBSCRIBED], "@unsubscribed", nil]; 62 62 } 63 63 … … 85 85 [_message release]; 86 86 _message = [[QRY_MESSAGE queryForString:self] retain]; 87 _type = (JabberSubscriptionType)[PRESSUBTYPE objectForKey:[self getAttribute:@"type"]]; 88 NSLog(@"Re-synced presence subscription request(%d): %@", _type, self); 87 _type = [[PRESSUBTYPE objectForKey:[self getAttribute:@"type"]] longValue]; 89 88 } 90 89 … … 113 112 { 114 113 JabberSubscriptionRequest* r; 115 NSLog(@"DEBUG Granted subscription request from %@", _from);116 114 117 115 r = [[JabberSubscriptionRequest alloc] initWithRecipient:_from]; trunk/Frameworks/Acid/utility/esession/base64.c
r3640 r3710 65 65 #include <stdlib.h> 66 66 #include <string.h> 67 68 /* Pre-decls */ 69 int ap_base64decode_binary(unsigned char *bufplain, const char *bufcoded); 70 int ap_base64encode_binary(char *encoded, const unsigned char *string, int len); 67 #include "base64.h" 71 68 72 69 /* aaaack but it's fast and const should make it shared text page. */ … … 107 104 } 108 105 106 static int ap_base64decode_binary(unsigned char *bufplain, 107 const char *bufcoded) 108 { 109 int nbytesdecoded; 110 register const unsigned char *bufin; 111 register unsigned char *bufout; 112 register int nprbytes; 113 114 bufin = (const unsigned char *) bufcoded; 115 while (pr2six[*(bufin++)] <= 63); 116 nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; 117 nbytesdecoded = ((nprbytes + 3) / 4) * 3; 118 119 bufout = (unsigned char *) bufplain; 120 bufin = (const unsigned char *) bufcoded; 121 122 while (nprbytes > 4) { 123 *(bufout++) = 124 (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); 125 *(bufout++) = 126 (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); 127 *(bufout++) = 128 (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); 129 bufin += 4; 130 nprbytes -= 4; 131 } 132 133 /* Note: (nprbytes == 1) would be an error, so just ingore that case */ 134 if (nprbytes > 1) { 135 *(bufout++) = 136 (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); 137 } 138 if (nprbytes > 2) { 139 *(bufout++) = 140 (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); 141 } 142 if (nprbytes > 3) { 143 *(bufout++) = 144 (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); 145 } 146 147 nbytesdecoded -= (4 - nprbytes) & 3; 148 return nbytesdecoded; 149 } 150 109 151 int ap_base64decode(char *bufplain, const char *bufcoded) 110 152 { … … 116 158 } 117 159 118 int ap_base64decode_binary(unsigned char *bufplain,119 const char *bufcoded)120 {121 int nbytesdecoded;122 register const unsigned char *bufin;123 register unsigned char *bufout;124 register int nprbytes;125 126 bufin = (const unsigned char *) bufcoded;127 while (pr2six[*(bufin++)] <= 63);128 nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;129 nbytesdecoded = ((nprbytes + 3) / 4) * 3;130 131 bufout = (unsigned char *) bufplain;132 bufin = (const unsigned char *) bufcoded;133 134 while (nprbytes > 4) {135 *(bufout++) =136 (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);137 *(bufout++) =138 (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);139 *(bufout++) =140 (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);141 bufin += 4;142 nprbytes -= 4;143 }144 145 /* Note: (nprbytes == 1) would be an error, so just ingore that case */146 if (nprbytes > 1) {147 *(bufout++) =148 (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);149 }150 if (nprbytes > 2) {151 *(bufout++) =152 (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);153 }154 if (nprbytes > 3) {155 *(bufout++) =156 (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);157 }158 159 nbytesdecoded -= (4 - nprbytes) & 3;160 return nbytesdecoded;161 }162 163 160 static const char basis_64[] = 164 161 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 165 162 166 int ap_base64encode_len(int len)163 static int ap_base64encode_len(int len) 167 164 { 168 165 return ((len + 2) / 3 * 4) + 1; 169 166 } 170 167 171 int ap_base64encode(char *encoded, const char *string, int len) 172 { 173 return ap_base64encode_binary(encoded, (const unsigned char *) string, len); 174 } 175 176 int ap_base64encode_binary(char *encoded, 168 static int ap_base64encode_binary(char *encoded, 177 169 const unsigned char *string, int len) 178 170 { … … 207 199 } 208 200 201 static int ap_base64encode(char *encoded, const char *string, int len) 202 { 203 return ap_base64encode_binary(encoded, (const unsigned char *) string, len); 204 } 205 209 206 /* convenience functions for j2 */ 210 207 char *b64_encode(char *buf, int len) { trunk/Frameworks/Acid/utility/esession/buffer.c
r3640 r3710 49 49 50 50 #include "buffer.h" 51 #include "base64.h" 51 52 #include <string.h> 52 53 #include <stdlib.h> 53 54 #include <assert.h> 54 55 /* Pre-decls */56 char *b64_encode(char *buf, int len);57 int ap_base64decode(char *bufplain, const char *bufcoded);58 int ap_base64decode_len(const char *bufcoded);59 55 60 56 /* Initializes the buffer structure. */ … … 212 208 buffer_dump(Buffer *buffer) 213 209 { 214 int i;210 unsigned int i; 215 211 u_char *ucp = buffer->buf; 216 212 … … 410 406 buffer_base64_encode(Buffer *buffer) 411 407 { 412 return b64_encode(buffer->buf+ buffer->offset,408 return (unsigned char *)b64_encode(((char *)buffer->buf) + buffer->offset, 413 409 buffer->end - buffer->offset); 414 410 } … … 420 416 buffer_init_from_base64(Buffer *buffer, const u_char* b64str) 421 417 { 422 buffer->alloc = ap_base64decode_len( buffer->buf);418 buffer->alloc = ap_base64decode_len((const char *)buffer->buf); 423 419 buffer->buf = (u_char*)malloc(buffer->alloc); 424 420 buffer->offset = 0; 425 buffer->end = ap_base64decode( buffer->buf,b64str);426 } 421 buffer->end = ap_base64decode((char *)buffer->buf, (const char *)b64str); 422 } trunk/Frameworks/Acid/utility/esession/esession.c
r3641 r3710 24 24 25 25 #include "esession.h" 26 #include "keycache.h" 27 #include "base64.h" 26 28 #include <openssl/ssl.h> 27 29 #include <assert.h> 28 30 #include "buffer.h" 29 31 #include <string.h> 30 31 /* Pre-decls */32 char* b64_encode(char* buf, int len);33 void b64_decode(const char* data, char* result, int* result_len);34 32 35 33 /* … … 48 46 void* _getpass_cb_arg; 49 47 50 /* Public key cache -- see keycache.c */51 void init_key_caches();52 const char* cache_public_key(const char* id, ESessionKeyType keytype,53 const char* fingerprint);54 const char* find_public_fingerprint(const char* id,55 ESessionKeyType keytype);56 const char* cache_personal_key(ESessionKeyType keytype, EVP_PKEY* pkey,57 char* fingerprint, char* public_key);58 59 48 /* MODP groups, as defined in RFC 3526 */ 60 49 static const char* MODP_5 = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF"; … … 86 75 unsigned char keybuf[EVP_MAX_MD_SIZE]; 87 76 unsigned int keybuf_len; 88 EVP_CIPHER* cipher_type;77 const EVP_CIPHER* cipher_type; 89 78 90 79 /* Ensure the size of the biggest max digest is bigger … … 147 136 EVP_MD_CTX ctx; 148 137 char keydigest[EVP_MAX_MD_SIZE]; 149 int keydigest_len;138 unsigned int keydigest_len; 150 139 char* result; 151 int i;140 unsigned int i; 152 141 153 142 /* Generate MD5 hash */ 154 143 EVP_DigestInit(&ctx, EVP_md5()); 155 144 EVP_DigestUpdate(&ctx, buffer_ptr(rawkeybuf), buffer_len(rawkeybuf)); 156 EVP_DigestFinal(&ctx, keydigest, &keydigest_len);145 EVP_DigestFinal(&ctx, (unsigned char *)keydigest, &keydigest_len); 157 146 158 147 /* Turn it into something meaningful... */ … … 176 165 177 166 /* First of all, base64 decode this keystring */ 178 buffer_init_from_base64(&rawkeybuf, keystr);167 buffer_init_from_base64(&rawkeybuf, (unsigned char *)keystr); 179 168 180 169 /* Turn the MD5 hash into printed form */ … … 259 248 */ 260 249 261 int es_get_last_error( )250 int es_get_last_error(void) 262 251 { 263 252 return _last_error; … … 331 320 332 321 /* Generate a base64 encoded public key */ 333 public_key = buffer_base64_encode(&b);322 public_key = (char *)buffer_base64_encode(&b); 334 323 335 324 /* Ok, we have enough info to cache this key: … … 352 341 353 342 /* First of all, base64 decode the keystring */ 354 buffer_init_from_base64(&rawkeybuf, public_key);343 buffer_init_from_base64(&rawkeybuf, (unsigned char *)public_key); 355 344 356 345 /* Turn the MD5 hash into printed form */ … … 418 407 buffer_put_bignum2(&b, rkey->e); 419 408 buffer_put_bignum2(&b, rkey->n); 420 result->public_key = buffer_base64_encode(&b);409 result->public_key = (char *)buffer_base64_encode(&b); 421 410 buffer_free(&b); 422 411 … … 437 426 buffer_put_bignum2(&b, dkey->g); 438 427 buffer_put_bignum2(&b, dkey->pub_key); 439 result->public_key = buffer_base64_encode(&b);428 result->public_key = (char *)buffer_base64_encode(&b); 440 429 buffer_free(&b); 441 430 … … 447 436 membio = BIO_new(BIO_s_mem()); 448 437 PEM_write_bio_PrivateKey(membio, evpkey, EVP_des_ede3_cbc(), 449 ( char*)privatepass, strlen(privatepass),438 (unsigned char *)privatepass, strlen(privatepass), 450 439 NULL, NULL); 451 440 … … 548 537 EVP_MD_CTX signctx; 549 538 char* sig; 550 int sig_len;539 unsigned int sig_len; 551 540 552 541 … … 585 574 /* Step 2.7: Calculate K by completing the DH handshake */ 586 575 K.length = DH_size(es->_dh); 587 K.data = (unsigned char*)malloc(K.length);588 rc = DH_compute_key( K.data, e, es->_dh);576 K.data = malloc(K.length); 577 rc = DH_compute_key((unsigned char *)K.data, e, es->_dh); 589 578 if (rc == -1) 590 579 { … … 596 585 597 586 /* Step 2.8: Compute a SHA1 hash of (Bob's public key, e, f, K) */ 598 _compute_sid( es->_public_key, e, f, K, &sid);587 _compute_sid((const char *)es->_public_key, e, f, K, &sid); 599 588 600 589 … … 603 592 result->type = 1; 604 593 result->f = BN_bn2hex(f); 605 result->public_key = strdup( es->_public_key);594 result->public_key = strdup((const char *)es->_public_key); 606 595 607 596 … … 611 600 EVP_SignInit(&signctx, EVP_sha1()); 612 601 EVP_SignUpdate(&signctx, buffer_ptr(&sid), buffer_len(&sid)); 613 EVP_SignFinal(&signctx, sig, &sig_len, es->_pkey);602 EVP_SignFinal(&signctx, (unsigned char *)sig, &sig_len, es->_pkey); 614 603 result->sig = b64_encode(sig, sig_len); 615 604 free(sig); … … 675 664 /* Step 2.11: Calculate K by completing the DH handshake */ 676 665 K.length = DH_size(es->_dh); 677 K.data = (unsigned char*)malloc(K.length);678 rc = DH_compute_key( K.data, f, es->_dh);666 K.data = malloc(K.length); 667 rc = DH_compute_key((unsigned char *)K.data, f, es->_dh); 679 668 if (rc == -1) 680 669 { … … 706 695 EVP_VerifyInit(&verifyctx, EVP_sha1()); 707 696 EVP_VerifyUpdate(&verifyctx, buffer_ptr(&sid), buffer_len(&sid)); 708 rc = EVP_VerifyFinal(&verifyctx, sig, sig_len, bobkey);697 rc = EVP_VerifyFinal(&verifyctx, (unsigned char *)sig, sig_len, bobkey); 709 698 if (rc != 1) 710 699 { trunk/Frameworks/Acid/utility/esession/esession.h
r3641 r3710 160 160 */ 161 161 162 int es_get_last_error( );162 int es_get_last_error(void); 163 163 164 164 const char* es_add_personal_key(const char* private_key); trunk/Frameworks/Acid/utility/esession/keycache.c
r3641 r3710 28 28 #include "buffer.h" 29 29 #include "esession.h" 30 #include "keycache.h" 30 31 31 32 typedef struct … … 59 60 buffer_put_cstring(&b, "dsakey"); 60 61 b.buf[b.end] = '\0'; 61 result = lh_strhash( b.buf);62 result = lh_strhash((char *)b.buf); 62 63 buffer_free(&b); 63 64 return result; 64 65 } 65 66 66 static unsigned long PUBKEY_hash(const PUBKEY* k)67 static unsigned long PUBKEY_hash(const void* k) 67 68 { 68 return _hashkey( k->keytype, k->id);69 return _hashkey(((PUBKEY*)k)->keytype, ((PUBKEY*)k)->id); 69 70 } 70 71 71 static int PUBKEY_cmp(const PUBKEY* lhs, const PUBKEY* rhs)72 static int PUBKEY_cmp(const void* lhs, const void* rhs) 72 73 { 73 74 int rc; 74 rc = !( lhs->keytype == rhs->keytype);75 rc = rc || strcmp( lhs->id, rhs->id);75 rc = !(((PUBKEY*)lhs)->keytype == ((PUBKEY*)rhs)->keytype); 76 rc = rc || strcmp(((PUBKEY*)lhs)->id, ((PUBKEY*)rhs)->id); 76 77 return rc; 77 78 } 78 79 79 static unsigned long PRIVKEY_hash(const PRIVKEY* k)80 static unsigned long PRIVKEY_hash(const void* k) 80 81 { 81 return _hashkey( k->keytype, k->fingerprint);82 return _hashkey(((PRIVKEY*)k)->keytype, ((PRIVKEY*)k)->fingerprint); 82 83 } 83 84 84 static int PRIVKEY_cmp(const PRIVKEY* lhs, const PRIVKEY* rhs)85 static int PRIVKEY_cmp(const void* lhs, const void* rhs) 85 86 { 86 87 int rc; 87 rc = !( lhs->keytype == rhs->keytype);88 rc = rc || strcmp( lhs->fingerprint, rhs->fingerprint);88 rc = !(((PRIVKEY*)lhs)->keytype == ((PRIVKEY*)rhs)->keytype); 89 rc = rc || strcmp(((PRIVKEY*)lhs)->fingerprint, ((PRIVKEY*)rhs)->fingerprint); 89 90 return rc; 90 91 } 91 92 92 void init_key_caches( )93 void init_key_caches(void) 93 94 { 94 95 _public_key_cache = lh_new(PUBKEY_hash, PUBKEY_cmp); … … 147 148 return newkey->fingerprint; 148 149 } 149 150 151 152 153 154 155
