source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/seed/seed_locl.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 4.5 KB
Line 
1/*
2 * Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10/*
11 * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Neither the name of author nor the names of its contributors may
19 * be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 */
35#ifndef HEADER_SEED_LOCL_H
36# define HEADER_SEED_LOCL_H
37
38# include "openssl/e_os2.h"
39# include <openssl/seed.h>
40
41# ifdef SEED_LONG /* need 32-bit type */
42typedef unsigned long seed_word;
43# else
44typedef unsigned int seed_word;
45# endif
46
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52# define char2word(c, i) \
53 (i) = ((((seed_word)(c)[0]) << 24) | (((seed_word)(c)[1]) << 16) | (((seed_word)(c)[2]) << 8) | ((seed_word)(c)[3]))
54
55# define word2char(l, c) \
56 *((c)+0) = (unsigned char)((l)>>24) & 0xff; \
57 *((c)+1) = (unsigned char)((l)>>16) & 0xff; \
58 *((c)+2) = (unsigned char)((l)>> 8) & 0xff; \
59 *((c)+3) = (unsigned char)((l)) & 0xff
60
61# define KEYSCHEDULE_UPDATE0(T0, T1, X1, X2, X3, X4, KC) \
62 (T0) = (X3); \
63 (X3) = (((X3)<<8) ^ ((X4)>>24)) & 0xffffffff; \
64 (X4) = (((X4)<<8) ^ ((T0)>>24)) & 0xffffffff; \
65 (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \
66 (T1) = ((X2) + (KC) - (X4)) & 0xffffffff
67
68# define KEYSCHEDULE_UPDATE1(T0, T1, X1, X2, X3, X4, KC) \
69 (T0) = (X1); \
70 (X1) = (((X1)>>8) ^ ((X2)<<24)) & 0xffffffff; \
71 (X2) = (((X2)>>8) ^ ((T0)<<24)) & 0xffffffff; \
72 (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \
73 (T1) = ((X2) + (KC) - (X4)) & 0xffffffff
74
75# define KEYUPDATE_TEMP(T0, T1, K) \
76 (K)[0] = G_FUNC((T0)); \
77 (K)[1] = G_FUNC((T1))
78
79# define XOR_SEEDBLOCK(DST, SRC) \
80 ((DST))[0] ^= ((SRC))[0]; \
81 ((DST))[1] ^= ((SRC))[1]; \
82 ((DST))[2] ^= ((SRC))[2]; \
83 ((DST))[3] ^= ((SRC))[3]
84
85# define MOV_SEEDBLOCK(DST, SRC) \
86 ((DST))[0] = ((SRC))[0]; \
87 ((DST))[1] = ((SRC))[1]; \
88 ((DST))[2] = ((SRC))[2]; \
89 ((DST))[3] = ((SRC))[3]
90
91# define CHAR2WORD(C, I) \
92 char2word((C), (I)[0]); \
93 char2word((C+4), (I)[1]); \
94 char2word((C+8), (I)[2]); \
95 char2word((C+12), (I)[3])
96
97# define WORD2CHAR(I, C) \
98 word2char((I)[0], (C)); \
99 word2char((I)[1], (C+4)); \
100 word2char((I)[2], (C+8)); \
101 word2char((I)[3], (C+12))
102
103# define E_SEED(T0, T1, X1, X2, X3, X4, rbase) \
104 (T0) = (X3) ^ (ks->data)[(rbase)]; \
105 (T1) = (X4) ^ (ks->data)[(rbase)+1]; \
106 (T1) ^= (T0); \
107 (T1) = G_FUNC((T1)); \
108 (T0) = ((T0) + (T1)) & 0xffffffff; \
109 (T0) = G_FUNC((T0)); \
110 (T1) = ((T1) + (T0)) & 0xffffffff; \
111 (T1) = G_FUNC((T1)); \
112 (T0) = ((T0) + (T1)) & 0xffffffff; \
113 (X1) ^= (T0); \
114 (X2) ^= (T1)
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* HEADER_SEED_LOCL_H */
Note: See TracBrowser for help on using the repository browser.