Prototype implementation of IKE key exchange via NTRU encryption
[strongswan.git] / src / libstrongswan / plugins / ntru / ntru_crypto / ntru_crypto_msbyte_uint32.h
1 /******************************************************************************
2 * NTRU Cryptography Reference Source Code
3 * Copyright (c) 2009-2013, by Security Innovation, Inc. All rights reserved.
4 *
5 * ntru_crypto_msbyte_uint32.h is a component of ntru-crypto.
6 *
7 * Copyright (C) 2009-2013 Security Innovation
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 *
23 *****************************************************************************/
24
25 /******************************************************************************
26 *
27 * File: ntru_crypto_msbyte_uint32.h
28 *
29 * Contents: Definitions and declarations for converting between a most-
30 * significant-first byte stream and a uint32_t array.
31 *
32 *****************************************************************************/
33
34 #ifndef NTRU_CRYPTO_MSBYTE_UINT32_H
35 #define NTRU_CRYPTO_MSBYTE_UINT32_H
36
37
38 #include "ntru_crypto_platform.h"
39
40
41 /* ntru_crypto_msbyte_2_uint32()
42 *
43 * This routine converts an array of bytes in network byte order to an array
44 * of uint32_t, placing the first byte in the most significant byte of the
45 * first uint32_t word.
46 *
47 * The number of bytes in the input stream MUST be at least 4 times the
48 * number of words expected in the output array.
49 */
50
51 extern void
52 ntru_crypto_msbyte_2_uint32(
53 uint32_t *words, // out - pointer to the output uint32_t array
54 uint8_t const *bytes, // in - pointer to the input byte array
55 uint32_t n); // in - number of words in the output array
56
57
58 /* ntru_crypto_uint32_2_msbyte()
59 *
60 * This routine converts an array of uint32_t to an array of bytes in
61 * network byte order, placing the most significant byte of the first uint32_t
62 * word as the first byte of the output array.
63 *
64 * The number of bytes in the output stream will be 4 times the number of words
65 * specified in the input array.
66 */
67
68 extern void
69 ntru_crypto_uint32_2_msbyte(
70 uint8_t *bytes, // out - pointer to the output byte array
71 uint32_t const *words, // in - pointer to the input uint32_t array
72 uint32_t n); // in - number of words in the input array
73
74
75 #endif /* NTRU_CRYPTO_MSBYTE_UINT32_H */