Skip to content

Commit 8427faf

Browse files
committed
fixup! crypto: add signDigest/verifyDigest and Ed25519ctx support
1 parent d553df5 commit 8427faf

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/crypto/crypto_sig.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,7 @@ bool SignTraits::DeriveBits(Environment* env,
852852
.len = params.signature.size(),
853853
};
854854
auto buf = DataPointer::Alloc(1);
855-
static_cast<char*>(buf.get())[0] = 0;
856-
if (pkctx.verify(sig_buf, data_buf)) {
857-
static_cast<char*>(buf.get())[0] = 1;
858-
}
855+
*buf.get<char>() = pkctx.verify(sig_buf, data_buf);
859856
*out = ByteSource::Allocated(buf.release());
860857
}
861858

@@ -928,10 +925,7 @@ bool SignTraits::DeriveBits(Environment* env,
928925
}
929926
} else {
930927
auto buf = DataPointer::Alloc(1);
931-
static_cast<char*>(buf.get())[0] = 0;
932-
if (context.verify(params.data, params.signature)) {
933-
static_cast<char*>(buf.get())[0] = 1;
934-
}
928+
*buf.get<char>() = context.verify(params.data, params.signature);
935929
*out = ByteSource::Allocated(buf.release());
936930
}
937931

0 commit comments

Comments
 (0)