Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Swift 5.1, fix crash on Linux #53

Merged
merged 5 commits into from
Nov 19, 2024
Merged

Update to Swift 5.1, fix crash on Linux #53

merged 5 commits into from
Nov 19, 2024

Conversation

djones6
Copy link
Contributor

@djones6 djones6 commented Oct 2, 2019

This PR updates the CI configuration to use the Swift 5.1 release toolchain.

While testing, I noticed an intermittent failure in test_makeKeyPair() that results in an error being thrown on macOS, and a hard crash on Linux (force-unwrapping nil):

macOS:

/Users/travis/build/IBM-Swift/BlueRSA/Tests/CryptorRSATests/CryptorRSATests.swift:770:
  error: -[CryptorRSATests.CryptorRSATests test_makeKeyPair] : failed - test_makeKeyPair 
  failed for bitSize: 1024, with error: Error code: -9999(0x-270F), Couldn't create key 
  reference from key data

Linux:

Test Case 'CryptorRSATests.test_makeKeyPair' started at 2019-09-27 15:15:58.221
Fatal error: Unexpectedly found nil while unwrapping an Optional value

I've included a fix here for the force-unwrap: d2i_PUBKEY_bio and d2i_PrivateKey_bio can fail (returning null) if the BIO does not contain a valid RSA key, but we were not handling that case. The test still fails intermittently, but with an error now:

/home/travis/build/IBM-Swift/BlueRSA/Tests/CryptorRSATests/CryptorRSATests.swift:770:
  error: CryptorRSATests.test_makeKeyPair : failed - test_makeKeyPair failed for bitSize: 
  4096, with error: Error code: -9999(0x-270F), ERROR: Failed to create key from BIO, 
  code: 218570875, reason: header too long

I tracked down the reason for the intermittent failure in #52 - an unsafe assumption that leads us - occasionally - to incorrectly drop the first 26 bytes of the key data. I added a test for this situation in a35c877 but I do not yet understand what the appropriate fix is, so this test is currently failing.

@CLAassistant
Copy link

CLAassistant commented Sep 27, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ dannys42
❌ djones6
You have signed the CLA already but the status is still pending? Let us recheck it.

@sonarcloud
Copy link

sonarcloud bot commented Feb 18, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dannys42 dannys42 self-requested a review November 19, 2024 01:08
Copy link

sonarcloud bot commented Nov 19, 2024

@dannys42
Copy link
Contributor

Thanks @djones6 !

@dannys42 dannys42 merged commit 8d2f8eb into master Nov 19, 2024
1 of 2 checks passed
@dannys42 dannys42 deleted the issue.swift51 branch November 19, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants