blob: c37d1f96aaaf20e4835505b312dfc66ccc40b19c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* $Source$
* $Author$
*
* Copyright 1990 by the Massachusetts Institute of Technology.
*
* For copying and distribution information, please see the file
* <krb5/copyright.h>.
*
*/
#if !defined(lint) && !defined(SABER)
static char rcsid_init_rkey_c[] =
"$Id$";
#endif /* !lint & !SABER */
#include <krb5/copyright.h>
#include <krb5/krb5.h>
#include <krb5/ext-proto.h>
#include "des_int.h"
/*
initialize the random key generator using the encryption key,
"seedblock", and allocating private sequence information, filling
in "seed" with the address of such information.
"seed" is later passed to the random_key() function to provide
sequence information.
*/
krb5_error_code mit_des_init_random_key (DECLARG(const krb5_keyblock *,seedblock),
DECLARG(krb5_pointer *,seed))
OLDDECLARG(const krb5_keyblock *,seedblock)
OLDDECLARG(krb5_pointer *,seed)
{
mit_des_random_key_seed * p_seed;
if (seedblock->keytype != KEYTYPE_DES)
return KRB5_BAD_KEYTYPE; /* XXX error code bad keytype */
if ( !(p_seed = (mit_des_random_key_seed *)
malloc(sizeof(mit_des_random_key_seed))) )
return ENOMEM;
bzero( (char *)p_seed, sizeof(mit_des_random_key_seed) );
mit_des_init_random_number_generator(seedblock->contents, p_seed);
*seed = (krb5_pointer) p_seed;
return 0;
}
|