Changeset 343

Show
Ignore:
Timestamp:
22/08/07 11:09:22 (15 months ago)
Author:
smoku
Message:

Using OpenSSL SHA1() implementation when available

Location:
trunk/util
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/util/sha1.c

    r2 r343  
    2020 
    2121/* modified for j2 by Robert Norris */ 
     22 
     23/* XXX WARNING! This function works incorrectly on 64bit platform */ 
    2224 
    2325#include "sha1.h" 
  • trunk/util/str.c

    r156 r343  
    1919 */ 
    2020 
     21#include "pool.h" 
    2122#include "util.h" 
    2223 
     
    116117} 
    117118 
    118 spool spool_new(pool p) 
     119spool spool_new(pool_t p) 
    119120{ 
    120121    spool s; 
     
    206207 
    207208/** convenience :) */ 
    208 char *spools(pool p, ...) 
     209char *spools(pool_t p, ...) 
    209210{ 
    210211    va_list ap; 
     
    223224    { 
    224225        arg = va_arg(ap,char *); 
    225         if((pool)arg == p) 
     226        if((pool_t)arg == p) 
    226227            break; 
    227228        else 
     
    235236 
    236237 
    237 char *strunescape(pool p, char *buf) 
     238char *strunescape(pool_t p, char *buf) 
    238239{ 
    239240    int i,j=0; 
     
    282283 
    283284 
    284 char *strescape(pool p, char *buf, int len) 
     285char *strescape(pool_t p, char *buf, int len) 
    285286{ 
    286287    int i,j,newlen = len; 
     
    369370    unsigned char hashval[20]; 
    370371     
     372#ifdef HAVE_SSL 
     373    /* use OpenSSL functions when available */ 
     374#   include <openssl/sha.h> 
     375    SHA1((unsigned char *)str, strlen(str), hashval); 
     376#else 
    371377    sha1_hash((unsigned char *)str, strlen(str), hashval); 
     378#endif 
    372379 
    373380    hex_from_raw(hashval, 20, hashbuf);