source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/evp/e_rc4.c@ 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-csrc
File size: 1.9 KB
Line 
1/*
2 * Copyright 1995-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#include <stdio.h>
11#include "internal/cryptlib.h"
12
13#ifndef OPENSSL_NO_RC4
14
15# include <openssl/evp.h>
16# include <openssl/objects.h>
17# include <openssl/rc4.h>
18
19# include "internal/evp_int.h"
20
21typedef struct {
22 RC4_KEY ks; /* working key */
23} EVP_RC4_KEY;
24
25# define data(ctx) ((EVP_RC4_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))
26
27static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
28 const unsigned char *iv, int enc);
29static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
30 const unsigned char *in, size_t inl);
31static const EVP_CIPHER r4_cipher = {
32 NID_rc4,
33 1, EVP_RC4_KEY_SIZE, 0,
34 EVP_CIPH_VARIABLE_LENGTH,
35 rc4_init_key,
36 rc4_cipher,
37 NULL,
38 sizeof(EVP_RC4_KEY),
39 NULL,
40 NULL,
41 NULL,
42 NULL
43};
44
45static const EVP_CIPHER r4_40_cipher = {
46 NID_rc4_40,
47 1, 5 /* 40 bit */ , 0,
48 EVP_CIPH_VARIABLE_LENGTH,
49 rc4_init_key,
50 rc4_cipher,
51 NULL,
52 sizeof(EVP_RC4_KEY),
53 NULL,
54 NULL,
55 NULL,
56 NULL
57};
58
59const EVP_CIPHER *EVP_rc4(void)
60{
61 return (&r4_cipher);
62}
63
64const EVP_CIPHER *EVP_rc4_40(void)
65{
66 return (&r4_40_cipher);
67}
68
69static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
70 const unsigned char *iv, int enc)
71{
72 RC4_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_key_length(ctx), key);
73 return 1;
74}
75
76static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
77 const unsigned char *in, size_t inl)
78{
79 RC4(&data(ctx)->ks, inl, in, out);
80 return 1;
81}
82#endif
Note: See TracBrowser for help on using the repository browser.