aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Makefile.am4
-rwxr-xr-xcontrib/gnunet-chk.py.in (renamed from contrib/gnunet-chk.py)15
2 files changed, 11 insertions, 8 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 577924fab..1db5b3091 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -20,7 +20,8 @@ noinst_SCRIPTS = \
20 terminate.py \ 20 terminate.py \
21 pydiffer.py \ 21 pydiffer.py \
22 gnunet_pyexpect.py \ 22 gnunet_pyexpect.py \
23 gnunet_janitor.py 23 gnunet_janitor.py \
24 gnunet-chk.py
24 25
25dist_pkgdata_DATA = \ 26dist_pkgdata_DATA = \
26 gns-bcd.html \ 27 gns-bcd.html \
@@ -50,6 +51,7 @@ EXTRA_DIST = \
50 terminate.py.in \ 51 terminate.py.in \
51 gnunet_pyexpect.py.in \ 52 gnunet_pyexpect.py.in \
52 gnunet_janitor.py.in \ 53 gnunet_janitor.py.in \
54 gnunet-chk.py.in \
53 pydiffer.py.in \ 55 pydiffer.py.in \
54 gnunet-gns-import.sh \ 56 gnunet-gns-import.sh \
55 openvpn-tap32/tapw32/tap0901.sys \ 57 openvpn-tap32/tapw32/tap0901.sys \
diff --git a/contrib/gnunet-chk.py b/contrib/gnunet-chk.py.in
index dba694c34..0d07e6239 100755
--- a/contrib/gnunet-chk.py
+++ b/contrib/gnunet-chk.py.in
@@ -1,6 +1,6 @@
1#!/usr/bin/python 1#!@PYTHON@
2# This file is part of GNUnet. 2# This file is part of GNUnet.
3# (C) 2013 Christian Grothoff (and other contributing authors) 3# (C) 2013, 2018 Christian Grothoff (and other contributing authors)
4# 4#
5# GNUnet is free software; you can redistribute it and/or modify 5# GNUnet is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published 6# it under the terms of the GNU General Public License as published
@@ -27,6 +27,7 @@ import os
27import getopt 27import getopt
28import sys 28import sys
29from Crypto.Cipher import AES 29from Crypto.Cipher import AES
30from functools import reduce
30 31
31 32
32# Defaults 33# Defaults
@@ -76,7 +77,7 @@ def encode_data_to_string(data):
76 wpos += 1 77 wpos += 1
77 vbit -= 5 78 vbit -= 5
78 assert (0 == vbit) 79 assert (0 == vbit)
79 return out; 80 return out
80 81
81 82
82def sha512_hash(data): 83def sha512_hash(data):
@@ -105,7 +106,7 @@ class AESKey:
105 passphrase: string containing the passphrase to get the AES key and 106 passphrase: string containing the passphrase to get the AES key and
106 initialization vector 107 initialization vector
107 """ 108 """
108 passphrase = bytearray(passphrase); 109 passphrase = bytearray(passphrase)
109 self.key = bytearray(self.KEY_SIZE) 110 self.key = bytearray(self.KEY_SIZE)
110 self.iv = bytearray(self.IV_SIZE) 111 self.iv = bytearray(self.IV_SIZE)
111 if (len(passphrase) > self.KEY_SIZE): 112 if (len(passphrase) > self.KEY_SIZE):
@@ -284,7 +285,7 @@ def compute_rootchk(readin, size):
284 readin: the stream where to read data from 285 readin: the stream where to read data from
285 size: the size of data to be read 286 size: the size of data to be read
286 """ 287 """
287 depth = compute_depth_(size); 288 depth = compute_depth_(size)
288 current_depth = 0 289 current_depth = 0
289 chks = [None] * (depth * CHK_PER_INODE) # list buffer 290 chks = [None] * (depth * CHK_PER_INODE) # list buffer
290 read_offset = 0 291 read_offset = 0
@@ -294,13 +295,13 @@ def compute_rootchk(readin, size):
294 off = CHK_PER_INODE * (depth - 1) 295 off = CHK_PER_INODE * (depth - 1)
295 assert (chks[off] is not None) 296 assert (chks[off] is not None)
296 logging.debug("Encoding done, reading CHK `" + chks[off].query + \ 297 logging.debug("Encoding done, reading CHK `" + chks[off].query + \
297 "' from " + repr(off) + "\n") 298 "' from " + repr(off) + "\n")
298 uri_chk = chks[off] 299 uri_chk = chks[off]
299 assert (size == read_offset) 300 assert (size == read_offset)
300 uri_chk.setSize(size) 301 uri_chk.setSize(size)
301 return uri_chk 302 return uri_chk
302 if (0 == current_depth): 303 if (0 == current_depth):
303 pt_size = min(DBLOCK_SIZE, size - read_offset); 304 pt_size = min(DBLOCK_SIZE, size - read_offset)
304 try: 305 try:
305 pt_block = readin.read(pt_size) 306 pt_block = readin.read(pt_size)
306 except IOError: 307 except IOError: