Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 651946 | Differences between
and this patch

Collapse All | Expand All

(-)a/utils/key2pub.py (-4 / +9 lines)
Lines 3-14 Link Here
3
import sys
3
import sys
4
try:
4
try:
5
       from M2Crypto import RSA
5
       from M2Crypto import RSA
6
except ImportError, e:
6
except ImportError as e:
7
       sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message)
7
       sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message)
8
       sys.stderr.write('Please install the "M2Crypto" Python module.\n')
8
       sys.stderr.write('Please install the "M2Crypto" Python module.\n')
9
       sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
9
       sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
10
       sys.exit(1)
10
       sys.exit(1)
11
11
12
if sys.version_info[0] == 2:
13
    RANGE=xrange
14
elif sys.version_info[0] >= 3:
15
    RANGE=range
16
12
def print_ssl_64(output, name, val):
17
def print_ssl_64(output, name, val):
13
    while val[0] == '\0':
18
    while val[0] == '\0':
14
        val = val[1:]
19
        val = val[1:]
Lines 80-86 struct pubkey { Link Here
80
85
81
static struct pubkey keys[] = {
86
static struct pubkey keys[] = {
82
''')
87
''')
83
    for n in xrange(n + 1):
88
    for n in RANGE(n + 1):
84
        output.write('	KEYS(e_%d, n_%d),\n' % (n, n))
89
        output.write('	KEYS(e_%d, n_%d),\n' % (n, n))
85
    output.write('};\n')
90
    output.write('};\n')
86
    pass
91
    pass
Lines 117-123 struct key_params { Link Here
117
122
118
static const struct key_params __attribute__ ((unused)) keys[] = {
123
static const struct key_params __attribute__ ((unused)) keys[] = {
119
''')
124
''')
120
    for n in xrange(n + 1):
125
    for n in RANGE(n + 1):
121
        output.write('	KEYS(e_%d, n_%d),\n' % (n, n))
126
        output.write('	KEYS(e_%d, n_%d),\n' % (n, n))
122
    output.write('};\n')
127
    output.write('};\n')
123
    
128
    
Lines 135-141 except IndexError: Link Here
135
    mode = None
140
    mode = None
136
141
137
if not mode in modes:
142
if not mode in modes:
138
    print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))
143
    print('Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys())))
139
    sys.exit(2)
144
    sys.exit(2)
140
145
141
output = open(outfile, 'w')
146
output = open(outfile, 'w')

Return to bug 651946