Skip to content

The Scalar and Point interface do not allow error handling  #530

Open
@K1li4nL

Description

@K1li4nL

Given the structure of kyber, the following piece of code often appears:

func (P *point) Add(P1, P2 kyber.Point) kyber.Point {
	E1 := P1.(*point)
...

Unfortunately if P1 is not the right type, this will panic. Allowing to return errors would allow graceful handling of the problem:

func (P *point) Add(P1, P2 kyber.Point) (kyber.Point, error) {
	E1, ok := P1.(*point)
        if !ok {
             /* Handle error */
             return nil,  _some error_
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions