Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:49

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 
0067 typedef struct seed_key_st {
0068 #   ifdef SEED_LONG
0069     unsigned long data[32];
0070 #   else
0071     unsigned int data[32];
0072 #   endif
0073 } SEED_KEY_SCHEDULE;
0074 #  endif /* OPENSSL_NO_DEPRECATED_3_0 */
0075 #  ifndef OPENSSL_NO_DEPRECATED_3_0
0076 OSSL_DEPRECATEDIN_3_0
0077 void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
0078                   SEED_KEY_SCHEDULE *ks);
0079 OSSL_DEPRECATEDIN_3_0
0080 void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE],
0081                   unsigned char d[SEED_BLOCK_SIZE],
0082                   const SEED_KEY_SCHEDULE *ks);
0083 OSSL_DEPRECATEDIN_3_0
0084 void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE],
0085                   unsigned char d[SEED_BLOCK_SIZE],
0086                   const SEED_KEY_SCHEDULE *ks);
0087 OSSL_DEPRECATEDIN_3_0
0088 void SEED_ecb_encrypt(const unsigned char *in,
0089                       unsigned char *out,
0090                       const SEED_KEY_SCHEDULE *ks, int enc);
0091 OSSL_DEPRECATEDIN_3_0
0092 void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
0093                       const SEED_KEY_SCHEDULE *ks,
0094                       unsigned char ivec[SEED_BLOCK_SIZE],
0095                       int enc);
0096 OSSL_DEPRECATEDIN_3_0
0097 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
0098                          size_t len, const SEED_KEY_SCHEDULE *ks,
0099                          unsigned char ivec[SEED_BLOCK_SIZE],
0100                          int *num, int enc);
0101 OSSL_DEPRECATEDIN_3_0
0102 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
0103                          size_t len, const SEED_KEY_SCHEDULE *ks,
0104                          unsigned char ivec[SEED_BLOCK_SIZE],
0105                          int *num);
0106 #  endif
0107 
0108 #  ifdef  __cplusplus
0109 }
0110 #  endif
0111 # endif
0112 
0113 #endif