*** empty log message ***
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1803 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
30
lib/krb5/generate_subkey.c
Normal file
30
lib/krb5/generate_subkey.c
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user