Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-24 09:18:04

0001 /*
0002  * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 /*
0011  * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
0012  *
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  * 1. Redistributions of source code must retain the above copyright
0017  *    notice, this list of conditions and the following disclaimer.
0018  * 2. Neither the name of author nor the names of its contributors may
0019  *    be used to endorse or promote products derived from this software
0020  *    without specific prior written permission.
0021  *
0022  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
0023  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0025  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
0026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0032  * SUCH DAMAGE.
0033  */
0034 
0035 #ifndef OPENSSL_SEED_H
0036 #define OPENSSL_SEED_H
0037 #pragma once
0038 
0039 #include <openssl/macros.h>
0040 #ifndef OPENSSL_NO_DEPRECATED_3_0
0041 #define HEADER_SEED_H
0042 #endif
0043 
0044 #include <openssl/opensslconf.h>
0045 
0046 #ifndef OPENSSL_NO_SEED
0047 #include <openssl/e_os2.h>
0048 #include <openssl/crypto.h>
0049 #include <sys/types.h>
0050 
0051 #ifdef __cplusplus
0052 extern "C" {
0053 #endif
0054 
0055 #define SEED_BLOCK_SIZE 16
0056 #define SEED_KEY_LENGTH 16
0057 
0058 #ifndef OPENSSL_NO_DEPRECATED_3_0
0059 /* look whether we need 'long' to get 32 bits */
0060 #ifdef AES_LONG
0061 #ifndef SEED_LONG
0062 #define SEED_LONG 1
0063 #endif
0064 #endif
0065 
0066 typedef struct seed_key_st {
0067 #ifdef SEED_LONG
0068     unsigned long data[32];
0069 #else
0070     unsigned int data[32];
0071 #endif
0072 } SEED_KEY_SCHEDULE;
0073 #endif /* OPENSSL_NO_DEPRECATED_3_0 */
0074 #ifndef OPENSSL_NO_DEPRECATED_3_0
0075 OSSL_DEPRECATEDIN_3_0
0076 void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
0077     SEED_KEY_SCHEDULE *ks);
0078 OSSL_DEPRECATEDIN_3_0
0079 void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE],
0080     unsigned char d[SEED_BLOCK_SIZE],
0081     const SEED_KEY_SCHEDULE *ks);
0082 OSSL_DEPRECATEDIN_3_0
0083 void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE],
0084     unsigned char d[SEED_BLOCK_SIZE],
0085     const SEED_KEY_SCHEDULE *ks);
0086 OSSL_DEPRECATEDIN_3_0
0087 void SEED_ecb_encrypt(const unsigned char *in,
0088     unsigned char *out,
0089     const SEED_KEY_SCHEDULE *ks, int enc);
0090 OSSL_DEPRECATEDIN_3_0
0091 void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
0092     const SEED_KEY_SCHEDULE *ks,
0093     unsigned char ivec[SEED_BLOCK_SIZE],
0094     int enc);
0095 OSSL_DEPRECATEDIN_3_0
0096 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
0097     size_t len, const SEED_KEY_SCHEDULE *ks,
0098     unsigned char ivec[SEED_BLOCK_SIZE],
0099     int *num, int enc);
0100 OSSL_DEPRECATEDIN_3_0
0101 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
0102     size_t len, const SEED_KEY_SCHEDULE *ks,
0103     unsigned char ivec[SEED_BLOCK_SIZE],
0104     int *num);
0105 #endif
0106 
0107 #ifdef __cplusplus
0108 }
0109 #endif
0110 #endif
0111 
0112 #endif