summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/abs.3
diff options
context:
space:
mode:
authortb <>2025-12-07 09:27:02 +0000
committertb <>2025-12-07 09:27:02 +0000
commit9f4aeb928441e201f22864578423923ec1b137b1 (patch)
tree46d51d7b5010bc6c810153a77bdf1f7e21e12dbe /src/lib/libc/stdlib/abs.3
parentf4f87fb91b4a97eaa42c01cc9189912b2d9c45d7 (diff)
downloadopenbsd-9f4aeb928441e201f22864578423923ec1b137b1.tar.gz
openbsd-9f4aeb928441e201f22864578423923ec1b137b1.tar.bz2
openbsd-9f4aeb928441e201f22864578423923ec1b137b1.zip
Remove last internal use of ASN1_STRING_data()
PKCS5_pbe_set0_algor() is no longer public, but its parameters are provided directly via public API, namely the wonderful PKCS8_encrypt() and PKCS12_pack_p7encdata(). Muppetry abounds. To wit: If saltlen < 0, the call to ASN1_STRING_set(pbe->salt, NULL, saltlen) would error. Let's do that up front in a more obvious way. We don't care about side-effects to pbe->salt since we free it on error anyway. If saltlen == 0, we default it to PKCS5_PBE1_SALT_LEN. This is particularly funky in case the caller passed in salt != NULL, in which case we can only hope and pray this buffer is long enough. If the caller passed a salt, copy it to pbe->salt via ASN1_STRING_set(). If there's no salt, allocate a buffer of the appropriate length, fill it with random and transfer ownership to pbe->salt via ASN1_STRING_set0(). There's a change of behavior in that this will not be NUL-terminated (why should it be?). If we wanted to preserve behavior, we'd just use calloc(1, saltlen + 1) instead of the malloc(). The exit path is quite special, too, but I didn't want to change this right now. tweaks/ok kenjiro
Diffstat (limited to 'src/lib/libc/stdlib/abs.3')
0 files changed, 0 insertions, 0 deletions