netwerk/srtp/src/crypto/include/aes_icm.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/srtp/src/crypto/include/aes_icm.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     1.4 +/*
     1.5 + * aes_icm.h
     1.6 + *
     1.7 + * Header for AES Integer Counter Mode.
     1.8 + *
     1.9 + * David A. McGrew
    1.10 + * Cisco Systems, Inc.
    1.11 + *
    1.12 + */
    1.13 +/*
    1.14 + *	
    1.15 + * Copyright (c) 2001-2006, Cisco Systems, Inc.
    1.16 + * All rights reserved.
    1.17 + * 
    1.18 + * Redistribution and use in source and binary forms, with or without
    1.19 + * modification, are permitted provided that the following conditions
    1.20 + * are met:
    1.21 + * 
    1.22 + *   Redistributions of source code must retain the above copyright
    1.23 + *   notice, this list of conditions and the following disclaimer.
    1.24 + * 
    1.25 + *   Redistributions in binary form must reproduce the above
    1.26 + *   copyright notice, this list of conditions and the following
    1.27 + *   disclaimer in the documentation and/or other materials provided
    1.28 + *   with the distribution.
    1.29 + * 
    1.30 + *   Neither the name of the Cisco Systems, Inc. nor the names of its
    1.31 + *   contributors may be used to endorse or promote products derived
    1.32 + *   from this software without specific prior written permission.
    1.33 + * 
    1.34 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.35 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.36 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    1.37 + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    1.38 + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
    1.39 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    1.40 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    1.41 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.42 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    1.43 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.44 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    1.45 + * OF THE POSSIBILITY OF SUCH DAMAGE.
    1.46 + *
    1.47 + */
    1.48 +
    1.49 +#ifndef AES_ICM_H
    1.50 +#define AES_ICM_H
    1.51 +
    1.52 +#include "aes.h"
    1.53 +#include "cipher.h"
    1.54 +
    1.55 +typedef struct {
    1.56 +  v128_t   counter;                /* holds the counter value          */
    1.57 +  v128_t   offset;                 /* initial offset value             */
    1.58 +  v128_t   keystream_buffer;       /* buffers bytes of keystream       */
    1.59 +  aes_expanded_key_t expanded_key; /* the cipher key                   */
    1.60 +  int      bytes_in_buffer;        /* number of unused bytes in buffer */
    1.61 +} aes_icm_ctx_t;
    1.62 +
    1.63 +
    1.64 +err_status_t
    1.65 +aes_icm_context_init(aes_icm_ctx_t *c,
    1.66 +		     const unsigned char *key,
    1.67 +		     int key_len); 
    1.68 +
    1.69 +err_status_t
    1.70 +aes_icm_set_iv(aes_icm_ctx_t *c, void *iv);
    1.71 +
    1.72 +err_status_t
    1.73 +aes_icm_encrypt(aes_icm_ctx_t *c,
    1.74 +		unsigned char *buf, unsigned int *bytes_to_encr);
    1.75 +
    1.76 +err_status_t
    1.77 +aes_icm_output(aes_icm_ctx_t *c,
    1.78 +	       unsigned char *buf, int bytes_to_output);
    1.79 +
    1.80 +err_status_t 
    1.81 +aes_icm_dealloc(cipher_t *c);
    1.82 + 
    1.83 +err_status_t 
    1.84 +aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c, 
    1.85 +			 unsigned char *buf, 
    1.86 +			 unsigned int *enc_len, 
    1.87 +			 int forIsmacryp);
    1.88 + 
    1.89 +err_status_t 
    1.90 +aes_icm_alloc_ismacryp(cipher_t **c, 
    1.91 +		       int key_len, 
    1.92 +		       int forIsmacryp);
    1.93 +
    1.94 +#endif /* AES_ICM_H */
    1.95 +

mercurial