diff options
author | assar <assar@FreeBSD.org> | 2001-02-13 16:46:19 +0000 |
---|---|---|
committer | assar <assar@FreeBSD.org> | 2001-02-13 16:46:19 +0000 |
commit | ebfe6dc471c206300fd82c7c0fd145f683aa52f6 (patch) | |
tree | e66aa570ad1d12c43b32a7313b0f8e28971bf8a9 /crypto/heimdal/lib/asn1 | |
parent | e5f617598c2db0dd51906a38ecea9208123a8b70 (diff) | |
download | FreeBSD-src-ebfe6dc471c206300fd82c7c0fd145f683aa52f6.zip FreeBSD-src-ebfe6dc471c206300fd82c7c0fd145f683aa52f6.tar.gz |
import of heimdal 0.3e
Diffstat (limited to 'crypto/heimdal/lib/asn1')
22 files changed, 1290 insertions, 818 deletions
diff --git a/crypto/heimdal/lib/asn1/Makefile.am b/crypto/heimdal/lib/asn1/Makefile.am index 97fb2bb..8f89441 100644 --- a/crypto/heimdal/lib/asn1/Makefile.am +++ b/crypto/heimdal/lib/asn1/Makefile.am @@ -1,62 +1,67 @@ -# $Id: Makefile.am,v 1.54 1999/12/21 17:03:42 assar Exp $ +# $Id: Makefile.am,v 1.59 2001/01/30 01:46:53 assar Exp $ include $(top_srcdir)/Makefile.am.common YFLAGS = -d lib_LTLIBRARIES = libasn1.la -libasn1_la_LDFLAGS = -version-info 1:4:0 +libasn1_la_LDFLAGS = -version-info 4:0:2 BUILT_SOURCES = \ $(gen_files:.x=.c) \ asn1_err.h \ asn1_err.c -gen_files = \ - asn1_APOptions.x \ - asn1_AP_REP.x \ - asn1_AP_REQ.x \ - asn1_AS_REP.x \ - asn1_AS_REQ.x \ - asn1_Authenticator.x \ - asn1_AuthorizationData.x \ - asn1_Checksum.x \ - asn1_EncAPRepPart.x \ - asn1_EncASRepPart.x \ - asn1_EncKDCRepPart.x \ - asn1_EncKrbCredPart.x \ - asn1_EncKrbPrivPart.x \ - asn1_EncTGSRepPart.x \ - asn1_EncTicketPart.x \ - asn1_EncryptedData.x \ - asn1_EncryptionKey.x \ - asn1_ETYPE_INFO.x \ - asn1_ETYPE_INFO_ENTRY.x \ - asn1_HostAddress.x \ - asn1_HostAddresses.x \ - asn1_KDCOptions.x \ - asn1_KDC_REP.x \ - asn1_KDC_REQ.x \ - asn1_KDC_REQ_BODY.x \ - asn1_KRB_CRED.x \ - asn1_KRB_ERROR.x \ - asn1_KRB_PRIV.x \ - asn1_KRB_SAFE.x \ - asn1_KRB_SAFE_BODY.x \ - asn1_KerberosTime.x \ - asn1_KrbCredInfo.x \ - asn1_LastReq.x \ - asn1_METHOD_DATA.x \ - asn1_PA_DATA.x \ - asn1_PA_ENC_TS_ENC.x \ - asn1_Principal.x \ - asn1_PrincipalName.x \ - asn1_Realm.x \ - asn1_TGS_REP.x \ - asn1_TGS_REQ.x \ - asn1_Ticket.x \ - asn1_TicketFlags.x \ - asn1_TransitedEncoding.x +gen_files = \ + asn1_APOptions.x \ + asn1_AP_REP.x \ + asn1_AP_REQ.x \ + asn1_AS_REP.x \ + asn1_AS_REQ.x \ + asn1_Authenticator.x \ + asn1_AuthorizationData.x \ + asn1_CKSUMTYPE.x \ + asn1_Checksum.x \ + asn1_ETYPE_INFO.x \ + asn1_ETYPE_INFO_ENTRY.x \ + asn1_EncAPRepPart.x \ + asn1_EncASRepPart.x \ + asn1_EncKDCRepPart.x \ + asn1_EncKrbCredPart.x \ + asn1_EncKrbPrivPart.x \ + asn1_EncTGSRepPart.x \ + asn1_EncTicketPart.x \ + asn1_EncryptedData.x \ + asn1_EncryptionKey.x \ + asn1_HostAddress.x \ + asn1_HostAddresses.x \ + asn1_KDCOptions.x \ + asn1_KDC_REP.x \ + asn1_KDC_REQ.x \ + asn1_KDC_REQ_BODY.x \ + asn1_KRB_CRED.x \ + asn1_KRB_ERROR.x \ + asn1_KRB_PRIV.x \ + asn1_KRB_SAFE.x \ + asn1_KRB_SAFE_BODY.x \ + asn1_KerberosTime.x \ + asn1_KrbCredInfo.x \ + asn1_LastReq.x \ + asn1_MESSAGE_TYPE.x \ + asn1_METHOD_DATA.x \ + asn1_NAME_TYPE.x \ + asn1_PADATA_TYPE.x \ + asn1_PA_DATA.x \ + asn1_PA_ENC_TS_ENC.x \ + asn1_Principal.x \ + asn1_PrincipalName.x \ + asn1_Realm.x \ + asn1_TGS_REP.x \ + asn1_TGS_REQ.x \ + asn1_Ticket.x \ + asn1_TicketFlags.x \ + asn1_TransitedEncoding.x \ + asn1_UNSIGNED.x noinst_PROGRAMS = asn1_compile asn1_print diff --git a/crypto/heimdal/lib/asn1/Makefile.in b/crypto/heimdal/lib/asn1/Makefile.in index 25acf1a..7652c10 100644 --- a/crypto/heimdal/lib/asn1/Makefile.in +++ b/crypto/heimdal/lib/asn1/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4a from Makefile.am -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-9, 2000 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -10,15 +10,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# $Id: Makefile.am,v 1.54 1999/12/21 17:03:42 assar Exp $ - - -# $Id: Makefile.am.common,v 1.3 1999/04/01 14:58:43 joda Exp $ - - -# $Id: Makefile.am.common,v 1.13 1999/11/01 03:19:58 assar Exp $ - - SHELL = @SHELL@ srcdir = @srcdir@ @@ -40,8 +31,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -54,9 +43,10 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : @@ -65,26 +55,39 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + +@SET_MAKE@ host_alias = @host_alias@ host_triplet = @host@ -AFS_EXTRA_LD = @AFS_EXTRA_LD@ AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@ +AMDEP = @AMDEP@ +AMTAR = @AMTAR@ +AS = @AS@ AWK = @AWK@ CANONICAL_HOST = @CANONICAL_HOST@ CATMAN = @CATMAN@ CATMANEXT = @CATMANEXT@ CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ DBLIB = @DBLIB@ +DEPDIR = @DEPDIR@ +DIR_des = @DIR_des@ +DIR_roken = @DIR_roken@ +DLLTOOL = @DLLTOOL@ EXEEXT = @EXEEXT@ EXTRA_LIB45 = @EXTRA_LIB45@ GROFF = @GROFF@ +INCLUDES_roken = @INCLUDES_roken@ INCLUDE_ = @INCLUDE_@ -LD = @LD@ LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBTOOL = @LIBTOOL@ LIB_ = @LIB_@ LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@ +LIB_des = @LIB_des@ +LIB_des_appl = @LIB_des_appl@ LIB_kdb = @LIB_kdb@ LIB_otp = @LIB_otp@ LIB_roken = @LIB_roken@ @@ -92,31 +95,43 @@ LIB_security = @LIB_security@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ -MAKE_X_PROGS_BIN_PROGS = @MAKE_X_PROGS_BIN_PROGS@ -MAKE_X_PROGS_BIN_SCRPTS = @MAKE_X_PROGS_BIN_SCRPTS@ -MAKE_X_PROGS_LIBEXEC_PROGS = @MAKE_X_PROGS_LIBEXEC_PROGS@ NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@ NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@ -NM = @NM@ NROFF = @NROFF@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ +STRIP = @STRIP@ VERSION = @VERSION@ VOID_RETSIGTYPE = @VOID_RETSIGTYPE@ WFLAGS = @WFLAGS@ WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@ WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@ YACC = @YACC@ +dpagaix_CFLAGS = @dpagaix_CFLAGS@ +dpagaix_LDADD = @dpagaix_LDADD@ +install_sh = @install_sh@ + +# $Id: Makefile.am,v 1.59 2001/01/30 01:46:53 assar Exp $ + + +# $Id: Makefile.am.common,v 1.3 1999/04/01 14:58:43 joda Exp $ + + +# $Id: Makefile.am.common,v 1.23 2000/12/05 09:11:09 joda Exp $ + AUTOMAKE_OPTIONS = foreign no-dependencies SUFFIXES = .et .h .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x -INCLUDES = -I$(top_builddir)/include +INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) AM_CFLAGS = $(WFLAGS) +CP = cp + COMPILE_ET = $(top_builddir)/lib/com_err/compile_et buildinclude = $(top_builddir)/include @@ -136,6 +151,7 @@ LIB_getsockopt = @LIB_getsockopt@ LIB_logout = @LIB_logout@ LIB_logwtmp = @LIB_logwtmp@ LIB_odm_initialize = @LIB_odm_initialize@ +LIB_pidfile = @LIB_pidfile@ LIB_readline = @LIB_readline@ LIB_res_search = @LIB_res_search@ LIB_setpcred = @LIB_setpcred@ @@ -144,6 +160,8 @@ LIB_socket = @LIB_socket@ LIB_syslog = @LIB_syslog@ LIB_tgetent = @LIB_tgetent@ +LIBS = @LIBS@ + HESIODLIB = @HESIODLIB@ HESIODINCLUDE = @HESIODINCLUDE@ INCLUDE_hesiod = @INCLUDE_hesiod@ @@ -152,36 +170,84 @@ LIB_hesiod = @LIB_hesiod@ INCLUDE_krb4 = @INCLUDE_krb4@ LIB_krb4 = @LIB_krb4@ +INCLUDE_openldap = @INCLUDE_openldap@ +LIB_openldap = @LIB_openldap@ + INCLUDE_readline = @INCLUDE_readline@ LEXLIB = @LEXLIB@ -cat1dir = $(mandir)/cat1 -cat3dir = $(mandir)/cat3 -cat5dir = $(mandir)/cat5 -cat8dir = $(mandir)/cat8 - -MANRX = \(.*\)\.\([0-9]\) -CATSUFFIX = @CATSUFFIX@ - NROFF_MAN = groff -mandoc -Tascii -@KRB4_TRUE@LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) +@KRB4_TRUE@LIB_kafs = @KRB4_TRUE@$(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) -@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la $(top_builddir)/lib/asn1/libasn1.la -@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la +@KRB5_TRUE@LIB_krb5 = @KRB5_TRUE@$(top_builddir)/lib/krb5/libkrb5.la \ +@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la +@KRB5_TRUE@LIB_gssapi = @KRB5_TRUE@$(top_builddir)/lib/gssapi/libgssapi.la CHECK_LOCAL = $(PROGRAMS) YFLAGS = -d lib_LTLIBRARIES = libasn1.la -libasn1_la_LDFLAGS = -version-info 1:4:0 - -BUILT_SOURCES = $(gen_files:.x=.c) asn1_err.h asn1_err.c - - -gen_files = asn1_APOptions.x asn1_AP_REP.x asn1_AP_REQ.x asn1_AS_REP.x asn1_AS_REQ.x asn1_Authenticator.x asn1_AuthorizationData.x asn1_Checksum.x asn1_EncAPRepPart.x asn1_EncASRepPart.x asn1_EncKDCRepPart.x asn1_EncKrbCredPart.x asn1_EncKrbPrivPart.x asn1_EncTGSRepPart.x asn1_EncTicketPart.x asn1_EncryptedData.x asn1_EncryptionKey.x asn1_ETYPE_INFO.x asn1_ETYPE_INFO_ENTRY.x asn1_HostAddress.x asn1_HostAddresses.x asn1_KDCOptions.x asn1_KDC_REP.x asn1_KDC_REQ.x asn1_KDC_REQ_BODY.x asn1_KRB_CRED.x asn1_KRB_ERROR.x asn1_KRB_PRIV.x asn1_KRB_SAFE.x asn1_KRB_SAFE_BODY.x asn1_KerberosTime.x asn1_KrbCredInfo.x asn1_LastReq.x asn1_METHOD_DATA.x asn1_PA_DATA.x asn1_PA_ENC_TS_ENC.x asn1_Principal.x asn1_PrincipalName.x asn1_Realm.x asn1_TGS_REP.x asn1_TGS_REQ.x asn1_Ticket.x asn1_TicketFlags.x asn1_TransitedEncoding.x +libasn1_la_LDFLAGS = -version-info 4:0:2 + +BUILT_SOURCES = \ + $(gen_files:.x=.c) \ + asn1_err.h \ + asn1_err.c + + +gen_files = \ + asn1_APOptions.x \ + asn1_AP_REP.x \ + asn1_AP_REQ.x \ + asn1_AS_REP.x \ + asn1_AS_REQ.x \ + asn1_Authenticator.x \ + asn1_AuthorizationData.x \ + asn1_CKSUMTYPE.x \ + asn1_Checksum.x \ + asn1_ETYPE_INFO.x \ + asn1_ETYPE_INFO_ENTRY.x \ + asn1_EncAPRepPart.x \ + asn1_EncASRepPart.x \ + asn1_EncKDCRepPart.x \ + asn1_EncKrbCredPart.x \ + asn1_EncKrbPrivPart.x \ + asn1_EncTGSRepPart.x \ + asn1_EncTicketPart.x \ + asn1_EncryptedData.x \ + asn1_EncryptionKey.x \ + asn1_HostAddress.x \ + asn1_HostAddresses.x \ + asn1_KDCOptions.x \ + asn1_KDC_REP.x \ + asn1_KDC_REQ.x \ + asn1_KDC_REQ_BODY.x \ + asn1_KRB_CRED.x \ + asn1_KRB_ERROR.x \ + asn1_KRB_PRIV.x \ + asn1_KRB_SAFE.x \ + asn1_KRB_SAFE_BODY.x \ + asn1_KerberosTime.x \ + asn1_KrbCredInfo.x \ + asn1_LastReq.x \ + asn1_MESSAGE_TYPE.x \ + asn1_METHOD_DATA.x \ + asn1_NAME_TYPE.x \ + asn1_PADATA_TYPE.x \ + asn1_PA_DATA.x \ + asn1_PA_ENC_TS_ENC.x \ + asn1_Principal.x \ + asn1_PrincipalName.x \ + asn1_Realm.x \ + asn1_TGS_REP.x \ + asn1_TGS_REQ.x \ + asn1_Ticket.x \ + asn1_TicketFlags.x \ + asn1_TransitedEncoding.x \ + asn1_UNSIGNED.x noinst_PROGRAMS = asn1_compile asn1_print @@ -189,26 +255,41 @@ check_PROGRAMS = check-der TESTS = check-der -asn1_compile_SOURCES = parse.y lex.l main.c hash.c symbol.c gen.c gen_encode.c gen_decode.c gen_free.c gen_length.c gen_copy.c gen_glue.c +asn1_compile_SOURCES = parse.y lex.l main.c hash.c symbol.c gen.c \ + gen_encode.c gen_decode.c gen_free.c gen_length.c gen_copy.c \ + gen_glue.c -libasn1_la_SOURCES = der_get.c der_put.c der_free.c der_length.c der_copy.c timegm.c $(BUILT_SOURCES) +libasn1_la_SOURCES = \ + der_get.c \ + der_put.c \ + der_free.c \ + der_length.c \ + der_copy.c \ + timegm.c \ + $(BUILT_SOURCES) -asn1_compile_LDADD = $(LIB_roken) $(LEXLIB) +asn1_compile_LDADD = \ + $(LIB_roken) $(LEXLIB) -check_der_LDADD = libasn1.la ../com_err/libcom_err.la $(LIB_roken) +check_der_LDADD = \ + libasn1.la \ + ../com_err/libcom_err.la \ + $(LIB_roken) asn1_print_LDADD = $(check_der_LDADD) -CLEANFILES = lex.c parse.c parse.h asn1.h $(BUILT_SOURCES) $(gen_files) asn1_files +CLEANFILES = lex.c parse.c parse.h asn1.h $(BUILT_SOURCES) \ + $(gen_files) asn1_files include_HEADERS = asn1.h asn1_err.h der.h EXTRA_DIST = asn1_err.et +subdir = lib/asn1 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../../include/config.h CONFIG_CLEAN_FILES = @@ -218,66 +299,72 @@ LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I../../include CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ libasn1_la_LIBADD = -libasn1_la_OBJECTS = der_get.lo der_put.lo der_free.lo der_length.lo \ +am_libasn1_la_OBJECTS = der_get.lo der_put.lo der_free.lo der_length.lo \ der_copy.lo timegm.lo asn1_APOptions.lo asn1_AP_REP.lo asn1_AP_REQ.lo \ asn1_AS_REP.lo asn1_AS_REQ.lo asn1_Authenticator.lo \ -asn1_AuthorizationData.lo asn1_Checksum.lo asn1_EncAPRepPart.lo \ +asn1_AuthorizationData.lo asn1_CKSUMTYPE.lo asn1_Checksum.lo \ +asn1_ETYPE_INFO.lo asn1_ETYPE_INFO_ENTRY.lo asn1_EncAPRepPart.lo \ asn1_EncASRepPart.lo asn1_EncKDCRepPart.lo asn1_EncKrbCredPart.lo \ asn1_EncKrbPrivPart.lo asn1_EncTGSRepPart.lo asn1_EncTicketPart.lo \ -asn1_EncryptedData.lo asn1_EncryptionKey.lo asn1_ETYPE_INFO.lo \ -asn1_ETYPE_INFO_ENTRY.lo asn1_HostAddress.lo asn1_HostAddresses.lo \ -asn1_KDCOptions.lo asn1_KDC_REP.lo asn1_KDC_REQ.lo asn1_KDC_REQ_BODY.lo \ -asn1_KRB_CRED.lo asn1_KRB_ERROR.lo asn1_KRB_PRIV.lo asn1_KRB_SAFE.lo \ -asn1_KRB_SAFE_BODY.lo asn1_KerberosTime.lo asn1_KrbCredInfo.lo \ -asn1_LastReq.lo asn1_METHOD_DATA.lo asn1_PA_DATA.lo \ -asn1_PA_ENC_TS_ENC.lo asn1_Principal.lo asn1_PrincipalName.lo \ -asn1_Realm.lo asn1_TGS_REP.lo asn1_TGS_REQ.lo asn1_Ticket.lo \ -asn1_TicketFlags.lo asn1_TransitedEncoding.lo asn1_err.lo +asn1_EncryptedData.lo asn1_EncryptionKey.lo asn1_HostAddress.lo \ +asn1_HostAddresses.lo asn1_KDCOptions.lo asn1_KDC_REP.lo \ +asn1_KDC_REQ.lo asn1_KDC_REQ_BODY.lo asn1_KRB_CRED.lo asn1_KRB_ERROR.lo \ +asn1_KRB_PRIV.lo asn1_KRB_SAFE.lo asn1_KRB_SAFE_BODY.lo \ +asn1_KerberosTime.lo asn1_KrbCredInfo.lo asn1_LastReq.lo \ +asn1_MESSAGE_TYPE.lo asn1_METHOD_DATA.lo asn1_NAME_TYPE.lo \ +asn1_PADATA_TYPE.lo asn1_PA_DATA.lo asn1_PA_ENC_TS_ENC.lo \ +asn1_Principal.lo asn1_PrincipalName.lo asn1_Realm.lo asn1_TGS_REP.lo \ +asn1_TGS_REQ.lo asn1_Ticket.lo asn1_TicketFlags.lo \ +asn1_TransitedEncoding.lo asn1_UNSIGNED.lo asn1_err.lo +libasn1_la_OBJECTS = $(am_libasn1_la_OBJECTS) check_PROGRAMS = check-der$(EXEEXT) noinst_PROGRAMS = asn1_compile$(EXEEXT) asn1_print$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) -check_der_SOURCES = check-der.c -check_der_OBJECTS = check-der.$(OBJEXT) -check_der_DEPENDENCIES = libasn1.la ../com_err/libcom_err.la -check_der_LDFLAGS = -asn1_compile_OBJECTS = parse.$(OBJEXT) lex.$(OBJEXT) main.$(OBJEXT) \ +am_asn1_compile_OBJECTS = parse.$(OBJEXT) lex.$(OBJEXT) main.$(OBJEXT) \ hash.$(OBJEXT) symbol.$(OBJEXT) gen.$(OBJEXT) gen_encode.$(OBJEXT) \ gen_decode.$(OBJEXT) gen_free.$(OBJEXT) gen_length.$(OBJEXT) \ gen_copy.$(OBJEXT) gen_glue.$(OBJEXT) +asn1_compile_OBJECTS = $(am_asn1_compile_OBJECTS) asn1_compile_DEPENDENCIES = asn1_compile_LDFLAGS = asn1_print_SOURCES = asn1_print.c asn1_print_OBJECTS = asn1_print.$(OBJEXT) asn1_print_DEPENDENCIES = libasn1.la ../com_err/libcom_err.la asn1_print_LDFLAGS = -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -CFLAGS = @CFLAGS@ +check_der_SOURCES = check-der.c +check_der_OBJECTS = check-der.$(OBJEXT) +check_der_DEPENDENCIES = libasn1.la ../com_err/libcom_err.la +check_der_LDFLAGS = COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CFLAGS = @CFLAGS@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libasn1_la_SOURCES) $(asn1_compile_SOURCES) \ +asn1_print.c check-der.c HEADERS = $(include_HEADERS) -DIST_COMMON = Makefile.am Makefile.in lex.c parse.c +depcomp = +DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in lex.c parse.c \ +parse.h -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar GZIP_ENV = --best -SOURCES = $(libasn1_la_SOURCES) check-der.c $(asn1_compile_SOURCES) asn1_print.c -OBJECTS = $(libasn1_la_OBJECTS) check-der.$(OBJEXT) $(asn1_compile_OBJECTS) asn1_print.$(OBJEXT) +SOURCES = $(libasn1_la_SOURCES) $(asn1_compile_SOURCES) asn1_print.c check-der.c +OBJECTS = $(am_libasn1_la_OBJECTS) $(am_asn1_compile_OBJECTS) asn1_print.$(OBJEXT) check-der.$(OBJEXT) all: all-redirect .SUFFIXES: -.SUFFIXES: .1 .3 .5 .8 .S .c .cat1 .cat3 .cat5 .cat8 .et .h .l .lo .o .obj .s .x .y +.SUFFIXES: .1 .3 .5 .8 .c .cat1 .cat3 .cat5 .cat8 .et .h .l .lo .o .obj .x .y $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/asn1/Makefile @@ -300,31 +387,18 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ done -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - mostlyclean-compile: -rm -f *.o core *.core -rm -f *.$(OBJEXT) @@ -336,15 +410,6 @@ distclean-compile: maintainer-clean-compile: -.c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - mostlyclean-libtool: -rm -f *.lo @@ -376,10 +441,6 @@ distclean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS: -check-der$(EXEEXT): $(check_der_OBJECTS) $(check_der_DEPENDENCIES) - @rm -f check-der$(EXEEXT) - $(LINK) $(check_der_LDFLAGS) $(check_der_OBJECTS) $(check_der_LDADD) $(LIBS) - asn1_compile$(EXEEXT): $(asn1_compile_OBJECTS) $(asn1_compile_DEPENDENCIES) @rm -f asn1_compile$(EXEEXT) $(LINK) $(asn1_compile_LDFLAGS) $(asn1_compile_OBJECTS) $(asn1_compile_LDADD) $(LIBS) @@ -387,6 +448,16 @@ asn1_compile$(EXEEXT): $(asn1_compile_OBJECTS) $(asn1_compile_DEPENDENCIES) asn1_print$(EXEEXT): $(asn1_print_OBJECTS) $(asn1_print_DEPENDENCIES) @rm -f asn1_print$(EXEEXT) $(LINK) $(asn1_print_LDFLAGS) $(asn1_print_OBJECTS) $(asn1_print_LDADD) $(LIBS) + +check-der$(EXEEXT): $(check_der_OBJECTS) $(check_der_DEPENDENCIES) + @rm -f check-der$(EXEEXT) + $(LINK) $(check_der_LDFLAGS) $(check_der_OBJECTS) $(check_der_LDADD) $(LIBS) +.c.o: + $(COMPILE) -c $< +.c.obj: + $(COMPILE) -c `cygpath -w $<` +.c.lo: + $(LTCOMPILE) -c -o $@ $< .l.c: $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ .y.c: @@ -402,35 +473,42 @@ install-includeHEADERS: $(include_HEADERS) $(mkinstalldirs) $(DESTDIR)$(includedir) @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ - echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ - $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$f; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) - list='$(include_HEADERS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(includedir)/$$p; \ + @list='$(include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ + rm -f $(DESTDIR)$(includedir)/$$f; \ done tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) mostlyclean-tags: @@ -440,48 +518,76 @@ distclean-tags: -rm -f TAGS ID maintainer-clean-tags: +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -subdir = lib/asn1 - distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ else \ test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook -check-TESTS: $(TESTS) - @failed=0; all=0; \ - srcdir=$(srcdir); export srcdir; \ - for tst in $(TESTS); do \ - if test -f $$tst; then dir=.; \ - else dir="$(srcdir)"; fi; \ - if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \ - all=`expr $$all + 1`; \ - echo "PASS: $$tst"; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="$$failed of $$all tests failed"; \ - fi; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0 info-am: info: info-am dvi-am: @@ -508,7 +614,7 @@ uninstall: uninstall-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) all-local all-redirect: all-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) @@ -523,7 +629,8 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: - -test -z "lexlparsehparsec$(BUILT_SOURCES)" || rm -f lexl parseh parsec $(BUILT_SOURCES) + -rm -f Makefile.in + -test -z "lex.cparse.hparse.c$(BUILT_SOURCES)" || rm -f lex.c parse.h parse.c $(BUILT_SOURCES) mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ mostlyclean-libtool mostlyclean-checkPROGRAMS \ mostlyclean-noinstPROGRAMS mostlyclean-tags \ @@ -566,12 +673,13 @@ maintainer-clean-checkPROGRAMS mostlyclean-noinstPROGRAMS \ distclean-noinstPROGRAMS clean-noinstPROGRAMS \ maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \ install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir check-TESTS info-am info dvi-am dvi \ +maintainer-clean-tags check-TESTS distdir info-am info dvi-am dvi \ check-local check check-am installcheck-am installcheck install-exec-am \ install-exec install-data-local install-data-am install-data install-am \ install uninstall-am uninstall all-local all-redirect all-am all \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +install-strip installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean install-suid-programs: @@ -579,7 +687,10 @@ install-suid-programs: for file in $$foo; do \ x=$(DESTDIR)$(bindir)/$$file; \ if chown 0:0 $$x && chmod u+s $$x; then :; else \ - chmod 0 $$x; fi; done + echo "*"; \ + echo "* Failed to install $$x setuid root"; \ + echo "*"; \ + fi; done install-exec-hook: install-suid-programs @@ -591,8 +702,8 @@ install-build-headers:: $(include_HEADERS) $(build_HEADERZ) else file="$$f"; fi; \ if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \ : ; else \ - echo " cp $$file $(buildinclude)/$$f"; \ - cp $$file $(buildinclude)/$$f; \ + echo " $(CP) $$file $(buildinclude)/$$f"; \ + $(CP) $$file $(buildinclude)/$$f; \ fi ; \ done @@ -661,87 +772,8 @@ dist-cat8-mans: dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans -install-cat1-mans: - @ext=1;\ - foo='$(man1_MANS)'; \ - bar='$(man_MANS)'; \ - for i in $$bar; do \ - case $$i in \ - *.1) foo="$$foo $$i";; \ - esac; done; \ - if test "$$foo"; then \ - $(mkinstalldirs) $(DESTDIR)$(cat1dir); \ - for x in $$foo; do \ - f=`echo $$x | sed 's/\.[^.]*$$/.cat1/'`; \ - if test -f "$(srcdir)/$$f"; then \ - b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ - echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX)";\ - $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX);\ - fi; \ - done ;\ - fi - -install-cat3-mans: - @ext=3;\ - foo='$(man3_MANS)'; \ - bar='$(man_MANS)'; \ - for i in $$bar; do \ - case $$i in \ - *.3) foo="$$foo $$i";; \ - esac; done; \ - if test "$$foo"; then \ - $(mkinstalldirs) $(DESTDIR)$(cat3dir); \ - for x in $$foo; do \ - f=`echo $$x | sed 's/\.[^.]*$$/.cat3/'`; \ - if test -f "$(srcdir)/$$f"; then \ - b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ - echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX)";\ - $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX);\ - fi; \ - done ;\ - fi - -install-cat5-mans: - @ext=5;\ - foo='$(man5_MANS)'; \ - bar='$(man_MANS)'; \ - for i in $$bar; do \ - case $$i in \ - *.5) foo="$$foo $$i";; \ - esac; done; \ - if test "$$foo"; then \ - $(mkinstalldirs) $(DESTDIR)$(cat5dir); \ - for x in $$foo; do \ - f=`echo $$x | sed 's/\.[^.]*$$/.cat5/'`; \ - if test -f "$(srcdir)/$$f"; then \ - b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ - echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX)";\ - $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX);\ - fi; \ - done ;\ - fi - -install-cat8-mans: - @ext=8;\ - foo='$(man8_MANS)'; \ - bar='$(man_MANS)'; \ - for i in $$bar; do \ - case $$i in \ - *.8) foo="$$foo $$i";; \ - esac; done; \ - if test "$$foo"; then \ - $(mkinstalldirs) $(DESTDIR)$(cat8dir); \ - for x in $$foo; do \ - f=`echo $$x | sed 's/\.[^.]*$$/.cat8/'`; \ - if test -f "$(srcdir)/$$f"; then \ - b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ - echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX)";\ - $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX);\ - fi; \ - done ;\ - fi - -install-cat-mans: install-cat1-mans install-cat3-mans install-cat5-mans install-cat8-mans +install-cat-mans: + $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) install-data-local: install-cat-mans diff --git a/crypto/heimdal/lib/asn1/asn1-common.h b/crypto/heimdal/lib/asn1/asn1-common.h new file mode 100644 index 0000000..d3a30f2 --- /dev/null +++ b/crypto/heimdal/lib/asn1/asn1-common.h @@ -0,0 +1,16 @@ +/* $Id: asn1-common.h,v 1.1 2000/04/14 15:41:31 joda Exp $ */ + +#include <stddef.h> +#include <time.h> + +#ifndef __asn1_common_definitions__ +#define __asn1_common_definitions__ + +typedef struct octet_string { + size_t length; + void *data; +} octet_string; + +typedef char *general_string; + +#endif diff --git a/crypto/heimdal/lib/asn1/asn1_print.c b/crypto/heimdal/lib/asn1/asn1_print.c index 92e6419..e66ac22 100644 --- a/crypto/heimdal/lib/asn1/asn1_print.c +++ b/crypto/heimdal/lib/asn1/asn1_print.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -37,7 +37,7 @@ #include <getarg.h> #include <err.h> -RCSID("$Id: asn1_print.c,v 1.5 1999/12/02 17:05:01 joda Exp $"); +RCSID("$Id: asn1_print.c,v 1.6 2000/12/29 03:34:16 assar Exp $"); static struct et_list *et_list; @@ -99,6 +99,9 @@ loop (unsigned char *buf, size_t len, int indent) ret = der_get_tag (buf, len, &class, &type, &tag, &sz); if (ret) errx (1, "der_get_tag: %s", com_right (et_list, ret)); + if (sz > len) + errx (1, "unreasonable length (%u) > %u", + (unsigned)sz, (unsigned)len); buf += sz; len -= sz; for (i = 0; i < indent; ++i) diff --git a/crypto/heimdal/lib/asn1/der.h b/crypto/heimdal/lib/asn1/der.h index 37158af..f031f81 100644 --- a/crypto/heimdal/lib/asn1/der.h +++ b/crypto/heimdal/lib/asn1/der.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: der.h,v 1.18 1999/12/02 17:05:01 joda Exp $ */ +/* $Id: der.h,v 1.20 2001/01/29 08:31:27 assar Exp $ */ #ifndef __DER_H__ #define __DER_H__ @@ -66,7 +66,7 @@ enum { time_t timegm (struct tm *); #endif -void time2generalizedtime (time_t t, octet_string *s); +int time2generalizedtime (time_t t, octet_string *s); int der_get_int (const unsigned char *p, size_t len, int *ret, size_t *size); int der_get_length (const unsigned char *p, size_t len, @@ -87,6 +87,7 @@ int der_match_tag_and_length (const unsigned char *p, size_t len, size_t *length_ret, size_t *size); int decode_integer (const unsigned char*, size_t, int*, size_t*); +int decode_unsigned (const unsigned char*, size_t, unsigned*, size_t*); int decode_general_string (const unsigned char*, size_t, general_string*, size_t*); int decode_octet_string (const unsigned char*, size_t, octet_string*, size_t*); @@ -105,6 +106,8 @@ int der_put_length_and_tag (unsigned char*, size_t, size_t, int encode_integer (unsigned char *p, size_t len, const int *data, size_t*); +int encode_unsigned (unsigned char *p, size_t len, + const unsigned *data, size_t*); int encode_general_string (unsigned char *p, size_t len, const general_string *data, size_t*); int encode_octet_string (unsigned char *p, size_t len, @@ -119,6 +122,7 @@ void free_generalized_time (time_t *t); size_t length_len (size_t len); size_t length_integer (const int *data); +size_t length_unsigned (const unsigned *data); size_t length_general_string (const general_string *data); size_t length_octet_string (const octet_string *k); size_t length_generalized_time (const time_t *t); diff --git a/crypto/heimdal/lib/asn1/der_get.c b/crypto/heimdal/lib/asn1/der_get.c index 9f0616b..1a180da 100644 --- a/crypto/heimdal/lib/asn1/der_get.c +++ b/crypto/heimdal/lib/asn1/der_get.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "der_locl.h" -RCSID("$Id: der_get.c,v 1.27 1999/12/02 17:05:01 joda Exp $"); +RCSID("$Id: der_get.c,v 1.28 2000/04/06 17:19:53 assar Exp $"); #include <version.h> @@ -225,6 +225,33 @@ decode_integer (const unsigned char *p, size_t len, } int +decode_unsigned (const unsigned char *p, size_t len, + unsigned *num, size_t *size) +{ + size_t ret = 0; + size_t l, reallen; + int e; + + e = der_match_tag (p, len, UNIV, PRIM, UT_Integer, &l); + if (e) return e; + p += l; + len -= l; + ret += l; + e = der_get_length (p, len, &reallen, &l); + if (e) return e; + p += l; + len -= l; + ret += l; + e = der_get_unsigned (p, reallen, num, &l); + if (e) return e; + p += l; + len -= l; + ret += l; + if(size) *size = ret; + return 0; +} + +int decode_general_string (const unsigned char *p, size_t len, general_string *str, size_t *size) { diff --git a/crypto/heimdal/lib/asn1/der_length.c b/crypto/heimdal/lib/asn1/der_length.c index 5db95ba..d488f8f 100644 --- a/crypto/heimdal/lib/asn1/der_length.c +++ b/crypto/heimdal/lib/asn1/der_length.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,10 +33,10 @@ #include "der_locl.h" -RCSID("$Id: der_length.c,v 1.10 1999/12/02 17:05:01 joda Exp $"); +RCSID("$Id: der_length.c,v 1.11 2000/04/06 17:20:26 assar Exp $"); static size_t -length_unsigned (unsigned val) +len_unsigned (unsigned val) { size_t ret = 0; @@ -48,7 +48,7 @@ length_unsigned (unsigned val) } static size_t -length_int (int val) +len_int (int val) { size_t ret = 0; @@ -73,13 +73,21 @@ length_len (size_t len) if (len < 128) return 1; else - return length_unsigned (len) + 1; + return len_unsigned (len) + 1; } size_t length_integer (const int *data) { - size_t len = length_int (*data); + size_t len = len_int (*data); + + return 1 + length_len(len) + len; +} + +size_t +length_unsigned (const unsigned *data) +{ + size_t len = len_unsigned (*data); return 1 + length_len(len) + len; } diff --git a/crypto/heimdal/lib/asn1/der_put.c b/crypto/heimdal/lib/asn1/der_put.c index ce21654..1eda917 100644 --- a/crypto/heimdal/lib/asn1/der_put.c +++ b/crypto/heimdal/lib/asn1/der_put.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "der_locl.h" -RCSID("$Id: der_put.c,v 1.22 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: der_put.c,v 1.24 2001/01/29 08:31:27 assar Exp $"); /* * All encoding functions take a pointer `p' to first position in @@ -221,6 +221,31 @@ encode_integer (unsigned char *p, size_t len, const int *data, size_t *size) } int +encode_unsigned (unsigned char *p, size_t len, const unsigned *data, + size_t *size) +{ + unsigned num = *data; + size_t ret = 0; + size_t l; + int e; + + e = der_put_unsigned (p, len, num, &l); + if(e) + return e; + p -= l; + len -= l; + ret += l; + e = der_put_length_and_tag (p, len, l, UNIV, PRIM, UT_Integer, &l); + if (e) + return e; + p -= l; + len -= l; + ret += l; + *size = ret; + return 0; +} + +int encode_general_string (unsigned char *p, size_t len, const general_string *data, size_t *size) { @@ -268,17 +293,20 @@ encode_octet_string (unsigned char *p, size_t len, return 0; } -void +int time2generalizedtime (time_t t, octet_string *s) { struct tm *tm; s->data = malloc(16); + if (s->data == NULL) + return ENOMEM; s->length = 15; tm = gmtime (&t); sprintf (s->data, "%04d%02d%02d%02d%02d%02dZ", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); + return 0; } int @@ -290,7 +318,9 @@ encode_generalized_time (unsigned char *p, size_t len, octet_string k; int e; - time2generalizedtime (*t, &k); + e = time2generalizedtime (*t, &k); + if (e) + return e; e = der_put_octet_string (p, len, &k, &l); free (k.data); if (e) diff --git a/crypto/heimdal/lib/asn1/gen.c b/crypto/heimdal/lib/asn1/gen.c index bca4516..54212d9 100644 --- a/crypto/heimdal/lib/asn1/gen.c +++ b/crypto/heimdal/lib/asn1/gen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,18 +33,24 @@ #include "gen_locl.h" -RCSID("$Id: gen.c,v 1.41 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: gen.c,v 1.44 2000/06/19 15:17:52 joda Exp $"); FILE *headerfile, *codefile, *logfile; #define STEM "asn1" -static char *orig_filename; +static const char *orig_filename; static char header[1024]; static char headerbase[1024] = STEM; +const char * +filename (void) +{ + return orig_filename; +} + void -init_generate (char *filename, char *base) +init_generate (const char *filename, const char *base) { orig_filename = filename; if(base) @@ -91,7 +97,7 @@ init_generate (char *filename, char *base) } void -close_generate () +close_generate (void) { fprintf (headerfile, "#endif /* __%s_h__ */\n", headerbase); @@ -126,6 +132,10 @@ define_asn1 (int level, Type *t) space(level); fprintf (headerfile, "INTEGER"); break; + case TUInteger: + space(level); + fprintf (headerfile, "UNSIGNED INTEGER"); + break; case TOctetString: space(level); fprintf (headerfile, "OCTET STRING"); @@ -217,7 +227,21 @@ define_type (int level, char *name, Type *t, int typedefp) break; case TInteger: space(level); - fprintf (headerfile, "int %s;\n", name); + if(t->members == NULL) { + fprintf (headerfile, "int %s;\n", name); + } else { + Member *m; + int tag = -1; + fprintf (headerfile, "enum %s {\n", typedefp ? name : ""); + for (m = t->members; m && m->val != tag; m = m->next) { + if(tag == -1) + tag = m->val; + space (level + 1); + fprintf(headerfile, "%s = %d%s\n", m->gen_name, m->val, + m->next->val == tag ? "" : ","); + } + fprintf (headerfile, "} %s;\n", name); + } break; case TUInteger: space(level); diff --git a/crypto/heimdal/lib/asn1/gen_copy.c b/crypto/heimdal/lib/asn1/gen_copy.c index f9aa489..7d414a9 100644 --- a/crypto/heimdal/lib/asn1/gen_copy.c +++ b/crypto/heimdal/lib/asn1/gen_copy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "gen_locl.h" -RCSID("$Id: gen_copy.c,v 1.10 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: gen_copy.c,v 1.11 2000/04/06 17:22:05 assar Exp $"); static void copy_primitive (const char *typename, const char *from, const char *to) @@ -54,6 +54,7 @@ copy_type (const char *from, const char *to, const Type *t) t->symbol->gen_name, from, to); break; case TInteger: + case TUInteger: fprintf(codefile, "*(%s) = *(%s);\n", to, from); break; case TOctetString: diff --git a/crypto/heimdal/lib/asn1/gen_decode.c b/crypto/heimdal/lib/asn1/gen_decode.c index 078ac44..bed19a9 100644 --- a/crypto/heimdal/lib/asn1/gen_decode.c +++ b/crypto/heimdal/lib/asn1/gen_decode.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "gen_locl.h" -RCSID("$Id: gen_decode.c,v 1.11 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: gen_decode.c,v 1.15 2001/01/29 08:36:45 assar Exp $"); static void decode_primitive (const char *typename, const char *name) @@ -48,215 +48,228 @@ decode_primitive (const char *typename, const char *name) static void decode_type (const char *name, const Type *t) { - switch (t->type) { - case TType: + switch (t->type) { + case TType: #if 0 - decode_type (name, t->symbol->type); + decode_type (name, t->symbol->type); #endif - fprintf (codefile, - "e = decode_%s(p, len, %s, &l);\n" - "FORW;\n", - t->symbol->gen_name, name); - break; - case TInteger: - decode_primitive ("integer", name); - break; - case TOctetString: - decode_primitive ("octet_string", name); - break; - case TBitString: { - Member *m; - int tag = -1; - int pos; + fprintf (codefile, + "e = decode_%s(p, len, %s, &l);\n" + "FORW;\n", + t->symbol->gen_name, name); + break; + case TInteger: + if(t->members == NULL) + decode_primitive ("integer", name); + else { + char *s; + asprintf(&s, "(int*)%s", name); + if(s == NULL) + errx (1, "out of memory"); + decode_primitive ("integer", s); + free(s); + } + break; + case TUInteger: + decode_primitive ("unsigned", name); + break; + case TOctetString: + decode_primitive ("octet_string", name); + break; + case TBitString: { + Member *m; + int tag = -1; + int pos; - fprintf (codefile, - "e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString," - "&reallen, &l);\n" - "FORW;\n" - "if(len < reallen)\n" - "return ASN1_OVERRUN;\n" - "p++;\n" - "len--;\n" - "reallen--;\n" - "ret++;\n"); - pos = 0; - for (m = t->members; m && tag != m->val; m = m->next) { - while (m->val / 8 > pos / 8) { fprintf (codefile, - "p++; len--; reallen--; ret++;\n"); - pos += 8; - } - fprintf (codefile, - "%s->%s = (*p >> %d) & 1;\n", - name, m->gen_name, 7 - m->val % 8); - if (tag == -1) - tag = m->val; + "e = der_match_tag_and_length (p, len, UNIV, PRIM, UT_BitString," + "&reallen, &l);\n" + "FORW;\n" + "if(len < reallen)\n" + "return ASN1_OVERRUN;\n" + "p++;\n" + "len--;\n" + "reallen--;\n" + "ret++;\n"); + pos = 0; + for (m = t->members; m && tag != m->val; m = m->next) { + while (m->val / 8 > pos / 8) { + fprintf (codefile, + "p++; len--; reallen--; ret++;\n"); + pos += 8; + } + fprintf (codefile, + "%s->%s = (*p >> %d) & 1;\n", + name, m->gen_name, 7 - m->val % 8); + if (tag == -1) + tag = m->val; + } + fprintf (codefile, + "p += reallen; len -= reallen; ret += reallen;\n"); + break; } - fprintf (codefile, - "p += reallen; len -= reallen; ret += reallen;\n"); - break; - } - case TSequence: { - Member *m; - int tag = -1; + case TSequence: { + Member *m; + int tag = -1; - if (t->members == NULL) - break; + if (t->members == NULL) + break; - fprintf (codefile, - "e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence," - "&reallen, &l);\n" - "FORW;\n" - "{\n" - "int dce_fix;\n" - "if((dce_fix = fix_dce(reallen, &len)) < 0)\n" - "return ASN1_BAD_FORMAT;\n"); + fprintf (codefile, + "e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence," + "&reallen, &l);\n" + "FORW;\n" + "{\n" + "int dce_fix;\n" + "if((dce_fix = fix_dce(reallen, &len)) < 0)\n" + "return ASN1_BAD_FORMAT;\n"); - for (m = t->members; m && tag != m->val; m = m->next) { - char *s; + for (m = t->members; m && tag != m->val; m = m->next) { + char *s; - asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name); - if (0 && m->type->type == TType){ - if(m->optional) - fprintf (codefile, - "%s = malloc(sizeof(*%s));\n", s, s); - fprintf (codefile, - "e = decode_seq_%s(p, len, %d, %d, %s, &l);\n", - m->type->symbol->gen_name, - m->val, - m->optional, - s); - if(m->optional) - fprintf (codefile, - "if (e == ASN1_MISSING_FIELD) {\n" - "free(%s);\n" - "%s = NULL;\n" - "e = l = 0;\n" - "}\n", - s, s); + asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name); + if (0 && m->type->type == TType){ + if(m->optional) + fprintf (codefile, + "%s = malloc(sizeof(*%s));\n" + "if(%s == NULL) return ENOMEM;\n", s, s, s); + fprintf (codefile, + "e = decode_seq_%s(p, len, %d, %d, %s, &l);\n", + m->type->symbol->gen_name, + m->val, + m->optional, + s); + if(m->optional) + fprintf (codefile, + "if (e == ASN1_MISSING_FIELD) {\n" + "free(%s);\n" + "%s = NULL;\n" + "e = l = 0;\n" + "}\n", + s, s); - fprintf (codefile, "FORW;\n"); + fprintf (codefile, "FORW;\n"); - }else{ - fprintf (codefile, "{\n" - "size_t newlen, oldlen;\n\n" - "e = der_match_tag (p, len, CONTEXT, CONS, %d, &l);\n", - m->val); - fprintf (codefile, - "if (e)\n"); - if(m->optional) - /* XXX should look at e */ - fprintf (codefile, - "%s = NULL;\n", s); - else - fprintf (codefile, - "return e;\n"); - fprintf (codefile, - "else {\n"); - fprintf (codefile, - "p += l;\n" - "len -= l;\n" - "ret += l;\n" - "e = der_get_length (p, len, &newlen, &l);\n" - "FORW;\n" - "{\n" + }else{ + fprintf (codefile, "{\n" + "size_t newlen, oldlen;\n\n" + "e = der_match_tag (p, len, CONTEXT, CONS, %d, &l);\n", + m->val); + fprintf (codefile, + "if (e)\n"); + if(m->optional) + /* XXX should look at e */ + fprintf (codefile, + "%s = NULL;\n", s); + else + fprintf (codefile, + "return e;\n"); + fprintf (codefile, + "else {\n"); + fprintf (codefile, + "p += l;\n" + "len -= l;\n" + "ret += l;\n" + "e = der_get_length (p, len, &newlen, &l);\n" + "FORW;\n" + "{\n" - "int dce_fix;\n" - "oldlen = len;\n" - "if((dce_fix = fix_dce(newlen, &len)) < 0)" - "return ASN1_BAD_FORMAT;\n"); - if (m->optional) - fprintf (codefile, - "%s = malloc(sizeof(*%s));\n", - s, s); - decode_type (s, m->type); - fprintf (codefile, - "if(dce_fix){\n" - "e = der_match_tag_and_length (p, len, " - "(Der_class)0, (Der_type)0, 0, &reallen, &l);\n" - "FORW;\n" - "}else \n" - "len = oldlen - newlen;\n" - "}\n" - "}\n"); - fprintf (codefile, - "}\n"); - } - if (tag == -1) - tag = m->val; - free (s); - } - fprintf(codefile, - "if(dce_fix){\n" - "e = der_match_tag_and_length (p, len, " - "(Der_class)0, (Der_type)0, 0, &reallen, &l);\n" - "FORW;\n" - "}\n" - "}\n"); + "int dce_fix;\n" + "oldlen = len;\n" + "if((dce_fix = fix_dce(newlen, &len)) < 0)" + "return ASN1_BAD_FORMAT;\n"); + if (m->optional) + fprintf (codefile, + "%s = malloc(sizeof(*%s));\n" + "if(%s == NULL) return ENOMEM;\n", s, s, s); + decode_type (s, m->type); + fprintf (codefile, + "if(dce_fix){\n" + "e = der_match_tag_and_length (p, len, " + "(Der_class)0, (Der_type)0, 0, &reallen, &l);\n" + "FORW;\n" + "}else \n" + "len = oldlen - newlen;\n" + "}\n" + "}\n"); + fprintf (codefile, + "}\n"); + } + if (tag == -1) + tag = m->val; + free (s); + } + fprintf(codefile, + "if(dce_fix){\n" + "e = der_match_tag_and_length (p, len, " + "(Der_class)0, (Der_type)0, 0, &reallen, &l);\n" + "FORW;\n" + "}\n" + "}\n"); - break; - } - case TSequenceOf: { - char *n; + break; + } + case TSequenceOf: { + char *n; - fprintf (codefile, - "e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence," - "&reallen, &l);\n" - "FORW;\n" - "if(len < reallen)\n" - "return ASN1_OVERRUN;\n" - "len = reallen;\n"); + fprintf (codefile, + "e = der_match_tag_and_length (p, len, UNIV, CONS, UT_Sequence," + "&reallen, &l);\n" + "FORW;\n" + "if(len < reallen)\n" + "return ASN1_OVERRUN;\n" + "len = reallen;\n"); - fprintf (codefile, - "{\n" - "size_t origlen = len;\n" - "int oldret = ret;\n" - "ret = 0;\n" - "(%s)->len = 0;\n" - "(%s)->val = NULL;\n" - "while(ret < origlen) {\n" - "(%s)->len++;\n" - "(%s)->val = realloc((%s)->val, sizeof(*((%s)->val)) * (%s)->len);\n", - name, name, name, name, name, name, name); - asprintf (&n, "&(%s)->val[(%s)->len-1]", name, name); - decode_type (n, t->subtype); - fprintf (codefile, - "len = origlen - ret;\n" - "}\n" - "ret += oldret;\n" - "}\n"); - free (n); - break; - } - case TGeneralizedTime: - decode_primitive ("generalized_time", name); - break; - case TGeneralString: - decode_primitive ("general_string", name); - break; - case TApplication: - fprintf (codefile, - "e = der_match_tag_and_length (p, len, APPL, CONS, %d, " - "&reallen, &l);\n" - "FORW;\n" - "{\n" - "int dce_fix;\n" - "if((dce_fix = fix_dce(reallen, &len)) < 0)\n" - "return ASN1_BAD_FORMAT;\n", - t->application); - decode_type (name, t->subtype); - fprintf(codefile, - "if(dce_fix){\n" - "e = der_match_tag_and_length (p, len, " - "(Der_class)0, (Der_type)0, 0, &reallen, &l);\n" - "FORW;\n" - "}\n" - "}\n"); + fprintf (codefile, + "{\n" + "size_t origlen = len;\n" + "int oldret = ret;\n" + "ret = 0;\n" + "(%s)->len = 0;\n" + "(%s)->val = NULL;\n" + "while(ret < origlen) {\n" + "(%s)->len++;\n" + "(%s)->val = realloc((%s)->val, sizeof(*((%s)->val)) * (%s)->len);\n", + name, name, name, name, name, name, name); + asprintf (&n, "&(%s)->val[(%s)->len-1]", name, name); + decode_type (n, t->subtype); + fprintf (codefile, + "len = origlen - ret;\n" + "}\n" + "ret += oldret;\n" + "}\n"); + free (n); + break; + } + case TGeneralizedTime: + decode_primitive ("generalized_time", name); + break; + case TGeneralString: + decode_primitive ("general_string", name); + break; + case TApplication: + fprintf (codefile, + "e = der_match_tag_and_length (p, len, APPL, CONS, %d, " + "&reallen, &l);\n" + "FORW;\n" + "{\n" + "int dce_fix;\n" + "if((dce_fix = fix_dce(reallen, &len)) < 0)\n" + "return ASN1_BAD_FORMAT;\n", + t->application); + decode_type (name, t->subtype); + fprintf(codefile, + "if(dce_fix){\n" + "e = der_match_tag_and_length (p, len, " + "(Der_class)0, (Der_type)0, 0, &reallen, &l);\n" + "FORW;\n" + "}\n" + "}\n"); - break; - default : - abort (); - } + break; + default : + abort (); + } } void @@ -282,17 +295,10 @@ generate_type_decode (const Symbol *s) switch (s->type->type) { case TInteger: - fprintf (codefile, "return decode_integer (p, len, data, size);\n"); - break; + case TUInteger: case TOctetString: - fprintf (codefile, "return decode_octet_string (p, len, data, size);\n"); - break; case TGeneralizedTime: - fprintf (codefile, "return decode_generalized_time (p, len, data, size);\n"); - break; case TGeneralString: - fprintf (codefile, "return decode_general_string (p, len, data, size);\n"); - break; case TBitString: case TSequence: case TSequenceOf: @@ -303,6 +309,7 @@ generate_type_decode (const Symbol *s) "size_t l;\n" "int i, e;\n\n"); fprintf(codefile, "i = 0;\n"); /* hack to avoid `unused variable' */ + fprintf(codefile, "reallen = 0;\n"); /* hack to avoid `unused variable' */ decode_type ("data", s->type); fprintf (codefile, diff --git a/crypto/heimdal/lib/asn1/gen_encode.c b/crypto/heimdal/lib/asn1/gen_encode.c index 9e9b293..367ca37 100644 --- a/crypto/heimdal/lib/asn1/gen_encode.c +++ b/crypto/heimdal/lib/asn1/gen_encode.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "gen_locl.h" -RCSID("$Id: gen_encode.c,v 1.9 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: gen_encode.c,v 1.11 2000/06/19 15:19:08 joda Exp $"); static void encode_primitive (const char *typename, const char *name) @@ -48,154 +48,166 @@ encode_primitive (const char *typename, const char *name) static void encode_type (const char *name, const Type *t) { - switch (t->type) { - case TType: + switch (t->type) { + case TType: #if 0 - encode_type (name, t->symbol->type); + encode_type (name, t->symbol->type); #endif - fprintf (codefile, - "e = encode_%s(p, len, %s, &l);\n" - "BACK;\n", - t->symbol->gen_name, name); - break; - case TInteger: - encode_primitive ("integer", name); - break; - case TOctetString: - encode_primitive ("octet_string", name); - break; - case TBitString: { - Member *m; - int pos; - int rest; - int tag = -1; - - if (t->members == NULL) - break; - - fprintf (codefile, "{\n" - "unsigned char c = 0;\n"); - pos = t->members->prev->val; - /* fix for buggy MIT (and OSF?) code */ - if (pos > 31) - abort (); - /* - * It seems that if we do not always set pos to 31 here, the MIT - * code will do the wrong thing. - * - * I hate ASN.1 (and DER), but I hate it even more when everybody - * has to screw it up differently. - */ - pos = 31; - rest = 7 - (pos % 8); - - for (m = t->members->prev; m && tag != m->val; m = m->prev) { - while (m->val / 8 < pos / 8) { fprintf (codefile, - "*p-- = c; len--; ret++;\n" - "c = 0;\n"); - pos -= 8; - } - fprintf (codefile, - "if(%s->%s) c |= 1<<%d;\n", name, m->gen_name, - 7 - m->val % 8); - - if (tag == -1) - tag = m->val; - } + "e = encode_%s(p, len, %s, &l);\n" + "BACK;\n", + t->symbol->gen_name, name); + break; + case TInteger: + if(t->members == NULL) + encode_primitive ("integer", name); + else { + char *s; + asprintf(&s, "(const int*)%s", name); + if(s == NULL) + errx(1, "out of memory"); + encode_primitive ("integer", s); + free(s); + } + break; + case TUInteger: + encode_primitive ("unsigned", name); + break; + case TOctetString: + encode_primitive ("octet_string", name); + break; + case TBitString: { + Member *m; + int pos; + int rest; + int tag = -1; - fprintf (codefile, - "*p-- = c;\n" - "*p-- = %d;\n" - "len -= 2;\n" - "ret += 2;\n" - "}\n\n" - "e = der_put_length_and_tag (p, len, ret, UNIV, PRIM," - "UT_BitString, &l);\n" - "BACK;\n", - rest); - break; - } - case TSequence: { - Member *m; - int tag = -1; + if (t->members == NULL) + break; - if (t->members == NULL) - break; + fprintf (codefile, "{\n" + "unsigned char c = 0;\n"); + pos = t->members->prev->val; + /* fix for buggy MIT (and OSF?) code */ + if (pos > 31) + abort (); + /* + * It seems that if we do not always set pos to 31 here, the MIT + * code will do the wrong thing. + * + * I hate ASN.1 (and DER), but I hate it even more when everybody + * has to screw it up differently. + */ + pos = 31; + rest = 7 - (pos % 8); - for (m = t->members->prev; m && tag != m->val; m = m->prev) { - char *s; + for (m = t->members->prev; m && tag != m->val; m = m->prev) { + while (m->val / 8 < pos / 8) { + fprintf (codefile, + "*p-- = c; len--; ret++;\n" + "c = 0;\n"); + pos -= 8; + } + fprintf (codefile, + "if(%s->%s) c |= 1<<%d;\n", name, m->gen_name, + 7 - m->val % 8); - asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name); - if (m->optional) - fprintf (codefile, - "if(%s)\n", - s); + if (tag == -1) + tag = m->val; + } + + fprintf (codefile, + "*p-- = c;\n" + "*p-- = %d;\n" + "len -= 2;\n" + "ret += 2;\n" + "}\n\n" + "e = der_put_length_and_tag (p, len, ret, UNIV, PRIM," + "UT_BitString, &l);\n" + "BACK;\n", + rest); + break; + } + case TSequence: { + Member *m; + int tag = -1; + + if (t->members == NULL) + break; + + for (m = t->members->prev; m && tag != m->val; m = m->prev) { + char *s; + + asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name); + if (m->optional) + fprintf (codefile, + "if(%s)\n", + s); #if 1 - fprintf (codefile, "{\n" - "int oldret = ret;\n" - "ret = 0;\n"); + fprintf (codefile, "{\n" + "int oldret = ret;\n" + "ret = 0;\n"); #endif - encode_type (s, m->type); - fprintf (codefile, - "e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, " - "%d, &l);\n" - "BACK;\n", - m->val); + encode_type (s, m->type); + fprintf (codefile, + "e = der_put_length_and_tag (p, len, ret, CONTEXT, CONS, " + "%d, &l);\n" + "BACK;\n", + m->val); #if 1 - fprintf (codefile, - "ret += oldret;\n" - "}\n"); + fprintf (codefile, + "ret += oldret;\n" + "}\n"); #endif - if (tag == -1) - tag = m->val; - free (s); + if (tag == -1) + tag = m->val; + free (s); + } + fprintf (codefile, + "e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);\n" + "BACK;\n"); + break; } - fprintf (codefile, - "e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);\n" - "BACK;\n"); - break; - } - case TSequenceOf: { - char *n; + case TSequenceOf: { + char *n; - fprintf (codefile, - "for(i = (%s)->len - 1; i >= 0; --i) {\n" + fprintf (codefile, + "for(i = (%s)->len - 1; i >= 0; --i) {\n" #if 1 - "int oldret = ret;\n" - "ret = 0;\n", + "int oldret = ret;\n" + "ret = 0;\n", #else - , + , #endif - name); - asprintf (&n, "&(%s)->val[i]", name); - encode_type (n, t->subtype); - fprintf (codefile, + name); + asprintf (&n, "&(%s)->val[i]", name); + encode_type (n, t->subtype); + fprintf (codefile, #if 1 - "ret += oldret;\n" + "ret += oldret;\n" #endif - "}\n" - "e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);\n" - "BACK;\n"); - free (n); - break; - } - case TGeneralizedTime: - encode_primitive ("generalized_time", name); - break; - case TGeneralString: - encode_primitive ("general_string", name); - break; - case TApplication: - encode_type (name, t->subtype); - fprintf (codefile, - "e = der_put_length_and_tag (p, len, ret, APPL, CONS, %d, &l);\n" - "BACK;\n", - t->application); - break; - default: - abort (); - } + "}\n" + "e = der_put_length_and_tag (p, len, ret, UNIV, CONS, UT_Sequence, &l);\n" + "BACK;\n"); + free (n); + break; + } + case TGeneralizedTime: + encode_primitive ("generalized_time", name); + break; + case TGeneralString: + encode_primitive ("general_string", name); + break; + case TApplication: + encode_type (name, t->subtype); + fprintf (codefile, + "e = der_put_length_and_tag (p, len, ret, APPL, CONS, %d, &l);\n" + "BACK;\n", + t->application); + break; + default: + abort (); + } } void @@ -217,17 +229,10 @@ generate_type_encode (const Symbol *s) switch (s->type->type) { case TInteger: - fprintf (codefile, "return encode_integer (p, len, data, size);\n"); - break; + case TUInteger: case TOctetString: - fprintf (codefile, "return encode_octet_string (p, len, data, size);\n"); - break; case TGeneralizedTime: - fprintf (codefile, "return encode_generalized_time (p, len, data, size);\n"); - break; case TGeneralString: - fprintf (codefile, "return encode_general_string (p, len, data, size);\n"); - break; case TBitString: case TSequence: case TSequenceOf: @@ -239,7 +244,8 @@ generate_type_encode (const Symbol *s) "int i, e;\n\n"); fprintf(codefile, "i = 0;\n"); /* hack to avoid `unused variable' */ - encode_type ("data", s->type); + encode_type("data", s->type); + fprintf (codefile, "*size = ret;\n" "return 0;\n"); break; diff --git a/crypto/heimdal/lib/asn1/gen_free.c b/crypto/heimdal/lib/asn1/gen_free.c index 0f6078b..20ae521 100644 --- a/crypto/heimdal/lib/asn1/gen_free.c +++ b/crypto/heimdal/lib/asn1/gen_free.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "gen_locl.h" -RCSID("$Id: gen_free.c,v 1.7 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: gen_free.c,v 1.8 2000/04/06 17:24:02 assar Exp $"); static void free_primitive (const char *typename, const char *name) @@ -52,6 +52,7 @@ free_type (const char *name, const Type *t) fprintf (codefile, "free_%s(%s);\n", t->symbol->gen_name, name); break; case TInteger: + case TUInteger: break; case TOctetString: free_primitive ("octet_string", name); diff --git a/crypto/heimdal/lib/asn1/gen_length.c b/crypto/heimdal/lib/asn1/gen_length.c index 1c3566d..ca2af6f 100644 --- a/crypto/heimdal/lib/asn1/gen_length.c +++ b/crypto/heimdal/lib/asn1/gen_length.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "gen_locl.h" -RCSID("$Id: gen_length.c,v 1.7 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: gen_length.c,v 1.10 2000/06/21 22:40:53 assar Exp $"); static void length_primitive (const char *typename, @@ -46,91 +46,103 @@ length_primitive (const char *typename, static void length_type (const char *name, const Type *t, const char *variable) { - switch (t->type) { - case TType: + switch (t->type) { + case TType: #if 0 - length_type (name, t->symbol->type); + length_type (name, t->symbol->type); #endif - fprintf (codefile, "%s += length_%s(%s);\n", - variable, t->symbol->gen_name, name); - break; - case TInteger: - length_primitive ("integer", name, variable); - break; - case TOctetString: - length_primitive ("octet_string", name, variable); - break; - case TBitString: { - /* - * XXX - Hope this is correct - * look at TBitString case in `encode_type' - */ - fprintf (codefile, "%s += 7;\n", variable); - break; - } - case TSequence: { - Member *m; - int tag = -1; + fprintf (codefile, "%s += length_%s(%s);\n", + variable, t->symbol->gen_name, name); + break; + case TInteger: + if(t->members == NULL) + length_primitive ("integer", name, variable); + else { + char *s; + asprintf(&s, "(const int*)%s", name); + if(s == NULL) + errx (1, "out of memory"); + length_primitive ("integer", s, variable); + free(s); + } + break; + case TUInteger: + length_primitive ("unsigned", name, variable); + break; + case TOctetString: + length_primitive ("octet_string", name, variable); + break; + case TBitString: { + /* + * XXX - Hope this is correct + * look at TBitString case in `encode_type' + */ + fprintf (codefile, "%s += 7;\n", variable); + break; + } + case TSequence: { + Member *m; + int tag = -1; - if (t->members == NULL) - break; + if (t->members == NULL) + break; - for (m = t->members; m && tag != m->val; m = m->next) { - char *s; + for (m = t->members; m && tag != m->val; m = m->next) { + char *s; - asprintf (&s, "%s(%s)->%s", - m->optional ? "" : "&", name, m->gen_name); - if (m->optional) - fprintf (codefile, "if(%s)", s); - fprintf (codefile, "{\n" - "int oldret = %s;\n" - "%s = 0;\n", variable, variable); - length_type (s, m->type, "ret"); - fprintf (codefile, "%s += 1 + length_len(%s) + oldret;\n", - variable, variable); - fprintf (codefile, "}\n"); - if (tag == -1) - tag = m->val; - free (s); - } - fprintf (codefile, - "%s += 1 + length_len(%s);\n", variable, variable); - break; - } - case TSequenceOf: { - char *n; + asprintf (&s, "%s(%s)->%s", + m->optional ? "" : "&", name, m->gen_name); + if (m->optional) + fprintf (codefile, "if(%s)", s); + fprintf (codefile, "{\n" + "int oldret = %s;\n" + "%s = 0;\n", variable, variable); + length_type (s, m->type, "ret"); + fprintf (codefile, "%s += 1 + length_len(%s) + oldret;\n", + variable, variable); + fprintf (codefile, "}\n"); + if (tag == -1) + tag = m->val; + free (s); + } + fprintf (codefile, + "%s += 1 + length_len(%s);\n", variable, variable); + break; + } + case TSequenceOf: { + char *n; - fprintf (codefile, - "{\n" - "int oldret = %s;\n" - "int i;\n" - "%s = 0;\n", - variable, variable); + fprintf (codefile, + "{\n" + "int oldret = %s;\n" + "int i;\n" + "%s = 0;\n", + variable, variable); - fprintf (codefile, "for(i = (%s)->len - 1; i >= 0; --i){\n", name); - asprintf (&n, "&(%s)->val[i]", name); - length_type(n, t->subtype, variable); - fprintf (codefile, "}\n"); + fprintf (codefile, "for(i = (%s)->len - 1; i >= 0; --i){\n", name); + asprintf (&n, "&(%s)->val[i]", name); + length_type(n, t->subtype, variable); + fprintf (codefile, "}\n"); - fprintf (codefile, - "%s += 1 + length_len(%s) + oldret;\n" - "}\n", variable, variable); - free(n); - break; - } - case TGeneralizedTime: - length_primitive ("generalized_time", name, variable); - break; - case TGeneralString: - length_primitive ("general_string", name, variable); - break; - case TApplication: - length_type (name, t->subtype, variable); - fprintf (codefile, "ret += 1 + length_len (ret);\n"); - break; - default : - abort (); - } + fprintf (codefile, + "%s += 1 + length_len(%s) + oldret;\n" + "}\n", variable, variable); + free(n); + break; + } + case TGeneralizedTime: + length_primitive ("generalized_time", name, variable); + break; + case TGeneralString: + length_primitive ("general_string", name, variable); + break; + case TApplication: + length_type (name, t->subtype, variable); + fprintf (codefile, "ret += 1 + length_len (ret);\n"); + break; + default : + abort (); + } } void diff --git a/crypto/heimdal/lib/asn1/gen_locl.h b/crypto/heimdal/lib/asn1/gen_locl.h index 7ee37ae..acf6bc1a 100644 --- a/crypto/heimdal/lib/asn1/gen_locl.h +++ b/crypto/heimdal/lib/asn1/gen_locl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: gen_locl.h,v 1.6 1999/12/02 17:05:02 joda Exp $ */ +/* $Id: gen_locl.h,v 1.7 2000/04/09 09:21:56 assar Exp $ */ #ifndef __GEN_LOCL_H__ #define __GEN_LOCL_H__ @@ -63,7 +63,8 @@ void generate_type_copy (const Symbol *s); void generate_type_maybe (const Symbol *s); void generate_glue (const Symbol *s); -void init_generate (char *filename, char *basename); +void init_generate (const char *filename, const char *basename); +const char *filename (void); void close_generate(void); int yyparse(void); diff --git a/crypto/heimdal/lib/asn1/k5.asn1 b/crypto/heimdal/lib/asn1/k5.asn1 index a7f4199..c5382f3 100644 --- a/crypto/heimdal/lib/asn1/k5.asn1 +++ b/crypto/heimdal/lib/asn1/k5.asn1 @@ -1,16 +1,89 @@ +-- $Id: k5.asn1,v 1.23 2000/12/11 06:30:35 assar Exp $ + KERBEROS5 DEFINITIONS ::= BEGIN -nt-unknown INTEGER ::= 0 -- Name type not known -nt-principal INTEGER ::= 1 -- Just the name of the principal as in -nt-srv-inst INTEGER ::= 2 -- Service and other unique instance (krbtgt) -nt-srv-hst INTEGER ::= 3 -- Service with host name as instance -nt-srv-xhst INTEGER ::= 4 -- Service with host as remaining components -nt-uid INTEGER ::= 5 -- Unique ID +NAME-TYPE ::= INTEGER { + KRB5_NT_UNKNOWN(0), -- Name type not known + KRB5_NT_PRINCIPAL(1), -- Just the name of the principal as in + KRB5_NT_SRV_INST(2), -- Service and other unique instance (krbtgt) + KRB5_NT_SRV_HST(3), -- Service with host name as instance + KRB5_NT_SRV_XHST(4), -- Service with host as remaining components + KRB5_NT_UID(5), -- Unique ID + KRB5_NT_X500_PRINCIPAL(6) -- PKINIT +} + +-- message types + +MESSAGE-TYPE ::= INTEGER { + krb-as-req(10), -- Request for initial authentication + krb-as-rep(11), -- Response to KRB_AS_REQ request + krb-tgs-req(12), -- Request for authentication based on TGT + krb-tgs-rep(13), -- Response to KRB_TGS_REQ request + krb-ap-req(14), -- application request to server + krb-ap-rep(15), -- Response to KRB_AP_REQ_MUTUAL + krb-safe(20), -- Safe (checksummed) application message + krb-priv(21), -- Private (encrypted) application message + krb-cred(22), -- Private (encrypted) message to forward credentials + krb-error(30) -- Error response +} + + +-- pa-data types + +PADATA-TYPE ::= INTEGER { + KRB5-PADATA-NONE(0), + KRB5-PADATA-TGS-REQ(1), + KRB5-PADATA-AP-REQ(1), + KRB5-PADATA-ENC-TIMESTAMP(2), + KRB5-PADATA-PW-SALT(3), + KRB5-PADATA-ENC-UNIX-TIME(5), + KRB5-PADATA-SANDIA-SECUREID(6), + KRB5-PADATA-SESAME(7), + KRB5-PADATA-OSF-DCE(8), + KRB5-PADATA-CYBERSAFE-SECUREID(9), + KRB5-PADATA-AFS3-SALT(10), + KRB5-PADATA-ETYPE-INFO(11), + KRB5-PADATA-SAM-CHALLENGE(12), -- (sam/otp) + KRB5-PADATA-SAM-RESPONSE(13), -- (sam/otp) + KRB5-PADATA-PK-AS-REQ(14), -- (PKINIT) + KRB5-PADATA-PK-AS-REP(15), -- (PKINIT) + KRB5-PADATA-PK-AS-SIGN(16), -- (PKINIT) + KRB5-PADATA-PK-KEY-REQ(17), -- (PKINIT) + KRB5-PADATA-PK-KEY-REP(18), -- (PKINIT) + KRB5-PADATA-USE-SPECIFIED-KVNO(20), + KRB5-PADATA-SAM-REDIRECT(21), -- (sam/otp) + KRB5-PADATA-GET-FROM-TYPED-DATA(22), + KRB5-PADATA-SAM-ETYPE-INFO(23) +} + +-- checksumtypes + +CKSUMTYPE ::= INTEGER { + CKSUMTYPE_NONE(0), + CKSUMTYPE_CRC32(1), + CKSUMTYPE_RSA_MD4(2), + CKSUMTYPE_RSA_MD4_DES(3), + CKSUMTYPE_DES_MAC(4), + CKSUMTYPE_DES_MAC_K(5), + CKSUMTYPE_RSA_MD4_DES_K(6), + CKSUMTYPE_RSA_MD5(7), + CKSUMTYPE_RSA_MD5_DES(8), + CKSUMTYPE_RSA_MD5_DES3(9), + -- CKSUMTYPE_SHA1(10), + CKSUMTYPE_HMAC_SHA1_DES3(12), + CKSUMTYPE_SHA1(1000), -- correct value? 10 (9 also) + CKSUMTYPE_HMAC_MD5(-138), -- unofficial microsoft number + CKSUMTYPE_HMAC_MD5_ENC(-1138) -- even more unofficial +} + +-- this is sugar to make something ASN1 does not have: unsigned + +UNSIGNED ::= INTEGER (0..4294967295) Realm ::= GeneralString PrincipalName ::= SEQUENCE { - name-type[0] INTEGER, + name-type[0] NAME-TYPE, name-string[1] SEQUENCE OF GeneralString } @@ -81,6 +154,7 @@ KDCOptions ::= BIT STRING { unused10(10), unused11(11), request-anonymous(14), + canonicalize(15), disable-transited-check(26), renewable-ok(27), enc-tkt-in-skey(28), @@ -133,7 +207,7 @@ EncTicketPart ::= [APPLICATION 3] SEQUENCE { } Checksum ::= SEQUENCE { - cksumtype[0] INTEGER, + cksumtype[0] CKSUMTYPE, checksum[1] OCTET STRING } @@ -145,13 +219,13 @@ Authenticator ::= [APPLICATION 2] SEQUENCE { cusec[4] INTEGER, ctime[5] KerberosTime, subkey[6] EncryptionKey OPTIONAL, - seq-number[7] INTEGER OPTIONAL, + seq-number[7] UNSIGNED OPTIONAL, authorization-data[8] AuthorizationData OPTIONAL } PA-DATA ::= SEQUENCE { -- might be encoded AP-REQ - padata-type[1] INTEGER, + padata-type[1] PADATA-TYPE, padata-value[2] OCTET STRING } @@ -185,7 +259,7 @@ KDC-REQ-BODY ::= SEQUENCE { KDC-REQ ::= SEQUENCE { pvno[1] INTEGER, - msg-type[2] INTEGER, + msg-type[2] MESSAGE-TYPE, padata[3] METHOD-DATA OPTIONAL, req-body[4] KDC-REQ-BODY } @@ -203,7 +277,7 @@ PA-ENC-TS-ENC ::= SEQUENCE { KDC-REP ::= SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, + msg-type[1] MESSAGE-TYPE, padata[2] METHOD-DATA OPTIONAL, crealm[3] Realm, cname[4] PrincipalName, @@ -234,7 +308,7 @@ EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart AP-REQ ::= [APPLICATION 14] SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, + msg-type[1] MESSAGE-TYPE, ap-options[2] APOptions, ticket[3] Ticket, authenticator[4] EncryptedData @@ -242,7 +316,7 @@ AP-REQ ::= [APPLICATION 14] SEQUENCE { AP-REP ::= [APPLICATION 15] SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, + msg-type[1] MESSAGE-TYPE, enc-part[2] EncryptedData } @@ -250,42 +324,42 @@ EncAPRepPart ::= [APPLICATION 27] SEQUENCE { ctime[0] KerberosTime, cusec[1] INTEGER, subkey[2] EncryptionKey OPTIONAL, - seq-number[3] INTEGER OPTIONAL + seq-number[3] UNSIGNED OPTIONAL } KRB-SAFE-BODY ::= SEQUENCE { user-data[0] OCTET STRING, timestamp[1] KerberosTime OPTIONAL, usec[2] INTEGER OPTIONAL, - seq-number[3] INTEGER OPTIONAL, + seq-number[3] UNSIGNED OPTIONAL, s-address[4] HostAddress OPTIONAL, r-address[5] HostAddress OPTIONAL } KRB-SAFE ::= [APPLICATION 20] SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, + msg-type[1] MESSAGE-TYPE, safe-body[2] KRB-SAFE-BODY, cksum[3] Checksum } KRB-PRIV ::= [APPLICATION 21] SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, + msg-type[1] MESSAGE-TYPE, enc-part[3] EncryptedData } EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE { user-data[0] OCTET STRING, timestamp[1] KerberosTime OPTIONAL, usec[2] INTEGER OPTIONAL, - seq-number[3] INTEGER OPTIONAL, + seq-number[3] UNSIGNED OPTIONAL, s-address[4] HostAddress OPTIONAL, -- sender's addr r-address[5] HostAddress OPTIONAL -- recip's addr } KRB-CRED ::= [APPLICATION 22] SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, -- KRB_CRED + msg-type[1] MESSAGE-TYPE, -- KRB_CRED tickets[2] SEQUENCE OF Ticket, enc-part[3] EncryptedData } @@ -315,7 +389,7 @@ EncKrbCredPart ::= [APPLICATION 29] SEQUENCE { KRB-ERROR ::= [APPLICATION 30] SEQUENCE { pvno[0] INTEGER, - msg-type[1] INTEGER, + msg-type[1] MESSAGE-TYPE, ctime[2] KerberosTime OPTIONAL, cusec[3] INTEGER OPTIONAL, stime[4] KerberosTime, @@ -331,51 +405,6 @@ KRB-ERROR ::= [APPLICATION 30] SEQUENCE { pvno INTEGER ::= 5 -- current Kerberos protocol version number --- message types - -krb-as-req INTEGER ::= 10 -- Request for initial authentication -krb-as-rep INTEGER ::= 11 -- Response to KRB_AS_REQ request -krb-tgs-req INTEGER ::= 12 -- Request for authentication based on TGT -krb-tgs-rep INTEGER ::= 13 -- Response to KRB_TGS_REQ request -krb-ap-req INTEGER ::= 14 -- application request to server -krb-ap-rep INTEGER ::= 15 -- Response to KRB_AP_REQ_MUTUAL -krb-safe INTEGER ::= 20 -- Safe (checksummed) application message -krb-priv INTEGER ::= 21 -- Private (encrypted) application message -krb-cred INTEGER ::= 22 -- Private (encrypted) message to forward credentials -krb-error INTEGER ::= 30 -- Error response - --- pa-data types - -pa-tgs-req INTEGER ::= 1 -pa-enc-timestamp INTEGER ::= 2 -pa-pw-salt INTEGER ::= 3 -pa-enc-unix-time INTEGER ::= 5 -pa-sandia-secureid INTEGER ::= 6 -pa-sesame INTEGER ::= 7 -pa-osf-dce INTEGER ::= 8 -pa-cybersafe-secureid INTEGER ::= 9 -pa-afs3-salt INTEGER ::= 10 -pa-etype-info INTEGER ::= 11 -sam-challenge INTEGER ::= 12 -- (sam/otp) -sam-response INTEGER ::= 13 -- (sam/otp) -pa-pk-as-req INTEGER ::= 14 -- (pkinit) -pa-pk-as-rep INTEGER ::= 15 -- (pkinit) -pa-pk-as-sign INTEGER ::= 16 -- (pkinit) -pa-pk-key-req INTEGER ::= 17 -- (pkinit) -pa-pk-key-rep INTEGER ::= 18 -- (pkinit) --- checksumtypes - -CRC32 INTEGER ::= 1 -rsa-md4 INTEGER ::= 2 -rsa-md4-des INTEGER ::= 3 -des-mac INTEGER ::= 4 -des-mac-k INTEGER ::= 5 -rsa-md4-des-k INTEGER ::= 6 -rsa-md5 INTEGER ::= 7 -rsa-md5-des INTEGER ::= 8 -rsa-md5-des3 INTEGER ::= 9 -hmac-sha1-des3 INTEGER ::= 12 - -- transited encodings DOMAIN-X500-COMPRESS INTEGER ::= 1 diff --git a/crypto/heimdal/lib/asn1/lex.h b/crypto/heimdal/lib/asn1/lex.h index 66d708c..9f5cadf 100644 --- a/crypto/heimdal/lib/asn1/lex.h +++ b/crypto/heimdal/lib/asn1/lex.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -31,6 +31,11 @@ * SUCH DAMAGE. */ -/* $Id: lex.h,v 1.3 1999/12/02 17:05:02 joda Exp $ */ +/* $Id: lex.h,v 1.5 2000/07/01 20:21:34 assar Exp $ */ -void error_message (char *, ...); +#include <roken.h> + +void error_message (const char *, ...) +__attribute__ ((format (printf, 1, 2))); + +int yylex(void); diff --git a/crypto/heimdal/lib/asn1/lex.l b/crypto/heimdal/lib/asn1/lex.l index b3fbf71..ffb6fd5 100644 --- a/crypto/heimdal/lib/asn1/lex.l +++ b/crypto/heimdal/lib/asn1/lex.l @@ -1,6 +1,6 @@ %{ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -32,7 +32,7 @@ * SUCH DAMAGE. */ -/* $Id: lex.l,v 1.10 1999/12/02 17:05:02 joda Exp $ */ +/* $Id: lex.l,v 1.15 2000/07/02 04:08:02 assar Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -46,17 +46,22 @@ #endif #include "symbol.h" #include "parse.h" - -void error_message(char *, ...); +#include "lex.h" +#include "gen_locl.h" static unsigned lineno = 1; -/* ","|"{"|"}"|"("|")"|"["|"]"|"|" { return *yytext; } */ +#define YY_NO_UNPUT + +#undef ECHO + %} %% INTEGER { return INTEGER; } +IMPORTS { return IMPORTS; } +FROM { return FROM; } SEQUENCE { return SEQUENCE; } OF { return OF; } OCTET { return OCTET; } @@ -70,15 +75,16 @@ BEGIN { return TBEGIN; } END { return END; } DEFINITIONS { return DEFINITIONS; } EXTERNAL { return EXTERNAL; } -[,{}()|] { return *yytext; } +[,;{}()|] { return *yytext; } "[" { return *yytext; } "]" { return *yytext; } ::= { return EEQUAL; } ---[^\n]*\n { ; } +--[^\n]*\n { ++lineno; } -?[0-9]+ { yylval.constant = atoi(yytext); return CONSTANT; } [A-Za-z][-A-Za-z0-9_]* { yylval.name = strdup (yytext); return IDENTIFIER; } [ \t] ; -\n { lineno++; } +\n { ++lineno; } +\.\. { return DOTDOT; } . { error_message("Ignoring char(%c)\n", *yytext); } %% @@ -91,12 +97,12 @@ yywrap () #endif void -error_message (char *format, ...) +error_message (const char *format, ...) { va_list args; va_start (args, format); - fprintf (stderr, ":%d: ", lineno); + fprintf (stderr, "%s:%d: ", filename(), lineno); vfprintf (stderr, format, args); va_end (args); } diff --git a/crypto/heimdal/lib/asn1/parse.y b/crypto/heimdal/lib/asn1/parse.y index f9e82b5..4b8e590 100644 --- a/crypto/heimdal/lib/asn1/parse.y +++ b/crypto/heimdal/lib/asn1/parse.y @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: parse.y,v 1.12 1999/12/02 17:05:02 joda Exp $ */ +/* $Id: parse.y,v 1.16 2000/07/08 11:35:47 assar Exp $ */ %{ #ifdef HAVE_CONFIG_H @@ -44,11 +44,10 @@ #include "lex.h" #include "gen_locl.h" -RCSID("$Id: parse.y,v 1.12 1999/12/02 17:05:02 joda Exp $"); +RCSID("$Id: parse.y,v 1.16 2000/07/08 11:35:47 assar Exp $"); static Type *new_type (Typetype t); void yyerror (char *); -int yylex(void); static void append (Member *l, Member *r); @@ -63,6 +62,8 @@ static void append (Member *l, Member *r); %token INTEGER SEQUENCE OF OCTET STRING GeneralizedTime GeneralString %token BIT APPLICATION OPTIONAL EEQUAL TBEGIN END DEFINITIONS EXTERNAL +%token DOTDOT +%token IMPORTS FROM %token <name> IDENTIFIER %token <constant> CONSTANT @@ -81,16 +82,24 @@ specification : | specification declaration ; -declaration : extern_decl +declaration : imports_decl | type_decl | constant_decl ; -extern_decl : IDENTIFIER EXTERNAL +referencenames : IDENTIFIER ',' referencenames { Symbol *s = addsym($1); s->stype = Stype; } + | IDENTIFIER + { + Symbol *s = addsym($1); + s->stype = Stype; + } + ; + +imports_decl : IMPORTS referencenames FROM IDENTIFIER ';' ; type_decl : IDENTIFIER EEQUAL type @@ -112,6 +121,19 @@ constant_decl : IDENTIFIER type EEQUAL constant ; type : INTEGER { $$ = new_type(TInteger); } + | INTEGER '(' constant DOTDOT constant ')' { + if($3 != 0) + error_message("Only 0 supported as low range"); + if($5 != INT_MIN && $5 != UINT_MAX && $5 != INT_MAX) + error_message("Only %u supported as high range", + UINT_MAX); + $$ = new_type(TUInteger); + } + | INTEGER '{' bitdecls '}' + { + $$ = new_type(TInteger); + $$->members = $3; + } | OCTET STRING { $$ = new_type(TOctetString); } | GeneralString { $$ = new_type(TGeneralString); } | GeneralizedTime { $$ = new_type(TGeneralizedTime); } diff --git a/crypto/heimdal/lib/asn1/pkinit.asn1 b/crypto/heimdal/lib/asn1/pkinit.asn1 new file mode 100644 index 0000000..92c5de7 --- /dev/null +++ b/crypto/heimdal/lib/asn1/pkinit.asn1 @@ -0,0 +1,189 @@ +PKINIT DEFINITIONS ::= BEGIN + +IMPORTS EncryptionKey, PrincipalName, Realm, KerberosTime, TypedData + FROM krb5; +IMPORTS SignedData, EnvelopedData FROM CMS; +IMPORTS CertificateSerialNumber, AttributeTypeAndValue, Name FROM X509; + + +-- 3.1 + +CertPrincipalName ::= SEQUENCE { + name-type[0] INTEGER, + name-string[1] SEQUENCE OF UTF8String +} + + +-- 3.2.2 + + +TrustedCertifiers ::= SEQUENCE OF PrincipalName + -- X.500 name encoded as a principal name + -- see Section 3.1 +CertificateIndex ::= INTEGER + -- 0 = 1st certificate, + -- (in order of encoding) + -- 1 = 2nd certificate, etc + +PA-PK-AS-REP ::= CHOICE { + -- PA TYPE 15 + dhSignedData[0] SignedData, + -- Defined in CMS and used only with + -- Diffie-Hellman key exchange (if the + -- client public value was present in the + -- request). + -- This choice MUST be supported + -- by compliant implementations. + encKeyPack[1] EnvelopedData + -- Defined in CMS + -- The temporary key is encrypted + -- using the client public key + -- key + -- SignedReplyKeyPack, encrypted + -- with the temporary key, is also + -- included. +} + + + +KdcDHKeyInfo ::= SEQUENCE { + -- used only when utilizing Diffie-Hellman + nonce[0] INTEGER, + -- binds responce to the request + subjectPublicKey[2] BIT STRING + -- Equals public exponent (g^a mod p) + -- INTEGER encoded as payload of + -- BIT STRING +} + +ReplyKeyPack ::= SEQUENCE { + -- not used for Diffie-Hellman + replyKey[0] EncryptionKey, + -- used to encrypt main reply + -- ENCTYPE is at least as strong as + -- ENCTYPE of session key + nonce[1] INTEGER + -- binds response to the request + -- must be same as the nonce + -- passed in the PKAuthenticator +} + +-- subjectAltName EXTENSION ::= { +-- SYNTAX GeneralNames +-- IDENTIFIED BY id-ce-subjectAltName +-- } + +OtherName ::= SEQUENCE { + type-id OBJECT IDENTIFIER, + value[0] OCTET STRING +-- value[0] EXPLICIT ANY DEFINED BY type-id +} + +GeneralName ::= CHOICE { + otherName [0] OtherName, + ... +} + +GeneralNames ::= SEQUENCE -- SIZE(1..MAX) + OF GeneralName + +KerberosName ::= SEQUENCE { + realm[0] Realm, + -- as defined in RFC 1510 + principalName[1] CertPrincipalName + -- defined above +} + + +-- krb5 OBJECT IDENTIFIER ::= { +-- iso (1) org (3) dod (6) internet (1) security (5) kerberosv5 (2) +-- } + +-- krb5PrincipalName OBJECT IDENTIFIER ::= { krb5 2 } + +-- 3.2.1 + + +IssuerAndSerialNumber ::= SEQUENCE { + issuer Name, + serialNumber CertificateSerialNumber +} + +TrustedCas ::= CHOICE { + principalName[0] KerberosName, + -- as defined below + caName[1] Name, + -- fully qualified X.500 name + -- as defined by X.509 + issuerAndSerial[2] IssuerAndSerialNumber + -- Since a CA may have a number of + -- certificates, only one of which + -- a client trusts +} + +PA-PK-AS-REQ ::= SEQUENCE { + -- PA TYPE 14 + signedAuthPack[0] SignedData, + -- defined in CMS [11] + -- AuthPack (below) defines the data + -- that is signed + trustedCertifiers[1] SEQUENCE OF TrustedCas OPTIONAL, + -- CAs that the client trusts + kdcCert[2] IssuerAndSerialNumber OPTIONAL, + -- as defined in CMS [11] + -- specifies a particular KDC + -- certificate if the client + -- already has it; + encryptionCert[3] IssuerAndSerialNumber OPTIONAL + -- For example, this may be the + -- client's Diffie-Hellman + -- certificate, or it may be the + -- client's RSA encryption + -- certificate. +} + +PKAuthenticator ::= SEQUENCE { + kdcName[0] PrincipalName, + kdcRealm[1] Realm, + cusec[2] INTEGER, + -- for replay prevention as in RFC1510 + ctime[3] KerberosTime, + -- for replay prevention as in RFC1510 + nonce[4] INTEGER +} + +-- This is the real definition of AlgorithmIdentifier +-- AlgorithmIdentifier ::= SEQUENCE { +-- algorithm ALGORITHM.&id, +-- parameters ALGORITHM.&Type +-- } -- as specified by the X.509 recommendation[10] + +-- But we'll use this one instead: + +AlgorithmIdentifier ::= SEQUENCE { + algorithm OBJECT IDENTIFIER, + parameters CHOICE { + a INTEGER + } +} + + + +SubjectPublicKeyInfo ::= SEQUENCE { + algorithm AlgorithmIdentifier, + -- dhKeyAgreement + subjectPublicKey BIT STRING + -- for DH, equals + -- public exponent (INTEGER encoded + -- as payload of BIT STRING) +} -- as specified by the X.509 recommendation[10] + +AuthPack ::= SEQUENCE { + pkAuthenticator[0] PKAuthenticator, + clientPublicValue[1] SubjectPublicKeyInfo OPTIONAL + -- if client is using Diffie-Hellman + -- (ephemeral-ephemeral only) +} + + +END diff --git a/crypto/heimdal/lib/asn1/rfc2459.asn1 b/crypto/heimdal/lib/asn1/rfc2459.asn1 new file mode 100644 index 0000000..c9adec6 --- /dev/null +++ b/crypto/heimdal/lib/asn1/rfc2459.asn1 @@ -0,0 +1,21 @@ +RFC2459 DEFINITIONS ::= BEGIN + +AttributeType ::= OBJECT-IDENTIFIER + +AttributeValue ::= OCTET STRING --ANY DEFINED BY AttributeType + +AttributeTypeAndValue ::= SEQUENCE { + type AttributeType, + value AttributeValue +} + +RelativeDistinguishedName ::= --SET +SEQUENCE OF AttributeTypeAndValue + +RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + +Name ::= CHOICE { -- RFC2459 + x RDNSequence +} + +END
\ No newline at end of file diff --git a/crypto/heimdal/lib/asn1/x509.asn1 b/crypto/heimdal/lib/asn1/x509.asn1 new file mode 100644 index 0000000..4a15844 --- /dev/null +++ b/crypto/heimdal/lib/asn1/x509.asn1 @@ -0,0 +1,23 @@ +X509 DEFINITIONS ::= BEGIN + +CertificateSerialNumber ::= INTEGER -- X.509 '97 + +AttributeType ::= OBJECT-IDENTIFIER + +AttributeValue ::= OCTET STRING --ANY DEFINED BY AttributeType + +AttributeTypeAndValue ::= SEQUENCE { + type AttributeType, + value AttributeValue +} + +RelativeDistinguishedName ::= --SET +SEQUENCE OF AttributeTypeAndValue + +RDNSequence ::= SEQUENCE OF RelativeDistinguishedName + +Name ::= CHOICE { -- RFC2459 + x RDNSequence +} + +END
\ No newline at end of file |