aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/tasn_new.c
Commit message (Collapse)AuthorAgeFilesLines
* New ASN.1 embed macro.Dr. Stephen Henson2015-09-161-6/+23
| | | | | | | | | | | | | | | | | | | New ASN.1 macro ASN1_EMBED. This is the same as ASN1_SIMPLE except the structure is not allocated: it is part of the parent. That is instead of FOO *x; it must be: FOO x; This reduces memory fragmentation and make it impossible to accidentally set a mandatory field to NULL. This currently only works for SEQUENCE and since it is equivalent to ASN1_SIMPLE it cannot be tagged, OPTIONAL, SET OF or SEQUENCE OF. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add and use OPENSSL_zallocRich Salz2015-09-021-4/+2
| | | | | | | | | There are many places (nearly 50) where we malloc and then memset. Add an OPENSSL_zalloc routine to encapsulate that. (Missed one conversion; thanks Richard) Also fixes GH328 Reviewed-by: Richard Levitte <levitte@openssl.org>
* Use safer sizeof variant in mallocRich Salz2015-05-041-1/+1
| | | | | | | | | | | | | For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Don't set *pval to NULL in ASN1_item_ex_new.Dr. Stephen Henson2015-04-101-2/+0
| | | | | | | | | | | | | While *pval is usually a pointer in rare circumstances it can be a long value. One some platforms (e.g. WIN64) where sizeof(long) < sizeof(ASN1_VALUE *) this will write past the field. *pval is initialised correctly in the rest of ASN1_item_ex_new so setting it to NULL is unecessary anyway. Thanks to Julien Kauffmann for reporting this issue. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove combine option from ASN.1 code.Dr. Stephen Henson2015-03-261-27/+14
| | | | | | | | | Remove the combine option. This was used for compatibility with some non standard behaviour in ancient versions of OpenSSL: specifically the X509_ATTRIBUTE and DSAPublicKey handling. Since these have now been revised it is no longer needed. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Move more internal only functions to asn1_locl.hDr. Stephen Henson2015-03-261-6/+8
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Move internal only ASN.1 functions to asn1_locl.hDr. Stephen Henson2015-03-251-0/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove old style ASN.1 support.Dr. Stephen Henson2015-03-231-11/+0
| | | | | | | | | Remove old ASN.1 COMPAT type. This was meant as a temporary measure so older ASN.1 code (from OpenSSL 0.9.6) still worked. It's a hack which breaks constification and hopefully nothing uses it now, if it ever did. Reviewed-by: Matt Caswell <matt@openssl.org>
* ASN1_primitive_new NULL param handlingMatt Caswell2015-03-121-2/+5
| | | | | | | | | | | | | | ASN1_primitive_new takes an ASN1_ITEM * param |it|. There are a couple of conditional code paths that check whether |it| is NULL or not - but later |it| is deref'd unconditionally. If |it| was ever really NULL then this would seg fault. In practice ASN1_primitive_new is marked as an internal function in the public header file. The only places it is ever used internally always pass a non NULL parameter for |it|. Therefore, change the code to sanity check that |it| is not NULL, and remove the conditional checking. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-289/+274
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* PR: 2013Dr. Stephen Henson2009-09-021-1/+5
| | | | | | | | | | | | Submitted by: steve@openssl.org Include a flag ASN1_STRING_FLAG_MSTRING when a multi string type is created. This makes it possible to tell if the underlying type is UTCTime, GeneralizedTime or Time when the structure is reused and X509_time_adj_ex() can handle each case in an appropriate manner. Add error checking to CRL generation in ca utility when nextUpdate is being set.
* Update obsolete email address...Dr. Stephen Henson2008-11-051-1/+1
|
* fix problems found by coverity: remove useless codeNils Larsch2006-03-151-4/+1
|
* make some internal functions static; patch supplied by Kurt RoeckxNils Larsch2006-02-151-2/+2
|
* Extend callback function to support print customization.Dr. Stephen Henson2005-09-011-4/+4
|
* Handle case where it==NULLDr. Stephen Henson2005-07-261-7/+8
|
* Fix more error codes.Bodo Möller2005-05-111-2/+2
| | | | | (Also improve util/ck_errf.pl script, and occasionally fix source code formatting.)
* More ASN1 reformat/tidy.Dr. Stephen Henson2004-04-251-89/+130
|
* Check for NULL ASN1_ITEM when initializeingDr. Stephen Henson2002-11-051-1/+4
| | | | boolean option in ASN1_TYPE.
* Preliminary streaming ASN1 encode support.Dr. Stephen Henson2002-10-031-0/+2
|
* Shut up compiler warnings for inconsistent declarations.Lutz Jänicke2002-01-291-1/+1
|
* Rewrite CHOICE field setting code to properly handleDr. Stephen Henson2001-04-021-1/+6
| | | | | | combine in CHOICE options. This was causing d2i_DSAPublicKey() to misbehave.
* Initial support for ASN1_ITEM_FUNCTION option toDr. Stephen Henson2001-02-231-2/+2
| | | | | | | | change the way ASN1 modules are exported. Still needs a bit of work for example the hack which a dummy function prototype to avoid compilers warning about multiple ;s.
* New options to 'ca' utility to support CRL entry extensions.Dr. Stephen Henson2001-02-161-1/+6
| | | | | | | | Add revelant new X509V3 extensions. Add OIDs. Fix ASN1 memory leak code to pop info if external allocation used.
* Include string.h (whis is in all relevant standards) instead ofBodo Möller2001-02-051-1/+1
| | | | memory.h (which is not).
* Fix a warning.Ben Laurie2001-02-041-0/+1
|
* Add debugging info to new ASN1 code to trace memory leaks.Dr. Stephen Henson2001-01-241-3/+27
| | | | | | Fix PKCS7 and PKCS12 memory leaks. Initialise encapsulated content type properly.
* Merge from the ASN1 branch of new ASN1 codeDr. Stephen Henson2000-12-081-0/+313
to main trunk. Lets see if the makes it to openssl-cvs :-)