/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*
* Copyright 2008 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
#include "k5-int.h"
#include "etypes.h"
#include "cksumtypes.h"
#include "dk.h"
#include "aead.h"
{
size_t i;
return NULL;
for (i = 0; i < num_data; i++) {
else
return NULL; /* can't appear twice */
}
}
return iov;
}
#ifdef DEBUG_IOV
static void
size_t i,
size_t j,
unsigned char *block,
{
size_t k;
for (k = 0; k < block_size; k++)
printf("\n");
}
#endif
static int
struct iov_block_state *iov_state,
size_t i)
{
int process_block;
break;
case KRB5_CRYPTO_TYPE_PADDING:
break;
case KRB5_CRYPTO_TYPE_HEADER:
break;
case KRB5_CRYPTO_TYPE_DATA:
process_block = 1;
break;
default:
process_block = 0;
break;
}
return process_block;
}
/*
* Returns TRUE if, having reached the end of the current buffer,
* we should pad the rest of the block with zeros.
*/
static int
struct iov_block_state *iov_state,
size_t i,
size_t j)
{
/* If the pad_to_boundary flag is unset, return FALSE */
if (iov_state->pad_to_boundary == 0)
return 0;
/* If we haven't got any data, we need to get some */
if (j == 0)
return 0;
/* No boundary between adjacent buffers marked for processing */
return 0;
return 1;
}
const krb5_crypto_iov *data,
struct iov_block_state *iov_state)
{
size_t i, j = 0;
continue;
break;
if (nbytes > block_size - j)
nbytes = block_size - j;
j += nbytes;
assert(j <= block_size);
if (j == block_size)
break;
}
if (i == num_data)
return FALSE;
if (j != block_size)
#ifdef DEBUG_IOV
#endif
return TRUE;
}
unsigned char *block,
struct iov_block_state *iov_state)
{
size_t i, j = 0;
continue;
break;
if (nbytes > block_size - j)
nbytes = block_size - j;
j += nbytes;
assert(j <= block_size);
if (j == block_size)
break;
}
#ifdef DEBUG_IOV
#endif
}
{
size_t i, j;
int got_data = 0;
return KRB5_BAD_MSIZE;
return ENOMEM;
i = 0;
i++;
for (j = 0; j < num_data; j++) {
if (got_data) {
return KRB5_BAD_MSIZE;
}
got_data++;
- trailer_len;
}
}
/* Use empty padding since tokens don't indicate the padding length. */
i++;
i++;
return ret;
}
unsigned int
{
/*
* Add in the header length since the header is encrypted along with the
* data. (arcfour violates this assumption since not all of the header is
* encrypted, but that's okay since it has no padding. If there is ever an
* enctype using a similar token format and a block cipher, we will have to
* move this logic into an enctype-dependent function.)
*/
data_length += header;
return 0;
else
}