summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authortb <>2023-10-11 13:20:18 +0000
committertb <>2023-10-11 13:20:18 +0000
commitcfcc87f837c8ab39b6f7678f8c6e4d028cd3c356 (patch)
treedd1a1a2d70bf9140a91777b23c946788b096cdc8 /src/usr.bin
parentec5535eb0976699e795a3849807e66a7e64bf29d (diff)
downloadopenbsd-cfcc87f837c8ab39b6f7678f8c6e4d028cd3c356.tar.gz
openbsd-cfcc87f837c8ab39b6f7678f8c6e4d028cd3c356.tar.bz2
openbsd-cfcc87f837c8ab39b6f7678f8c6e4d028cd3c356.zip
Rewrite X509_ALGOR_set0()
The current implementation is a complete mess. There are three cases: 1) ptype == V_ASN1_UNDEF: parameter must be freed and set to NULL. 2) ptype == 0: existing non-NULL parameters are left untouched, NULL parameters are replaced with ASN1_TYPE_new()'s wacky defaults. 3) otherwise allocate new parameters if needed and set them to ptype/pval. In all three cases free the algorithm and set it to aobj. The challenge now is to implement this using nine if statements and one else clause... We can do better. This preserves existing behavior. There would be cleaner implementations possible, but they would change behavior. There are many callers in the ecosystem that do not error check X509_ALGOR_set0() since OpenSSL failed to do so. So this was carefully rewritten to leave alg in a consisten state so that unchecking callers don't encounter corrupted algs. ok jsing
Diffstat (limited to 'src/usr.bin')
0 files changed, 0 insertions, 0 deletions