Several bugs, which conspired to cover their tracks.
* BaseSlot never actually stored the `omitp' and `allowp' functions.
* The MPSlot handler didn't chain up to the BaseSlot implementation
of `setup'.
* The EllipticCurveGroup's `beta' slot definition's `omitp' and `allowp'
functions used the slot name `type' instead of the object.
The incorrect lookups were hidden because the functions were never called.
The omission of `beta' values for most curve groups should then have
caused an error, only MPSlot.setup didn't chain up to the method which
would have noticed.
def __init__(me, name, headline = False, omitp = None, allowp = None):
me.name = name
me.headline = headline
def __init__(me, name, headline = False, omitp = None, allowp = None):
me.name = name
me.headline = headline
- me._omitp = None
- me._allowp = None
+ me._omitp = omitp
+ me._allowp = allowp
def set(me, st, value):
if me._allowp and not me._allowp(st, value):
raise Exception, "slot `%s' not allowed here" % me.name
def set(me, st, value):
if me._allowp and not me._allowp(st, value):
raise Exception, "slot `%s' not allowed here" % me.name
class MPSlot (BaseSlot):
def setup(me, st):
class MPSlot (BaseSlot):
def setup(me, st):
+ super(MPSlot, me).setup(st)
v = st.d.get(me)
if v not in st.mpmap:
write_limbs('v%d' % st.nextmp, v)
v = st.d.get(me)
if v not in st.mpmap:
write_limbs('v%d' % st.nextmp, v)
data_t = 'ecdata'
entry_t = 'ecentry'
tabname = 'ectab'
data_t = 'ecdata'
entry_t = 'ecentry'
tabname = 'ectab'
- slots = [EnumSlot('type', 'FTAG',
- ['prime', 'niceprime', 'binpoly', 'binnorm'],
- headline = True),
+ _typeslot = EnumSlot('type', 'FTAG',
+ ['prime', 'niceprime', 'binpoly', 'binnorm'],
+ headline = True)
+ slots = [_typeslot,
MPSlot('p'),
MPSlot('beta',
MPSlot('p'),
MPSlot('beta',
- allowp = lambda st, _: st.d['type'] == 'binnorm',
- omitp = lambda st: st.d['type'] != 'binnorm'),
+ allowp = lambda st, _:
+ st.d[EllipticCurveTable._typeslot] == 'binnorm',
+ omitp = lambda st:
+ st.d[EllipticCurveTable._typeslot] != 'binnorm'),
MPSlot('a'), MPSlot('b'), MPSlot('r'), MPSlot('h'),
MPSlot('gx'), MPSlot('gy')]
MPSlot('a'), MPSlot('b'), MPSlot('r'), MPSlot('h'),
MPSlot('gx'), MPSlot('gy')]