Example #1
0
    def __set_to_coordinates(self, x_val, y_val):
        try:
            point = OpenSSL.EC_POINT_new(self.os_group)
            x, y = ec_bignum.BigNum(decval=x_val), ec_bignum.BigNum(
                decval=y_val)

            if self.curve.field_type == 'prime':
                OpenSSL.EC_POINT_set_affine_coordinates_GFp(
                    self.os_group, point, x.bn, y.bn, None)
            elif self.curve.field_type == 'characteristic-two':
                OpenSSL.EC_POINT_set_affine_coordinates_GF2m(
                    self.os_group, point, x.bn, y.bn, None)

            self.x, self.y = x_val, y_val
            self.os_point = point
        finally:
            del x, y