Esempio n. 1
0
int main()
{
 uint8_t buf[64];
 sha_verify("update_update.bin",buf,3844971);//"update.bin", buf, 3843075);  
 sha_verify("update.bin", buf, 3843075);
 return 0;
}
Esempio n. 2
0
void
checker(char *key, char *lock)
{
    char
        *rawkey,
        *rawlock;
    char
        keytype[BUFFSIZE],
        locktype[BUFFSIZE];

    printf("L %s K %s ", lock, key);

    rawkey = lock_strip_alpha(key, keytype);
    rawlock = lock_strip_alpha(lock, locktype);

    if (!strcmp(keytype, locktype)) {
        if (!strcmp(keytype, "sha1")) {
            if (!sha_verify(rawkey, rawlock))
                printf("sha1 OK\n");
            else
                printf("sha1 no\n");
        }
        else
            printf("unknown\n");
    }
    else
        printf("Mismatch %s %s\n", keytype, locktype);
}
Esempio n. 3
0
int
verify_request(fence_req_t *req, fence_hash_t min,
	       void *key, size_t key_len)
{
	if (req->hashtype < min) {
		printf("Hash type not strong enough (%d < %d)\n",
		       req->hashtype, min);
		return 0;
	}
	switch(req->hashtype) {
	case HASH_NONE:
		return 1;
	case HASH_SHA1:
	case HASH_SHA256:
	case HASH_SHA512:
		return sha_verify(req, key, key_len);
	default:
		break;
	}
	return 0;
}