dpdk: Add support for Mellanox ConnectX-4 devices
[vpp.git] / vppinfra / vppinfra / random_isaac.h
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16   ------------------------------------------------------------------------------
17   By Bob Jenkins, 1996, Public Domain
18   MODIFIED:
19   960327: Creation (addition of randinit, really)
20   970719: use context, not global variables, for internal state
21   980324: renamed seed to flag
22   980605: recommend ISAAC_LOG2_SIZE=4 for noncryptography.
23   010626: note this is public domain
24   ------------------------------------------------------------------------------
25
26   Modified for CLIB by Eliot Dresselhaus.
27   Dear Bob, Thanks for all the great work. - Eliot
28
29   modifications copyright (c) 2003 Eliot Dresselhaus
30
31   Permission is hereby granted, free of charge, to any person obtaining
32   a copy of this software and associated documentation files (the
33   "Software"), to deal in the Software without restriction, including
34   without limitation the rights to use, copy, modify, merge, publish,
35   distribute, sublicense, and/or sell copies of the Software, and to
36   permit persons to whom the Software is furnished to do so, subject to
37   the following conditions:
38
39   The above copyright notice and this permission notice shall be
40   included in all copies or substantial portions of the Software.
41
42   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
46   LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
47   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
48   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49 */
50
51 #ifndef included_random_isaac_h
52 #define included_random_isaac_h
53
54 #include <vppinfra/clib.h>      /* for u32/u64 */
55 #include <vppinfra/format.h>    /* for unformat_input_t */
56
57 /* Bob recommends 8 for crypto, 4 for simulations */
58 #define ISAAC_LOG2_SIZE   (4)
59 #define ISAAC_SIZE (1 << ISAAC_LOG2_SIZE)
60
61 typedef struct
62 {
63   uword memory[ISAAC_SIZE];
64   uword a, b, c;
65 } isaac_t;
66
67 void isaac (isaac_t * ctx, uword * results);
68 void isaac2 (isaac_t * ctx, uword * results);
69 void isaac_init (isaac_t * ctx, uword * results);
70
71 int test_isaac_main (unformat_input_t * input);
72
73 #endif /* included_random_isaac_h */
74
75 /*
76  * fd.io coding-style-patch-verification: ON
77  *
78  * Local Variables:
79  * eval: (c-set-style "gnu")
80  * End:
81  */