Moved generate_random_keyblock to encrypt.c
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3528 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -38,40 +38,6 @@
|
|||||||
|
|
||||||
#include "krb5_locl.h"
|
#include "krb5_locl.h"
|
||||||
|
|
||||||
krb5_error_code
|
|
||||||
krb5_generate_random_des_key(krb5_context context,
|
|
||||||
krb5_keyblock *keyblock)
|
|
||||||
{
|
|
||||||
des_new_random_key(keyblock->keyvalue.data);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct key_type {
|
|
||||||
int keytype;
|
|
||||||
int keysize;
|
|
||||||
krb5_error_code (*func)(krb5_context, krb5_keyblock*);
|
|
||||||
} key_types[] = {
|
|
||||||
{ KEYTYPE_DES, 8, krb5_generate_random_des_key },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int num_key_types = sizeof(key_types) / sizeof(key_types[0]);
|
|
||||||
|
|
||||||
krb5_error_code
|
|
||||||
krb5_generate_random_keyblock(krb5_context context,
|
|
||||||
int keytype,
|
|
||||||
krb5_keyblock *keyblock)
|
|
||||||
{
|
|
||||||
struct key_type *k;
|
|
||||||
for(k = key_types; k < key_types + num_key_types; k++)
|
|
||||||
if(keytype == k->keytype){
|
|
||||||
keyblock->keytype = keytype;
|
|
||||||
keyblock->keyvalue.length = k->keysize;
|
|
||||||
keyblock->keyvalue.data = malloc(keyblock->keyvalue.length);
|
|
||||||
return (*k->func)(context, keyblock);
|
|
||||||
}
|
|
||||||
return KRB5_PROG_KEYTYPE_NOSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
krb5_free_keyblock(krb5_context context,
|
krb5_free_keyblock(krb5_context context,
|
||||||
krb5_keyblock *keyblock)
|
krb5_keyblock *keyblock)
|
||||||
@@ -89,7 +55,6 @@ krb5_copy_keyblock_contents (krb5_context context,
|
|||||||
return krb5_data_copy (&to->keyvalue,
|
return krb5_data_copy (&to->keyvalue,
|
||||||
inblock->keyvalue.data,
|
inblock->keyvalue.data,
|
||||||
inblock->keyvalue.length);
|
inblock->keyvalue.length);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
|
Reference in New Issue
Block a user