summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorSimon Rettberg2020-08-12 12:27:02 +0200
committerSimon Rettberg2020-08-12 12:27:02 +0200
commitdf1f1c469e65156c18dd98931618a7d37c9d8691 (patch)
tree12bf4fe1a74701b5f86a696d1e28822dac055765 /src/include
parentRevert "Revert "[build] Construct full version number automatically from git ... (diff)
parent[efi] Use device path to locate filesystem from which we were loaded (diff)
downloadipxe-df1f1c469e65156c18dd98931618a7d37c9d8691.tar.gz
ipxe-df1f1c469e65156c18dd98931618a7d37c9d8691.tar.xz
ipxe-df1f1c469e65156c18dd98931618a7d37c9d8691.zip
Merge branch 'master' into openslx
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/asn1.h18
-rw-r--r--src/include/ipxe/efi/efi.h32
-rw-r--r--src/include/ipxe/open.h2
-rw-r--r--src/include/ipxe/rotate.h34
-rw-r--r--src/include/string.h2
-rw-r--r--src/include/usr/ifmgmt.h3
6 files changed, 80 insertions, 11 deletions
diff --git a/src/include/ipxe/asn1.h b/src/include/ipxe/asn1.h
index 24caecdc5..efc66631d 100644
--- a/src/include/ipxe/asn1.h
+++ b/src/include/ipxe/asn1.h
@@ -312,6 +312,24 @@ struct asn1_algorithm {
/** Declare an ASN.1 OID-identified algorithm */
#define __asn1_algorithm __table_entry ( ASN1_ALGORITHMS, 01 )
+/* ASN.1 OID-identified algorithms */
+extern struct asn1_algorithm rsa_encryption_algorithm;
+extern struct asn1_algorithm md5_with_rsa_encryption_algorithm;
+extern struct asn1_algorithm sha1_with_rsa_encryption_algorithm;
+extern struct asn1_algorithm sha256_with_rsa_encryption_algorithm;
+extern struct asn1_algorithm sha384_with_rsa_encryption_algorithm;
+extern struct asn1_algorithm sha512_with_rsa_encryption_algorithm;
+extern struct asn1_algorithm sha224_with_rsa_encryption_algorithm;
+extern struct asn1_algorithm oid_md4_algorithm;
+extern struct asn1_algorithm oid_md5_algorithm;
+extern struct asn1_algorithm oid_sha1_algorithm;
+extern struct asn1_algorithm oid_sha256_algorithm;
+extern struct asn1_algorithm oid_sha384_algorithm;
+extern struct asn1_algorithm oid_sha512_algorithm;
+extern struct asn1_algorithm oid_sha224_algorithm;
+extern struct asn1_algorithm oid_sha512_224_algorithm;
+extern struct asn1_algorithm oid_sha512_256_algorithm;
+
/** An ASN.1 bit string */
struct asn1_bit_string {
/** Data */
diff --git a/src/include/ipxe/efi/efi.h b/src/include/ipxe/efi/efi.h
index 669e5364a..b8777ef47 100644
--- a/src/include/ipxe/efi/efi.h
+++ b/src/include/ipxe/efi/efi.h
@@ -65,6 +65,8 @@ typedef struct {} *EFI_HANDLE;
#include <ipxe/tables.h>
#include <ipxe/uuid.h>
+#include <ipxe/version.h>
+#include <ipxe/profile.h>
/** An EFI protocol used by iPXE */
struct efi_protocol {
@@ -272,6 +274,36 @@ extern void dbg_efi_protocols ( EFI_HANDLE handle );
#define DBGCP_EFI_PROTOCOLS( ... ) \
DBGC_EFI_PROTOCOLS_IF ( PROFILE, ##__VA_ARGS__ )
+extern unsigned long __stack_chk_guard;
+extern unsigned long efi_stack_cookie ( EFI_HANDLE handle );
+extern void __stack_chk_fail ( void );
+
+/**
+ * Initialise stack cookie
+ *
+ * @v handle Image handle
+ */
+static inline __attribute__ (( always_inline )) void
+efi_init_stack_guard ( EFI_HANDLE handle ) {
+
+ /* The calling function must not itself use stack protection,
+ * since the change in the stack guard value would trigger a
+ * false positive.
+ *
+ * There is unfortunately no way to annotate a function to
+ * exclude the use of stack protection. We must therefore
+ * rely on correctly anticipating the compiler's decision on
+ * the use of stack protection.
+ *
+ * The calculation of the stack cookie value deliberately
+ * takes the address of a stack variable (to provide an
+ * additional source of entropy). This operation would
+ * trigger the application of stack protection to the calling
+ * function, and so must be externalised.
+ */
+ __stack_chk_guard = efi_stack_cookie ( handle );
+}
+
extern EFI_STATUS efi_init ( EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *systab );
diff --git a/src/include/ipxe/open.h b/src/include/ipxe/open.h
index 43d4cdc66..64e12d177 100644
--- a/src/include/ipxe/open.h
+++ b/src/include/ipxe/open.h
@@ -70,8 +70,6 @@ struct uri_opener {
struct socket_opener {
/** Communication semantics (e.g. SOCK_STREAM) */
int semantics;
- /** Address family (e.g. AF_INET) */
- int family;
/** Open socket
*
* @v intf Object interface
diff --git a/src/include/ipxe/rotate.h b/src/include/ipxe/rotate.h
index b5693e3ca..4dea09aeb 100644
--- a/src/include/ipxe/rotate.h
+++ b/src/include/ipxe/rotate.h
@@ -10,44 +10,62 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
+#define ROLx( data, rotation ) \
+ ( ( (data) << (rotation) ) | \
+ ( (data) >> ( ( 8 * sizeof (data) ) - (rotation) ) ) );
+
+#define RORx( data, rotation ) \
+ ( ( (data) >> (rotation) ) | \
+ ( (data) << ( ( 8 * sizeof (data) ) - (rotation) ) ) );
+
static inline __attribute__ (( always_inline )) uint8_t
rol8 ( uint8_t data, unsigned int rotation ) {
- return ( ( data << rotation ) | ( data >> ( 8 - rotation ) ) );
+ return ROLx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint8_t
ror8 ( uint8_t data, unsigned int rotation ) {
- return ( ( data >> rotation ) | ( data << ( 8 - rotation ) ) );
+ return RORx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint16_t
rol16 ( uint16_t data, unsigned int rotation ) {
- return ( ( data << rotation ) | ( data >> ( 16 - rotation ) ) );
+ return ROLx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint16_t
ror16 ( uint16_t data, unsigned int rotation ) {
- return ( ( data >> rotation ) | ( data << ( 16 - rotation ) ) );
+ return RORx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint32_t
rol32 ( uint32_t data, unsigned int rotation ) {
- return ( ( data << rotation ) | ( data >> ( 32 - rotation ) ) );
+ return ROLx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint32_t
ror32 ( uint32_t data, unsigned int rotation ) {
- return ( ( data >> rotation ) | ( data << ( 32 - rotation ) ) );
+ return RORx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint64_t
rol64 ( uint64_t data, unsigned int rotation ) {
- return ( ( data << rotation ) | ( data >> ( 64 - rotation ) ) );
+ return ROLx ( data, rotation );
}
static inline __attribute__ (( always_inline )) uint64_t
ror64 ( uint64_t data, unsigned int rotation ) {
- return ( ( data >> rotation ) | ( data << ( 64 - rotation ) ) );
+ return RORx ( data, rotation );
+}
+
+static inline __attribute__ (( always_inline )) unsigned long
+roll ( unsigned long data, unsigned int rotation ) {
+ return ROLx ( data, rotation );
+}
+
+static inline __attribute__ (( always_inline )) unsigned long
+rorl ( unsigned long data, unsigned int rotation ) {
+ return RORx ( data, rotation );
}
#endif /* _IPXE_ROTATE_H */
diff --git a/src/include/string.h b/src/include/string.h
index 0f4182001..5f5aecb92 100644
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -15,6 +15,8 @@ extern void * generic_memset ( void *dest, int character,
size_t len ) __nonnull;
extern void * generic_memcpy ( void *dest, const void *src,
size_t len ) __nonnull;
+extern void * generic_memcpy_reverse ( void *dest, const void *src,
+ size_t len ) __nonnull;
extern void * generic_memmove ( void *dest, const void *src,
size_t len ) __nonnull;
diff --git a/src/include/usr/ifmgmt.h b/src/include/usr/ifmgmt.h
index 5c386327b..52f88f957 100644
--- a/src/include/usr/ifmgmt.h
+++ b/src/include/usr/ifmgmt.h
@@ -14,7 +14,8 @@ struct net_device_configurator;
extern int ifopen ( struct net_device *netdev );
extern int ifconf ( struct net_device *netdev,
- struct net_device_configurator *configurator );
+ struct net_device_configurator *configurator,
+ unsigned long timeout );
extern void ifclose ( struct net_device *netdev );
extern void ifstat ( struct net_device *netdev );
extern int iflinkwait ( struct net_device *netdev, unsigned long timeout );