]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
33388b44 | 2 | * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved. |
21dcbebc | 3 | * |
48f4ad77 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
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 | ||
96afc1cf | 10 | /* |
0f113f3e | 11 | * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. |
96afc1cf BM |
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. | |
96afc1cf BM |
33 | */ |
34 | ||
ae4186b0 DMSP |
35 | #ifndef OPENSSL_SEED_H |
36 | # define OPENSSL_SEED_H | |
d86167ec DMSP |
37 | # pragma once |
38 | ||
39 | # include <openssl/macros.h> | |
936c2b9e | 40 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
d86167ec DMSP |
41 | # define HEADER_SEED_H |
42 | # endif | |
96afc1cf | 43 | |
0f113f3e | 44 | # include <openssl/opensslconf.h> |
3c27208f RS |
45 | |
46 | # ifndef OPENSSL_NO_SEED | |
fb8ce413 P |
47 | # include <openssl/e_os2.h> |
48 | # include <openssl/crypto.h> | |
28c690cb | 49 | # include <sys/types.h> |
96afc1cf | 50 | |
fb8ce413 | 51 | # ifdef __cplusplus |
3c27208f | 52 | extern "C" { |
fb8ce413 | 53 | # endif |
96afc1cf | 54 | |
28c690cb P |
55 | # define SEED_BLOCK_SIZE 16 |
56 | # define SEED_KEY_LENGTH 16 | |
57 | ||
58 | # ifndef OPENSSL_NO_DEPRECATED_3_0 | |
68d39f3c | 59 | /* look whether we need 'long' to get 32 bits */ |
28c690cb P |
60 | # ifdef AES_LONG |
61 | # ifndef SEED_LONG | |
62 | # define SEED_LONG 1 | |
63 | # endif | |
fb8ce413 | 64 | # endif |
96afc1cf | 65 | |
96afc1cf | 66 | |
96afc1cf | 67 | typedef struct seed_key_st { |
28c690cb | 68 | # ifdef SEED_LONG |
96afc1cf | 69 | unsigned long data[32]; |
28c690cb | 70 | # else |
96afc1cf | 71 | unsigned int data[32]; |
28c690cb | 72 | # endif |
96afc1cf | 73 | } SEED_KEY_SCHEDULE; |
28c690cb | 74 | # endif /* OPENSSL_NO_DEPRECATED_3_0 */ |
0038fff0 RL |
75 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
76 | OSSL_DEPRECATEDIN_3_0 | |
77 | void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], | |
78 | SEED_KEY_SCHEDULE *ks); | |
79 | OSSL_DEPRECATEDIN_3_0 | |
80 | void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], | |
81 | unsigned char d[SEED_BLOCK_SIZE], | |
82 | const SEED_KEY_SCHEDULE *ks); | |
83 | OSSL_DEPRECATEDIN_3_0 | |
84 | void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], | |
85 | unsigned char d[SEED_BLOCK_SIZE], | |
86 | const SEED_KEY_SCHEDULE *ks); | |
87 | OSSL_DEPRECATEDIN_3_0 | |
88 | void SEED_ecb_encrypt(const unsigned char *in, | |
89 | unsigned char *out, | |
90 | const SEED_KEY_SCHEDULE *ks, int enc); | |
91 | OSSL_DEPRECATEDIN_3_0 | |
92 | void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, | |
93 | const SEED_KEY_SCHEDULE *ks, | |
94 | unsigned char ivec[SEED_BLOCK_SIZE], | |
95 | int enc); | |
96 | OSSL_DEPRECATEDIN_3_0 | |
97 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |
98 | size_t len, const SEED_KEY_SCHEDULE *ks, | |
99 | unsigned char ivec[SEED_BLOCK_SIZE], | |
100 | int *num, int enc); | |
101 | OSSL_DEPRECATEDIN_3_0 | |
102 | void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, | |
103 | size_t len, const SEED_KEY_SCHEDULE *ks, | |
104 | unsigned char ivec[SEED_BLOCK_SIZE], | |
105 | int *num); | |
106 | # endif | |
96afc1cf | 107 | |
fb8ce413 | 108 | # ifdef __cplusplus |
96afc1cf | 109 | } |
fb8ce413 | 110 | # endif |
3c27208f | 111 | # endif |
96afc1cf | 112 | |
3c27208f | 113 | #endif |