source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/engine/eng_fat.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: 3.8 KB
Line 
1/*
2 * Copyright 2001-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/* ====================================================================
11 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
12 * ECDH support in OpenSSL originally developed by
13 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
14 */
15
16#include "eng_int.h"
17#include <openssl/conf.h>
18
19int ENGINE_set_default(ENGINE *e, unsigned int flags)
20{
21 if ((flags & ENGINE_METHOD_CIPHERS) && !ENGINE_set_default_ciphers(e))
22 return 0;
23 if ((flags & ENGINE_METHOD_DIGESTS) && !ENGINE_set_default_digests(e))
24 return 0;
25#ifndef OPENSSL_NO_RSA
26 if ((flags & ENGINE_METHOD_RSA) && !ENGINE_set_default_RSA(e))
27 return 0;
28#endif
29#ifndef OPENSSL_NO_DSA
30 if ((flags & ENGINE_METHOD_DSA) && !ENGINE_set_default_DSA(e))
31 return 0;
32#endif
33#ifndef OPENSSL_NO_DH
34 if ((flags & ENGINE_METHOD_DH) && !ENGINE_set_default_DH(e))
35 return 0;
36#endif
37#ifndef OPENSSL_NO_EC
38 if ((flags & ENGINE_METHOD_EC) && !ENGINE_set_default_EC(e))
39 return 0;
40#endif
41 if ((flags & ENGINE_METHOD_RAND) && !ENGINE_set_default_RAND(e))
42 return 0;
43 if ((flags & ENGINE_METHOD_PKEY_METHS)
44 && !ENGINE_set_default_pkey_meths(e))
45 return 0;
46 if ((flags & ENGINE_METHOD_PKEY_ASN1_METHS)
47 && !ENGINE_set_default_pkey_asn1_meths(e))
48 return 0;
49 return 1;
50}
51
52/* Set default algorithms using a string */
53
54static int int_def_cb(const char *alg, int len, void *arg)
55{
56 unsigned int *pflags = arg;
57 if (alg == NULL)
58 return 0;
59 if (strncmp(alg, "ALL", len) == 0)
60 *pflags |= ENGINE_METHOD_ALL;
61 else if (strncmp(alg, "RSA", len) == 0)
62 *pflags |= ENGINE_METHOD_RSA;
63 else if (strncmp(alg, "DSA", len) == 0)
64 *pflags |= ENGINE_METHOD_DSA;
65 else if (strncmp(alg, "DH", len) == 0)
66 *pflags |= ENGINE_METHOD_DH;
67 else if (strncmp(alg, "EC", len) == 0)
68 *pflags |= ENGINE_METHOD_EC;
69 else if (strncmp(alg, "RAND", len) == 0)
70 *pflags |= ENGINE_METHOD_RAND;
71 else if (strncmp(alg, "CIPHERS", len) == 0)
72 *pflags |= ENGINE_METHOD_CIPHERS;
73 else if (strncmp(alg, "DIGESTS", len) == 0)
74 *pflags |= ENGINE_METHOD_DIGESTS;
75 else if (strncmp(alg, "PKEY", len) == 0)
76 *pflags |= ENGINE_METHOD_PKEY_METHS | ENGINE_METHOD_PKEY_ASN1_METHS;
77 else if (strncmp(alg, "PKEY_CRYPTO", len) == 0)
78 *pflags |= ENGINE_METHOD_PKEY_METHS;
79 else if (strncmp(alg, "PKEY_ASN1", len) == 0)
80 *pflags |= ENGINE_METHOD_PKEY_ASN1_METHS;
81 else
82 return 0;
83 return 1;
84}
85
86int ENGINE_set_default_string(ENGINE *e, const char *def_list)
87{
88 unsigned int flags = 0;
89 if (!CONF_parse_list(def_list, ',', 1, int_def_cb, &flags)) {
90 ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING,
91 ENGINE_R_INVALID_STRING);
92 ERR_add_error_data(2, "str=", def_list);
93 return 0;
94 }
95 return ENGINE_set_default(e, flags);
96}
97
98int ENGINE_register_complete(ENGINE *e)
99{
100 ENGINE_register_ciphers(e);
101 ENGINE_register_digests(e);
102#ifndef OPENSSL_NO_RSA
103 ENGINE_register_RSA(e);
104#endif
105#ifndef OPENSSL_NO_DSA
106 ENGINE_register_DSA(e);
107#endif
108#ifndef OPENSSL_NO_DH
109 ENGINE_register_DH(e);
110#endif
111#ifndef OPENSSL_NO_EC
112 ENGINE_register_EC(e);
113#endif
114 ENGINE_register_RAND(e);
115 ENGINE_register_pkey_meths(e);
116 return 1;
117}
118
119int ENGINE_register_all_complete(void)
120{
121 ENGINE *e;
122
123 for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
124 if (!(e->flags & ENGINE_FLAGS_NO_REGISTER_ALL))
125 ENGINE_register_complete(e);
126 return 1;
127}
Note: See TracBrowser for help on using the repository browser.