summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-05-22 11:25:14 +0000
committerriastradh <riastradh@NetBSD.org>2022-05-22 11:25:14 +0000
commitdd25b8ea7dd4819f30919b4488b399444396e9eb (patch)
tree49983d87c5b8ec13be4ffe58aaab9ac67f0ac55e /sys/dev
parent44d77602effd8862fbc1063cad5ff4cde6566355 (diff)
opencrypto: Make sid=0 always invalid, but OK to free.
Previously, crypto_newsession could sometimes return 0 as the driver-specific part of the session id, and 0 as the hid, for sid=0. But netipsec assumes that it is always safe to free sid=0 from zero-initialized memory even if crypto_newsession has never succeeded. So it was up to every driver in tree to gracefully handle sid=0, if it happened to get assigned hid=0. And, as long as the freesession callback was expected to just return an error code when given a bogus session id, that worked out fine...because nothing ever used the error code. That was a terrible fragile system that should never have been invented. Instead, let's just ensure that valid session ids are nonzero, and make crypto_freesession with sid=0 be a no-op.
Diffstat (limited to 'sys/dev')
0 files changed, 0 insertions, 0 deletions