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

Yf/crypto algo alignment #2794

Closed

Conversation

WildFireFlum
Copy link
Contributor

  • Problem Overview
    Remove relic and cryptopp from our repository and use openssl instead.

There have been multiple previous pull requests which were not directed to master:
arc-vmware#6
arc-vmware#15
arc-vmware#12

Pankaj and others added 30 commits August 25, 2022 12:04
In this commit we will create new classes such that the Digest data and
digest creation is decoupled. Digest data will be kept at the same
place but the creation can be choosen by different libraries like
cryptopp or openssl. This rearrangement of classes will be done in this
PR.

Rearranging DigestCreator and DigestHolder

1) Added the proper way for type subsetting
2) Added skeleton code for proper maintainability.

This commit includes below changes:-
* OpenSSL library implementation for SHA_256 & SHA3_256 hashing.
* Design change for existing Crypto++ library hashing (existing Digest class modified). The storing of generated digest and the digest generation procedures are decoupled and achieved with the help of 'DigestHolder' & 'DigestCreator' classes respectively.
* Introduced compilation macros to choose between cryptographic hashing libraries i.e. Cryptopp and OpenSSL (SHA_256 and SHA3_256).

Review comments addressed.

Cryptographic libs macros added in CI runs.

This commit contains:-
* CryptoppDigestCreator class implemented for digest generation.
* DigestUtil class modified to templated DigestHelper class which takes the digest creator class.

DigestUtil class removed. CryptoppDigestCreator will do the job of DigestUtil.

Compilation error fixed.

Review comments addressed.

compute() added in interface.

Changes mentioned below:
- DigestCreator class moved to digest_creator.hpp file.
- CryptoppDigestCreator class moved to cryptopp_digest_creator.*pp files.
- OpenSSLDigestCreator class moved to openssl_digest_creator.ipp file.
- DigestHolder class moved to digest_holder.hpp file.
- Renamed files: Digest.hpp to digest.hpp, DigestType.hpp to digest_type.hpp.

Removed unwanted file.

Decoupling crypto digest to choose crypto algos

In this commit we will create new classes such that the Digest data and
digest creation is decoupled. Digest data will be kept at the same
place but the creation can be choosen by different libraries like
cryptopp or openssl. This rearrangement of classes will be done in this
PR.

Rearranging DigestCreator and DigestHolder

1) Added the proper way for type subsetting
2) Added skeleton code for proper maintainability.

Merge pull request #2 from pkthapa/cryptographic-openssl-hashing

OpenSSL SHA hashing implementation.

Minor include changes.
- Remove init() from DigestCreator class.
- Change update() and compute to updateDigest() and computeDigest() respectively.
- static property of a function removed from EVPHash class.
- Remove init() from DigestCreator class.
- Change update() and compute to updateDigest() and computeDigest() respectively.
- static property of a function removed from EVPHash class.
Apollo now logs when it generates keys
Apollo now logs the command line arguments when it starts a replica
Integrated EdDSA multisig to conconrd-bft's key generation
and to commit path threshold signature collection
Added unittests for EdDSA multisig interface
Introduced the USE_RELIC cmake option to control relic linkage and
control relic-dependant target generation.
Added configuration flags to the threshsign benchmark
i. Compilation macros (USE_CRYPTOPP_RSA and USE_EDDSA_SINGLE_SIGN) for RSA and EdDSA removed.
ii. The choice of signing algorithm is now based on the value set in 'replicaMsgSigningAlgo' and 'operatorMsgSigningAlgo' config variables.
@WildFireFlum WildFireFlum force-pushed the yf/crypto-algo-alignment branch 2 times, most recently from 9702db0 to 541b4ea Compare September 12, 2022 15:28
@@ -110,6 +127,67 @@ class AsymmetricPublicKey {
AsymmetricPublicKey() {}
};

// Wrapper class for OpenSSL Crypto's EVP_PKEY objects implementing
// AsymmetricPrivateKey.
class EVPPKEYPrivateKey : public AsymmetricPrivateKey {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is needed if we want to use existing code to generate ecdsa keys.
We still need to adapt the interface to support PEM files, which are used by
ClientTlsKeyExchangeHandler::exchangeTlsKeys.

@WildFireFlum
Copy link
Contributor Author

The purposes of moving all of the crypto utilities are:

  1. it is clear which library is used when and for what
  2. libraries can be added/removed easily

Currently, cryptopp cannot be removed as it is used for ecdsa key generation and aes encryption. Both should be replaced by openssl so that we can build without cryptopp.
the usage of cryptopp should be limited to factory.cpp (and maybe another factory for digest algorithms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants