webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
internal.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_TOOL_INTERNAL_H
16 #define OPENSSL_HEADER_TOOL_INTERNAL_H
17 
18 #include <openssl/base.h>
19 
20 #include <string>
21 #include <vector>
22 
24 // MSVC issues warning C4702 for unreachable code in its xtree header when
25 // compiling with -D_HAS_EXCEPTIONS=0. See
26 // https://connect.microsoft.com/VisualStudio/feedback/details/809962
28 
29 #include <map>
30 
32 
33 #if defined(OPENSSL_WINDOWS)
34  #define BORINGSSL_OPEN _open
35  #define BORINGSSL_FDOPEN _fdopen
36  #define BORINGSSL_CLOSE _close
37  #define BORINGSSL_READ _read
38  #define BORINGSSL_WRITE _write
39 #else
40  #define BORINGSSL_OPEN open
41  #define BORINGSSL_FDOPEN fdopen
42  #define BORINGSSL_CLOSE close
43  #define BORINGSSL_READ read
44  #define BORINGSSL_WRITE write
45 #endif
46 
51 };
52 
53 struct argument {
54  const char *name;
56  const char *description;
57 };
58 
59 bool ParseKeyValueArguments(std::map<std::string, std::string> *out_args, const
60  std::vector<std::string> &args, const struct argument *templates);
61 
62 void PrintUsage(const struct argument *templates);
63 
64 bool GetUnsigned(unsigned *out, const std::string &arg_name,
65  unsigned default_value,
66  const std::map<std::string, std::string> &args);
67 
68 bool Ciphers(const std::vector<std::string> &args);
69 bool Client(const std::vector<std::string> &args);
70 bool DoPKCS12(const std::vector<std::string> &args);
71 bool GenerateEd25519Key(const std::vector<std::string> &args);
72 bool GenerateRSAKey(const std::vector<std::string> &args);
73 bool MD5Sum(const std::vector<std::string> &args);
74 bool Rand(const std::vector<std::string> &args);
75 bool SHA1Sum(const std::vector<std::string> &args);
76 bool SHA224Sum(const std::vector<std::string> &args);
77 bool SHA256Sum(const std::vector<std::string> &args);
78 bool SHA384Sum(const std::vector<std::string> &args);
79 bool SHA512Sum(const std::vector<std::string> &args);
80 bool Server(const std::vector<std::string> &args);
81 bool Speed(const std::vector<std::string> &args);
82 
83 // These values are DER encoded, RSA private keys.
84 extern const uint8_t kDERRSAPrivate2048[];
85 extern const size_t kDERRSAPrivate2048Len;
86 extern const uint8_t kDERRSAPrivate4096[];
87 extern const size_t kDERRSAPrivate4096Len;
88 extern const uint8_t kDERRSAPrivate3Prime2048[];
89 extern const size_t kDERRSAPrivate3Prime2048Len;
90 
91 
92 #endif /* !OPENSSL_HEADER_TOOL_INTERNAL_H */
const uint8_t kDERRSAPrivate2048[]
Definition: const.cc:21
bool SHA384Sum(const std::vector< std::string > &args)
Definition: digest.cc:472
std::vector< TraceArg > args
Definition: event_tracer.cc:256
Definition: internal.h:49
bool ParseKeyValueArguments(std::map< std::string, std::string > *out_args, const std::vector< std::string > &args, const struct argument *templates)
Definition: args.cc:26
bool GetUnsigned(unsigned *out, const std::string &arg_name, unsigned default_value, const std::map< std::string, std::string > &args)
Definition: args.cc:81
bool SHA1Sum(const std::vector< std::string > &args)
Definition: digest.cc:460
bool Ciphers(const std::vector< std::string > &args)
Definition: ciphers.cc:26
bool SHA512Sum(const std::vector< std::string > &args)
Definition: digest.cc:476
const size_t kDERRSAPrivate2048Len
Definition: const.cc:124
const uint8_t kDERRSAPrivate3Prime2048[]
Definition: const.cc:327
Definition: internal.h:53
ArgumentType
Definition: internal.h:47
const size_t kDERRSAPrivate3Prime2048Len
Definition: const.cc:434
int int * out
Definition: gcc-loops.cpp:206
const uint8_t kDERRSAPrivate4096[]
Definition: const.cc:126
bool DoPKCS12(const std::vector< std::string > &args)
Definition: pkcs12.cc:58
unsigned char uint8_t
Definition: ptypes.h:89
bool Speed(const std::vector< std::string > &args)
Definition: speed.cc:586
bool GenerateEd25519Key(const std::vector< std::string > &args)
Definition: generate_ed25519.cc:60
bool SHA256Sum(const std::vector< std::string > &args)
Definition: digest.cc:468
bool GenerateRSAKey(const std::vector< std::string > &args)
Definition: genrsa.cc:38
OPENSSL_MSVC_PRAGMA(warning(disable:4702))
Definition: e_aes.c:70
const size_t kDERRSAPrivate4096Len
Definition: const.cc:325
void PrintUsage(const struct argument *templates)
Definition: args.cc:74
const char * name
Definition: internal.h:54
const char * description
Definition: internal.h:56
Definition: internal.h:50
GLsizei const GLchar *const * string
Definition: gl2.h:479
Definition: internal.h:48
bool MD5Sum(const std::vector< std::string > &args)
Definition: digest.cc:456
bool Client(const std::vector< std::string > &args)
Definition: client.cc:139
def disable(level)
Definition: __init__.py:1181
ArgumentType type
Definition: internal.h:55
midl_pragma warning(disable:2111) midl_pragma warning(disable
Definition: Accessible2.idl:352
bool Rand(const std::vector< std::string > &args)
Definition: rand.cc:36
bool SHA224Sum(const std::vector< std::string > &args)
Definition: digest.cc:464
bool Server(const std::vector< std::string > &args)
Definition: server.cc:94