1 #ifndef SRC_CRYPTO_CRYPTO_DSA_H_ 2 #define SRC_CRYPTO_CRYPTO_DSA_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include "crypto/crypto_keys.h" 7 #include "crypto/crypto_keygen.h" 8 #include "crypto/crypto_util.h" 9 #include "env.h" 10 #include "memory_tracker.h" 11 #include "v8.h" 12 13 namespace node { 14 namespace crypto { 15 struct DsaKeyPairParams final : public MemoryRetainer { 16 unsigned int modulus_bits; 17 int divisor_bits; 18 SET_NO_MEMORY_INFO() 19 SET_MEMORY_INFO_NAME(DsaKeyPairParams) 20 SET_SELF_SIZE(DsaKeyPairParams) 21 }; 22 23 using DsaKeyPairGenConfig = KeyPairGenConfig<DsaKeyPairParams>; 24 25 struct DsaKeyGenTraits final { 26 using AdditionalParameters = DsaKeyPairGenConfig; 27 static constexpr const char* JobName = "DsaKeyPairGenJob"; 28 29 static EVPKeyCtxPointer Setup(DsaKeyPairGenConfig* params); 30 31 static v8::Maybe<bool> AdditionalConfig( 32 CryptoJobMode mode, 33 const v8::FunctionCallbackInfo<v8::Value>& args, 34 unsigned int* offset, 35 DsaKeyPairGenConfig* params); 36 }; 37 38 using DsaKeyPairGenJob = KeyGenJob<KeyPairGenTraits<DsaKeyGenTraits>>; 39 40 struct DSAKeyExportConfig final : public MemoryRetainer { 41 SET_NO_MEMORY_INFO() 42 SET_MEMORY_INFO_NAME(DSAKeyExportConfig) 43 SET_SELF_SIZE(DSAKeyExportConfig) 44 }; 45 46 struct DSAKeyExportTraits final { 47 static constexpr const char* JobName = "DSAKeyExportJob"; 48 using AdditionalParameters = DSAKeyExportConfig; 49 50 static v8::Maybe<bool> AdditionalConfig( 51 const v8::FunctionCallbackInfo<v8::Value>& args, 52 unsigned int offset, 53 DSAKeyExportConfig* config); 54 55 static WebCryptoKeyExportStatus DoExport( 56 std::shared_ptr<KeyObjectData> key_data, 57 WebCryptoKeyFormat format, 58 const DSAKeyExportConfig& params, 59 ByteSource* out); 60 }; 61 62 using DSAKeyExportJob = KeyExportJob<DSAKeyExportTraits>; 63 64 v8::Maybe<bool> GetDsaKeyDetail( 65 Environment* env, 66 std::shared_ptr<KeyObjectData> key, 67 v8::Local<v8::Object> target); 68 69 namespace DSAAlg { 70 void Initialize(Environment* env, v8::Local<v8::Object> target); 71 void RegisterExternalReferences(ExternalReferenceRegistry* registry); 72 } // namespace DSAAlg 73 } // namespace crypto 74 } // namespace node 75 76 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 77 #endif // SRC_CRYPTO_CRYPTO_DSA_H_ 78