-
Notifications
You must be signed in to change notification settings - Fork 55
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
Refactor rnp_key_store_t to rnp::KeyStore. #2122
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2122 +/- ##
==========================================
- Coverage 76.87% 76.86% -0.01%
==========================================
Files 193 193
Lines 37051 37003 -48
==========================================
- Hits 28484 28444 -40
+ Misses 8567 8559 -8
☔ View full report in Codecov by Sentry. |
d0a2649
to
a43e565
Compare
…y to rnp_key_store_t::get_signer()
a43e565
to
31e2e52
Compare
switch (alg) { | ||
case PGP_PKA_RSA: | ||
case PGP_PKA_RSA_SIGN_ONLY: | ||
case PGP_PKA_RSA_ENCRYPT_ONLY: | ||
grip_hash_mpi(*hash, rsa.n, '\0'); | ||
break; | ||
case PGP_PKA_DSA: | ||
grip_hash_mpi(*hash, dsa.p, 'p'); | ||
grip_hash_mpi(*hash, dsa.q, 'q'); | ||
grip_hash_mpi(*hash, dsa.g, 'g'); | ||
grip_hash_mpi(*hash, dsa.y, 'y'); | ||
break; | ||
case PGP_PKA_ELGAMAL: | ||
case PGP_PKA_ELGAMAL_ENCRYPT_OR_SIGN: | ||
grip_hash_mpi(*hash, eg.p, 'p'); | ||
grip_hash_mpi(*hash, eg.g, 'g'); | ||
grip_hash_mpi(*hash, eg.y, 'y'); | ||
break; | ||
case PGP_PKA_ECDH: | ||
case PGP_PKA_ECDSA: | ||
case PGP_PKA_EDDSA: | ||
case PGP_PKA_SM2: | ||
grip_hash_ec(*hash, ec); | ||
break; | ||
#if defined(ENABLE_CRYPTO_REFRESH) | ||
// TODO: if GnuPG would ever support v6, check whether this works correctly. | ||
case PGP_PKA_ED25519: | ||
hash->add(key->ed25519.pub); | ||
break; | ||
case PGP_PKA_X25519: | ||
hash->add(key->x25519.pub); | ||
break; | ||
#endif | ||
#if defined(ENABLE_PQC) | ||
case PGP_PKA_KYBER768_X25519: | ||
FALLTHROUGH_STATEMENT; | ||
// TODO add case PGP_PKA_KYBER1024_X448: FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_KYBER768_P256: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_KYBER1024_P384: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_KYBER768_BP256: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_KYBER1024_BP384: | ||
hash->add(key->kyber_ecdh.pub.get_encoded()); | ||
break; | ||
case PGP_PKA_DILITHIUM3_ED25519: | ||
FALLTHROUGH_STATEMENT; | ||
// TODO: add case PGP_PKA_DILITHIUM5_ED448: FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_DILITHIUM3_P256: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_DILITHIUM5_P384: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_DILITHIUM3_BP256: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_DILITHIUM5_BP384: | ||
hash->add(key->dilithium_exdsa.pub.get_encoded()); | ||
break; | ||
case PGP_PKA_SPHINCSPLUS_SHA2: | ||
FALLTHROUGH_STATEMENT; | ||
case PGP_PKA_SPHINCSPLUS_SHAKE: | ||
hash->add(key->sphincsplus.pub.get_encoded()); | ||
break; | ||
#endif | ||
default: | ||
RNP_LOG("unsupported public-key algorithm %d", (int) alg); | ||
return false; | ||
} |
Check notice
Code scanning / CodeQL
Long switch case Note
PGP_PKA_SM2 (42 lines)
break; | ||
case PGP_PKA_DILITHIUM3_ED25519: | ||
FALLTHROUGH_STATEMENT; | ||
// TODO: add case PGP_PKA_DILITHIUM5_ED448: FALLTHROUGH_STATEMENT; |
Check notice
Code scanning / CodeQL
Commented-out code Note
#if defined(ENABLE_PQC) | ||
case PGP_PKA_KYBER768_X25519: | ||
FALLTHROUGH_STATEMENT; | ||
// TODO add case PGP_PKA_KYBER1024_X448: FALLTHROUGH_STATEMENT; |
Check notice
Code scanning / CodeQL
Commented-out code Note
@ronaldtse Ping for review :) |
@maxirmx @ribose-jeffreylau Could you please review this? Thanks! |
Two approvals and merging. Thank you @ni4 ! |
...hopefully at some point we'll finally get rid from C leftovers.