1
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3
* lib/crypto/krb/prf//des_prf.c
5
* Copyright (C) 2004, 2009 by the Massachusetts Institute of Technology.
8
* Export of this software from the United States of America may
9
* require a specific license from the United States Government.
10
* It is the responsibility of any person or organization contemplating
11
* export to obtain such a license before exporting.
13
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
14
* distribute this software and its documentation for any purpose and
15
* without fee is hereby granted, provided that the above copyright
16
* notice appear in all copies and that both that copyright notice and
17
* this permission notice appear in supporting documentation, and that
18
* the name of M.I.T. not be used in advertising or publicity pertaining
19
* to distribution of the software without specific, written prior
20
* permission. Furthermore if you modify this software you must label
21
* your software as modified software and not distribute it in such a
22
* fashion that it might be confused with the original M.I.T. software.
23
* M.I.T. makes no representations about the suitability of
24
* this software for any purpose. It is provided "as is" without express
25
* or implied warranty.
29
* This file contains an implementation of the RFC 3961 PRF for
30
* des-cbc-crc, des-cbc-md4, and des-cbc-md5 enctypes.
34
#include "hash_provider/hash_provider.h"
37
krb5int_des_prf(const struct krb5_keytypes *ktp, krb5_key key,
38
const krb5_data *in, krb5_data *out)
40
const struct krb5_hash_provider *hash = &krb5int_hash_md5;
44
/* Compute a hash of the input, storing into the output buffer. */
45
iov.flags = KRB5_CRYPTO_TYPE_DATA;
47
ret = hash->hash(&iov, 1, out);
51
/* Encrypt the hash in place. */
53
return ktp->enc->encrypt(key, NULL, &iov, 1);