sig calculation and output follows pbp scheme. unittests, doc and

detached sigs still missing.
This commit is contained in:
TLINDEN
2014-01-26 11:57:23 +01:00
parent 7b7aa6d395
commit 52a7509fe2
5 changed files with 151 additions and 110 deletions

View File

@@ -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;
}