diff options
author | Tobias Nießen <tniessen@tnie.de> | 2019-08-21 01:05:55 +0300 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2019-11-20 19:55:47 +0300 |
commit | c63af4fea041673eb7c33f6df3c474d4537fe5eb (patch) | |
tree | 73e1942eb0ca50d5414fbe4619099c49d0666494 /src/node_crypto.h | |
parent | 80efb80f3f9dffb412aa1a41ab36c843c90c60e5 (diff) |
crypto: add support for IEEE-P1363 DSA signatures
PR-URL: https://github.com/nodejs/node/pull/29292
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_crypto.h')
-rw-r--r-- | src/node_crypto.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/node_crypto.h b/src/node_crypto.h index 777ba5d302a..56a9ad3104d 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -326,6 +326,13 @@ class ByteSource { const char* get() const; size_t size() const; + inline operator bool() const { + return data_ != nullptr; + } + + static ByteSource Allocated(char* data, size_t size); + static ByteSource Foreign(const char* data, size_t size); + static ByteSource FromStringOrBuffer(Environment* env, v8::Local<v8::Value> value); @@ -350,9 +357,6 @@ class ByteSource { size_t size_ = 0; ByteSource(const char* data, char* allocated_data, size_t size); - - static ByteSource Allocated(char* data, size_t size); - static ByteSource Foreign(const char* data, size_t size); }; enum PKEncodingType { @@ -628,7 +632,8 @@ class SignBase : public BaseObject { kSignNotInitialised, kSignUpdate, kSignPrivateKey, - kSignPublicKey + kSignPublicKey, + kSignMalformedSignature } Error; SignBase(Environment* env, v8::Local<v8::Object> wrap) @@ -649,6 +654,10 @@ class SignBase : public BaseObject { EVPMDPointer mdctx_; }; +enum DSASigEnc { + kSigEncDER, kSigEncP1363 +}; + class Sign : public SignBase { public: static void Initialize(Environment* env, v8::Local<v8::Object> target); @@ -666,7 +675,8 @@ class Sign : public SignBase { SignResult SignFinal( const ManagedEVPPKey& pkey, int padding, - const v8::Maybe<int>& saltlen); + const v8::Maybe<int>& saltlen, + DSASigEnc dsa_sig_enc); protected: static void New(const v8::FunctionCallbackInfo<v8::Value>& args); |