*** empty log message ***
This commit is contained in:
parent
a8e21ef4c2
commit
887741751c
|
|
@ -156,6 +156,12 @@
|
|||
#define NSPR_LIBS nspr4
|
||||
#defer HAVE_NSPR $[libtest $[NSPR_LPATH],$[NSPR_LIBS]]
|
||||
|
||||
// Is Crypto++ installed, and where?
|
||||
#define CRYPTO_IPATH /usr/include/crypto++
|
||||
#define CRYPTO_LPATH /usr/lib
|
||||
#define CRYPTO_LIBS cryptlib
|
||||
#defer HAVE_CRYPTO $[libtest $[CRYPTO_LPATH],$[CRYPTO_LIBS]]
|
||||
|
||||
// Is VRPN installed, and where?
|
||||
#define VRPN_IPATH
|
||||
#define VRPN_LPATH
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ $[cdefine HAVE_PYTHON]
|
|||
/* Define if we have NSPR installed. */
|
||||
$[cdefine HAVE_NSPR]
|
||||
|
||||
/* Define if we have crypto++ installed. */
|
||||
$[cdefine HAVE_CRYPTO]
|
||||
|
||||
/* Define if we have VRPN installed. */
|
||||
$[cdefine HAVE_VRPN]
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,12 @@
|
|||
#define nspr_libs $[NSPR_LIBS]
|
||||
#endif
|
||||
|
||||
#if $[HAVE_CRYPTO]
|
||||
#define crypto_ipath $[wildcard $[CRYPTO_IPATH]]
|
||||
#define crypto_lpath $[wildcard $[CRYPTO_LPATH]]
|
||||
#define crypto_libs $[CRYPTO_LIBS]
|
||||
#endif
|
||||
|
||||
#if $[HAVE_ZLIB]
|
||||
#define zlib_ipath $[wildcard $[ZLIB_IPATH]]
|
||||
#define zlib_lpath $[wildcard $[ZLIB_LPATH]]
|
||||
|
|
@ -170,6 +176,7 @@
|
|||
$[and \
|
||||
$[or $[not $[DIRECTORY_IF_PYTHON]],$[HAVE_PYTHON]], \
|
||||
$[or $[not $[DIRECTORY_IF_NSPR]],$[HAVE_NSPR]], \
|
||||
$[or $[not $[DIRECTORY_IF_CRYPTO]],$[HAVE_CRYPTO]], \
|
||||
$[or $[not $[DIRECTORY_IF_ZLIB]],$[HAVE_ZLIB]], \
|
||||
$[or $[not $[DIRECTORY_IF_SOXST]],$[HAVE_SOXST]], \
|
||||
$[or $[not $[DIRECTORY_IF_GL]],$[HAVE_GL]], \
|
||||
|
|
@ -195,6 +202,7 @@
|
|||
$[and \
|
||||
$[or $[not $[TARGET_IF_PYTHON]],$[HAVE_PYTHON]], \
|
||||
$[or $[not $[TARGET_IF_NSPR]],$[HAVE_NSPR]], \
|
||||
$[or $[not $[TARGET_IF_CRYPTO]],$[HAVE_CRYPTO]], \
|
||||
$[or $[not $[TARGET_IF_ZLIB]],$[HAVE_ZLIB]], \
|
||||
$[or $[not $[TARGET_IF_SOXST]],$[HAVE_SOXST]], \
|
||||
$[or $[not $[TARGET_IF_GL]],$[HAVE_GL]], \
|
||||
|
|
@ -237,6 +245,7 @@
|
|||
// target.
|
||||
#defer get_sources \
|
||||
$[SOURCES] \
|
||||
$[if $[HAVE_CRYPTO],$[IF_CRYPTO_SOURCES]] \
|
||||
$[if $[HAVE_ZLIB],$[IF_ZLIB_SOURCES]] \
|
||||
$[if $[HAVE_IPC],$[IF_IPC_SOURCES]] \
|
||||
$[if $[HAVE_NET],$[IF_NET_SOURCES]] \
|
||||
|
|
@ -279,6 +288,9 @@
|
|||
#defun get_cflags
|
||||
#define alt_cflags $[nspr_cflags] $[python_cflags]
|
||||
|
||||
#if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs]],]
|
||||
#set alt_cflags $[alt_cflags] $[crypto_cflags]
|
||||
#endif
|
||||
#if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],]
|
||||
#set alt_cflags $[alt_cflags] $[zlib_cflags]
|
||||
#endif
|
||||
|
|
@ -326,6 +338,9 @@
|
|||
#defun get_ipath
|
||||
#define alt_ipath $[nspr_ipath] $[python_ipath]
|
||||
|
||||
#if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs]],]
|
||||
#set alt_ipath $[alt_ipath] $[crypto_ipath]
|
||||
#endif
|
||||
#if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],]
|
||||
#set alt_ipath $[alt_ipath] $[zlib_ipath]
|
||||
#endif
|
||||
|
|
@ -373,6 +388,9 @@
|
|||
#defun get_lpath
|
||||
#define alt_lpath $[nspr_lpath] $[python_lpath]
|
||||
|
||||
#if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs]],]
|
||||
#set alt_lpath $[alt_lpath] $[crypto_lpath]
|
||||
#endif
|
||||
#if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],]
|
||||
#set alt_lpath $[alt_lpath] $[zlib_lpath]
|
||||
#endif
|
||||
|
|
@ -421,6 +439,9 @@
|
|||
#defun get_libs
|
||||
#define alt_libs $[nspr_libs] $[python_libs]
|
||||
|
||||
#if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs]],]
|
||||
#set alt_libs $[alt_libs] $[crypto_libs]
|
||||
#endif
|
||||
#if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],]
|
||||
#set alt_libs $[alt_libs] $[zlib_libs]
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1322,15 +1322,15 @@ handle_include_directive(const string &args, int first_line,
|
|||
}
|
||||
|
||||
// Now look for it on the include path.
|
||||
if (!found_file && filename.resolve_filename(_include_path)) {
|
||||
found_file = true;
|
||||
source = CPPFile::S_alternate;
|
||||
}
|
||||
|
||||
if (!found_file && filename.resolve_filename(_system_include_path)) {
|
||||
found_file = true;
|
||||
source = CPPFile::S_system;
|
||||
}
|
||||
|
||||
if (!found_file && filename.resolve_filename(_include_path)) {
|
||||
found_file = true;
|
||||
source = CPPFile::S_alternate;
|
||||
}
|
||||
|
||||
if (!found_file) {
|
||||
warning("Cannot find " + filename.get_fullpath(),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
#define INSTALL_PARSER_INC \
|
||||
deque iostream list map pair queue set stack stdtypedefs.h \
|
||||
string vector windows.h zlib.h
|
||||
string vector windows.h zlib.h md5.h files.h
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
// Filename: files.h
|
||||
// Created by: drose (07Nov00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file, and all the other files in this directory, aren't
|
||||
// intended to be compiled--they're just parsed by CPPParser (and
|
||||
// interrogate) in lieu of the actual system headers, to generate the
|
||||
// interrogate database.
|
||||
|
||||
#ifndef FILES_H
|
||||
#define FILES_H
|
||||
|
||||
namespace CryptoPP {
|
||||
class FileSource;
|
||||
class FileSink;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Filename: md5.h
|
||||
// Created by: drose (07Nov00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file, and all the other files in this directory, aren't
|
||||
// intended to be compiled--they're just parsed by CPPParser (and
|
||||
// interrogate) in lieu of the actual system headers, to generate the
|
||||
// interrogate database.
|
||||
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
namespace CryptoPP {
|
||||
class MD5;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#define LOCAL_LIBS event ipc express pandabase
|
||||
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolutil:c dtoolbase:c dtool:m
|
||||
#define USE_ZLIB yes
|
||||
#define USE_CRYPTO yes
|
||||
#define USE_IPC yes
|
||||
|
||||
#begin lib_target
|
||||
|
|
@ -19,6 +20,9 @@
|
|||
decompressor.cxx decompressor.h zcompressor.I zcompressor.cxx \
|
||||
zcompressor.h download_utils.cxx download_utils.h
|
||||
|
||||
#define IF_CRYPTO_SOURCES \
|
||||
crypto_utils.cxx crypto_utils.h
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
downloader.h downloader.I \
|
||||
config_downloader.h zcompressor.I zcompressor.h \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
// Filename: crypto_utils.cxx
|
||||
// Created by: drose (07Nov00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is compiled only if we have crypto++ installed.
|
||||
|
||||
#include "crypto_utils.h"
|
||||
|
||||
#include <md5.h>
|
||||
#include <files.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
USING_NAMESPACE(CryptoPP);
|
||||
USING_NAMESPACE(std);
|
||||
|
||||
uint
|
||||
read32(istream& is) {
|
||||
unsigned int ret = 0x0;
|
||||
unsigned char b1, b2, b3, b4;
|
||||
is >> b1;
|
||||
is >> b2;
|
||||
is >> b3;
|
||||
is >> b4;
|
||||
ret = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
md5_a_file(const Filename &name, HashVal &ret) {
|
||||
ostringstream os;
|
||||
MD5 md5;
|
||||
|
||||
string fs = name.get_fullpath();
|
||||
FileSource f(fs.c_str(), true, new HashFilter(md5, new FileSink(os)));
|
||||
|
||||
istringstream is(os.str());
|
||||
|
||||
ret[0] = read32(is);
|
||||
ret[1] = read32(is);
|
||||
ret[2] = read32(is);
|
||||
ret[3] = read32(is);
|
||||
}
|
||||
|
||||
void
|
||||
md5_a_buffer(unsigned char* buf, unsigned long len, HashVal& ret) {
|
||||
MD5 md5;
|
||||
|
||||
HashFilter hash(md5);
|
||||
hash.Put((byte*)buf, len);
|
||||
hash.Close();
|
||||
|
||||
unsigned char* outb;
|
||||
unsigned long outl = hash.MaxRetrieveable();
|
||||
outb = new uchar[outl];
|
||||
hash.Get((byte*)outb, outl);
|
||||
ret[0] = (outb[0] << 24) | (outb[1] << 16) | (outb[2] << 8) | outb[3];
|
||||
ret[1] = (outb[4] << 24) | (outb[5] << 16) | (outb[6] << 8) | outb[7];
|
||||
ret[2] = (outb[8] << 24) | (outb[9] << 16) | (outb[10] << 8) | outb[11];
|
||||
ret[3] = (outb[12] << 24) | (outb[13] << 16) | (outb[14] << 8) | outb[15];
|
||||
delete outb;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Filename: crypto_utils.h
|
||||
// Created by: drose (07Nov00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CRYPTO_UTILS_H
|
||||
#define CRYPTO_UTILS_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include <filename.h>
|
||||
#include <typedef.h>
|
||||
|
||||
typedef uint HashVal[4];
|
||||
|
||||
EXPCL_PANDAEXPRESS void md5_a_file(const Filename &fname, HashVal &ret);
|
||||
EXPCL_PANDAEXPRESS void md5_a_buffer(uchar *buf, ulong len, HashVal &ret);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -60,61 +60,3 @@ check_adler(Filename name) {
|
|||
|
||||
return adler;
|
||||
}
|
||||
|
||||
#include <md5.h>
|
||||
#include <files.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <strstream>
|
||||
|
||||
USING_NAMESPACE(CryptoPP);
|
||||
USING_NAMESPACE(std);
|
||||
|
||||
uint
|
||||
read32(istream& is) {
|
||||
unsigned int ret = 0x0;
|
||||
unsigned char b1, b2, b3, b4;
|
||||
is >> b1;
|
||||
is >> b2;
|
||||
is >> b3;
|
||||
is >> b4;
|
||||
ret = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
md5_a_file(const Filename &name, HashVal &ret) {
|
||||
ostrstream os;
|
||||
MD5 md5;
|
||||
|
||||
string fs = name.get_fullpath();
|
||||
FileSource f(fs.c_str(), true, new HashFilter(md5, new FileSink(os)));
|
||||
|
||||
istrstream is(os.str());
|
||||
|
||||
ret[0] = read32(is);
|
||||
ret[1] = read32(is);
|
||||
ret[2] = read32(is);
|
||||
ret[3] = read32(is);
|
||||
}
|
||||
|
||||
void
|
||||
md5_a_buffer(unsigned char* buf, unsigned long len, HashVal& ret) {
|
||||
MD5 md5;
|
||||
|
||||
HashFilter hash(md5);
|
||||
hash.Put((byte*)buf, len);
|
||||
hash.Close();
|
||||
|
||||
unsigned char* outb;
|
||||
unsigned long outl = hash.MaxRetrieveable();
|
||||
outb = new uchar[outl];
|
||||
hash.Get((byte*)outb, outl);
|
||||
ret[0] = (outb[0] << 24) | (outb[1] << 16) | (outb[2] << 8) | outb[3];
|
||||
ret[1] = (outb[4] << 24) | (outb[5] << 16) | (outb[6] << 8) | outb[7];
|
||||
ret[2] = (outb[8] << 24) | (outb[9] << 16) | (outb[10] << 8) | outb[11];
|
||||
ret[3] = (outb[12] << 24) | (outb[13] << 16) | (outb[14] << 8) | outb[15];
|
||||
delete outb;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,15 +7,11 @@
|
|||
#define DOWNLOAD_UTILS_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include <typedef.h>
|
||||
#include <filename.h>
|
||||
|
||||
typedef uint HashVal[4];
|
||||
#include <typedef.h>
|
||||
|
||||
EXPCL_PANDAEXPRESS ulong check_crc(Filename name);
|
||||
EXPCL_PANDAEXPRESS ulong check_adler(Filename name);
|
||||
EXPCL_PANDAEXPRESS void md5_a_file(const Filename &fname, HashVal &ret);
|
||||
EXPCL_PANDAEXPRESS void md5_a_buffer(uchar *buf, ulong len, HashVal &ret);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue