corretto / amazon-corretto-crypto-provider

The Amazon Corretto Crypto Provider is a collection of high-performance cryptographic implementations exposed via standard JCA/JCE interfaces.
Apache License 2.0
238 stars 56 forks source link

Fix libaccp builds for GCC 4.1.2 #225

Closed WillChilds-Klein closed 2 years ago

WillChilds-Klein commented 2 years ago

Issue #, if available: CryptoAlg-1161

Description of changes:

Notes

This commit fixes builds for ACCP's native library on GCC 4.1.2, which only supports a subset of C++11. This issue was first discovered while trying to build ACCP internally on RHEL5, which failed. Two of the changes in this commit are trivial syntax/const semantics changes.

Another change accounts for C++ not having added std::move to the standard library until C++11, and also fixes a subtle "bug" that was introcuded here (prompted by this). The change to using BigNumObj::move instead of std::move under C++11 shouldn't make a significant difference -- the two behave the same in that they both give ownership of the passed BN to the calling instance. In C++ versions less than 11, however, std::move doesn't exist so the code doesn't compile.

Finally, we update our AWS-LC dependency commit to incorporate a recent change fixing AWS-LC C++ builds on GCC 4.1.2.

Testing

$ # NOTE PLATFORM OVERRIDE

$ brazil ws show
Workspace:              childw_accp_import
    Root:               /local/home/childw/workplace/brazil/accp_import
    Version Set:        AmazonCorrettoCryptoProvider/import@6085387855
    Platform Override:  RHEL5_64
    Packages:
                        AWS-LC-0.x -> .
                        NativeJCEBindings-1.1 -> .
                        RubinAwsCrypToolsTools-1.0 -> .

$ rde :brazil sandbox-build --target clean && rde :brazil sandbox-build --target release
...
Status: Image is up to date for 011465881737.dkr.ecr.us-west-2.amazonaws.com/sandboxed-builds:rhel5_64-1.0-latest
...
Test run finished after 377782 ms
[       139 containers found      ]
[         0 containers skipped    ]
[       139 containers started    ]
[         0 containers aborted    ]
[       139 containers successful ]
[         0 containers failed     ]
[     14277 tests found           ]
[         0 tests skipped         ]
[     14277 tests started         ]
[        75 tests aborted         ]
[     14202 tests successful      ]
[         0 tests failed          ]
...
BUILD SUCCEEDED

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.