mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
Deprecate the internal int/uint types in favor of the cstdint types they were based on
This commit is contained in:
parent
18e4976c6c
commit
54752ef9a1
218 changed files with 1331 additions and 1323 deletions
|
@ -37,7 +37,7 @@ file_analysis::Analyzer* DataEvent::Instantiate(RecordVal* args, File* file)
|
|||
return new DataEvent(args, file, chunk, stream);
|
||||
}
|
||||
|
||||
bool DataEvent::DeliverChunk(const u_char* data, uint64 len, uint64 offset)
|
||||
bool DataEvent::DeliverChunk(const u_char* data, uint64_t len, uint64_t offset)
|
||||
{
|
||||
if ( ! chunk_event ) return true;
|
||||
|
||||
|
@ -50,7 +50,7 @@ bool DataEvent::DeliverChunk(const u_char* data, uint64 len, uint64 offset)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool DataEvent::DeliverStream(const u_char* data, uint64 len)
|
||||
bool DataEvent::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
if ( ! stream_event ) return true;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
* @param offset number of bytes from start of file at which chunk occurs.
|
||||
* @return always true
|
||||
*/
|
||||
bool DeliverChunk(const u_char* data, uint64 len, uint64 offset) override;
|
||||
bool DeliverChunk(const u_char* data, uint64_t len, uint64_t offset) override;
|
||||
|
||||
/**
|
||||
* Generates the event, if any, specified by the "stream_event" field of
|
||||
|
@ -34,7 +34,7 @@ public:
|
|||
* @param len number of bytes in the data chunk.
|
||||
* @return always true
|
||||
*/
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
|
||||
/**
|
||||
* Create a new instance of a DataEvent analyzer.
|
||||
|
|
|
@ -27,7 +27,7 @@ file_analysis::Analyzer* Entropy::Instantiate(RecordVal* args, File* file)
|
|||
return new Entropy(args, file);
|
||||
}
|
||||
|
||||
bool Entropy::DeliverStream(const u_char* data, uint64 len)
|
||||
bool Entropy::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
if ( ! fed )
|
||||
fed = len > 0;
|
||||
|
@ -42,7 +42,7 @@ bool Entropy::EndOfFile()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Entropy::Undelivered(uint64 offset, uint64 len)
|
||||
bool Entropy::Undelivered(uint64_t offset, uint64_t len)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
* @param len number of bytes in the data chunk.
|
||||
* @return false if the digest is in an invalid state, else true.
|
||||
*/
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
|
||||
/**
|
||||
* Finalizes the hash and raises a "file_entropy_test" event.
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
* @param len number of missing bytes.
|
||||
* @return always false so analyzer will detach from file.
|
||||
*/
|
||||
bool Undelivered(uint64 offset, uint64 len) override;
|
||||
bool Undelivered(uint64_t offset, uint64_t len) override;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
using namespace file_analysis;
|
||||
|
||||
Extract::Extract(RecordVal* args, File* file, const string& arg_filename,
|
||||
uint64 arg_limit)
|
||||
uint64_t arg_limit)
|
||||
: file_analysis::Analyzer(file_mgr->GetComponentTag("EXTRACT"), args, file),
|
||||
filename(arg_filename), limit(arg_limit), depth(0)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ file_analysis::Analyzer* Extract::Instantiate(RecordVal* args, File* file)
|
|||
limit->AsCount());
|
||||
}
|
||||
|
||||
static bool check_limit_exceeded(uint64 lim, uint64 depth, uint64 len, uint64* n)
|
||||
static bool check_limit_exceeded(uint64_t lim, uint64_t depth, uint64_t len, uint64_t* n)
|
||||
{
|
||||
if ( lim == 0 )
|
||||
{
|
||||
|
@ -80,12 +80,12 @@ static bool check_limit_exceeded(uint64 lim, uint64 depth, uint64 len, uint64* n
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Extract::DeliverStream(const u_char* data, uint64 len)
|
||||
bool Extract::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
if ( ! fd )
|
||||
return false;
|
||||
|
||||
uint64 towrite = 0;
|
||||
uint64_t towrite = 0;
|
||||
bool limit_exceeded = check_limit_exceeded(limit, depth, len, &towrite);
|
||||
|
||||
if ( limit_exceeded && file_extraction_limit )
|
||||
|
@ -111,7 +111,7 @@ bool Extract::DeliverStream(const u_char* data, uint64 len)
|
|||
return ( ! limit_exceeded );
|
||||
}
|
||||
|
||||
bool Extract::Undelivered(uint64 offset, uint64 len)
|
||||
bool Extract::Undelivered(uint64_t offset, uint64_t len)
|
||||
{
|
||||
if ( depth == offset )
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
* @return false if there was no extraction file open and the data couldn't
|
||||
* be written, else true.
|
||||
*/
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
|
||||
/**
|
||||
* Report undelivered bytes.
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
* @param len number of bytes undelivered.
|
||||
* @return true
|
||||
*/
|
||||
bool Undelivered(uint64 offset, uint64 len) override;
|
||||
bool Undelivered(uint64_t offset, uint64_t len) override;
|
||||
|
||||
/**
|
||||
* Create a new instance of an Extract analyzer.
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
* "no limit".
|
||||
* @param bytes number of bytes allowed to be extracted
|
||||
*/
|
||||
void SetLimit(uint64 bytes) { limit = bytes; }
|
||||
void SetLimit(uint64_t bytes) { limit = bytes; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -68,13 +68,13 @@ protected:
|
|||
* @param arg_limit the maximum allowed file size.
|
||||
*/
|
||||
Extract(RecordVal* args, File* file, const string& arg_filename,
|
||||
uint64 arg_limit);
|
||||
uint64_t arg_limit);
|
||||
|
||||
private:
|
||||
string filename;
|
||||
int fd;
|
||||
uint64 limit;
|
||||
uint64 depth;
|
||||
uint64_t limit;
|
||||
uint64_t depth;
|
||||
};
|
||||
|
||||
} // namespace file_analysis
|
||||
|
|
|
@ -20,7 +20,7 @@ Hash::~Hash()
|
|||
Unref(hash);
|
||||
}
|
||||
|
||||
bool Hash::DeliverStream(const u_char* data, uint64 len)
|
||||
bool Hash::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
if ( ! hash->IsValid() )
|
||||
return false;
|
||||
|
@ -38,7 +38,7 @@ bool Hash::EndOfFile()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Hash::Undelivered(uint64 offset, uint64 len)
|
||||
bool Hash::Undelivered(uint64_t offset, uint64_t len)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
* @param len number of bytes in the data chunk.
|
||||
* @return false if the digest is in an invalid state, else true.
|
||||
*/
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
|
||||
/**
|
||||
* Finalizes the hash and raises a "file_hash" event.
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
* @param len number of missing bytes.
|
||||
* @return always false so analyzer will detach from file.
|
||||
*/
|
||||
bool Undelivered(uint64 offset, uint64 len) override;
|
||||
bool Undelivered(uint64_t offset, uint64_t len) override;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ PE::~PE()
|
|||
delete conn;
|
||||
}
|
||||
|
||||
bool PE::DeliverStream(const u_char* data, uint64 len)
|
||||
bool PE::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
if ( conn->is_done() )
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
static file_analysis::Analyzer* Instantiate(RecordVal* args, File* file)
|
||||
{ return new PE(args, file); }
|
||||
|
||||
virtual bool DeliverStream(const u_char* data, uint64 len);
|
||||
virtual bool DeliverStream(const u_char* data, uint64_t len);
|
||||
|
||||
virtual bool EndOfFile();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ file_analysis::Analyzer* Unified2::Instantiate(RecordVal* args, File* file)
|
|||
return new Unified2(args, file);
|
||||
}
|
||||
|
||||
bool Unified2::DeliverStream(const u_char* data, uint64 len)
|
||||
bool Unified2::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ class Unified2 : public file_analysis::Analyzer {
|
|||
public:
|
||||
~Unified2() override;
|
||||
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
|
||||
static file_analysis::Analyzer* Instantiate(RecordVal* args, File* file);
|
||||
|
||||
|
|
|
@ -135,13 +135,13 @@ file_analysis::OCSP::OCSP(RecordVal* args, file_analysis::File* file, bool arg_r
|
|||
{
|
||||
}
|
||||
|
||||
bool file_analysis::OCSP::DeliverStream(const u_char* data, uint64 len)
|
||||
bool file_analysis::OCSP::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
ocsp_data.append(reinterpret_cast<const char*>(data), len);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool file_analysis::OCSP::Undelivered(uint64 offset, uint64 len)
|
||||
bool file_analysis::OCSP::Undelivered(uint64_t offset, uint64_t len)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ static Val* parse_basic_resp_data_version(OCSP_BASICRESP* basic_resp)
|
|||
return val_mgr->GetCount(asn1_int);
|
||||
}
|
||||
|
||||
static uint64 parse_request_version(OCSP_REQUEST* req)
|
||||
static uint64_t parse_request_version(OCSP_REQUEST* req)
|
||||
{
|
||||
int der_req_len = 0;
|
||||
unsigned char* der_req_dat = nullptr;
|
||||
|
@ -414,11 +414,11 @@ void file_analysis::OCSP::ParseRequest(OCSP_REQUEST* req)
|
|||
char buf[OCSP_STRING_BUF_SIZE]; // we need a buffer for some of the openssl functions
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
uint64 version = 0;
|
||||
uint64_t version = 0;
|
||||
|
||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
if ( req->tbsRequest->version )
|
||||
version = (uint64)ASN1_INTEGER_get(req->tbsRequest->version);
|
||||
version = (uint64_t)ASN1_INTEGER_get(req->tbsRequest->version);
|
||||
#else
|
||||
version = parse_request_version(req);
|
||||
// TODO: try to parse out general name ?
|
||||
|
@ -507,7 +507,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
|||
vl.push_back(status_val);
|
||||
|
||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
vl.push_back(val_mgr->GetCount((uint64)ASN1_INTEGER_get(resp_data->version)));
|
||||
vl.push_back(val_mgr->GetCount((uint64_t)ASN1_INTEGER_get(resp_data->version)));
|
||||
#else
|
||||
vl.push_back(parse_basic_resp_data_version(basic_resp));
|
||||
#endif
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace file_analysis {
|
|||
|
||||
class OCSP : public file_analysis::X509Common {
|
||||
public:
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool Undelivered(uint64 offset, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
bool Undelivered(uint64_t offset, uint64_t len) override;
|
||||
bool EndOfFile() override;
|
||||
|
||||
static file_analysis::Analyzer* InstantiateRequest(RecordVal* args, File* file);
|
||||
|
|
|
@ -26,14 +26,14 @@ file_analysis::X509::X509(RecordVal* args, file_analysis::File* file)
|
|||
cert_data.clear();
|
||||
}
|
||||
|
||||
bool file_analysis::X509::DeliverStream(const u_char* data, uint64 len)
|
||||
bool file_analysis::X509::DeliverStream(const u_char* data, uint64_t len)
|
||||
{
|
||||
// just add it to the data we have so far, since we cannot do anything else anyways...
|
||||
cert_data.append(reinterpret_cast<const char*>(data), len);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool file_analysis::X509::Undelivered(uint64 offset, uint64 len)
|
||||
bool file_analysis::X509::Undelivered(uint64_t offset, uint64_t len)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ RecordVal* file_analysis::X509::ParseCertificate(X509Val* cert_val, File* f)
|
|||
RecordVal* pX509Cert = new RecordVal(BifType::Record::X509::Certificate);
|
||||
BIO *bio = BIO_new(BIO_s_mem());
|
||||
|
||||
pX509Cert->Assign(0, val_mgr->GetCount((uint64) X509_get_version(ssl_cert) + 1));
|
||||
pX509Cert->Assign(0, val_mgr->GetCount((uint64_t) X509_get_version(ssl_cert) + 1));
|
||||
i2a_ASN1_INTEGER(bio, X509_get_serialNumber(ssl_cert));
|
||||
int len = BIO_read(bio, buf, sizeof(buf));
|
||||
pX509Cert->Assign(1, new StringVal(len, buf));
|
||||
|
@ -330,7 +330,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
|||
if ( ips == 0 )
|
||||
ips = new VectorVal(internal_type("addr_vec")->AsVectorType());
|
||||
|
||||
uint32* addr = (uint32*) gen->d.ip->data;
|
||||
uint32_t* addr = (uint32_t*) gen->d.ip->data;
|
||||
|
||||
if( gen->d.ip->length == 4 )
|
||||
ips->Assign(ips->Size(), new AddrVal(*addr));
|
||||
|
|
|
@ -68,8 +68,8 @@ class X509Val;
|
|||
|
||||
class X509 : public file_analysis::X509Common {
|
||||
public:
|
||||
bool DeliverStream(const u_char* data, uint64 len) override;
|
||||
bool Undelivered(uint64 offset, uint64 len) override;
|
||||
bool DeliverStream(const u_char* data, uint64_t len) override;
|
||||
bool Undelivered(uint64_t offset, uint64_t len) override;
|
||||
bool EndOfFile() override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ X509_STORE* x509_get_root_store(TableVal* root_certs)
|
|||
Val* key = idxs->Index(i);
|
||||
StringVal *sv = root_certs->Lookup(key)->AsStringVal();
|
||||
assert(sv);
|
||||
const uint8* data = sv->Bytes();
|
||||
const uint8_t* data = sv->Bytes();
|
||||
X509* x = d2i_X509(NULL, &data, sv->Len());
|
||||
if ( ! x )
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ function sct_verify%(cert: opaque of x509, logid: string, log_key: string, signa
|
|||
}
|
||||
|
||||
unsigned char *cert_out = nullptr;
|
||||
uint32 cert_length;
|
||||
uint32_t cert_length;
|
||||
if ( precert )
|
||||
{
|
||||
#if ( OPENSSL_VERSION_NUMBER < 0x10002000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||
|
@ -724,7 +724,7 @@ function sct_verify%(cert: opaque of x509, logid: string, log_key: string, signa
|
|||
else
|
||||
cert_length = i2d_X509(x, &cert_out);
|
||||
assert( cert_out );
|
||||
uint32 cert_length_network = htonl(cert_length);
|
||||
uint32_t cert_length_network = htonl(cert_length);
|
||||
assert( sizeof(cert_length_network) == 4);
|
||||
|
||||
data.append(reinterpret_cast<const char*>(&cert_length_network)+1, 3); // 3 bytes certificate length
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue