Skip to content

.NET 8.0 - In Linux, RSAOpenSsl.Equals does not return true when comparing an instance with itself #118701

@mttwc

Description

@mttwc

Description

RSAOpenSsl Equals returns false when comparing an instance with itself when running on Linux in a net8.0 project.

Reproduction Steps

var rsa = RSA.Create(); // creates a RSAOpenSsl in Linux
var result = rsa.Equals(rsa);

Expected behavior

The value of result is true.

Actual behavior

The value of result is false.

Regression?

Don't know.

Known Workarounds

If using data structures for storing RSA objects that use EqualityComparer under the hood (such as ConcurrentDictionary<TKey, RSA>), an adapter class implementing IEquatable can be used to wrap the RSA so the equality checks within the data structure can behave as expected.

Configuration

  • net8.0
  • Azure Linux 3.0

Other information

This was found when trying to use ConcurrentDictionary<TKey, RSA>::AddOrUpdate. The Update path in this code uses an equality check using the old value that is expected to eventually succeed. The bug causes this to never succeed, so the thread gets stuck inside an infinite while loop that keeps retrying the underlying Update and never succeeds.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions