Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
seed.h114 linesDownload Raw Back to openssl
1/*2 * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.3 *4 * Licensed under the Apache License 2.0 (the "License").  You may not use5 * this file except in compliance with the License.  You can obtain a copy6 * in the file LICENSE in the source distribution or at7 * https://www.openssl.org/source/license.html8 */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 without14 * modification, are permitted provided that the following conditions15 * are met:16 * 1. Redistributions of source code must retain the above copyright17 *    notice, this list of conditions and the following disclaimer.18 * 2. Neither the name of author nor the names of its contributors may19 *    be used to endorse or promote products derived from this software20 *    without specific prior written permission.21 *22 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE25 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF32 * SUCH DAMAGE.33 */34 35#ifndef OPENSSL_SEED_H36# define OPENSSL_SEED_H37# pragma once38 39# include <openssl/macros.h>40# ifndef OPENSSL_NO_DEPRECATED_3_041#  define HEADER_SEED_H42# endif43 44# include <openssl/opensslconf.h>45 46# ifndef OPENSSL_NO_SEED47#  include <openssl/e_os2.h>48#  include <openssl/crypto.h>49#  include <sys/types.h>50 51#  ifdef  __cplusplus52extern "C" {53#  endif54 55#  define SEED_BLOCK_SIZE 1656#  define SEED_KEY_LENGTH 1657 58#  ifndef OPENSSL_NO_DEPRECATED_3_059/* look whether we need 'long' to get 32 bits */60#   ifdef AES_LONG61#    ifndef SEED_LONG62#     define SEED_LONG 163#    endif64#   endif65 66 67typedef struct seed_key_st {68#   ifdef SEED_LONG69    unsigned long data[32];70#   else71    unsigned int data[32];72#   endif73} SEED_KEY_SCHEDULE;74#  endif /* OPENSSL_NO_DEPRECATED_3_0 */75#  ifndef OPENSSL_NO_DEPRECATED_3_076OSSL_DEPRECATEDIN_3_077void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],78                  SEED_KEY_SCHEDULE *ks);79OSSL_DEPRECATEDIN_3_080void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE],81                  unsigned char d[SEED_BLOCK_SIZE],82                  const SEED_KEY_SCHEDULE *ks);83OSSL_DEPRECATEDIN_3_084void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE],85                  unsigned char d[SEED_BLOCK_SIZE],86                  const SEED_KEY_SCHEDULE *ks);87OSSL_DEPRECATEDIN_3_088void SEED_ecb_encrypt(const unsigned char *in,89                      unsigned char *out,90                      const SEED_KEY_SCHEDULE *ks, int enc);91OSSL_DEPRECATEDIN_3_092void 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);96OSSL_DEPRECATEDIN_3_097void 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);101OSSL_DEPRECATEDIN_3_0102void 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#  endif107 108#  ifdef  __cplusplus109}110#  endif111# endif112 113#endif114