summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/objects (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Hoist OBJ_sn2nid() over OBJ_ln2nid()tb2023-12-151-17/+17
| | | | | In all other places, the short name comes before the long name, so fix the only exception.
* Coverity rightly points out that an unsigned int is always >= 0tb2023-12-151-4/+4
|
* OBJ_create: sorry Omar, aobj is a better name than optb2023-12-141-5/+5
| | | | Done.
* OBJ_create: use a nid variable to avoid nested function calltb2023-12-141-3/+4
|
* OBJ_create: malloc() -> calloc()tb2023-12-141-2/+2
|
* OBJ_create: test and assign as usualtb2023-12-141-7/+7
|
* OBJ_create: initialize buf and turn function into single exittb2023-12-141-4/+5
|
* OBJ_create: rename ok to ret and make it last declarationtb2023-12-141-4/+4
|
* OBJ_create(): rename i to lentb2023-12-141-8/+8
|
* OBJ_create(): remove pointless parenthesestb2023-12-141-4/+4
|
* OBJ_create(): remove useless casttb2023-12-141-2/+2
|
* OPENSSL_assert() that the passed nid is within rangetb2023-12-141-1/+7
| | | | discussed with deraadt and jsing
* Move the txt to obj/nid conversions a bit down.tb2023-12-141-42/+42
| | | | No code change
* Dedup OBJ_nid2{obj,sn,ln}()tb2023-12-141-49/+9
| | | | | First get the obj corresponding to nid, then inspect its sn and ln. Shaves off 40 lines of code and will simplify locking.
* Simplify OBJ_nid2obj()tb2023-12-141-23/+26
| | | | | | | This is now yet another identical copy of the same code... Next step will be to dedup. ok jsing
* Simplify OBJ_nid2sn()tb2023-12-141-23/+26
| | | | | | | This is exactly the same as the previous OBJ_nid2ln() change modulo s/ln/sn/g. ok jsing
* Simplify OBJ_nid2ln()tb2023-12-141-23/+26
| | | | | | | | | | | | If nid is in the range of built-in NIDs, return the corresponding long name, unless some genius left a hole. Otherwise perform a yolo check if there are any user-added objects with matching nid in the global hash. This changes behavior in that we now push an OBJ_R_UNKNOWN_NID error onto the stack even if there are no user-added objects. ok jsing
* Simplify OBJ_ln2nid()tb2023-12-131-42/+32
| | | | | | | | | This is s/sn/ln/g of the previous commit and eliminates another OBJ_bsearch_() user, the last one in this file. The bsearch() uses in this file are possibly the only ones that actually make sense since we're searching tables of roughly 1000 entries. ok jsing
* Simplify OBJ_sn2nid()tb2023-12-131-41/+30
| | | | | | | | | | Another OBJ_bsearch_() elimination. OBJ_sn2nid() is very similar to OBJ_obj2nid(). First it tries to retrieve an object identifier with matching "short name" from the global hash of added objects and then searches the table of built-in objects. ok jsing
* Simplify OBJ_obj2nid()tb2023-12-131-39/+28
| | | | | | | | | | | | | | | | | | Continue with OBJ_bsearch_() elimination. OBJ_obj2nid() first checks if the object identifier passed in has a nid and if so, it returns that. Otherwise, it looks into the global hash of added objects (of course without locking) for a match and then returns the nid thereof. As a last attempt, it searches the table of built-in object identifiers. The last two steps can be cleaned up and simplified quite a bit by using C99 initializers, bsearch() and an appropriate comparison function. Then it becomes obvious that bsearch() already returns a pointer to the nid we're looking for, so there is no point in converting that into its corresponding obj and returning the nid thereof. ok jsing
* Remove silly parenthesestb2023-11-271-3/+3
|
* Improve error handling in OBJ_add_object()tb2023-09-051-13/+7
| | | | | | | | | | | | | | | | | There is no need for a helper function to obfuscate lh_ADDED_OBJ_new(). Just call the real thing directly. Adding an object with a NID of NID_undef basically amounts to disabling a built-in OID. It does so in an incoherent fashion and the caller can't easily tell success from failure of the operation. Arguably the result is a corrupted objects table. Let's not allow adding such an object in an attempt at keeping things slightly more coherent. Issue noted and initial diff by schwarze while writing documentation ok schwarze
* Garbage collect two commented abort()tb2023-08-171-3/+1
|
* Make the local ASN1_OBJECTs consttb2023-08-171-2/+2
| | | | ok jsing
* Remove some unnecessary else branchestb2023-08-171-7/+5
|
* Remove some parents from return statementstb2023-08-171-8/+8
|
* Use cmp instead of i for the result of a comparisontb2023-08-171-5/+5
| | | | ok jsing
* Use OBJ_cmp() instead of inlining two variantstb2023-08-171-12/+4
| | | | | | | | | | This also avoids more undefined behavior with memcmp(). ok jsing PS: Unsolicited advice for no one in particular: there is this awesome tool called grep. If someone reports an issue, you might want to use it to find more instances.
* Avoid memcmp(NULL, x, 0) in OBJ_cmp()tb2023-08-171-6/+7
| | | | | | | | If a->length is 0, either a->data or b->data could be NULL and memcmp() will rely on undefined behavior to compare them as equal. So avoid this comparison in the first place. ok jsing
* Remove OBJ_add_sigid() and OBJ_sigid_free()tb2023-07-282-17/+2
| | | | | | | | Another bit of unused extensibility that was responsible for a lot of complexity until recently. This removes the remaining stubs from the public API. ok jsing
* Align argument names of OBJ_add_sigid() with the other functions.tb2023-07-221-2/+2
|
* Rewrite obj_xref.ctb2023-07-224-419/+291
| | | | | | | | | | | | Instead of having two unreadable tables placed in a header generated by a janky perl script from an ugly text file, use a single table inlined in the C file. This table is used to translate between signature algorithm OIDs and pairs of OIDs of a message digest and a cipher. The table has fewer than fifty entries and isn't used in a hot path. Using binary search is overkill. Just do two linear searches, one for each translation. None of the original code remains apart from the API. ok jsing
* Neuter OBJ_add_sigid() and OBJ_sigid_free()tb2023-07-221-93/+11
| | | | | | | | | | These functions will be removed in the upcoming bump. Nothing uses them, so it won't hurt if they become noops. This allows us to garbage collect the sig_app and sigx_app stacks and make a first step towards simplifying the OBJ_bsearch_() dances. Also sprinkle some const correctness... because we can. intermediate step towards a diff that is ok jsing
* Hide symbols in objectsbeck2023-07-085-5/+37
| | | | ok tb@
* Move check_defer() and obj_cleanup_defer to evp/names.ctb2023-06-291-6/+1
| | | | | | | | | | These formerly public symbols are the last things hidden by LIBRESSL_CRYPTO_INTERNAL. Most of their use is in evp/names.c Unfortunately, check_defer() needs to know about NUM_NIDS, so its implementation needs to remain in obj_dat.c, the only file that can include obj_dat.h due to NID tables. ok miod
* regentb2023-06-151-1/+9
|
* Add RSA with the sha3s to obj_xref.txttb2023-06-151-0/+4
| | | | ok jsing
* regen obj_xref.htb2023-06-151-12/+14
| | | | (this and the Ed25519 addition to obj_xref.txt were ok jsing)
* Add Ed25519 to the obj_xref table.tb2023-06-151-3/+6
| | | | | Also move part of for RSA-PSS to the top since it doesn't only apply to RSA-PSS.
* Simplify OBJ_obj2txt()tb2023-05-231-7/+1
| | | | | | | | | | Instead of adding a NUL termination to OBJ_obj2txt(), move the aobj == NULL or aobj->data == NULL checks to i2t_ASN1_OBJECT_internal(). The only other caller, i2t_ASN1_OBJECT(), fails on aobj == NULL and aobj->length == 0, and the latter condition is implied by aobj->data. Cleaner solution for obj_dat.c r1.52 suggested by/ok jsing
* Always NUL terminate buf in OBJ_obj2txt()tb2023-05-231-1/+4
| | | | | | | | | | | OBJ_obj2txt() is often called without error checking and is used for reporting unexpected or malformed objects. As such, we should ensure buf is a string even on failure. This had long been the case before it was lost in a recent rewrite. If obj and obj->data are both non-NULL this is already taken care of by i2t_ASN1_OBJECT_internal(), so many callers were still safe. ok miod
* Add NIDs for truncated SHA-2, SHA-3 and related thingstb2023-04-252-7/+72
| | | | From jsing
* spelling fixes; from paul tagliamontejmc2022-12-262-4/+4
| | | | | | | i removed the arithmetics -> arithmetic changes, as i felt they were not clearly correct ok tb
* Make internal header file names consistenttb2022-11-262-4/+4
| | | | | | | | | | | | | | | | Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names used for internal headers. Move all these headers we inherited from OpenSSL to *_local.h, reserving the name *_internal.h for our own code. Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h. constant_time_locl.h is moved to constant_time.h since it's special. Adjust all .c files in libcrypto, libssl and regress. The diff is mechanical with the exception of tls13_quic.c, where #include <ssl_locl.h> was fixed manually. discussed with jsing, no objection bcook
* Add ED25519 aliases for NID, SN and OBJtb2022-11-131-3/+1
| | | | The Ed25519 versions already existed, but OpenSSL chose to uppercase the D.
* Stop pretending that obj_mac.h is optional.jsing2022-11-111-896/+1
| | | | | | | | This is effectively: unifdef -m -DUSE_OBJ_MAC objects/objects.h ok beck@, with extreme prejudice.
* Map objects for ED25519 to Ed25519.jsing2022-11-101-1/+7
| | | | | | | OpenSSL used ED25519, even though the RFCs use Ed25519 - as such, we get to provide both. ok tb@
* In case lh_OBJ_NAME_insert returns NULL due to a failed malloc, onpmbuhl2022-11-081-1/+2
| | | | | | is leaked in OBJ_NAME_add. ok tb Found by CodeChecker.
* Add OID for RPKI signedTAL objectsjob2022-09-152-0/+2
| | | | | | | | | IANA made a permanent registration in the SMI Security for S/MIME CMS Content Type registry at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#security-smime-1 for signed objects conforming to draft-ietf-sidrops-signed-tal. OK tb@
* Add NID for signingCertificateV2kn2022-07-162-0/+2
| | | | | | https://oidref.com/1.2.840.113549.1.9.16.2.47 OK tb