asn1_k_decode_sam.o\
asn1_encode.o\
asn1_get.o\
- asn1_make.o\
asn1buf.o\
krb5_decode.o\
krb5_decode_kdc.o\
$(srcdir)/asn1_k_decode_sam.c\
$(srcdir)/asn1_encode.c\
$(srcdir)/asn1_get.c\
- $(srcdir)/asn1_make.c\
$(srcdir)/asn1buf.c\
$(srcdir)/krb5_decode.c\
$(srcdir)/krb5_decode_kdc.c\
$(OUTPRE)asn1_k_decode_sam.$(OBJEXT)\
$(OUTPRE)asn1_encode.$(OBJEXT)\
$(OUTPRE)asn1_get.$(OBJEXT)\
- $(OUTPRE)asn1_make.$(OBJEXT)\
$(OUTPRE)asn1buf.$(OBJEXT)\
$(OUTPRE)krb5_decode.$(OBJEXT)\
$(OUTPRE)krb5_decode_kdc.$(OBJEXT)\
/* ASN.1 primitive encoders */
#include "asn1_encode.h"
-#include "asn1_make.h"
asn1_error_code
asn1_encode_boolean(asn1buf *buf, asn1_intmax val, unsigned int *retlen)
return asn1buf_insert_octet(buf, '\0');
}
+static asn1_error_code
+make_tag(asn1buf *buf, const taginfo *t, unsigned int *retlen)
+{
+ asn1_error_code ret;
+ asn1_tagnum tag_copy;
+ unsigned int sum = 0, length, len_copy;
+
+ if (t->tagnum > ASN1_TAGNUM_MAX)
+ return ASN1_OVERFLOW;
+
+ /* Encode the length of the content within the tag. */
+ if (t->length < 128) {
+ ret = asn1buf_insert_octet(buf, t->length & 0x7F);
+ if (ret)
+ return ret;
+ length = 1;
+ } else {
+ length = 0;
+ for (len_copy = t->length; len_copy != 0; len_copy >>= 8) {
+ ret = asn1buf_insert_octet(buf, len_copy & 0xFF);
+ if (ret)
+ return ret;
+ length++;
+ }
+ ret = asn1buf_insert_octet(buf, 0x80 | (length & 0x7F));
+ if (ret)
+ return ret;
+ length++;
+ }
+ sum += length;
+
+ /* Encode the tag and construction bit. */
+ if (t->tagnum < 31) {
+ ret = asn1buf_insert_octet(buf,
+ t->asn1class | t->construction | t->tagnum);
+ if (ret)
+ return ret;
+ length = 1;
+ } else {
+ tag_copy = t->tagnum;
+ length = 0;
+ ret = asn1buf_insert_octet(buf, tag_copy & 0x7F);
+ if (ret)
+ return ret;
+ tag_copy >>= 7;
+ length++;
+
+ for (; tag_copy != 0; tag_copy >>= 7) {
+ ret = asn1buf_insert_octet(buf, 0x80 | (tag_copy & 0x7F));
+ if (ret)
+ return ret;
+ length++;
+ }
+
+ ret = asn1buf_insert_octet(buf, t->asn1class | t->construction | 0x1F);
+ if (ret)
+ return ret;
+ length++;
+ }
+ sum += length;
+
+ *retlen = sum;
+ return 0;
+}
+
/*
* ASN.1 constructed type encoder engine
*
return retval;
if (!tag->implicit) {
unsigned int tlen;
- retval = asn1_make_tag(buf, rettag->asn1class,
- rettag->construction, rettag->tagnum,
- rettag->length, &tlen);
+ retval = make_tag(buf, rettag, &tlen);
if (retval)
return retval;
rettag->length += tlen;
retval = krb5int_asn1_encode_type(buf, val, a, &t);
if (retval)
return retval;
- retval = asn1_make_tag(buf, t.asn1class, t.construction, t.tagnum,
- t.length, &tlen);
+ retval = make_tag(buf, &t, &tlen);
if (retval)
return retval;
*retlen = t.length + tlen;
* or implied warranty.
*/
-#include "asn1_make.h"
#include "asn1_encode.h"
#include <assert.h>
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/* lib/krb5/asn.1/asn1_make.c */
-/*
- * Copyright 1994 by the Massachusetts Institute of Technology.
- * All Rights Reserved.
- *
- * Export of this software from the United States of America may
- * require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- * distribute this software and its documentation for any purpose and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Furthermore if you modify this software you must label
- * your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#include "asn1_make.h"
-
-asn1_error_code
-asn1_make_etag(asn1buf *buf, asn1_class asn1class, asn1_tagnum tagnum,
- unsigned int in_len, unsigned int *retlen)
-{
- return asn1_make_tag(buf,asn1class,CONSTRUCTED,tagnum,in_len,retlen);
-}
-
-asn1_error_code
-asn1_make_tag(asn1buf *buf, asn1_class asn1class,
- asn1_construction construction, asn1_tagnum tagnum,
- unsigned int in_len, unsigned int *retlen)
-{
- asn1_error_code retval;
- unsigned int sumlen=0, length;
-
- if (tagnum > ASN1_TAGNUM_MAX) return ASN1_OVERFLOW;
-
- retval = asn1_make_length(buf,in_len, &length);
- if (retval) return retval;
- sumlen += length;
- retval = asn1_make_id(buf,asn1class,construction,tagnum,&length);
- if (retval) return retval;
- sumlen += length;
-
- *retlen = sumlen;
- return 0;
-}
-
-asn1_error_code
-asn1_make_length(asn1buf *buf, const unsigned int in_len, unsigned int *retlen)
-{
- asn1_error_code retval;
-
- if (in_len < 128) {
- retval = asn1buf_insert_octet(buf, (asn1_octet)(in_len&0x7F));
- if (retval) return retval;
- *retlen = 1;
- } else {
- int in_copy=in_len, length=0;
-
- while (in_copy != 0) {
- retval = asn1buf_insert_octet(buf, (asn1_octet)(in_copy&0xFF));
- if (retval) return retval;
- in_copy = in_copy >> 8;
- length++;
- }
- retval = asn1buf_insert_octet(buf, (asn1_octet) (0x80 | (asn1_octet)(length&0x7F)));
- if (retval) return retval;
- length++;
- *retlen = length;
- }
-
- return 0;
-}
-
-asn1_error_code
-asn1_make_id(asn1buf *buf, asn1_class asn1class,
- asn1_construction construction, asn1_tagnum tagnum,
- unsigned int *retlen)
-{
- asn1_error_code retval;
-
- if (tagnum < 31) {
- retval = asn1buf_insert_octet(buf, (asn1_octet) (asn1class | construction |
- (asn1_octet)tagnum));
- if (retval) return retval;
- *retlen = 1;
- } else {
- asn1_tagnum tagcopy = tagnum;
- int length = 0;
-
- retval = asn1buf_insert_octet(buf, (asn1_octet)(tagcopy&0x7F));
- if (retval) return retval;
- tagcopy >>= 7;
- length++;
-
- for (; tagcopy != 0; tagcopy >>= 7) {
- retval = asn1buf_insert_octet(buf, (asn1_octet) (0x80 | (asn1_octet)(tagcopy&0x7F)));
- if (retval) return retval;
- length++;
- }
-
- retval = asn1buf_insert_octet(buf, (asn1_octet) (asn1class | construction | 0x1F));
- if (retval) return retval;
- length++;
- *retlen = length;
- }
-
- return 0;
-}
-
-asn1_error_code
-asn1_make_sequence(asn1buf *buf, const unsigned int seq_len,
- unsigned int *retlen)
-{
- asn1_error_code retval;
- unsigned int len, sum=0;
-
- retval = asn1_make_length(buf,seq_len,&len);
- if (retval) return retval;
- sum += len;
- retval = asn1_make_id(buf,UNIVERSAL,CONSTRUCTED,ASN1_SEQUENCE,&len);
- if (retval) return retval;
- sum += len;
-
- *retlen = sum;
- return 0;
-}
-
-asn1_error_code
-asn1_make_set(asn1buf *buf, const unsigned int set_len, unsigned int *retlen)
-{
- asn1_error_code retval;
- unsigned int len, sum=0;
-
- retval = asn1_make_length(buf,set_len,&len);
- if (retval) return retval;
- sum += len;
- retval = asn1_make_id(buf,UNIVERSAL,CONSTRUCTED,ASN1_SET,&len);
- if (retval) return retval;
- sum += len;
-
- *retlen = sum;
- return 0;
-}
-
-asn1_error_code
-asn1_make_string(asn1buf *buf, const unsigned int length, const char *string,
- int *retlen)
-{
- asn1_error_code retval;
-
- retval = asn1buf_insert_charstring(buf,length,string);
- if (retval) return retval;
-
- *retlen = length;
- return 0;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/* lib/krb5/asn.1/asn1_make.h */
-/*
- * Copyright 1994 by the Massachusetts Institute of Technology.
- * All Rights Reserved.
- *
- * Export of this software from the United States of America may
- * require a specific license from the United States Government.
- * It is the responsibility of any person or organization contemplating
- * export to obtain such a license before exporting.
- *
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
- * distribute this software and its documentation for any purpose and
- * without fee is hereby granted, provided that the above copyright
- * notice appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation, and that
- * the name of M.I.T. not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Furthermore if you modify this software you must label
- * your software as modified software and not distribute it in such a
- * fashion that it might be confused with the original M.I.T. software.
- * M.I.T. makes no representations about the suitability of
- * this software for any purpose. It is provided "as is" without express
- * or implied warranty.
- */
-
-#ifndef __ASN1_MAKE_H__
-#define __ASN1_MAKE_H__
-
-#include "k5-int.h"
-#include "krbasn1.h"
-#include "asn1buf.h"
-
-/*
- * Overview
- *
- * Each of these procedures constructs a subpart of an ASN.1
- * primitive in a coding buffer.
- *
- * Operations
- *
- * asn1_make_etag
- * asn1_make_sequence
- * asn1_make_set
- * asn1_make_tag
- * asn1_make_string
- */
-
-asn1_error_code asn1_make_etag(asn1buf *buf, asn1_class asn1class,
- asn1_tagnum tagnum, unsigned int in_len,
- unsigned int *retlen);
-/*
- * requires *buf is allocated, in_len is the length of an ASN.1 encoding
- * which has just been inserted in *buf
- * modifies *buf, *retlen
- * effects Inserts an explicit tag with class = asn1class, id# = tag
- * length = in_len into *buf.
- * Returns the length of this encoding in *retlen.
- * Returns ENOMEM if memory runs out.
- */
-
-asn1_error_code asn1_make_tag(asn1buf *buf, asn1_class asn1class,
- asn1_construction construction,
- asn1_tagnum tagnum, unsigned int in_len,
- unsigned int *retlen);
-/*
- * requires *buf is allocated, in_len is the length of an ASN.1 encoding
- * which has just been inserted in *buf
- * modifies *buf, *retlen
- * effects Inserts the encoding of a tag with class = asn1class,
- * primitive/constructed staus = construction,
- * id# = tag and length = in_len into *buf.
- * Returns the length of this encoding in *retlen.
- * Returns ENOMEM if memory runs out.
- * Returns ASN1_OVERFLOW if tagnum exceeds the limits of
- * the implementation.
- */
-
-asn1_error_code asn1_make_sequence(asn1buf *buf, const unsigned int seq_len,
- unsigned int *len);
-/*
- * requires *buf is allocated, seq_len is the length of a series of
- * sequence components which have just been inserted in *buf
- * modifies *buf, *retlen
- * effects Inserts the sequence header for a sequence of length seq_len
- * in *buf. Returns the length of this encoding in *retlen.
- * Returns ENOMEM if memory runs out.
- */
-
-asn1_error_code asn1_make_set(asn1buf *buf, const unsigned int set_len,
- unsigned int *retlen);
-/*
- * requires *buf is allocated, seq_len is the length of a series of
- * sequence components which have just been inserted in *buf
- * modifies *buf, *retlen
- * effects Inserts the set header for a set of length set_len in *buf.
- * Returns the length of this encoding in *retlen.
- * Returns ENOMEM if memory runs out.
- */
-
-asn1_error_code asn1_make_string(asn1buf *buf, const unsigned int len,
- const char *string, int *retlen);
-/*
- * requires *buf is allocated, len is the length of *string
- * effects Inserts the encoding of *string (a series of octets) in *buf.
- * Returns the length of this encoding in *retlen.
- * Returns ENOMEM if memory runs out.
- */
-
-
-/****************************************************************/
-/* Private procedures */
-
-/* "helper" procedure for asn1_make_tag */
-asn1_error_code asn1_make_length(asn1buf *buf, const unsigned int in_len,
- unsigned int *retlen);
-/*
- * requires *buf is allocated, in_len is the length of an ASN.1 encoding
- * which has just been inserted in *buf
- * modifies *buf, *retlen
- * effects inserts length octet(s) for in_len into *buf
- */
-
-/* "helper" procedure for asn1_make_tag */
-asn1_error_code asn1_make_id(asn1buf *buf, asn1_class asn1class,
- asn1_construction construction,
- asn1_tagnum tagnum, unsigned int *retlen);
-/*
- * requires *buf is allocated, asn1class and tagnum are appropriate for
- * the ASN.1 encoding which has just been inserted in *buf
- * modifies *buf, *retlen
- * effects Inserts id octet(s) of class asn1class and tag number tagnum
- * into *buf
- */
-
-#endif
$(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \
$(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \
$(top_srcdir)/include/socket-utils.h asn1_encode.c \
- asn1_encode.h asn1_make.h asn1buf.h krbasn1.h
+ asn1_encode.h asn1_get.h asn1buf.h krbasn1.h
asn1_get.so asn1_get.po $(OUTPRE)asn1_get.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
$(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \
$(top_srcdir)/include/socket-utils.h asn1_get.c asn1_get.h \
asn1buf.h krbasn1.h
-asn1_make.so asn1_make.po $(OUTPRE)asn1_make.$(OBJEXT): \
- $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
- $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
- $(COM_ERR_DEPS) $(top_srcdir)/include/k5-buf.h $(top_srcdir)/include/k5-err.h \
- $(top_srcdir)/include/k5-gmt_mktime.h $(top_srcdir)/include/k5-int-pkinit.h \
- $(top_srcdir)/include/k5-int.h $(top_srcdir)/include/k5-platform.h \
- $(top_srcdir)/include/k5-plugin.h $(top_srcdir)/include/k5-thread.h \
- $(top_srcdir)/include/k5-trace.h $(top_srcdir)/include/krb5.h \
- $(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \
- $(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \
- $(top_srcdir)/include/socket-utils.h asn1_make.c asn1_make.h \
- asn1buf.h krbasn1.h
asn1buf.so asn1buf.po $(OUTPRE)asn1buf.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
$(BUILDTOP)/include/krb5/krb5.h $(BUILDTOP)/include/osconf.h \
$(BUILDTOP)/include/profile.h $(COM_ERR_DEPS) $(top_srcdir)/include/k5-buf.h \
$(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \
$(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \
$(top_srcdir)/include/socket-utils.h asn1_encode.h \
- asn1_k_encode.c asn1_make.h asn1buf.h krbasn1.h
+ asn1_get.h asn1_k_encode.c asn1buf.h krbasn1.h
ldap_key_seq.so ldap_key_seq.po $(OUTPRE)ldap_key_seq.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
$(top_srcdir)/include/krb5.h $(top_srcdir)/include/krb5/authdata_plugin.h \
$(top_srcdir)/include/krb5/plugin.h $(top_srcdir)/include/krb5/preauth_plugin.h \
$(top_srcdir)/include/port-sockets.h $(top_srcdir)/include/socket-utils.h \
- asn1_decode.h asn1_encode.h asn1_get.h asn1_make.h \
- asn1buf.h krbasn1.h ldap_key_seq.c
+ asn1_decode.h asn1_encode.h asn1_get.h asn1buf.h krbasn1.h \
+ ldap_key_seq.c
asn1_misc.so asn1_misc.po $(OUTPRE)asn1_misc.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
#include "krbasn1.h"
#include "asn1_encode.h"
#include "asn1_decode.h"
-#include "asn1_make.h"
#include "asn1_get.h"
#ifdef ENABLE_LDAP