|
Packit Service |
99d1c0 |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
Packit Service |
99d1c0 |
/* lib/crypto/krb/state.c */
|
|
Packit Service |
99d1c0 |
/*
|
|
Packit Service |
99d1c0 |
* Copyright (C) 2001 by the Massachusetts Institute of Technology.
|
|
Packit Service |
99d1c0 |
* All rights reserved.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* Export of this software from the United States of America may
|
|
Packit Service |
99d1c0 |
* require a specific license from the United States Government.
|
|
Packit Service |
99d1c0 |
* It is the responsibility of any person or organization contemplating
|
|
Packit Service |
99d1c0 |
* export to obtain such a license before exporting.
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
|
|
Packit Service |
99d1c0 |
* distribute this software and its documentation for any purpose and
|
|
Packit Service |
99d1c0 |
* without fee is hereby granted, provided that the above copyright
|
|
Packit Service |
99d1c0 |
* notice appear in all copies and that both that copyright notice and
|
|
Packit Service |
99d1c0 |
* this permission notice appear in supporting documentation, and that
|
|
Packit Service |
99d1c0 |
* the name of M.I.T. not be used in advertising or publicity pertaining
|
|
Packit Service |
99d1c0 |
* to distribution of the software without specific, written prior
|
|
Packit Service |
99d1c0 |
* permission. Furthermore if you modify this software you must label
|
|
Packit Service |
99d1c0 |
* your software as modified software and not distribute it in such a
|
|
Packit Service |
99d1c0 |
* fashion that it might be confused with the original M.I.T. software.
|
|
Packit Service |
99d1c0 |
* M.I.T. makes no representations about the suitability of
|
|
Packit Service |
99d1c0 |
* this software for any purpose. It is provided "as is" without express
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
*
|
|
Packit Service |
99d1c0 |
* * Section 6 (Encryption) of the Kerberos revisions document defines
|
|
Packit Service |
99d1c0 |
* cipher states to be used to chain encryptions and decryptions
|
|
Packit Service |
99d1c0 |
* together. Examples of cipher states include initialization vectors
|
|
Packit Service |
99d1c0 |
* for CBC encription. This file contains implementations of
|
|
Packit Service |
99d1c0 |
* krb5_c_init_state and krb5_c_free_state used by clients of the
|
|
Packit Service |
99d1c0 |
* Kerberos crypto library.
|
|
Packit Service |
99d1c0 |
*/
|
|
Packit Service |
99d1c0 |
#include "crypto_int.h"
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
krb5_error_code KRB5_CALLCONV
|
|
Packit Service |
99d1c0 |
krb5_c_init_state (krb5_context context, const krb5_keyblock *key,
|
|
Packit Service |
99d1c0 |
krb5_keyusage keyusage, krb5_data *new_state)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
const struct krb5_keytypes *ktp;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
ktp = find_enctype(key->enctype);
|
|
Packit Service |
99d1c0 |
if (ktp == NULL)
|
|
Packit Service |
99d1c0 |
return KRB5_BAD_ENCTYPE;
|
|
Packit Service |
99d1c0 |
return ktp->enc->init_state(key, keyusage, new_state);
|
|
Packit Service |
99d1c0 |
}
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
krb5_error_code KRB5_CALLCONV
|
|
Packit Service |
99d1c0 |
krb5_c_free_state(krb5_context context, const krb5_keyblock *key,
|
|
Packit Service |
99d1c0 |
krb5_data *state)
|
|
Packit Service |
99d1c0 |
{
|
|
Packit Service |
99d1c0 |
const struct krb5_keytypes *ktp;
|
|
Packit Service |
99d1c0 |
|
|
Packit Service |
99d1c0 |
ktp = find_enctype(key->enctype);
|
|
Packit Service |
99d1c0 |
if (ktp == NULL)
|
|
Packit Service |
99d1c0 |
return KRB5_BAD_ENCTYPE;
|
|
Packit Service |
99d1c0 |
ktp->enc->free_state(state);
|
|
Packit Service |
99d1c0 |
return 0;
|
|
Packit Service |
99d1c0 |
}
|