Commit Graph

26 Commits

Author SHA1 Message Date
Jeffrey Altman
ee56cb33b2 lib/asn1: prevent wrong size argument warnings
190263bb7a
("assert non-NULL ptrs before calling mem funcs") introduced
two wrong size argument warnings.  These locations are not
errors since the allocation is simply to ensure that the
data pointer is non-NULL; length is zero.

Change-Id: I7b3b58247799a48da3653008c7b6d7fbbbf83e25
2022-01-24 00:31:27 -05:00
Jeffrey Altman
190263bb7a assert non-NULL ptrs before calling mem funcs
The definitions of memcpy(), memmove(), and memset() state that
the behaviour is undefined if any of the pointer arguments are
NULL, and some compilers are known to make use of this to
optimise away existing NULL checks in the source.

Change-Id: I489bc256e3eac7ff41d91becb0b43aba73dbb3f9
Link: https://www.imperialviolet.org/2016/06/26/nonnull.html
2022-01-24 00:07:51 -05:00
Nicolas Williams
7f8fa65c5b asn1: Fix leak in der_copy_octet_string()
This manifested as a leak via _save fields in the template backend.
2022-01-14 12:01:34 -06:00
Jeffrey Altman
d269c30b2b lib/asn1: all exported functions must use ASN1CALL convention
Otherwise, on 32-bit Windows there is a mismatch that and the
ESP register will not be populated correctly.

Prior to this change some exports were ASN1CALL and others
were not.   All of the tests assume ASN1CALL.

Change-Id: Icecff44aed4726b86100c939f64628d121bbd7ee
2021-11-16 22:09:16 -05:00
Nicolas Williams
19d378f44d Add 64-bit integer support to ASN.1 compiler
ASN.1 INTEGERs will now compile to C int64_t or uint64_t, depending
    on whether the constraint ranges include numbers that cannot be
    represented in 32-bit ints and whether they include negative
    numbers.

    Template backend support included.  check-template is now built with
    --template, so we know we're testing it.

    Tests included.
2011-12-12 20:01:20 -06:00
Love Hornquist Astrand
fa4c84e6d6 make printablestring and ia5string octetstrings 2010-08-08 15:51:33 -07:00
Love Hornquist Astrand
b939943b07 first stange of asn1 table driven compiler 2009-11-21 10:24:56 -08:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
983b89b811 Add VisibleString parsing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19539 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-12-28 17:15:05 +00:00
Love Hörnquist Åstrand
f4f9013804 prefix primitive types with der_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18443 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-14 05:36:34 +00:00
Love Hörnquist Åstrand
9ed8bb8ea2 rename copy_ to der_copy_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18440 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-14 05:21:36 +00:00
Love Hörnquist Åstrand
6042e74b75 (copy_heim_integer): copy the negative flag
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16478 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-01-04 23:41:29 +00:00
Love Hörnquist Åstrand
b838707d0e Commit much improved ASN.1 compiler from joda-choice-branch.
Highlighs for the compiler is support for CHOICE and in general better
support for tags. This compiler support most of what is needed for
PK-INIT, LDAP, X.509, PKCS-12 and many other protocols.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15617 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-12 06:27:42 +00:00
Love Hörnquist Åstrand
48a9c79e8f (copy_oid): copy all components
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13084 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-11-07 07:39:43 +00:00
Love Hörnquist Åstrand
939b444ca3 prefix typedef\'s and structs with heim_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12438 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-07-15 13:57:32 +00:00
Love Hörnquist Åstrand
21f95ad266 (copy_general_string): use strdup
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12087 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-04-17 07:13:08 +00:00
Assar Westerlund
2bcae56ac3 add ENUMERATED and OBJECT IDENTIFIER
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10741 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-09-25 13:39:27 +00:00
Johan Danielsson
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
Assar Westerlund
6c9520273d (copy_octet_string): don't fail if length == 0 and malloc returns NULL
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6388 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-07-02 21:35:12 +00:00
Johan Danielsson
e520087f91 Check result of malloc.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2457 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-19 02:06:35 +00:00
Johan Danielsson
5a32a5c8e7 Add copyright notice.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2389 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-16 21:40:05 +00:00
Assar Westerlund
c1439d2cd8 changed asn1_locl.h to gen_locl.h and der_locl.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2328 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-15 20:02:05 +00:00
Johan Danielsson
415cbbf252 Constness.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1882 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-06-10 12:53:28 +00:00
Johan Danielsson
f13518ca8f krb5_data -> octet_string, char * -> general_string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1873 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-06-09 22:43:04 +00:00
Johan Danielsson
6c523c651c Specific copy functions.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1446 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-03-17 10:33:21 +00:00