Commit d1fcb61c authored by jan.koester's avatar jan.koester
Browse files

test

parent 54639f55
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -632,14 +632,19 @@ namespace netplus {


    void rsa::multiply(const bigInt& a, const bigInt& b, bigInt& res) {
        const size_t au = a.used;
        const size_t bu = b.used;

        // Ensure result buffer has room for au+bu+1 limbs:
        // the carry propagation loop can temporarily write to index au+bu.
        res.reserve(au + bu + 1);

        const limb_t* __restrict__ ap = a.data.get();
        const limb_t* __restrict__ bp = b.data.get();
        limb_t* __restrict__ rp = res.data.get();
        const size_t au = a.used;
        const size_t bu = b.used;

        // Zero only the output region we'll actually write
        std::memset(rp, 0, (au + bu) * sizeof(limb_t));
        // Zero the output region including the carry overflow slot
        std::memset(rp, 0, (au + bu + 1) * sizeof(limb_t));

        for (size_t i = 0; i < au; ++i) {
            dlimb_t carry = 0;
+0 −1
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ namespace netplus {

                netplus::rsa::bigInt& operator=(const bigInt& other);
                netplus::rsa::bigInt& operator=(bigInt&& other) noexcept;
                netplus::rsa::bigInt& operator=(const rsa& src);

                // Helper to check bit state for modPow
                bool isBitSet(size_t bit) const;