mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-18 12:20:58 +01:00
sig calculation and output follows pbp scheme. unittests, doc and
detached sigs still missing.
This commit is contained in:
@@ -38,18 +38,23 @@ static inline char *_lc(char *in) {
|
||||
}
|
||||
|
||||
// find the offset of the beginning of a certain string within binary data
|
||||
static inline int _findoffset(unsigned char *bin, size_t binlen, char *sigstart, size_t hlen) {
|
||||
static inline size_t _findoffset(unsigned char *bin, size_t binlen, char *sigstart, size_t hlen) {
|
||||
size_t i;
|
||||
int sigfoot = 181; // yes, also bad. that's the armored sig footer
|
||||
int offset = -1;
|
||||
size_t offset = 0;
|
||||
int m = 0;
|
||||
|
||||
for(i=0; i<binlen-sigfoot; ++i) {
|
||||
for(i=0; i<binlen-hlen; ++i) {
|
||||
if(memcmp(&bin[i], sigstart, hlen) == 0) {
|
||||
offset = i;
|
||||
m = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(m == 0)
|
||||
offset = -1;
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user