GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node/src/crypto/crypto_sig.h at main · synapse/node Expand file tree/ Copy pathcrypto_sig.hMore file actions 168 lines (132 loc) · 4.47 KB / Copy pathcrypto_sig.hFile metadata and controls168 lines (132 loc) · 4.47 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 #ifndef SRC_CRYPTO_CRYPTO_SIG_H_ #define SRC_CRYPTO_CRYPTO_SIG_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "base_object.h" #include "crypto/crypto_keys.h" #include "crypto/crypto_util.h" #include "env.h" #include "memory_tracker.h" namespace node { namespace crypto { static const unsigned int kNoDsaSignature = static_cast<unsigned int>(-1); enum DSASigEnc { kSigEncDER, kSigEncP1363 }; class SignBase : public BaseObject { public: enum Error { kSignOk, kSignUnknownDigest, kSignInit, kSignNotInitialised, kSignUpdate, kSignPrivateKey, kSignPublicKey, kSignMalformedSignature }; SignBase(Environment* env, v8::Local<v8::Object> wrap); Error Init(const char* sign_type); Error Update(const char* data, size_t len); // TODO(joyeecheung): track the memory used by OpenSSL types void MemoryInfo(MemoryTracker* tracker) const override; SET_MEMORY_INFO_NAME(SignBase) SET_SELF_SIZE(SignBase) protected: EVPMDCtxPointer mdctx_; }; class Sign : public SignBase { public: static void Initialize(Environment* env, v8::Local<v8::Object> target); static void RegisterExternalReferences(ExternalReferenceRegistry* registry); struct SignResult { Error error; std::unique_ptr<v8::BackingStore> signature; explicit SignResult( Error err, std::unique_ptr<v8::BackingStore>&& sig = nullptr) : error(err), signature(std::move(sig)) {} }; SignResult SignFinal( const ManagedEVPPKey& pkey, int padding, const v8::Maybe<int>& saltlen, DSASigEnc dsa_sig_enc); static void SignSync(const v8::FunctionCallbackInfo<v8::Value>& args); protected: static void New(const v8::FunctionCallbackInfo<v8::Value>& args); static void SignInit(const v8::FunctionCallbackInfo<v8::Value>& args); static void SignUpdate(const v8::FunctionCallbackInfo<v8::Value>& args); static void SignFinal(const v8::FunctionCallbackInfo<v8::Value>& args); Sign(Environment* env, v8::Local<v8::Object> wrap); }; class Verify : public SignBase { public: static void Initialize(Environment* env, v8::Local<v8::Object> target); static void RegisterExternalReferences(ExternalReferenceRegistry* registry); Error VerifyFinal(const ManagedEVPPKey& key, const ByteSource& sig, int padding, const v8::Maybe<int>& saltlen, bool* verify_result); static void VerifySync(const v8::FunctionCallbackInfo<v8::Value>& args); protected: static void New(const v8::FunctionCallbackInfo<v8::Value>& args); static void VerifyInit(const v8::FunctionCallbackInfo<v8::Value>& args); static void VerifyUpdate(const v8::FunctionCallbackInfo<v8::Value>& args); static void VerifyFinal(const v8::FunctionCallbackInfo<v8::Value>& args); Verify(Environment* env, v8::Local<v8::Object> wrap); }; struct SignConfiguration final : public MemoryRetainer { enum Mode { kSign, kVerify }; enum Flags { kHasNone = 0, kHasSaltLength = 1, kHasPadding = 2 }; CryptoJobMode job_mode; Mode mode; ManagedEVPPKey key; ByteSource data; ByteSource signature; const EVP_MD* digest = nullptr; int flags = SignConfiguration::kHasNone; int padding = 0; int salt_length = 0; DSASigEnc dsa_encoding = kSigEncDER; SignConfiguration() = default; explicit SignConfiguration(SignConfiguration&& other) noexcept; SignConfiguration& operator=(SignConfiguration&& other) noexcept; void MemoryInfo(MemoryTracker* tracker) const override; SET_MEMORY_INFO_NAME(SignConfiguration) SET_SELF_SIZE(SignConfiguration) }; struct SignTraits final { using AdditionalParameters = SignConfiguration; static constexpr const char* JobName = "SignJob"; // TODO(@jasnell): Sign request vs. Verify request static constexpr AsyncWrap::ProviderType Provider = AsyncWrap::PROVIDER_SIGNREQUEST; static v8::Maybe<bool> AdditionalConfig( CryptoJobMode mode, const v8::FunctionCallbackInfo<v8::Value>& args, unsigned int offset, SignConfiguration* params); static bool DeriveBits( Environment* env, const SignConfiguration& params, ByteSource* out); static v8::Maybe<bool> EncodeOutput( Environment* env, const SignConfiguration& params, ByteSource* out, v8::Local<v8::Value>* result); }; using SignJob = DeriveBitsJob<SignTraits>; } // namespace crypto } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_CRYPTO_CRYPTO_SIG_H_ |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |