| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,29 +104,21 @@ Maybe<bool> RandomPrimeTraits::AdditionalConfig( | |||
| 104 | 104 | bool safe = args[offset + 1]->IsTrue(); | |
| 105 | 105 | ||
| 106 | 106 | if (!args[offset + 2]->IsUndefined()) { | |
| 107 | - params->add.reset(BN_secure_new()); | ||
| 107 | + ArrayBufferOrViewContents<unsigned char> add(args[offset + 2]); | ||
| 108 | + params->add.reset(BN_bin2bn(add.data(), add.size(), nullptr)); | ||
| 108 | 109 | if (!params->add) { | |
| 109 | 110 | THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); | |
| 110 | 111 | return Nothing<bool>(); | |
| 111 | 112 | } | |
| 112 | - ArrayBufferOrViewContents<unsigned char> add(args[offset + 2]); | ||
| 113 | - if (BN_bin2bn(add.data(), add.size(), params->add.get()) == nullptr) { | ||
| 114 | - THROW_ERR_INVALID_ARG_VALUE(env, "invalid options.add"); | ||
| 115 | - return Nothing<bool>(); | ||
| 116 | - } | ||
| 117 | 113 | } | |
| 118 | 114 | ||
| 119 | 115 | if (!args[offset + 3]->IsUndefined()) { | |
| 120 | - params->rem.reset(BN_secure_new()); | ||
| 116 | + ArrayBufferOrViewContents<unsigned char> rem(args[offset + 3]); | ||
| 117 | + params->rem.reset(BN_bin2bn(rem.data(), rem.size(), nullptr)); | ||
| 121 | 118 | if (!params->rem) { | |
| 122 | 119 | THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); | |
| 123 | 120 | return Nothing<bool>(); | |
| 124 | 121 | } | |
| 125 | - ArrayBufferOrViewContents<unsigned char> rem(args[offset + 3]); | ||
| 126 | - if (BN_bin2bn(rem.data(), rem.size(), params->rem.get()) == nullptr) { | ||
| 127 | - THROW_ERR_INVALID_ARG_VALUE(env, "invalid options.rem"); | ||
| 128 | - return Nothing<bool>(); | ||
| 129 | - } | ||
| 130 | 122 | } | |
| 131 | 123 | ||
| 132 | 124 | int bits = static_cast<int>(size); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments