*** empty log message ***

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1803 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-06-01 14:34:32 +00:00
parent 77e9073cca
commit 71646ad85b
2 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#include <krb5_locl.h>
RCSID("$Id$");
krb5_error_code
krb5_generate_subkey(krb5_context context,
const krb5_keyblock *key,
krb5_keyblock **subkey)
{
krb5_error_code ret;
krb5_keyblock *k;
if (key->keytype != KEYTYPE_DES)
abort ();
k = malloc(sizeof(**subkey));
if (k == NULL)
return ENOMEM;
k->keytype = key->keytype;
k->contents.length = 0;
ret = krb5_data_copy (&k->contents,
key->contents.data,
key->contents.length);
if (ret) {
free(k);
return ret;
}
des_new_random_key ((des_cblock *)k->contents.data);
*subkey = k;
return 0;
}