/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ... copyright ... */
/*
*/
/*
* Novell key-format scheme:
*
* KrbKeySet ::= SEQUENCE {
* attribute-major-vno [0] UInt16,
* attribute-minor-vno [1] UInt16,
* kvno [2] UInt32,
* mkvno [3] UInt32 OPTIONAL,
* keys [4] SEQUENCE OF KrbKey,
* ...
* }
*
* KrbKey ::= SEQUENCE {
* salt [0] KrbSalt OPTIONAL,
* key [1] EncryptionKey,
* s2kparams [2] OCTET STRING OPTIONAL,
* ...
* }
*
* KrbSalt ::= SEQUENCE {
* type [0] Int32,
* salt [1] OCTET STRING OPTIONAL
* }
*
* EncryptionKey ::= SEQUENCE {
* keytype [0] Int32,
* keyvalue [1] OCTET STRING
* }
*
*/
#include <k5-int.h>
#include <kdb.h>
#include "krbasn1.h"
#include "asn1_encode.h"
#include "asn1_decode.h"
#include "asn1_make.h"
#include "asn1_get.h"
#include "asn1_k_encode.h"
#ifdef ENABLE_LDAP
/************************************************************************/
/* Encode the Principal's keys */
/************************************************************************/
/*
* Imports from asn1_k_encode.c.
* XXX Must be manually synchronized for now.
*/
IMPORT_TYPE(octetstring, unsigned char *);
};
static unsigned int
optional_krbsalt (const void *p)
{
const krb5_key_data *k = p;
unsigned int optional = 0;
if (k->key_data_length[1] > 0)
return optional;
}
};
#if 0 /* We don't support this field currently. */
#endif
};
FIELD_INT_IMM(1, 0),
int16, 4),
};
/* Export a function to do the whole encoding. */
/************************************************************************/
/* Decode the Principal's keys */
/************************************************************************/
{ \
goto last; \
}
#define checkerr \
if (ret != 0) \
goto last
cleanup (ASN1_BAD_LENGTH); \
static asn1_error_code
{
int buflen;
taginfo t;
/* Work on a copy of 'buf' */
if (t.tagnum != expectedtag)
last:
return ret;
}
#if 0 /* not currently used */
static asn1_error_code
{
int buflen;
asn1_error_code ret = 0;
taginfo t;
/* Work on a copy of 'buf' */
if (t.tagnum != expectedtag)
last:
return ret;
}
#endif
static asn1_error_code
unsigned int *len,
asn1_octet **val)
{
int buflen;
taginfo t;
/* Work on a copy of 'buf' */
if (t.tagnum != expectedtag)
last:
if (ret != 0)
return ret;
}
static asn1_error_code
{
unsigned int length;
taginfo t;
asn1_get_tag_2(&subbuf, &t);
/* Salt */
if (t.tagnum == 0) {
int salt_buflen;
long keytype;
unsigned int keylen;
} else
keylen = 0;
} else
/* Key */
{
int key_buflen;
long lval;
unsigned int ival;
if (t.tagnum != 1)
key_buflen = length;
}
last:
if (ret != 0) {
}
return ret;
}
{
int *mkvno;
int seqindef;
unsigned int length;
taginfo t;
long lval;
/* Solaris Kerberos */
return (ENOMEM);
*n_key_data = 0;
/* attribute-major-vno */
/* attribute-minor-vno */
/* kvno (assuming all keys in array have same version) */
/* mkvno (optional) */
/* Sequence of keys */
{
int i, seq_buflen;
if (t.tagnum != 4)
seq_buflen = length;
(*n_key_data)++;
if (asn1buf_remains(&keyseq, 0) == 0)
break; /* Not freeing the last key structure */
}
}
/*
* There could be other data inside the outermost sequence ... tags we don't
* know about. So, not invoking "safe_syncbuf(&buf,&subbuf)"
*/
last:
if (ret != 0) {
int i;
for (i = 0; i < *n_key_data; i++) {
}
}
return ret;
}
#endif