Skip to content

math/big: panic when signing with unusual RSA key sizes #13973

@lwithers

Description

@lwithers

Go version 1.5.3, reproduced both with official go1.5.3.linux-amd64.tar.gz package and toolchain built from source also on Linux/AMD64.

When I use an RSA key with an unusual size, say 1028 or 1032 bits, I often encounter a panic in math/big: math/big: mismatched montgomery number lengths. The frequency of the occurrence seems to depend on the keysize but many such panics can be observed in 100 runs.

This does not occur with more common key sizes, say powers of two or small integer multiples of 256. I have attached a small program that can be used to observe and reproduce the issue.
mont.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions