@@ -209,6 +209,7 @@ class KeyMaterial {
209209
210210 /* Pick up hash algorithm, used for signing, to be compatible with key material. */
211211 virtual pgp_hash_alg_t adjust_hash (pgp_hash_alg_t hash) const ;
212+ virtual bool sig_hash_allowed (pgp_hash_alg_t hash) const ;
212213 virtual size_t bits () const noexcept = 0;
213214 virtual pgp_curve_t curve () const noexcept ;
214215 KeyGrip grip () const ;
@@ -465,20 +466,22 @@ class Ed25519KeyMaterial : public KeyMaterial {
465466 Ed25519KeyMaterial () : KeyMaterial(PGP_PKA_ED25519), key_{} {};
466467 std::unique_ptr<KeyMaterial> clone () override ;
467468
468- void clear_secret () noexcept override ;
469- bool parse (pgp_packet_body_t &pkt) noexcept override ;
470- bool parse_secret (pgp_packet_body_t &pkt) noexcept override ;
471- void write (pgp_packet_body_t &pkt) const override ;
472- void write_secret (pgp_packet_body_t &pkt) const override ;
473- bool generate (rnp::SecurityContext &ctx, const KeyParams ¶ms) override ;
474- rnp_result_t verify (const rnp::SecurityContext &ctx,
475- const SigMaterial & sig,
476- const rnp::secure_bytes & hash) const override ;
477- rnp_result_t sign (rnp::SecurityContext & ctx,
478- SigMaterial & sig,
479- const rnp::secure_bytes &hash) const override ;
480- size_t bits () const noexcept override ;
481- pgp_curve_t curve () const noexcept override ;
469+ void clear_secret () noexcept override ;
470+ bool parse (pgp_packet_body_t &pkt) noexcept override ;
471+ bool parse_secret (pgp_packet_body_t &pkt) noexcept override ;
472+ void write (pgp_packet_body_t &pkt) const override ;
473+ void write_secret (pgp_packet_body_t &pkt) const override ;
474+ bool generate (rnp::SecurityContext &ctx, const KeyParams ¶ms) override ;
475+ rnp_result_t verify (const rnp::SecurityContext & ctx,
476+ const pgp_signature_material_t & sig,
477+ const rnp::secure_vector<uint8_t > &hash) const override ;
478+ rnp_result_t sign (rnp::SecurityContext & ctx,
479+ pgp_signature_material_t & sig,
480+ const rnp::secure_vector<uint8_t > &hash) const override ;
481+ pgp_hash_alg_t adjust_hash (pgp_hash_alg_t hash) const override ;
482+ bool sig_hash_allowed (pgp_hash_alg_t hash) const override ;
483+ size_t bits () const noexcept override ;
484+ pgp_curve_t curve () const noexcept override ;
482485
483486 const std::vector<uint8_t > &pub () const noexcept ;
484487 const std::vector<uint8_t > &priv () const noexcept ;
@@ -525,20 +528,23 @@ class Ed448KeyMaterial : public KeyMaterial {
525528 Ed448KeyMaterial () : KeyMaterial(PGP_PKA_ED448), key_{} {};
526529 std::unique_ptr<KeyMaterial> clone () override ;
527530
528- void clear_secret () noexcept override ;
529- bool parse (pgp_packet_body_t &pkt) noexcept override ;
530- bool parse_secret (pgp_packet_body_t &pkt) noexcept override ;
531- void write (pgp_packet_body_t &pkt) const override ;
532- void write_secret (pgp_packet_body_t &pkt) const override ;
533- bool generate (rnp::SecurityContext &ctx, const KeyParams ¶ms) override ;
534- rnp_result_t verify (const rnp::SecurityContext & ctx,
535- const SigMaterial & sig,
531+ void clear_secret () noexcept override ;
532+ bool parse (pgp_packet_body_t &pkt) noexcept override ;
533+ bool parse_secret (pgp_packet_body_t &pkt) noexcept override ;
534+ void write (pgp_packet_body_t &pkt) const override ;
535+ void write_secret (pgp_packet_body_t &pkt) const override ;
536+ bool generate (rnp::SecurityContext &ctx, const KeyParams ¶ms) override ;
537+ rnp_result_t verify (const rnp::SecurityContext & ctx,
538+ const pgp_signature_material_t & sig,
539+ const rnp::secure_vector<uint8_t > &hash) const override ;
540+ rnp_result_t sign (rnp::SecurityContext & ctx,
541+ pgp_signature_material_t & sig,
536542 const rnp::secure_vector<uint8_t > &hash) const override ;
537- rnp_result_t sign (rnp::SecurityContext & ctx,
538- SigMaterial & sig,
539- const rnp::secure_vector< uint8_t > &hash) const override ;
540- size_t bits () const noexcept override ;
541- pgp_curve_t curve () const noexcept override ;
543+ pgp_hash_alg_t adjust_hash ( pgp_hash_alg_t hash) const override ;
544+ bool sig_hash_allowed ( pgp_hash_alg_t hash) const override ;
545+
546+ size_t bits () const noexcept override ;
547+ pgp_curve_t curve () const noexcept override ;
542548
543549 const std::vector<uint8_t > &pub () const noexcept ;
544550 const std::vector<uint8_t > &priv () const noexcept ;
@@ -624,12 +630,14 @@ class DilithiumEccKeyMaterial : public KeyMaterial {
624630 void write (pgp_packet_body_t &pkt) const override ;
625631 void write_secret (pgp_packet_body_t &pkt) const override ;
626632 bool generate (rnp::SecurityContext &ctx, const KeyParams ¶ms) override ;
627- rnp_result_t verify (const rnp::SecurityContext &ctx,
628- const SigMaterial & sig,
629- const rnp::secure_bytes & hash) const override ;
630- rnp_result_t sign (rnp::SecurityContext & ctx,
631- SigMaterial & sig,
632- const rnp::secure_bytes &hash) const override ;
633+ rnp_result_t verify (const rnp::SecurityContext & ctx,
634+ const pgp_signature_material_t & sig,
635+ const rnp::secure_vector<uint8_t > &hash) const override ;
636+ rnp_result_t sign (rnp::SecurityContext & ctx,
637+ pgp_signature_material_t & sig,
638+ const rnp::secure_vector<uint8_t > &hash) const override ;
639+ pgp_hash_alg_t adjust_hash (pgp_hash_alg_t hash) const override ;
640+ bool sig_hash_allowed (pgp_hash_alg_t hash) const override ;
633641 size_t bits () const noexcept override ;
634642
635643 const pgp_dilithium_exdsa_composite_public_key_t & pub () const noexcept ;
@@ -653,12 +661,14 @@ class SlhdsaKeyMaterial : public KeyMaterial {
653661 void write (pgp_packet_body_t &pkt) const override ;
654662 void write_secret (pgp_packet_body_t &pkt) const override ;
655663 bool generate (rnp::SecurityContext &ctx, const KeyParams ¶ms) override ;
656- rnp_result_t verify (const rnp::SecurityContext &ctx,
657- const SigMaterial & sig,
658- const rnp::secure_bytes & hash) const override ;
659- rnp_result_t sign (rnp::SecurityContext & ctx,
660- SigMaterial & sig,
661- const rnp::secure_bytes &hash) const override ;
664+ rnp_result_t verify (const rnp::SecurityContext & ctx,
665+ const pgp_signature_material_t & sig,
666+ const rnp::secure_vector<uint8_t > &hash) const override ;
667+ rnp_result_t sign (rnp::SecurityContext & ctx,
668+ pgp_signature_material_t & sig,
669+ const rnp::secure_vector<uint8_t > &hash) const override ;
670+ pgp_hash_alg_t adjust_hash (pgp_hash_alg_t hash) const override ;
671+ bool sig_hash_allowed (pgp_hash_alg_t hash) const override ;
662672 size_t bits () const noexcept override ;
663673
664674 const pgp_sphincsplus_public_key_t & pub () const noexcept ;
0 commit comments