aboutsummaryrefslogtreecommitdiff
path: root/projects
diff options
context:
space:
mode:
Diffstat (limited to 'projects')
-rwxr-xr-xprojects/hsm/cryptech_upload15
1 files changed, 10 insertions, 5 deletions
diff --git a/projects/hsm/cryptech_upload b/projects/hsm/cryptech_upload
index 66fbe7d..8bb6ebb 100755
--- a/projects/hsm/cryptech_upload
+++ b/projects/hsm/cryptech_upload
@@ -116,8 +116,8 @@ def _execute(dst, cmd):
pin = getpass.getpass('SO PIN: ')
_write(dst, pin + '\r')
prompt = _read(dst)
- if not prompt.endswith('> '):
- #sys.stderr.write('Device does not seem to be ready for a file transfer (got {!r})\n'.format(prompt))
+ if not prompt.endswith(('> ', '# ')):
+ print('Device does not seem to be ready for a file transfer (got {!r})'.format(prompt))
return prompt
_write(dst, cmd + '\r')
response = _read(dst)
@@ -142,14 +142,18 @@ def send_file(filename, args, dst):
print 'Access denied'
return False
if not 'OK' in response:
- sys.stderr.write('Device did not accept the upload command (got {!r})\n'.format(response))
+ print('Device did not accept the upload command (got {!r})'.format(response))
return False
crc = 0
counter = 0
# 1. Write size of file (4 bytes)
_write(dst, struct.pack('<I', size))
- _read(dst)
+ response = _read(dst)
+ if not response.startswith('Send '):
+ print response
+ return False
+
# 2. Write file contents while calculating CRC-32
while True:
data = src.read(chunk_size)
@@ -178,7 +182,8 @@ def send_file(filename, args, dst):
# 3. Write CRC-32 (4 bytes)
_write(dst, struct.pack('<I', crc))
- _read(dst)
+ response = _read(dst)
+ print response
src.close()
ings like fiddling with the BPKDF2' href='/sw/pkcs11/commit/GNUmakefile?id=c45562762aab7e874eac71792f9eebb5185ee47d'>c455627
0c8d1d7









303152d
0c8d1d7


ece23e9
0c8d1d7

5f0d1c2
0c8d1d7
c455627



ece23e9
c455627
0c8d1d7

291a2e0
0c8d1d7
5479e52










5479e52





715c5fb
5479e52


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109