4 * Copyright 2008 by the Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
31 krb5_crypto_iov * KRB5_CALLCONV
32 krb5int_c_locate_iov(krb5_crypto_iov *data,
34 krb5_cryptotype type);
36 krb5_error_code KRB5_CALLCONV
37 krb5int_c_make_checksum_iov(const struct krb5_cksumtypes *cksum,
38 const krb5_keyblock *key,
40 const krb5_crypto_iov *data,
42 krb5_data *cksum_data);
44 const struct krb5_cksumtypes * KRB5_CALLCONV
45 krb5int_c_find_checksum_type(krb5_cksumtype cksumtype);
47 #define ENCRYPT_CONF_IOV(_iov) ((_iov)->flags == KRB5_CRYPTO_TYPE_HEADER)
49 #define ENCRYPT_DATA_IOV(_iov) ((_iov)->flags == KRB5_CRYPTO_TYPE_DATA || \
50 (_iov)->flags == KRB5_CRYPTO_TYPE_PADDING)
52 #define ENCRYPT_IOV(_iov) (ENCRYPT_CONF_IOV(_iov) || ENCRYPT_DATA_IOV(_iov))
54 #define SIGN_IOV(_iov) (ENCRYPT_IOV(_iov) || \
55 (_iov)->flags == KRB5_CRYPTO_TYPE_SIGN_ONLY )
57 struct iov_block_state {
58 size_t iov_pos; /* index into iov array */
59 size_t data_pos; /* index into iov contents */
60 unsigned int ignore_header : 1; /* have/should we process HEADER */
61 unsigned int include_sign_only : 1; /* should we process SIGN_ONLY blocks */
62 unsigned int pad_to_boundary : 1; /* should we zero fill blocks until next buffer */
65 #define IOV_BLOCK_STATE_INIT(_state) ((_state)->iov_pos = \
66 (_state)->data_pos = \
67 (_state)->ignore_header = \
68 (_state)->include_sign_only = \
69 (_state)->pad_to_boundary = 0)
71 krb5_boolean KRB5_CALLCONV
72 krb5int_c_iov_get_block(unsigned char *block,
74 const krb5_crypto_iov *data,
76 struct iov_block_state *iov_state);
78 krb5_boolean KRB5_CALLCONV
79 krb5int_c_iov_put_block(const krb5_crypto_iov *data,
83 struct iov_block_state *iov_state);
85 krb5_error_code KRB5_CALLCONV
86 krb5int_c_iov_decrypt_stream(const struct krb5_aead_provider *aead,
87 const struct krb5_enc_provider *enc,
88 const struct krb5_hash_provider *hash,
89 const krb5_keyblock *key,
90 krb5_keyusage keyusage,
91 const krb5_data *ivec,
92 krb5_crypto_iov *data,