Annotation of embedaddon/strongswan/src/libstrongswan/plugins/bliss/bliss_utils.h, revision 1.1.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_utils bliss_utils
                     18:  * @{ @ingroup bliss_p
                     19:  */
                     20: 
                     21: #ifndef BLISS_UTILS_H_
                     22: #define BLISS_UTILS_H_
                     23: 
                     24: #include "bliss_param_set.h"
                     25: 
                     26: #include <library.h>
                     27: 
                     28: /**
                     29:  * Compute the scalar product of two vectors of size n
                     30:  *
                     31:  * @param x                    input vector of size n
                     32:  * @param y                    input vector of size n
                     33:  * @param n                    size of input vectors x and y
                     34:  * @result                     scalar product of x and y
                     35:  */
                     36: int32_t bliss_utils_scalar_product(int32_t *x, int32_t *y, int n);
                     37: 
                     38: /**
                     39:  * Drop d bits but round first
                     40:  *
                     41:  * @param set          BLISS parameter set
                     42:  * @param x                    input vector x of size n
                     43:  * @param xd           rounded vector x with d bits dropped
                     44:  */
                     45: void bliss_utils_round_and_drop(const bliss_param_set_t *set,
                     46:                                                                int32_t *x, int16_t *xd);
                     47: 
                     48: /**
                     49:  * Generate the binary challenge vector c as an array of kappa indices
                     50:  *
                     51:  * @param alg                  XOF to be used for the internal oracle
                     52:  * @param data_hash            hash of the data to be signed
                     53:  * @param ud                   input vector ud of size n
                     54:  * @param set                  BLISS parameter set to be used (n, n_bits, kappa)
                     55:  * @param c_indices            indexes of non-zero challenge coefficients
                     56:  */
                     57: bool bliss_utils_generate_c(ext_out_function_t alg, chunk_t data_hash,
                     58:                                                        uint16_t *ud, const bliss_param_set_t *set,
                     59:                                                        uint16_t *c_indices);
                     60: 
                     61: /**
                     62:  * Check the infinity and l2 norms of the vectors z1 and z2d << d
                     63:  *
                     64:  * @param set          BLISS parameter set
                     65:  * @param z1           input vector
                     66:  * @param z2d          input vector
                     67:  * @result                     TRUE if infinite and l2 norms do not exceed boundaries
                     68:  */
                     69: bool bliss_utils_check_norms(const bliss_param_set_t *set,
                     70:                                                         int32_t *z1, int16_t *z2d);
                     71: 
                     72: #endif /** BLISS_UTILS_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>