Select Git revision
der-iterator.c
gost28147.c 30.51 KiB
/* gost28147.c - GOST 28147-89 cipher implementation
*
* based on Russian standard GOST 28147-89
* For English description, check RFC 5830.
* S-Boxes are expanded from the tables defined in RFC4357:
* https://tools.ietf.org/html/rfc4357
*
* Copyright: 2019 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "macros.h"
#include "gost28147-internal.h"
/* pre-initialized GOST lookup tables based on rotated S-Box */
const struct gost28147_param _nettle_gost28147_param_test_3411 =
{
{
{ /* 0 */
0x00072000, 0x00075000, 0x00074800, 0x00071000,
0x00076800, 0x00074000, 0x00070000, 0x00077000,
0x00073000, 0x00075800, 0x00070800, 0x00076000,
0x00073800, 0x00077800, 0x00072800, 0x00071800,
0x0005a000, 0x0005d000, 0x0005c800, 0x00059000,
0x0005e800, 0x0005c000, 0x00058000, 0x0005f000,
0x0005b000, 0x0005d800, 0x00058800, 0x0005e000,
0x0005b800, 0x0005f800, 0x0005a800, 0x00059800,
0x00022000, 0x00025000, 0x00024800, 0x00021000,
0x00026800, 0x00024000, 0x00020000, 0x00027000,
0x00023000, 0x00025800, 0x00020800, 0x00026000,
0x00023800, 0x00027800, 0x00022800, 0x00021800,
0x00062000, 0x00065000, 0x00064800, 0x00061000,
0x00066800, 0x00064000, 0x00060000, 0x00067000,
0x00063000, 0x00065800, 0x00060800, 0x00066000,
0x00063800, 0x00067800, 0x00062800, 0x00061800,
0x00032000, 0x00035000, 0x00034800, 0x00031000,
0x00036800, 0x00034000, 0x00030000, 0x00037000,
0x00033000, 0x00035800, 0x00030800, 0x00036000,
0x00033800, 0x00037800, 0x00032800, 0x00031800,
0x0006a000, 0x0006d000, 0x0006c800, 0x00069000,
0x0006e800, 0x0006c000, 0x00068000, 0x0006f000,
0x0006b000, 0x0006d800, 0x00068800, 0x0006e000,
0x0006b800, 0x0006f800, 0x0006a800, 0x00069800,
0x0007a000, 0x0007d000, 0x0007c800, 0x00079000,
0x0007e800, 0x0007c000, 0x00078000, 0x0007f000,
0x0007b000, 0x0007d800, 0x00078800, 0x0007e000,
0x0007b800, 0x0007f800, 0x0007a800, 0x00079800,