summaryrefslogtreecommitdiffstats
path: root/src/crypto/rootcert.c
diff options
context:
space:
mode:
authorMichael Brown2012-03-18 18:25:55 +0100
committerMichael Brown2012-03-19 01:22:22 +0100
commit4d3b5473f850f9c0ba7107cff397cfca4972d679 (patch)
treedd39e919a8283c728919c2a2edb4910ce43c8e3b /src/crypto/rootcert.c
parent[rsa] Actually check the unused-bits byte in the public key bit string (diff)
downloadipxe-4d3b5473f850f9c0ba7107cff397cfca4972d679.tar.gz
ipxe-4d3b5473f850f9c0ba7107cff397cfca4972d679.tar.xz
ipxe-4d3b5473f850f9c0ba7107cff397cfca4972d679.zip
[tls] Add full X.509 certificate parsing
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto/rootcert.c')
-rw-r--r--src/crypto/rootcert.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/crypto/rootcert.c b/src/crypto/rootcert.c
new file mode 100644
index 00000000..99ee9c87
--- /dev/null
+++ b/src/crypto/rootcert.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <ipxe/crypto.h>
+#include <ipxe/sha256.h>
+#include <ipxe/x509.h>
+#include <ipxe/rootcert.h>
+
+/** @file
+ *
+ * Root certificate store
+ *
+ */
+
+/* Use iPXE root CA if no trusted certificates are explicitly specified */
+#ifndef TRUSTED
+#define TRUSTED \
+ /* iPXE root CA */ \
+ 0x9f, 0xaf, 0x71, 0x7b, 0x7f, 0x8c, 0xa2, 0xf9, 0x3c, 0x25, \
+ 0x6c, 0x79, 0xf8, 0xac, 0x55, 0x91, 0x89, 0x5d, 0x66, 0xd1, \
+ 0xff, 0x3b, 0xee, 0x63, 0x97, 0xa7, 0x0d, 0x29, 0xc6, 0x5e, \
+ 0xed, 0x1a,
+#endif
+
+/** Root certificate fingerprints */
+static const uint8_t fingerprints[] = { TRUSTED };
+
+/** Root certificates */
+struct x509_root root_certificates = {
+ .digest = &sha256_algorithm,
+ .count = ( sizeof ( fingerprints ) / SHA256_DIGEST_SIZE ),
+ .fingerprints = fingerprints,
+};