@@ -197,7 +197,6 @@ using DeleteFnPtr = typename FunctionDeleter<T, function>::Pointer;
197197
198198using BignumCtxPointer = DeleteFnPtr<BN_CTX, BN_CTX_free>;
199199using BignumGenCallbackPointer = DeleteFnPtr<BN_GENCB, BN_GENCB_free>;
200- using ECDSASigPointer = DeleteFnPtr<ECDSA_SIG, ECDSA_SIG_free>;
201200using ECGroupPointer = DeleteFnPtr<EC_GROUP, EC_GROUP_free>;
202201using ECKeyPointer = DeleteFnPtr<EC_KEY, EC_KEY_free>;
203202using ECPointPointer = DeleteFnPtr<EC_POINT, EC_POINT_free>;
@@ -821,6 +820,38 @@ class X509Pointer final {
821820 DeleteFnPtr<X509, X509_free> cert_;
822821};
823822
823+ class ECDSASigPointer final {
824+ public:
825+ explicit ECDSASigPointer ();
826+ explicit ECDSASigPointer (ECDSA_SIG* sig);
827+ ECDSASigPointer (ECDSASigPointer&& other) noexcept ;
828+ ECDSASigPointer& operator =(ECDSASigPointer&& other) noexcept ;
829+ NCRYPTO_DISALLOW_COPY (ECDSASigPointer)
830+ ~ECDSASigPointer ();
831+
832+ inline bool operator ==(std::nullptr_t ) noexcept { return sig_ == nullptr ; }
833+ inline operator bool () const { return sig_ != nullptr ; }
834+ inline ECDSA_SIG* get () const { return sig_.get (); }
835+ inline operator ECDSA_SIG*() const { return sig_.get (); }
836+ void reset (ECDSA_SIG* sig = nullptr );
837+ ECDSA_SIG* release ();
838+
839+ static ECDSASigPointer New ();
840+ static ECDSASigPointer Parse (const Buffer<const unsigned char >& buffer);
841+
842+ inline const BIGNUM* r () const { return pr_; }
843+ inline const BIGNUM* s () const { return ps_; }
844+
845+ bool setParams (BignumPointer&& r, BignumPointer&& s);
846+
847+ Buffer<unsigned char > encode () const ;
848+
849+ private:
850+ DeleteFnPtr<ECDSA_SIG, ECDSA_SIG_free> sig_;
851+ const BIGNUM* pr_ = nullptr ;
852+ const BIGNUM* ps_ = nullptr ;
853+ };
854+
824855#ifndef OPENSSL_NO_ENGINE
825856class EnginePointer final {
826857 public:
0 commit comments