Annotation of embedaddon/strongswan/src/libstrongswan/plugins/bliss/bliss_huffman_code.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2014 Andreas Steffen
! 3: * HSR Hochschule fuer Technik Rapperswil
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: */
! 15:
! 16: /**
! 17: * @defgroup bliss_huffman_code bliss_huffman_code
! 18: * @{ @ingroup bliss_p
! 19: */
! 20:
! 21: #ifndef BLISS_HUFFMAN_CODE_H_
! 22: #define BLISS_HUFFMAN_CODE_H_
! 23:
! 24: #include "bliss_param_set.h"
! 25:
! 26: #include <library.h>
! 27:
! 28: typedef struct bliss_huffman_code_t bliss_huffman_code_t;
! 29: typedef struct bliss_huffman_code_tuple_t bliss_huffman_code_tuple_t;
! 30: typedef struct bliss_huffman_code_node_t bliss_huffman_code_node_t;
! 31:
! 32: struct bliss_huffman_code_tuple_t {
! 33: uint32_t code;
! 34: uint16_t bits;
! 35: };
! 36:
! 37: #define BLISS_HUFFMAN_CODE_NO_TUPLE -1
! 38: #define BLISS_HUFFMAN_CODE_NO_NODE -1
! 39:
! 40: struct bliss_huffman_code_node_t {
! 41: int16_t node_0;
! 42: int16_t node_1;
! 43: int16_t tuple;
! 44: };
! 45:
! 46: /**
! 47: * Defines the Huffman code for the optimum encoding of a BLISS signature
! 48: */
! 49: struct bliss_huffman_code_t {
! 50:
! 51: /**
! 52: * Range of z1: 0..n_z1-1
! 53: */
! 54: uint16_t n_z1;
! 55:
! 56: /**
! 57: * Range of z2: -n_z2..n_z2
! 58: */
! 59: uint16_t n_z2;
! 60:
! 61: /**
! 62: * Table of tuple codewords
! 63: */
! 64: bliss_huffman_code_tuple_t *tuples;
! 65:
! 66: /**
! 67: * Table of binary decision nodes
! 68: */
! 69: bliss_huffman_code_node_t *nodes;
! 70: };
! 71:
! 72: /**
! 73: * Get Optimum Huffman code for BLISS signature given by BLISS parameter set ID
! 74: *
! 75: * @param id BLISS parameter set ID
! 76: * @return Optimum Huffman code for BLISS signature
! 77: */
! 78: bliss_huffman_code_t* bliss_huffman_code_get_by_id(bliss_param_set_id_t id);
! 79:
! 80: #endif /** BLISS_HUFFMAN_CODE_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>