Multi-prime RSA support.

RSA with more than two primes is specified in
https://tools.ietf.org/html/rfc3447, although the idea goes back far
earier than that.

This change ports some of the changes in
http://rt.openssl.org/Ticket/Display.html?id=3477&user=guest&pass=guest
to BoringSSL—specifically those bits that are under an OpenSSL license.

Change-Id: I51e8e345e2148702b8ce12e00518f6ef4683d3e1
Reviewed-on: https://boringssl-review.googlesource.com/4870
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/tool/tool.cc b/tool/tool.cc
index 4bd7d1a..e4d5201 100644
--- a/tool/tool.cc
+++ b/tool/tool.cc
@@ -27,16 +27,17 @@
 
 
 bool Client(const std::vector<std::string> &args);
-bool Server(const std::vector<std::string> &args);
+bool DoPKCS12(const std::vector<std::string> &args);
+bool GenerateRSAKey(const std::vector<std::string> &args);
 bool MD5Sum(const std::vector<std::string> &args);
+bool Rand(const std::vector<std::string> &args);
 bool SHA1Sum(const std::vector<std::string> &args);
 bool SHA224Sum(const std::vector<std::string> &args);
 bool SHA256Sum(const std::vector<std::string> &args);
 bool SHA384Sum(const std::vector<std::string> &args);
 bool SHA512Sum(const std::vector<std::string> &args);
-bool DoPKCS12(const std::vector<std::string> &args);
+bool Server(const std::vector<std::string> &args);
 bool Speed(const std::vector<std::string> &args);
-bool Rand(const std::vector<std::string> &args);
 
 typedef bool (*tool_func_t)(const std::vector<std::string> &args);
 
@@ -46,19 +47,20 @@
 };
 
 static const Tool kTools[] = {
-  { "speed", Speed },
-  { "pkcs12", DoPKCS12 },
   { "client", Client },
-  { "s_client", Client },
-  { "server", Server },
-  { "s_server", Server },
+  { "genrsa", GenerateRSAKey },
   { "md5sum", MD5Sum },
+  { "pkcs12", DoPKCS12 },
+  { "rand", Rand },
+  { "s_client", Client },
+  { "s_server", Server },
+  { "server", Server },
   { "sha1sum", SHA1Sum },
   { "sha224sum", SHA224Sum },
   { "sha256sum", SHA256Sum },
   { "sha384sum", SHA384Sum },
   { "sha512sum", SHA512Sum },
-  { "rand", Rand },
+  { "speed", Speed },
   { "", nullptr },
 };