summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_sigalgs.h
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2018-11-09 00:34:55 +0000
committerbeck <beck@openbsd.org>2018-11-09 00:34:55 +0000
commit96b1ac03f67478d7faaa82e05372ba1c1d4f118b (patch)
treec1b6e336965c9b95c06384fc5c8496aafd0c0b37 /lib/libssl/ssl_sigalgs.h
parentFirst skeleton of the TLS 1.3 state machine. Based on RFC 8446 and (diff)
downloadwireguard-openbsd-96b1ac03f67478d7faaa82e05372ba1c1d4f118b.tar.xz
wireguard-openbsd-96b1ac03f67478d7faaa82e05372ba1c1d4f118b.zip
Reimplement the sigalgs processing code into a new implementation
that will be usable with TLS 1.3 with less eye bleed. ok jsing@ tb@
Diffstat (limited to 'lib/libssl/ssl_sigalgs.h')
-rw-r--r--lib/libssl/ssl_sigalgs.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/libssl/ssl_sigalgs.h b/lib/libssl/ssl_sigalgs.h
new file mode 100644
index 00000000000..b0ed70b7fc0
--- /dev/null
+++ b/lib/libssl/ssl_sigalgs.h
@@ -0,0 +1,69 @@
+/* $OpenBSD: ssl_sigalgs.h,v 1.1 2018/11/09 00:34:55 beck Exp $ */
+/*
+ * Copyright (c) 2018, Bob Beck <beck@openbsd.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#define SIGALG_NONE 0x0000
+
+/*
+ * RFC 8446 Section 4.2.3
+ * RFC 5246 Section 7.4.1.4.1
+ */
+#define SIGALG_RSA_PKCS1_SHA224 0x0301
+#define SIGALG_RSA_PKCS1_SHA256 0x0401
+#define SIGALG_RSA_PKCS1_SHA384 0x0501
+#define SIGALG_RSA_PKCS1_SHA512 0x0601
+#define SIGALG_ECDSA_SECP224R1_SHA224 0x0303
+#define SIGALG_ECDSA_SECP256R1_SHA256 0x0403
+#define SIGALG_ECDSA_SECP384R1_SHA384 0x0503
+#define SIGALG_ECDSA_SECP512R1_SHA512 0x0603
+#define SIGALG_RSA_PSS_RSAE_SHA256 0x0804
+#define SIGALG_RSA_PSS_RSAE_SHA384 0x0805
+#define SIGALG_RSA_PSS_RSAE_SHA512 0x0806
+#define SIGALG_ED25519 0x0807
+#define SIGALG_ED448 0x0808
+#define SIGALG_RSA_PSS_PSS_SHA256 0x0809
+#define SIGALG_RSA_PSS_PSS_SHA384 0x080a
+#define SIGALG_RSA_PSS_PSS_SHA512 0x080b
+#define SIGALG_RSA_PKCS1_SHA1 0x0201
+#define SIGALG_ECDSA_SHA1 0x0203
+#define SIGALG_PRIVATE_START 0xFE00
+#define SIGALG_PRIVATE_END 0xFFFF
+
+/*
+ * If Russia can elect the US President, surely
+ * IANA could fix this problem.
+ */
+#define SIGALG_GOSTR12_512_STREEBOG_512 0xEFEF
+#define SIGALG_GOSTR12_256_STREEBOG_256 0xEEEE
+#define SIGALG_GOSTR01_GOST94 0xEDED
+
+#define SIGALG_FLAG_RSA_PSS 0x00000001
+
+struct ssl_sigalg{
+ uint16_t value;
+ const EVP_MD *(*md)(void);
+ int key_type;
+ int pkey_idx; /* XXX get rid of this eventually */
+ int curve_nid;
+ int flags;
+};
+
+const struct ssl_sigalg *ssl_sigalg_lookup(uint16_t sigalg);
+const EVP_MD * ssl_sigalg_md(uint16_t sigalg);
+uint16_t ssl_sigalg_value(const EVP_PKEY *pk, const EVP_MD *md);
+int ssl_sigalgs_build(CBB *cbb);
+int ssl_sigalg_pkey_check(uint16_t sigalg, EVP_PKEY *pk);