Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dc80d20d3 | ||
|
|
8f6a9399b3 | ||
|
|
a881a26061 | ||
|
|
b234226dbc | ||
|
|
8e2469c861 | ||
|
|
989dbe0bc4 | ||
|
|
6f70e8be83 | ||
|
|
17135c83fb | ||
|
|
27398f1360 | ||
|
|
de8a0821c7 | ||
|
|
2eea04c02c | ||
|
|
908174ec7e | ||
|
|
bac13ba1f6 | ||
|
|
13e390d54e | ||
|
|
26d3ef062b | ||
|
|
4b7d9a6af0 | ||
|
|
6d29415c89 | ||
|
|
6ca597eee9 | ||
|
|
e66552eeed | ||
|
|
08fcb0e8fb | ||
|
|
c6226f104e | ||
|
|
0abb3e85e5 | ||
|
|
4ed7a5718f | ||
|
|
fa62213231 | ||
|
|
119c415ee4 | ||
|
|
9e92c39894 | ||
|
|
3fc1b407d2 | ||
|
|
0958e01463 | ||
|
|
337880deaa | ||
|
|
f22879ca99 | ||
|
|
98dd25a3bb | ||
|
|
a147245f1a | ||
|
|
c3dd3168c9 | ||
|
|
b829b1750d | ||
|
|
03ff1bb99a | ||
|
|
18582a05fc | ||
|
|
6714b20ea2 | ||
|
|
b37d89db90 | ||
|
|
cc858acd32 | ||
|
|
b30a0987e2 | ||
|
|
3d8a614657 | ||
|
|
a9e89787d0 | ||
|
|
678a60f61d | ||
|
|
8c8ead2530 | ||
|
|
77b07ea4fd | ||
|
|
d8f9c221ed | ||
|
|
595b1796f6 | ||
|
|
1bd01b761f | ||
|
|
5524bb9832 | ||
|
|
36e1a559a2 | ||
|
|
1f3a37e342 | ||
|
|
74ec00a9f3 | ||
|
|
f883203132 | ||
|
|
115707c0ed | ||
|
|
ff0f860483 | ||
|
|
8b14652e50 | ||
|
|
56cc61a168 | ||
|
|
cac3a584dc | ||
|
|
8cbf248198 | ||
|
|
8b1d34badf | ||
|
|
cc1e27e525 | ||
|
|
ae4e85bde9 | ||
|
|
eeb7cd56e5 | ||
|
|
0aa2e4ec96 | ||
|
|
9e99a55b31 | ||
|
|
c1834f323f | ||
|
|
d5c08f78bd | ||
|
|
c30b71ee9c | ||
|
|
f3036fc213 | ||
|
|
59d065c9ac | ||
|
|
48ae5d5361 | ||
|
|
6701d91c50 | ||
|
|
b5b60ea33d | ||
|
|
8244410690 | ||
|
|
daa9e54ab8 | ||
|
|
3ef4f7e2ef | ||
|
|
cc07ed7c7e | ||
|
|
6f57d91935 | ||
|
|
e17568ad06 | ||
|
|
2524a60550 | ||
|
|
280942a92a | ||
|
|
6d98e0ca47 | ||
|
|
0c67a3632d | ||
|
|
c57887bfc8 | ||
|
|
18af669701 | ||
|
|
cfe65aa826 | ||
|
|
ae435cb4cc | ||
|
|
f8a0d1c0b8 | ||
|
|
f0b1025503 | ||
|
|
c832580f19 | ||
|
|
9a118322a0 | ||
|
|
2689a6e776 | ||
|
|
4fa4052c7e | ||
|
|
25a3d3acab | ||
|
|
8ab9bdca4f | ||
|
|
12776acce5 | ||
|
|
367e022b5e | ||
|
|
b9a60fb0b7 | ||
|
|
a64764d10f | ||
|
|
bc75bbaf17 | ||
|
|
e7adf5701f | ||
|
|
92ab2de3a4 | ||
|
|
3184ff74eb | ||
|
|
9cb0a4b8ec | ||
|
|
b0093571f8 | ||
|
|
6a7f560e60 | ||
|
|
5b43181436 | ||
|
|
d2e1601cf4 | ||
|
|
95b8338f0d | ||
|
|
28184b7c22 | ||
|
|
3c214f0465 | ||
|
|
ce2200d5fb | ||
|
|
c4a8d90387 | ||
|
|
79d85e29aa | ||
|
|
d27cd8196d | ||
|
|
03eea19c19 | ||
|
|
0bb0aea878 | ||
|
|
f9beb20e99 | ||
|
|
f93e6b712f | ||
|
|
22cc65535a | ||
|
|
bd13697446 | ||
|
|
9fb28080d9 | ||
|
|
1e4c3789e9 | ||
|
|
0d04635ef0 | ||
|
|
1d1cf74a5e | ||
|
|
aa368ba529 | ||
|
|
2c6a15d2a3 | ||
|
|
09e8a15408 | ||
|
|
bf25e23d07 |
@@ -49,7 +49,8 @@ jobs:
|
|||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y -o Acquire::Retries=50 \
|
sudo apt install -y -o Acquire::Retries=50 \
|
||||||
mtools syslinux isolinux \
|
mtools syslinux isolinux \
|
||||||
libc6-dev-i386 libc6-dbg:i386 valgrind
|
libc6-dev-i386 valgrind \
|
||||||
|
libgcc-s1:i386 libc6-dbg:i386
|
||||||
- name: Build (BIOS)
|
- name: Build (BIOS)
|
||||||
run: |
|
run: |
|
||||||
make -j 4 -C src
|
make -j 4 -C src
|
||||||
|
|||||||
@@ -46,11 +46,19 @@ def create_snapshot(region, description, image):
|
|||||||
return snapshot_id
|
return snapshot_id
|
||||||
|
|
||||||
|
|
||||||
def import_image(region, name, architecture, image, public):
|
def import_image(region, name, architecture, image, public, overwrite):
|
||||||
"""Import an AMI image"""
|
"""Import an AMI image"""
|
||||||
client = boto3.client('ec2', region_name=region)
|
client = boto3.client('ec2', region_name=region)
|
||||||
resource = boto3.resource('ec2', region_name=region)
|
resource = boto3.resource('ec2', region_name=region)
|
||||||
description = '%s (%s)' % (name, architecture)
|
description = '%s (%s)' % (name, architecture)
|
||||||
|
images = client.describe_images(Filters=[{'Name': 'name',
|
||||||
|
'Values': [description]}])
|
||||||
|
if overwrite and images['Images']:
|
||||||
|
images = images['Images'][0]
|
||||||
|
image_id = images['ImageId']
|
||||||
|
snapshot_id = images['BlockDeviceMappings'][0]['Ebs']['SnapshotId']
|
||||||
|
resource.Image(image_id).deregister()
|
||||||
|
resource.Snapshot(snapshot_id).delete()
|
||||||
snapshot_id = create_snapshot(region=region, description=description,
|
snapshot_id = create_snapshot(region=region, description=description,
|
||||||
image=image)
|
image=image)
|
||||||
client.get_waiter('snapshot_completed').wait(SnapshotIds=[snapshot_id])
|
client.get_waiter('snapshot_completed').wait(SnapshotIds=[snapshot_id])
|
||||||
@@ -88,6 +96,8 @@ parser.add_argument('--name', '-n',
|
|||||||
help="Image name")
|
help="Image name")
|
||||||
parser.add_argument('--public', '-p', action='store_true',
|
parser.add_argument('--public', '-p', action='store_true',
|
||||||
help="Make image public")
|
help="Make image public")
|
||||||
|
parser.add_argument('--overwrite', action='store_true',
|
||||||
|
help="Overwrite any existing image with same name")
|
||||||
parser.add_argument('--region', '-r', action='append',
|
parser.add_argument('--region', '-r', action='append',
|
||||||
help="AWS region(s)")
|
help="AWS region(s)")
|
||||||
parser.add_argument('--wiki', '-w', metavar='FILE',
|
parser.add_argument('--wiki', '-w', metavar='FILE',
|
||||||
@@ -115,7 +125,8 @@ with ThreadPoolExecutor(max_workers=len(imports)) as executor:
|
|||||||
name=args.name,
|
name=args.name,
|
||||||
architecture=architectures[image],
|
architecture=architectures[image],
|
||||||
image=image,
|
image=image,
|
||||||
public=args.public): (region, image)
|
public=args.public,
|
||||||
|
overwrite=args.overwrite): (region, image)
|
||||||
for region, image in imports}
|
for region, image in imports}
|
||||||
results = {futures[future]: future.result()
|
results = {futures[future]: future.result()
|
||||||
for future in as_completed(futures)}
|
for future in as_completed(futures)}
|
||||||
|
|||||||
Executable
+68
@@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
import boto3
|
||||||
|
|
||||||
|
BLOCKSIZE = 512 * 1024
|
||||||
|
|
||||||
|
IPXELOG_OFFSET = 16 * 1024
|
||||||
|
|
||||||
|
IPXELOG_MAGIC = b'iPXE LOG'
|
||||||
|
|
||||||
|
|
||||||
|
def create_snapshot(region, instance_id):
|
||||||
|
"""Create root volume snapshot"""
|
||||||
|
client = boto3.client('ec2', region_name=region)
|
||||||
|
resource = boto3.resource('ec2', region_name=region)
|
||||||
|
instance = resource.Instance(instance_id)
|
||||||
|
volumes = list(instance.volumes.all())
|
||||||
|
snapshot = volumes[0].create_snapshot()
|
||||||
|
snapshot.wait_until_completed()
|
||||||
|
return snapshot.id
|
||||||
|
|
||||||
|
|
||||||
|
def get_snapshot_block(region, snapshot_id, index):
|
||||||
|
"""Get block content from snapshot"""
|
||||||
|
client = boto3.client('ebs', region_name=region)
|
||||||
|
blocks = client.list_snapshot_blocks(SnapshotId=snapshot_id,
|
||||||
|
StartingBlockIndex=index)
|
||||||
|
token = blocks['Blocks'][0]['BlockToken']
|
||||||
|
block = client.get_snapshot_block(SnapshotId=snapshot_id,
|
||||||
|
BlockIndex=index,
|
||||||
|
BlockToken=token)
|
||||||
|
return block['BlockData'].read()
|
||||||
|
|
||||||
|
|
||||||
|
def get_block0_content(region, instance_id):
|
||||||
|
"""Get content of root volume block zero from instance"""
|
||||||
|
client = boto3.client('ec2', region_name=region)
|
||||||
|
resource = boto3.resource('ec2', region_name=region)
|
||||||
|
snapshot_id = create_snapshot(region, instance_id)
|
||||||
|
block = get_snapshot_block(region, snapshot_id, 0)
|
||||||
|
resource.Snapshot(snapshot_id).delete()
|
||||||
|
return block
|
||||||
|
|
||||||
|
|
||||||
|
def get_int13con_output(region, instance_id):
|
||||||
|
"""Get INT13 console output"""
|
||||||
|
block = get_block0_content(region, instance_id)
|
||||||
|
logpart = block[IPXELOG_OFFSET:]
|
||||||
|
magic = logpart[:len(IPXELOG_MAGIC)]
|
||||||
|
if magic != IPXELOG_MAGIC:
|
||||||
|
raise ValueError("Invalid log magic signature")
|
||||||
|
log = logpart[len(IPXELOG_MAGIC):].split(b'\0')[0]
|
||||||
|
return log.decode()
|
||||||
|
|
||||||
|
|
||||||
|
# Parse command-line arguments
|
||||||
|
parser = argparse.ArgumentParser(description="Get AWS INT13 console output")
|
||||||
|
parser.add_argument('--region', '-r', help="AWS region")
|
||||||
|
parser.add_argument('id', help="Instance ID")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Get console output from INT13CON partition
|
||||||
|
output = get_int13con_output(args.region, args.id)
|
||||||
|
|
||||||
|
# Print console output
|
||||||
|
print(output)
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
.toolcheck
|
.toolcheck
|
||||||
.echocheck
|
.echocheck
|
||||||
TAGS*
|
TAGS*
|
||||||
bin*
|
bin-*
|
||||||
|
|||||||
+5
-1
@@ -50,6 +50,10 @@ $(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
|
|||||||
$(QM)$(ECHO) " [CAB] $@"
|
$(QM)$(ECHO) " [CAB] $@"
|
||||||
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
|
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
|
||||||
|
|
||||||
$(BIN)/%.iso $(BIN)/%.usb : $(BIN)/%.efi util/genfsimg
|
$(BIN)/%.iso : $(BIN)/%.efi util/genfsimg
|
||||||
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
||||||
|
$(Q)util/genfsimg -o $@ $<
|
||||||
|
|
||||||
|
$(BIN)/%.usb : $(BIN)/%.efi util/genfsimg
|
||||||
$(QM)$(ECHO) " [GENFSIMG] $@"
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
||||||
$(Q)util/genfsimg -o $@ $<
|
$(Q)util/genfsimg -o $@ $<
|
||||||
|
|||||||
@@ -502,6 +502,13 @@ LDFLAGS += --gc-sections
|
|||||||
#
|
#
|
||||||
LDFLAGS += -static
|
LDFLAGS += -static
|
||||||
|
|
||||||
|
# Use separate code segment if supported by linker
|
||||||
|
#
|
||||||
|
ZSC_TEST = $(LD) -z separate-code --version 2>&1 > /dev/null
|
||||||
|
ZSC_FLAGS := $(shell [ -z "`$(ZSC_TEST)`" ] && \
|
||||||
|
$(ECHO) '-z separate-code -z max-page-size=4096')
|
||||||
|
LDFLAGS += $(ZSC_FLAGS)
|
||||||
|
|
||||||
# compiler.h is needed for our linking and debugging system
|
# compiler.h is needed for our linking and debugging system
|
||||||
#
|
#
|
||||||
CFLAGS += -include include/compiler.h
|
CFLAGS += -include include/compiler.h
|
||||||
@@ -1002,6 +1009,7 @@ endif
|
|||||||
# Device ID tables (using IDs from ROM definition file)
|
# Device ID tables (using IDs from ROM definition file)
|
||||||
#
|
#
|
||||||
define obj_pci_id_asm
|
define obj_pci_id_asm
|
||||||
|
.section ".note.GNU-stack", "", $(ASM_TCHAR)progbits
|
||||||
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
|
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
|
||||||
.globl pci_devlist_$(1)
|
.globl pci_devlist_$(1)
|
||||||
pci_devlist_$(1):
|
pci_devlist_$(1):
|
||||||
@@ -1171,7 +1179,7 @@ BLIB = $(BIN)/blib.a
|
|||||||
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
|
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
|
||||||
$(Q)$(RM) $(BLIB)
|
$(Q)$(RM) $(BLIB)
|
||||||
$(QM)$(ECHO) " [AR] $@"
|
$(QM)$(ECHO) " [AR] $@"
|
||||||
$(Q)$(AR) rD $@ $(sort $(BLIB_OBJS))
|
$(Q)$(AR) rcD $@ $(sort $(BLIB_OBJS))
|
||||||
$(Q)$(OBJCOPY) --enable-deterministic-archives \
|
$(Q)$(OBJCOPY) --enable-deterministic-archives \
|
||||||
--prefix-symbols=$(SYMBOL_PREFIX) $@
|
--prefix-symbols=$(SYMBOL_PREFIX) $@
|
||||||
$(Q)$(RANLIB) -D $@
|
$(Q)$(RANLIB) -D $@
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ INCDIRS += arch/arm/include
|
|||||||
|
|
||||||
# ARM-specific directories containing source files
|
# ARM-specific directories containing source files
|
||||||
#
|
#
|
||||||
|
SRCDIRS += arch/arm/core
|
||||||
SRCDIRS += arch/arm/interface/efi
|
SRCDIRS += arch/arm/interface/efi
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ union arm32_io_qword {
|
|||||||
*
|
*
|
||||||
* This is not atomic for ARM32.
|
* This is not atomic for ARM32.
|
||||||
*/
|
*/
|
||||||
static uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
static __unused uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
||||||
volatile union arm32_io_qword *ptr =
|
volatile union arm32_io_qword *ptr =
|
||||||
container_of ( io_addr, union arm32_io_qword, qword );
|
container_of ( io_addr, union arm32_io_qword, qword );
|
||||||
union arm32_io_qword tmp;
|
union arm32_io_qword tmp;
|
||||||
@@ -64,7 +64,8 @@ static uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
|||||||
*
|
*
|
||||||
* This is not atomic for ARM32.
|
* This is not atomic for ARM32.
|
||||||
*/
|
*/
|
||||||
static void arm32_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
|
static __unused void arm32_writeq ( uint64_t data,
|
||||||
|
volatile uint64_t *io_addr ) {
|
||||||
volatile union arm32_io_qword *ptr =
|
volatile union arm32_io_qword *ptr =
|
||||||
container_of ( io_addr, union arm32_io_qword, qword );
|
container_of ( io_addr, union arm32_io_qword, qword );
|
||||||
union arm32_io_qword tmp;
|
union arm32_io_qword tmp;
|
||||||
@@ -82,7 +83,6 @@ PROVIDE_IOAPI_INLINE ( arm, readl );
|
|||||||
PROVIDE_IOAPI_INLINE ( arm, writeb );
|
PROVIDE_IOAPI_INLINE ( arm, writeb );
|
||||||
PROVIDE_IOAPI_INLINE ( arm, writew );
|
PROVIDE_IOAPI_INLINE ( arm, writew );
|
||||||
PROVIDE_IOAPI_INLINE ( arm, writel );
|
PROVIDE_IOAPI_INLINE ( arm, writel );
|
||||||
PROVIDE_IOAPI_INLINE ( arm, iodelay );
|
|
||||||
PROVIDE_IOAPI_INLINE ( arm, mb );
|
PROVIDE_IOAPI_INLINE ( arm, mb );
|
||||||
#ifdef __aarch64__
|
#ifdef __aarch64__
|
||||||
PROVIDE_IOAPI_INLINE ( arm, readq );
|
PROVIDE_IOAPI_INLINE ( arm, readq );
|
||||||
@@ -91,3 +91,4 @@ PROVIDE_IOAPI_INLINE ( arm, writeq );
|
|||||||
PROVIDE_IOAPI ( arm, readq, arm32_readq );
|
PROVIDE_IOAPI ( arm, readq, arm32_readq );
|
||||||
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
|
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
|
||||||
#endif
|
#endif
|
||||||
|
PROVIDE_DUMMY_PIO ( arm );
|
||||||
|
|||||||
@@ -9,6 +9,4 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
#include <ipxe/io.h>
|
|
||||||
|
|
||||||
#endif /* _BITS_PCI_IO_H */
|
#endif /* _BITS_PCI_IO_H */
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define IOAPI_PREFIX_arm __arm_
|
#define IOAPI_PREFIX_arm __arm_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <ipxe/dummy_pio.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory space mappings
|
* Memory space mappings
|
||||||
*
|
*
|
||||||
@@ -77,55 +79,6 @@ ARM_WRITEX ( w, uint16_t, "h", "" );
|
|||||||
ARM_WRITEX ( l, uint32_t, "", "" );
|
ARM_WRITEX ( l, uint32_t, "", "" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Dummy PIO reads and writes up to 32 bits
|
|
||||||
*
|
|
||||||
* There is no common standard for I/O-space access for ARM, and
|
|
||||||
* non-MMIO peripherals are vanishingly rare. Provide dummy
|
|
||||||
* implementations that will allow code to link and should cause
|
|
||||||
* drivers to simply fail to detect hardware at runtime.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define ARM_INX( _suffix, _type ) \
|
|
||||||
static inline __always_inline _type \
|
|
||||||
IOAPI_INLINE ( arm, in ## _suffix ) ( volatile _type *io_addr __unused) { \
|
|
||||||
return ~( (_type) 0 ); \
|
|
||||||
} \
|
|
||||||
static inline __always_inline void \
|
|
||||||
IOAPI_INLINE ( arm, ins ## _suffix ) ( volatile _type *io_addr __unused, \
|
|
||||||
_type *data, unsigned int count ) { \
|
|
||||||
memset ( data, 0xff, count * sizeof ( *data ) ); \
|
|
||||||
}
|
|
||||||
ARM_INX ( b, uint8_t );
|
|
||||||
ARM_INX ( w, uint16_t );
|
|
||||||
ARM_INX ( l, uint32_t );
|
|
||||||
|
|
||||||
#define ARM_OUTX( _suffix, _type ) \
|
|
||||||
static inline __always_inline void \
|
|
||||||
IOAPI_INLINE ( arm, out ## _suffix ) ( _type data __unused, \
|
|
||||||
volatile _type *io_addr __unused ) { \
|
|
||||||
/* Do nothing */ \
|
|
||||||
} \
|
|
||||||
static inline __always_inline void \
|
|
||||||
IOAPI_INLINE ( arm, outs ## _suffix ) ( volatile _type *io_addr __unused, \
|
|
||||||
const _type *data __unused, \
|
|
||||||
unsigned int count __unused ) { \
|
|
||||||
/* Do nothing */ \
|
|
||||||
}
|
|
||||||
ARM_OUTX ( b, uint8_t );
|
|
||||||
ARM_OUTX ( w, uint16_t );
|
|
||||||
ARM_OUTX ( l, uint32_t );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Slow down I/O
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static inline __always_inline void
|
|
||||||
IOAPI_INLINE ( arm, iodelay ) ( void ) {
|
|
||||||
/* Nothing to do */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory barrier
|
* Memory barrier
|
||||||
*
|
*
|
||||||
@@ -140,4 +93,7 @@ IOAPI_INLINE ( arm, mb ) ( void ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dummy PIO */
|
||||||
|
DUMMY_PIO ( arm );
|
||||||
|
|
||||||
#endif /* _IPXE_ARM_IO_H */
|
#endif /* _IPXE_ARM_IO_H */
|
||||||
|
|||||||
@@ -36,19 +36,23 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
* Multiply big integers
|
* Multiply big integers
|
||||||
*
|
*
|
||||||
* @v multiplicand0 Element 0 of big integer to be multiplied
|
* @v multiplicand0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplicand_size Number of elements in multiplicand
|
||||||
* @v multiplier0 Element 0 of big integer to be multiplied
|
* @v multiplier0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplier_size Number of elements in multiplier
|
||||||
* @v result0 Element 0 of big integer to hold result
|
* @v result0 Element 0 of big integer to hold result
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
*/
|
||||||
void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint32_t *multiplier0,
|
const uint32_t *multiplier0,
|
||||||
uint32_t *result0, unsigned int size ) {
|
unsigned int multiplier_size,
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
|
uint32_t *result0 ) {
|
||||||
( ( const void * ) multiplicand0 );
|
unsigned int result_size = ( multiplicand_size + multiplier_size );
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
|
const bigint_t ( multiplicand_size ) __attribute__ (( may_alias ))
|
||||||
( ( const void * ) multiplier0 );
|
*multiplicand = ( ( const void * ) multiplicand0 );
|
||||||
bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
|
const bigint_t ( multiplier_size ) __attribute__ (( may_alias ))
|
||||||
( ( void * ) result0 );
|
*multiplier = ( ( const void * ) multiplier0 );
|
||||||
|
bigint_t ( result_size ) __attribute__ (( may_alias ))
|
||||||
|
*result = ( ( void * ) result0 );
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
uint32_t multiplicand_element;
|
uint32_t multiplicand_element;
|
||||||
@@ -62,9 +66,9 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
|||||||
memset ( result, 0, sizeof ( *result ) );
|
memset ( result, 0, sizeof ( *result ) );
|
||||||
|
|
||||||
/* Multiply integers one element at a time */
|
/* Multiply integers one element at a time */
|
||||||
for ( i = 0 ; i < size ; i++ ) {
|
for ( i = 0 ; i < multiplicand_size ; i++ ) {
|
||||||
multiplicand_element = multiplicand->element[i];
|
multiplicand_element = multiplicand->element[i];
|
||||||
for ( j = 0 ; j < size ; j++ ) {
|
for ( j = 0 ; j < multiplier_size ; j++ ) {
|
||||||
multiplier_element = multiplier->element[j];
|
multiplier_element = multiplier->element[j];
|
||||||
result_elements = &result->element[ i + j ];
|
result_elements = &result->element[ i + j ];
|
||||||
/* Perform a single multiply, and add the
|
/* Perform a single multiply, and add the
|
||||||
@@ -73,7 +77,7 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
|||||||
* never overflow beyond the end of the
|
* never overflow beyond the end of the
|
||||||
* result, since:
|
* result, since:
|
||||||
*
|
*
|
||||||
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
|
* a < 2^{n}, b < 2^{m} => ab < 2^{n+m}
|
||||||
*/
|
*/
|
||||||
__asm__ __volatile__ ( "umull %1, %2, %5, %6\n\t"
|
__asm__ __volatile__ ( "umull %1, %2, %5, %6\n\t"
|
||||||
"ldr %3, [%0]\n\t"
|
"ldr %3, [%0]\n\t"
|
||||||
|
|||||||
@@ -310,7 +310,9 @@ bigint_done_raw ( const uint32_t *value0, unsigned int size __unused,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint32_t *multiplier0,
|
const uint32_t *multiplier0,
|
||||||
uint32_t *value0, unsigned int size );
|
unsigned int multiplier_size,
|
||||||
|
uint32_t *value0 );
|
||||||
|
|
||||||
#endif /* _BITS_BIGINT_H */
|
#endif /* _BITS_BIGINT_H */
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", %progbits
|
.section ".note.GNU-stack", "", %progbits
|
||||||
.text
|
|
||||||
.thumb
|
.thumb
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", %progbits
|
.section ".note.GNU-stack", "", %progbits
|
||||||
.text
|
|
||||||
.arm
|
.arm
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,19 +36,23 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
* Multiply big integers
|
* Multiply big integers
|
||||||
*
|
*
|
||||||
* @v multiplicand0 Element 0 of big integer to be multiplied
|
* @v multiplicand0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplicand_size Number of elements in multiplicand
|
||||||
* @v multiplier0 Element 0 of big integer to be multiplied
|
* @v multiplier0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplier_size Number of elements in multiplier
|
||||||
* @v result0 Element 0 of big integer to hold result
|
* @v result0 Element 0 of big integer to hold result
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
*/
|
||||||
void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint64_t *multiplier0,
|
const uint64_t *multiplier0,
|
||||||
uint64_t *result0, unsigned int size ) {
|
unsigned int multiplier_size,
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
|
uint64_t *result0 ) {
|
||||||
( ( const void * ) multiplicand0 );
|
unsigned int result_size = ( multiplicand_size + multiplier_size );
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
|
const bigint_t ( multiplicand_size ) __attribute__ (( may_alias ))
|
||||||
( ( const void * ) multiplier0 );
|
*multiplicand = ( ( const void * ) multiplicand0 );
|
||||||
bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
|
const bigint_t ( multiplier_size ) __attribute__ (( may_alias ))
|
||||||
( ( void * ) result0 );
|
*multiplier = ( ( const void * ) multiplier0 );
|
||||||
|
bigint_t ( result_size ) __attribute__ (( may_alias ))
|
||||||
|
*result = ( ( void * ) result0 );
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
uint64_t multiplicand_element;
|
uint64_t multiplicand_element;
|
||||||
@@ -63,9 +67,9 @@ void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
|||||||
memset ( result, 0, sizeof ( *result ) );
|
memset ( result, 0, sizeof ( *result ) );
|
||||||
|
|
||||||
/* Multiply integers one element at a time */
|
/* Multiply integers one element at a time */
|
||||||
for ( i = 0 ; i < size ; i++ ) {
|
for ( i = 0 ; i < multiplicand_size ; i++ ) {
|
||||||
multiplicand_element = multiplicand->element[i];
|
multiplicand_element = multiplicand->element[i];
|
||||||
for ( j = 0 ; j < size ; j++ ) {
|
for ( j = 0 ; j < multiplier_size ; j++ ) {
|
||||||
multiplier_element = multiplier->element[j];
|
multiplier_element = multiplier->element[j];
|
||||||
result_elements = &result->element[ i + j ];
|
result_elements = &result->element[ i + j ];
|
||||||
/* Perform a single multiply, and add the
|
/* Perform a single multiply, and add the
|
||||||
@@ -74,7 +78,7 @@ void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
|||||||
* never overflow beyond the end of the
|
* never overflow beyond the end of the
|
||||||
* result, since:
|
* result, since:
|
||||||
*
|
*
|
||||||
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
|
* a < 2^{n}, b < 2^{m} => ab < 2^{n+m}
|
||||||
*/
|
*/
|
||||||
__asm__ __volatile__ ( "mul %1, %6, %7\n\t"
|
__asm__ __volatile__ ( "mul %1, %6, %7\n\t"
|
||||||
"umulh %2, %6, %7\n\t"
|
"umulh %2, %6, %7\n\t"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", %progbits
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/* Must match jmp_buf structure layout */
|
/* Must match jmp_buf structure layout */
|
||||||
|
|||||||
@@ -311,7 +311,9 @@ bigint_done_raw ( const uint64_t *value0, unsigned int size __unused,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
extern void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint64_t *multiplier0,
|
const uint64_t *multiplier0,
|
||||||
uint64_t *value0, unsigned int size );
|
unsigned int multiplier_size,
|
||||||
|
uint64_t *value0 );
|
||||||
|
|
||||||
#endif /* _BITS_BIGINT_H */
|
#endif /* _BITS_BIGINT_H */
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
* Interrupt handlers
|
* Interrupt handlers
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.section ".text", "ax", @progbits
|
.section ".text", "ax", @progbits
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.text
|
.text
|
||||||
.arch i386
|
|
||||||
.code32
|
.code32
|
||||||
|
.arch i386
|
||||||
|
|
||||||
/* Must match jmp_buf structure layout */
|
/* Must match jmp_buf structure layout */
|
||||||
.struct 0
|
.struct 0
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code32
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
.section ".data", "aw", @progbits
|
.section ".data", "aw", @progbits
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ CFLAGS += -fshort-wchar
|
|||||||
|
|
||||||
# LoongArch64-specific directories containing source files
|
# LoongArch64-specific directories containing source files
|
||||||
SRCDIRS += arch/loong64/core
|
SRCDIRS += arch/loong64/core
|
||||||
|
SRCDIRS += arch/loong64/interface/efi
|
||||||
|
|
||||||
# Include platform-specific Makefile
|
# Include platform-specific Makefile
|
||||||
MAKEDEPS += arch/loong64/Makefile.$(PLATFORM)
|
MAKEDEPS += arch/loong64/Makefile.$(PLATFORM)
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# -*- makefile -*- : Force emacs to use Makefile mode
|
||||||
|
|
||||||
|
# Specify EFI image builder
|
||||||
|
#
|
||||||
|
ELF2EFI = $(ELF2EFI64)
|
||||||
|
|
||||||
|
# Specify EFI boot file
|
||||||
|
#
|
||||||
|
EFI_BOOT_FILE = bootloongarch64.efi
|
||||||
|
|
||||||
|
# Include generic EFI Makefile
|
||||||
|
#
|
||||||
|
MAKEDEPS += Makefile.efi
|
||||||
|
include Makefile.efi
|
||||||
@@ -37,19 +37,23 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
* Multiply big integers
|
* Multiply big integers
|
||||||
*
|
*
|
||||||
* @v multiplicand0 Element 0 of big integer to be multiplied
|
* @v multiplicand0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplicand_size Number of elements in multiplicand
|
||||||
* @v multiplier0 Element 0 of big integer to be multiplied
|
* @v multiplier0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplier_size Number of elements in multiplier
|
||||||
* @v result0 Element 0 of big integer to hold result
|
* @v result0 Element 0 of big integer to hold result
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
*/
|
||||||
void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint64_t *multiplier0,
|
const uint64_t *multiplier0,
|
||||||
uint64_t *result0, unsigned int size ) {
|
unsigned int multiplier_size,
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
|
uint64_t *result0 ) {
|
||||||
( ( const void * ) multiplicand0 );
|
unsigned int result_size = ( multiplicand_size + multiplier_size );
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
|
const bigint_t ( multiplicand_size ) __attribute__ (( may_alias ))
|
||||||
( ( const void * ) multiplier0 );
|
*multiplicand = ( ( const void * ) multiplicand0 );
|
||||||
bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
|
const bigint_t ( multiplier_size ) __attribute__ (( may_alias ))
|
||||||
( ( void * ) result0 );
|
*multiplier = ( ( const void * ) multiplier0 );
|
||||||
|
bigint_t ( result_size ) __attribute__ (( may_alias ))
|
||||||
|
*result = ( ( void * ) result0 );
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
uint64_t multiplicand_element;
|
uint64_t multiplicand_element;
|
||||||
@@ -64,9 +68,9 @@ void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
|||||||
memset ( result, 0, sizeof ( *result ) );
|
memset ( result, 0, sizeof ( *result ) );
|
||||||
|
|
||||||
/* Multiply integers one element at a time */
|
/* Multiply integers one element at a time */
|
||||||
for ( i = 0 ; i < size ; i++ ) {
|
for ( i = 0 ; i < multiplicand_size ; i++ ) {
|
||||||
multiplicand_element = multiplicand->element[i];
|
multiplicand_element = multiplicand->element[i];
|
||||||
for ( j = 0 ; j < size ; j++ ) {
|
for ( j = 0 ; j < multiplier_size ; j++ ) {
|
||||||
multiplier_element = multiplier->element[j];
|
multiplier_element = multiplier->element[j];
|
||||||
result_elements = &result->element[ i + j ];
|
result_elements = &result->element[ i + j ];
|
||||||
/* Perform a single multiply, and add the
|
/* Perform a single multiply, and add the
|
||||||
@@ -75,7 +79,7 @@ void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
|||||||
* never overflow beyond the end of the
|
* never overflow beyond the end of the
|
||||||
* result, since:
|
* result, since:
|
||||||
*
|
*
|
||||||
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
|
* a < 2^{n}, b < 2^{m} => ab < 2^{n+m}
|
||||||
*/
|
*/
|
||||||
__asm__ __volatile__ ( "mul.d %1, %6, %7\n\t"
|
__asm__ __volatile__ ( "mul.d %1, %6, %7\n\t"
|
||||||
"mulh.du %2, %6, %7\n\t"
|
"mulh.du %2, %6, %7\n\t"
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <ipxe/io.h>
|
||||||
|
#include <ipxe/loong64_io.h>
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* iPXE I/O API for LoongArch64
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, phys_to_bus );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, bus_to_phys );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, readb );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, readw );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, readl );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, readq );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, writeb );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, writew );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, writel );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, writeq );
|
||||||
|
PROVIDE_IOAPI_INLINE ( loong64, mb );
|
||||||
|
PROVIDE_DUMMY_PIO ( loong64 );
|
||||||
@@ -53,34 +53,37 @@ bigint_add_raw ( const uint64_t *addend0, uint64_t *value0,
|
|||||||
uint64_t *discard_value;
|
uint64_t *discard_value;
|
||||||
uint64_t discard_addend_i;
|
uint64_t discard_addend_i;
|
||||||
uint64_t discard_value_i;
|
uint64_t discard_value_i;
|
||||||
|
uint64_t discard_carry;
|
||||||
|
uint64_t discard_temp;
|
||||||
unsigned int discard_size;
|
unsigned int discard_size;
|
||||||
__asm__ __volatile__ ( "move $t0, $zero\n"
|
|
||||||
"1:\n\t"
|
__asm__ __volatile__ ( "\n1:\n\t"
|
||||||
"ld.d %3, %0, 0\n\t"
|
/* Load addend[i] and value[i] */
|
||||||
|
"ld.d %3, %0, 0\n\t"
|
||||||
|
"ld.d %4, %1, 0\n\t"
|
||||||
|
/* Add carry flag and addend */
|
||||||
|
"add.d %4, %4, %5\n\t"
|
||||||
|
"sltu %6, %4, %5\n\t"
|
||||||
|
"add.d %4, %4, %3\n\t"
|
||||||
|
"sltu %5, %4, %3\n\t"
|
||||||
|
"or %5, %5, %6\n\t"
|
||||||
|
/* Store value[i] */
|
||||||
|
"st.d %4, %1, 0\n\t"
|
||||||
|
/* Loop */
|
||||||
"addi.d %0, %0, 8\n\t"
|
"addi.d %0, %0, 8\n\t"
|
||||||
"ld.d %4, %1, 0\n\t"
|
|
||||||
|
|
||||||
"add.d %4, %4, $t0\n\t"
|
|
||||||
"sltu $t0, %4, $t0\n\t"
|
|
||||||
|
|
||||||
"add.d %4, %4, %3\n\t"
|
|
||||||
"sltu $t1, %4, %3\n\t"
|
|
||||||
|
|
||||||
"or $t0, $t0, $t1\n\t"
|
|
||||||
"st.d %4, %1, 0\n\t"
|
|
||||||
"addi.d %1, %1, 8\n\t"
|
"addi.d %1, %1, 8\n\t"
|
||||||
"addi.w %2, %2, -1\n\t"
|
"addi.w %2, %2, -1\n\t"
|
||||||
"bnez %2, 1b"
|
"bnez %2, 1b\n\t"
|
||||||
: "=r" ( discard_addend ),
|
: "=r" ( discard_addend ),
|
||||||
"=r" ( discard_value ),
|
"=r" ( discard_value ),
|
||||||
"=r" ( discard_size ),
|
"=r" ( discard_size ),
|
||||||
"=r" ( discard_addend_i ),
|
"=r" ( discard_addend_i ),
|
||||||
"=r" ( discard_value_i ),
|
"=r" ( discard_value_i ),
|
||||||
|
"=r" ( discard_carry ),
|
||||||
|
"=r" ( discard_temp ),
|
||||||
"+m" ( *value )
|
"+m" ( *value )
|
||||||
: "0" ( addend0 ),
|
: "0" ( addend0 ), "1" ( value0 ),
|
||||||
"1" ( value0 ),
|
"2" ( size ), "5" ( 0 ) );
|
||||||
"2" ( size )
|
|
||||||
: "t0", "t1" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,35 +96,43 @@ bigint_add_raw ( const uint64_t *addend0, uint64_t *value0,
|
|||||||
static inline __attribute__ (( always_inline )) void
|
static inline __attribute__ (( always_inline )) void
|
||||||
bigint_subtract_raw ( const uint64_t *subtrahend0, uint64_t *value0,
|
bigint_subtract_raw ( const uint64_t *subtrahend0, uint64_t *value0,
|
||||||
unsigned int size ) {
|
unsigned int size ) {
|
||||||
|
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||||
|
( ( void * ) value0 );
|
||||||
uint64_t *discard_subtrahend;
|
uint64_t *discard_subtrahend;
|
||||||
uint64_t *discard_value;
|
uint64_t *discard_value;
|
||||||
uint64_t discard_subtrahend_i;
|
uint64_t discard_subtrahend_i;
|
||||||
uint64_t discard_value_i;
|
uint64_t discard_value_i;
|
||||||
|
uint64_t discard_carry;
|
||||||
|
uint64_t discard_temp;
|
||||||
unsigned int discard_size;
|
unsigned int discard_size;
|
||||||
unsigned int flag = 0;
|
|
||||||
|
|
||||||
discard_subtrahend = (uint64_t*) subtrahend0;
|
__asm__ __volatile__ ( "\n1:\n\t"
|
||||||
discard_value = value0;
|
/* Load subtrahend[i] and value[i] */
|
||||||
discard_size = size;
|
"ld.d %3, %0, 0\n\t"
|
||||||
|
"ld.d %4, %1, 0\n\t"
|
||||||
do {
|
/* Subtract carry flag and subtrahend */
|
||||||
discard_subtrahend_i = *discard_subtrahend;
|
"sltu %6, %4, %5\n\t"
|
||||||
discard_subtrahend++;
|
"sub.d %4, %4, %5\n\t"
|
||||||
discard_value_i = *discard_value;
|
"sltu %5, %4, %3\n\t"
|
||||||
|
"sub.d %4, %4, %3\n\t"
|
||||||
discard_value_i = discard_value_i - discard_subtrahend_i - flag;
|
"or %5, %5, %6\n\t"
|
||||||
|
/* Store value[i] */
|
||||||
if ( *discard_value < (discard_subtrahend_i + flag)) {
|
"st.d %4, %1, 0\n\t"
|
||||||
flag = 1;
|
/* Loop */
|
||||||
} else {
|
"addi.d %0, %0, 8\n\t"
|
||||||
flag = 0;
|
"addi.d %1, %1, 8\n\t"
|
||||||
}
|
"addi.w %2, %2, -1\n\t"
|
||||||
|
"bnez %2, 1b\n\t"
|
||||||
*discard_value = discard_value_i;
|
: "=r" ( discard_subtrahend ),
|
||||||
|
"=r" ( discard_value ),
|
||||||
discard_value++;
|
"=r" ( discard_size ),
|
||||||
discard_size -= 1;
|
"=r" ( discard_subtrahend_i ),
|
||||||
} while (discard_size != 0);
|
"=r" ( discard_value_i ),
|
||||||
|
"=r" ( discard_carry ),
|
||||||
|
"=r" ( discard_temp ),
|
||||||
|
"+m" ( *value )
|
||||||
|
: "0" ( subtrahend0 ), "1" ( value0 ),
|
||||||
|
"2" ( size ), "5" ( 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,30 +143,37 @@ bigint_subtract_raw ( const uint64_t *subtrahend0, uint64_t *value0,
|
|||||||
*/
|
*/
|
||||||
static inline __attribute__ (( always_inline )) void
|
static inline __attribute__ (( always_inline )) void
|
||||||
bigint_rol_raw ( uint64_t *value0, unsigned int size ) {
|
bigint_rol_raw ( uint64_t *value0, unsigned int size ) {
|
||||||
|
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||||
|
( ( void * ) value0 );
|
||||||
uint64_t *discard_value;
|
uint64_t *discard_value;
|
||||||
uint64_t discard_value_i;
|
uint64_t discard_value_i;
|
||||||
|
uint64_t discard_carry;
|
||||||
|
uint64_t discard_temp;
|
||||||
unsigned int discard_size;
|
unsigned int discard_size;
|
||||||
uint64_t current_value_i;
|
|
||||||
unsigned int flag = 0;
|
|
||||||
|
|
||||||
discard_value = value0;
|
__asm__ __volatile__ ( "\n1:\n\t"
|
||||||
discard_size = size;
|
/* Load value[i] */
|
||||||
do {
|
"ld.d %2, %0, 0\n\t"
|
||||||
discard_value_i = *discard_value;
|
/* Shift left */
|
||||||
current_value_i = discard_value_i;
|
"rotri.d %2, %2, 63\n\t"
|
||||||
|
"andi %4, %2, 1\n\t"
|
||||||
discard_value_i += discard_value_i + flag;
|
"xor %2, %2, %4\n\t"
|
||||||
|
"or %2, %2, %3\n\t"
|
||||||
if (discard_value_i < current_value_i) {
|
"move %3, %4\n\t"
|
||||||
flag = 1;
|
/* Store value[i] */
|
||||||
} else {
|
"st.d %2, %0, 0\n\t"
|
||||||
flag = 0;
|
/* Loop */
|
||||||
}
|
"addi.d %0, %0, 8\n\t"
|
||||||
|
"addi.w %1, %1, -1\n\t"
|
||||||
*discard_value = discard_value_i;
|
"bnez %1, 1b\n\t"
|
||||||
discard_value++;
|
: "=r" ( discard_value ),
|
||||||
discard_size -= 1;
|
"=r" ( discard_size ),
|
||||||
} while ( discard_size != 0 );
|
"=r" ( discard_value_i ),
|
||||||
|
"=r" ( discard_carry ),
|
||||||
|
"=r" ( discard_temp ),
|
||||||
|
"+m" ( *value )
|
||||||
|
: "0" ( value0 ), "1" ( size ), "3" ( 0 )
|
||||||
|
: "cc" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,27 +184,37 @@ bigint_rol_raw ( uint64_t *value0, unsigned int size ) {
|
|||||||
*/
|
*/
|
||||||
static inline __attribute__ (( always_inline )) void
|
static inline __attribute__ (( always_inline )) void
|
||||||
bigint_ror_raw ( uint64_t *value0, unsigned int size ) {
|
bigint_ror_raw ( uint64_t *value0, unsigned int size ) {
|
||||||
|
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||||
|
( ( void * ) value0 );
|
||||||
uint64_t *discard_value;
|
uint64_t *discard_value;
|
||||||
uint64_t discard_value_i;
|
uint64_t discard_value_i;
|
||||||
uint64_t discard_value_j;
|
uint64_t discard_carry;
|
||||||
|
uint64_t discard_temp;
|
||||||
unsigned int discard_size;
|
unsigned int discard_size;
|
||||||
|
|
||||||
discard_value = value0;
|
__asm__ __volatile__ ( "\n1:\n\t"
|
||||||
discard_size = size;
|
/* Load value[i] */
|
||||||
|
"ld.d %2, %0, -8\n\t"
|
||||||
discard_value_j = 0;
|
/* Shift right */
|
||||||
|
"andi %4, %2, 1\n\t"
|
||||||
do {
|
"xor %2, %2, %4\n\t"
|
||||||
discard_size -= 1;
|
"or %2, %2, %3\n\t"
|
||||||
|
"move %3, %4\n\t"
|
||||||
discard_value_i = *(discard_value + discard_size);
|
"rotri.d %2, %2, 1\n\t"
|
||||||
|
/* Store value[i] */
|
||||||
discard_value_j = (discard_value_j << 63) | (discard_value_i >> 1);
|
"st.d %2, %0, -8\n\t"
|
||||||
|
/* Loop */
|
||||||
*(discard_value + discard_size) = discard_value_j;
|
"addi.d %0, %0, -8\n\t"
|
||||||
|
"addi.w %1, %1, -1\n\t"
|
||||||
discard_value_j = discard_value_i;
|
"bnez %1, 1b\n\t"
|
||||||
} while ( discard_size > 0 );
|
: "=r" ( discard_value ),
|
||||||
|
"=r" ( discard_size ),
|
||||||
|
"=r" ( discard_value_i ),
|
||||||
|
"=r" ( discard_carry ),
|
||||||
|
"=r" ( discard_temp ),
|
||||||
|
"+m" ( *value )
|
||||||
|
: "0" ( value0 + size ), "1" ( size ), "3" ( 0 )
|
||||||
|
: "cc" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -330,7 +358,9 @@ bigint_done_raw ( const uint64_t *value0, unsigned int size __unused,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
extern void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint64_t *multiplier0,
|
const uint64_t *multiplier0,
|
||||||
uint64_t *value0, unsigned int size );
|
unsigned int multiplier_size,
|
||||||
|
uint64_t *value0 );
|
||||||
|
|
||||||
#endif /* _BITS_BIGINT_H */
|
#endif /* _BITS_BIGINT_H */
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
/** Page shift */
|
/** Page shift */
|
||||||
#define PAGE_SHIFT 12
|
#define PAGE_SHIFT 12
|
||||||
|
|
||||||
|
#include <ipxe/loong64_io.h>
|
||||||
|
|
||||||
#endif /* _BITS_IO_H */
|
#endif /* _BITS_IO_H */
|
||||||
|
|||||||
@@ -9,4 +9,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
#endif /* _BITS_MAP_H */
|
#include <ipxe/efi/efiloong64_nap.h>
|
||||||
|
|
||||||
|
#endif /* _BITS_NAP_H */
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef _IPXE_EFILOONG64_NAP_H
|
||||||
|
#define _IPXE_EFILOONG64_NAP_H
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* EFI CPU sleeping
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#ifdef NAP_EFILOONG64
|
||||||
|
#define NAP_PREFIX_efiloong64
|
||||||
|
#else
|
||||||
|
#define NAP_PREFIX_efiloong64 __efiloong64_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _IPXE_EFILOONG64_NAP_H */
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
#ifndef _IPXE_LOONG64_IO_H
|
||||||
|
#define _IPXE_LOONG64_IO_H
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* iPXE I/O API for LoongArch64
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#ifdef IOAPI_LOONG64
|
||||||
|
#define IOAPI_PREFIX_loong64
|
||||||
|
#else
|
||||||
|
#define IOAPI_PREFIX_loong64 __loong64_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <ipxe/dummy_pio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Memory space mappings
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Physical<->Bus address mappings
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline __always_inline unsigned long
|
||||||
|
IOAPI_INLINE ( loong64, phys_to_bus ) ( unsigned long phys_addr ) {
|
||||||
|
return phys_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline __always_inline unsigned long
|
||||||
|
IOAPI_INLINE ( loong64, bus_to_phys ) ( unsigned long bus_addr ) {
|
||||||
|
return bus_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MMIO reads and writes up to native word size
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LOONG64_READX( _suffix, _type, _insn_suffix ) \
|
||||||
|
static inline __always_inline _type \
|
||||||
|
IOAPI_INLINE ( loong64, read ## _suffix ) ( volatile _type *io_addr ) { \
|
||||||
|
_type data; \
|
||||||
|
__asm__ __volatile__ ( "ld." _insn_suffix " %0, %1" \
|
||||||
|
: "=r" ( data ) : "m" ( *io_addr ) ); \
|
||||||
|
return data; \
|
||||||
|
}
|
||||||
|
LOONG64_READX ( b, uint8_t, "bu");
|
||||||
|
LOONG64_READX ( w, uint16_t, "hu");
|
||||||
|
LOONG64_READX ( l, uint32_t, "wu");
|
||||||
|
LOONG64_READX ( q, uint64_t, "d");
|
||||||
|
|
||||||
|
#define LOONG64_WRITEX( _suffix, _type, _insn_suffix ) \
|
||||||
|
static inline __always_inline void \
|
||||||
|
IOAPI_INLINE ( loong64, write ## _suffix ) ( _type data, \
|
||||||
|
volatile _type *io_addr ) { \
|
||||||
|
__asm__ __volatile__ ( "st." _insn_suffix " %0, %1" \
|
||||||
|
: : "r" ( data ), "m" ( *io_addr ) ); \
|
||||||
|
}
|
||||||
|
LOONG64_WRITEX ( b, uint8_t, "b");
|
||||||
|
LOONG64_WRITEX ( w, uint16_t, "h");
|
||||||
|
LOONG64_WRITEX ( l, uint32_t, "w" );
|
||||||
|
LOONG64_WRITEX ( q, uint64_t, "d");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Memory barrier
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static inline __always_inline void
|
||||||
|
IOAPI_INLINE ( loong64, mb ) ( void ) {
|
||||||
|
__asm__ __volatile__ ( "dbar 0" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dummy PIO */
|
||||||
|
DUMMY_PIO ( loong64 );
|
||||||
|
|
||||||
|
#endif /* _IPXE_LOONG64_IO_H */
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <ipxe/nap.h>
|
||||||
|
#include <ipxe/efi/efi.h>
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* iPXE CPU sleeping API for EFI
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sleep until next interrupt
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static void efiloong64_cpu_nap ( void ) {
|
||||||
|
/*
|
||||||
|
* I can't find any EFI API that allows us to put the CPU to
|
||||||
|
* sleep. The CpuSleep() function is defined in CpuLib.h, but
|
||||||
|
* isn't part of any exposed protocol so we have no way to
|
||||||
|
* call it.
|
||||||
|
*
|
||||||
|
* The EFI shell doesn't seem to bother sleeping the CPU; it
|
||||||
|
* just sits there idly burning power.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
__asm__ __volatile__ ( "idle 0" );
|
||||||
|
}
|
||||||
|
|
||||||
|
PROVIDE_NAP ( efiloong64, cpu_nap, efiloong64_cpu_nap );
|
||||||
@@ -13,6 +13,13 @@ LDSCRIPT_PREFIX = arch/x86/scripts/prefixonly.lds
|
|||||||
#
|
#
|
||||||
LDFLAGS += -N --no-check-sections
|
LDFLAGS += -N --no-check-sections
|
||||||
|
|
||||||
|
# Do not warn about RWX segments (required by most prefixes)
|
||||||
|
#
|
||||||
|
WRWX_TEST = $(LD) --warn-rwx-segments --version 2>&1 > /dev/null
|
||||||
|
WRWX_FLAGS := $(shell [ -z "`$(WRWX_TEST)`" ] && \
|
||||||
|
$(ECHO) '--no-warn-rwx-segments')
|
||||||
|
LDFLAGS += $(WRWX_FLAGS)
|
||||||
|
|
||||||
# Media types.
|
# Media types.
|
||||||
#
|
#
|
||||||
MEDIA += rom
|
MEDIA += rom
|
||||||
@@ -54,9 +61,15 @@ LIST_NAME_mrom := ROMS
|
|||||||
LIST_NAME_pcirom := ROMS
|
LIST_NAME_pcirom := ROMS
|
||||||
LIST_NAME_isarom := ROMS
|
LIST_NAME_isarom := ROMS
|
||||||
|
|
||||||
# ISO or FAT filesystem images
|
# ISO images
|
||||||
NON_AUTO_MEDIA += iso
|
NON_AUTO_MEDIA += iso
|
||||||
$(BIN)/%.iso $(BIN)/%.sdsk: $(BIN)/%.lkrn util/genfsimg
|
$(BIN)/%.iso : $(BIN)/%.lkrn util/genfsimg
|
||||||
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
||||||
|
$(Q)util/genfsimg -o $@ $<
|
||||||
|
|
||||||
|
# FAT filesystem images (via syslinux)
|
||||||
|
NON_AUTO_MEDIA += sdsk
|
||||||
|
$(BIN)/%.sdsk : $(BIN)/%.lkrn util/genfsimg
|
||||||
$(QM)$(ECHO) " [GENFSIMG] $@"
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
||||||
$(Q)util/genfsimg -o $@ $<
|
$(Q)util/genfsimg -o $@ $<
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.arch i386
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Set/clear CF on the stack as appropriate, assumes stack is as it should
|
* Set/clear CF on the stack as appropriate, assumes stack is as it should
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.arch i386
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
#define STACK_SIZE 8192
|
#define STACK_SIZE 8192
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.arch i386
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Internal stack
|
* Internal stack
|
||||||
|
|||||||
@@ -36,19 +36,23 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
* Multiply big integers
|
* Multiply big integers
|
||||||
*
|
*
|
||||||
* @v multiplicand0 Element 0 of big integer to be multiplied
|
* @v multiplicand0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplicand_size Number of elements in multiplicand
|
||||||
* @v multiplier0 Element 0 of big integer to be multiplied
|
* @v multiplier0 Element 0 of big integer to be multiplied
|
||||||
|
* @v multiplier_size Number of elements in multiplier
|
||||||
* @v result0 Element 0 of big integer to hold result
|
* @v result0 Element 0 of big integer to hold result
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
*/
|
||||||
void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint32_t *multiplier0,
|
const uint32_t *multiplier0,
|
||||||
uint32_t *result0, unsigned int size ) {
|
unsigned int multiplier_size,
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
|
uint32_t *result0 ) {
|
||||||
( ( const void * ) multiplicand0 );
|
unsigned int result_size = ( multiplicand_size + multiplier_size );
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
|
const bigint_t ( multiplicand_size ) __attribute__ (( may_alias ))
|
||||||
( ( const void * ) multiplier0 );
|
*multiplicand = ( ( const void * ) multiplicand0 );
|
||||||
bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
|
const bigint_t ( multiplier_size ) __attribute__ (( may_alias ))
|
||||||
( ( void * ) result0 );
|
*multiplier = ( ( const void * ) multiplier0 );
|
||||||
|
bigint_t ( result_size ) __attribute__ (( may_alias ))
|
||||||
|
*result = ( ( void * ) result0 );
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
uint32_t multiplicand_element;
|
uint32_t multiplicand_element;
|
||||||
@@ -62,9 +66,9 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
|||||||
memset ( result, 0, sizeof ( *result ) );
|
memset ( result, 0, sizeof ( *result ) );
|
||||||
|
|
||||||
/* Multiply integers one element at a time */
|
/* Multiply integers one element at a time */
|
||||||
for ( i = 0 ; i < size ; i++ ) {
|
for ( i = 0 ; i < multiplicand_size ; i++ ) {
|
||||||
multiplicand_element = multiplicand->element[i];
|
multiplicand_element = multiplicand->element[i];
|
||||||
for ( j = 0 ; j < size ; j++ ) {
|
for ( j = 0 ; j < multiplier_size ; j++ ) {
|
||||||
multiplier_element = multiplier->element[j];
|
multiplier_element = multiplier->element[j];
|
||||||
result_elements = &result->element[ i + j ];
|
result_elements = &result->element[ i + j ];
|
||||||
/* Perform a single multiply, and add the
|
/* Perform a single multiply, and add the
|
||||||
@@ -73,7 +77,7 @@ void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
|||||||
* never overflow beyond the end of the
|
* never overflow beyond the end of the
|
||||||
* result, since:
|
* result, since:
|
||||||
*
|
*
|
||||||
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
|
* a < 2^{n}, b < 2^{m} => ab < 2^{n+m}
|
||||||
*/
|
*/
|
||||||
__asm__ __volatile__ ( "mull %5\n\t"
|
__asm__ __volatile__ ( "mull %5\n\t"
|
||||||
"addl %%eax, (%6,%2,4)\n\t"
|
"addl %%eax, (%6,%2,4)\n\t"
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
|||||||
#define PIC1_ICR 0x20
|
#define PIC1_ICR 0x20
|
||||||
#define PIC2_ICR 0xa0
|
#define PIC2_ICR 0xa0
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.arch i386
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
|
|
||||||
.section ".text16", "ax", @progbits
|
.section ".text16", "ax", @progbits
|
||||||
.globl undiisr
|
.globl undiisr
|
||||||
|
|||||||
@@ -355,6 +355,10 @@ static size_t bzimage_load_initrd ( struct image *image,
|
|||||||
size_t offset;
|
size_t offset;
|
||||||
size_t pad_len;
|
size_t pad_len;
|
||||||
|
|
||||||
|
/* Skip hidden images */
|
||||||
|
if ( initrd->flags & IMAGE_HIDDEN )
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Create cpio header for non-prebuilt images */
|
/* Create cpio header for non-prebuilt images */
|
||||||
offset = cpio_header ( initrd, &cpio );
|
offset = cpio_header ( initrd, &cpio );
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,10 @@ static int multiboot_add_modules ( struct image *image, physaddr_t start,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Skip hidden images */
|
||||||
|
if ( module_image->flags & IMAGE_HIDDEN )
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Page-align the module */
|
/* Page-align the module */
|
||||||
start = ( ( start + 0xfff ) & ~0xfff );
|
start = ( ( start + 0xfff ) & ~0xfff );
|
||||||
|
|
||||||
|
|||||||
@@ -323,7 +323,9 @@ bigint_done_raw ( const uint32_t *value0, unsigned int size __unused,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
|
||||||
|
unsigned int multiplicand_size,
|
||||||
const uint32_t *multiplier0,
|
const uint32_t *multiplier0,
|
||||||
uint32_t *value0, unsigned int size );
|
unsigned int multiplier_size,
|
||||||
|
uint32_t *value0 );
|
||||||
|
|
||||||
#endif /* _BITS_BIGINT_H */
|
#endif /* _BITS_BIGINT_H */
|
||||||
|
|||||||
@@ -250,8 +250,10 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
|
|||||||
/* CODE_DEFAULT: restore default .code32/.code64 directive */
|
/* CODE_DEFAULT: restore default .code32/.code64 directive */
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
#define CODE_DEFAULT ".code64"
|
#define CODE_DEFAULT ".code64"
|
||||||
|
#define STACK_DEFAULT "q"
|
||||||
#else
|
#else
|
||||||
#define CODE_DEFAULT ".code32"
|
#define CODE_DEFAULT ".code32"
|
||||||
|
#define STACK_DEFAULT "l"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* LINE_SYMBOL: declare a symbol for the current source code line */
|
/* LINE_SYMBOL: declare a symbol for the current source code line */
|
||||||
@@ -268,7 +270,7 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
|
|||||||
|
|
||||||
/* REAL_CODE: declare a fragment of code that executes in real mode */
|
/* REAL_CODE: declare a fragment of code that executes in real mode */
|
||||||
#define REAL_CODE( asm_code_str ) \
|
#define REAL_CODE( asm_code_str ) \
|
||||||
"push $1f\n\t" \
|
"push" STACK_DEFAULT " $1f\n\t" \
|
||||||
"call real_call\n\t" \
|
"call real_call\n\t" \
|
||||||
TEXT16_CODE ( "\n1:\n\t" \
|
TEXT16_CODE ( "\n1:\n\t" \
|
||||||
asm_code_str \
|
asm_code_str \
|
||||||
@@ -277,7 +279,7 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
|
|||||||
|
|
||||||
/* PHYS_CODE: declare a fragment of code that executes in flat physical mode */
|
/* PHYS_CODE: declare a fragment of code that executes in flat physical mode */
|
||||||
#define PHYS_CODE( asm_code_str ) \
|
#define PHYS_CODE( asm_code_str ) \
|
||||||
"push $1f\n\t" \
|
"push" STACK_DEFAULT " $1f\n\t" \
|
||||||
"call phys_call\n\t" \
|
"call phys_call\n\t" \
|
||||||
".section \".text.phys\", \"ax\", @progbits\n\t"\
|
".section \".text.phys\", \"ax\", @progbits\n\t"\
|
||||||
"\n" LINE_SYMBOL "\n\t" \
|
"\n" LINE_SYMBOL "\n\t" \
|
||||||
|
|||||||
@@ -290,29 +290,38 @@ static const char *bios_ansi_input = "";
|
|||||||
struct bios_key {
|
struct bios_key {
|
||||||
/** Scancode */
|
/** Scancode */
|
||||||
uint8_t scancode;
|
uint8_t scancode;
|
||||||
/** Key code */
|
/** Relative key value */
|
||||||
uint16_t key;
|
uint16_t rkey;
|
||||||
} __attribute__ (( packed ));
|
} __attribute__ (( packed ));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a BIOS key mapping
|
||||||
|
*
|
||||||
|
* @v scancode Scancode
|
||||||
|
* @v key iPXE key code
|
||||||
|
* @v bioskey BIOS key mapping
|
||||||
|
*/
|
||||||
|
#define BIOS_KEY( scancode, key ) { scancode, KEY_REL ( key ) }
|
||||||
|
|
||||||
/** Mapping from BIOS scan codes to iPXE key codes */
|
/** Mapping from BIOS scan codes to iPXE key codes */
|
||||||
static const struct bios_key bios_keys[] = {
|
static const struct bios_key bios_keys[] = {
|
||||||
{ 0x53, KEY_DC },
|
BIOS_KEY ( 0x53, KEY_DC ),
|
||||||
{ 0x48, KEY_UP },
|
BIOS_KEY ( 0x48, KEY_UP ),
|
||||||
{ 0x50, KEY_DOWN },
|
BIOS_KEY ( 0x50, KEY_DOWN ),
|
||||||
{ 0x4b, KEY_LEFT },
|
BIOS_KEY ( 0x4b, KEY_LEFT ),
|
||||||
{ 0x4d, KEY_RIGHT },
|
BIOS_KEY ( 0x4d, KEY_RIGHT ),
|
||||||
{ 0x47, KEY_HOME },
|
BIOS_KEY ( 0x47, KEY_HOME ),
|
||||||
{ 0x4f, KEY_END },
|
BIOS_KEY ( 0x4f, KEY_END ),
|
||||||
{ 0x49, KEY_PPAGE },
|
BIOS_KEY ( 0x49, KEY_PPAGE ),
|
||||||
{ 0x51, KEY_NPAGE },
|
BIOS_KEY ( 0x51, KEY_NPAGE ),
|
||||||
{ 0x3f, KEY_F5 },
|
BIOS_KEY ( 0x3f, KEY_F5 ),
|
||||||
{ 0x40, KEY_F6 },
|
BIOS_KEY ( 0x40, KEY_F6 ),
|
||||||
{ 0x41, KEY_F7 },
|
BIOS_KEY ( 0x41, KEY_F7 ),
|
||||||
{ 0x42, KEY_F8 },
|
BIOS_KEY ( 0x42, KEY_F8 ),
|
||||||
{ 0x43, KEY_F9 },
|
BIOS_KEY ( 0x43, KEY_F9 ),
|
||||||
{ 0x44, KEY_F10 },
|
BIOS_KEY ( 0x44, KEY_F10 ),
|
||||||
{ 0x85, KEY_F11 },
|
BIOS_KEY ( 0x85, KEY_F11 ),
|
||||||
{ 0x86, KEY_F12 },
|
BIOS_KEY ( 0x86, KEY_F12 ),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -323,7 +332,7 @@ static const struct bios_key bios_keys[] = {
|
|||||||
*/
|
*/
|
||||||
static const char * bios_ansi_seq ( unsigned int scancode ) {
|
static const char * bios_ansi_seq ( unsigned int scancode ) {
|
||||||
static char buf[ 5 /* "[" + two digits + terminator + NUL */ ];
|
static char buf[ 5 /* "[" + two digits + terminator + NUL */ ];
|
||||||
unsigned int key;
|
unsigned int rkey;
|
||||||
unsigned int terminator;
|
unsigned int terminator;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -338,9 +347,9 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Construct escape sequence */
|
/* Construct escape sequence */
|
||||||
key = bios_keys[i].key;
|
rkey = bios_keys[i].rkey;
|
||||||
n = KEY_ANSI_N ( key );
|
n = KEY_ANSI_N ( rkey );
|
||||||
terminator = KEY_ANSI_TERMINATOR ( key );
|
terminator = KEY_ANSI_TERMINATOR ( rkey );
|
||||||
*(tmp++) = '[';
|
*(tmp++) = '[';
|
||||||
if ( n )
|
if ( n )
|
||||||
tmp += sprintf ( tmp, "%d", n );
|
tmp += sprintf ( tmp, "%d", n );
|
||||||
@@ -479,6 +488,7 @@ struct console_driver bios_console __console_driver = {
|
|||||||
static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
|
static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
|
||||||
unsigned int discard_a;
|
unsigned int discard_a;
|
||||||
unsigned int scancode;
|
unsigned int scancode;
|
||||||
|
unsigned int rkey;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint16_t keypress;
|
uint16_t keypress;
|
||||||
int key;
|
int key;
|
||||||
@@ -521,9 +531,10 @@ static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
|
|||||||
|
|
||||||
/* Handle special keys */
|
/* Handle special keys */
|
||||||
if ( key >= KEY_MIN ) {
|
if ( key >= KEY_MIN ) {
|
||||||
|
rkey = KEY_REL ( key );
|
||||||
for ( i = 0 ; i < ( sizeof ( bios_keys ) /
|
for ( i = 0 ; i < ( sizeof ( bios_keys ) /
|
||||||
sizeof ( bios_keys[0] ) ) ; i++ ) {
|
sizeof ( bios_keys[0] ) ) ; i++ ) {
|
||||||
if ( bios_keys[i].key == key ) {
|
if ( bios_keys[i].rkey == rkey ) {
|
||||||
scancode = bios_keys[i].scancode;
|
scancode = bios_keys[i].scancode;
|
||||||
keypress = ( scancode << 8 );
|
keypress = ( scancode << 8 );
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
* @v smbios SMBIOS entry point descriptor structure to fill in
|
* @v smbios SMBIOS entry point descriptor structure to fill in
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int bios_find_smbios ( struct smbios *smbios ) {
|
static int bios_find_smbios2 ( struct smbios *smbios ) {
|
||||||
struct smbios_entry entry;
|
struct smbios_entry entry;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Scan through BIOS segment to find SMBIOS entry point */
|
/* Scan through BIOS segment to find SMBIOS 32-bit entry point */
|
||||||
if ( ( rc = find_smbios_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
|
if ( ( rc = find_smbios_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
|
||||||
&entry ) ) != 0 )
|
&entry ) ) != 0 )
|
||||||
return rc;
|
return rc;
|
||||||
@@ -62,4 +62,55 @@ static int bios_find_smbios ( struct smbios *smbios ) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find SMBIOS
|
||||||
|
*
|
||||||
|
* @v smbios SMBIOS entry point descriptor structure to fill in
|
||||||
|
* @ret rc Return status code
|
||||||
|
*/
|
||||||
|
static int bios_find_smbios3 ( struct smbios *smbios ) {
|
||||||
|
struct smbios3_entry entry;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Scan through BIOS segment to find SMBIOS 64-bit entry point */
|
||||||
|
if ( ( rc = find_smbios3_entry ( real_to_user ( BIOS_SEG, 0 ), 0x10000,
|
||||||
|
&entry ) ) != 0 )
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
/* Check that address is accessible */
|
||||||
|
if ( entry.smbios_address > ~( ( physaddr_t ) 0 ) ) {
|
||||||
|
DBG ( "SMBIOS3 at %08llx is inaccessible\n",
|
||||||
|
( ( unsigned long long ) entry.smbios_address ) );
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fill in entry point descriptor structure */
|
||||||
|
smbios->address = phys_to_user ( entry.smbios_address );
|
||||||
|
smbios->len = entry.smbios_len;
|
||||||
|
smbios->count = 0;
|
||||||
|
smbios->version = SMBIOS_VERSION ( entry.major, entry.minor );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find SMBIOS
|
||||||
|
*
|
||||||
|
* @v smbios SMBIOS entry point descriptor structure to fill in
|
||||||
|
* @ret rc Return status code
|
||||||
|
*/
|
||||||
|
static int bios_find_smbios ( struct smbios *smbios ) {
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Use 32-bit table if present */
|
||||||
|
if ( ( rc = bios_find_smbios2 ( smbios ) ) == 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Otherwise, use 64-bit table if present and accessible */
|
||||||
|
if ( ( rc = bios_find_smbios3 ( smbios ) ) == 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
PROVIDE_SMBIOS ( pcbios, find_smbios, bios_find_smbios );
|
PROVIDE_SMBIOS ( pcbios, find_smbios, bios_find_smbios );
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.arch i386
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
|
|
||||||
#define SMAP 0x534d4150
|
#define SMAP 0x534d4150
|
||||||
|
|
||||||
|
|||||||
@@ -165,24 +165,27 @@ static void pcicloud_init ( void ) {
|
|||||||
static struct pci_api *apis[] = {
|
static struct pci_api *apis[] = {
|
||||||
&ecam_api, &pcibios_api, &pcidirect_api
|
&ecam_api, &pcibios_api, &pcidirect_api
|
||||||
};
|
};
|
||||||
struct pci_range range;
|
struct pci_device pci;
|
||||||
|
uint32_t busdevfn;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
int rc;
|
||||||
|
|
||||||
/* Select first API that successfully discovers an address range */
|
/* Select first API that successfully discovers a PCI device */
|
||||||
for ( i = 0 ; i < ( sizeof ( apis ) / sizeof ( apis[0] ) ) ; i++ ) {
|
for ( i = 0 ; i < ( sizeof ( apis ) / sizeof ( apis[0] ) ) ; i++ ) {
|
||||||
pcicloud = apis[i];
|
pcicloud = apis[i];
|
||||||
pcicloud_discover ( 0, &range );
|
busdevfn = 0;
|
||||||
if ( range.count != 0 ) {
|
if ( ( rc = pci_find_next ( &pci, &busdevfn ) ) == 0 ) {
|
||||||
DBGC ( pcicloud, "PCICLOUD selected %s API\n",
|
DBGC ( pcicloud, "PCICLOUD selected %s API (found "
|
||||||
pcicloud->name );
|
PCI_FMT ")\n", pcicloud->name,
|
||||||
break;
|
PCI_ARGS ( &pci ) );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The PCI direct API can never fail discovery since the range
|
/* Fall back to using final attempted API if no devices found */
|
||||||
* is hardcoded.
|
pcicloud = apis[ i - 1 ];
|
||||||
*/
|
DBGC ( pcicloud, "PCICLOUD selected %s API (nothing detected)\n",
|
||||||
assert ( range.count != 0 );
|
pcicloud->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cloud VM PCI configuration space access initialisation function */
|
/** Cloud VM PCI configuration space access initialisation function */
|
||||||
|
|||||||
@@ -375,9 +375,10 @@ int pxe_start_nbp ( void ) {
|
|||||||
* Notify BIOS of existence of network device
|
* Notify BIOS of existence of network device
|
||||||
*
|
*
|
||||||
* @v netdev Network device
|
* @v netdev Network device
|
||||||
|
* @v priv Private data
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int pxe_notify ( struct net_device *netdev ) {
|
static int pxe_notify ( struct net_device *netdev, void *priv __unused ) {
|
||||||
|
|
||||||
/* Do nothing if we already have a network device */
|
/* Do nothing if we already have a network device */
|
||||||
if ( pxe_netdev )
|
if ( pxe_netdev )
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
|||||||
|
|
||||||
#include "librm.h"
|
#include "librm.h"
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.code32
|
.code32
|
||||||
|
|||||||
@@ -207,65 +207,35 @@ struct init_fn guestinfo_init_fn __init_fn ( INIT_NORMAL ) = {
|
|||||||
* Create per-netdevice GuestInfo settings
|
* Create per-netdevice GuestInfo settings
|
||||||
*
|
*
|
||||||
* @v netdev Network device
|
* @v netdev Network device
|
||||||
|
* @v priv Private data
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int guestinfo_net_probe ( struct net_device *netdev ) {
|
static int guestinfo_net_probe ( struct net_device *netdev, void *priv ) {
|
||||||
struct settings *settings;
|
struct settings *settings = priv;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Do nothing unless we have a GuestInfo channel available */
|
/* Do nothing unless we have a GuestInfo channel available */
|
||||||
if ( guestinfo_channel < 0 )
|
if ( guestinfo_channel < 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Allocate and initialise settings block */
|
/* Initialise and register settings */
|
||||||
settings = zalloc ( sizeof ( *settings ) );
|
settings_init ( settings, &guestinfo_settings_operations,
|
||||||
if ( ! settings ) {
|
&netdev->refcnt, NULL );
|
||||||
rc = -ENOMEM;
|
|
||||||
goto err_alloc;
|
|
||||||
}
|
|
||||||
settings_init ( settings, &guestinfo_settings_operations, NULL, NULL );
|
|
||||||
|
|
||||||
/* Register settings */
|
|
||||||
if ( ( rc = register_settings ( settings, netdev_settings ( netdev ),
|
if ( ( rc = register_settings ( settings, netdev_settings ( netdev ),
|
||||||
"vmware" ) ) != 0 ) {
|
"vmware" ) ) != 0 ) {
|
||||||
DBGC ( settings, "GuestInfo %p could not register for %s: %s\n",
|
DBGC ( settings, "GuestInfo %p could not register for %s: %s\n",
|
||||||
settings, netdev->name, strerror ( rc ) );
|
settings, netdev->name, strerror ( rc ) );
|
||||||
goto err_register;
|
return rc;
|
||||||
}
|
}
|
||||||
DBGC ( settings, "GuestInfo %p registered for %s\n",
|
DBGC ( settings, "GuestInfo %p registered for %s\n",
|
||||||
settings, netdev->name );
|
settings, netdev->name );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_register:
|
|
||||||
free ( settings );
|
|
||||||
err_alloc:
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove per-netdevice GuestInfo settings
|
|
||||||
*
|
|
||||||
* @v netdev Network device
|
|
||||||
*/
|
|
||||||
static void guestinfo_net_remove ( struct net_device *netdev ) {
|
|
||||||
struct settings *parent = netdev_settings ( netdev );
|
|
||||||
struct settings *settings;
|
|
||||||
|
|
||||||
list_for_each_entry ( settings, &parent->children, siblings ) {
|
|
||||||
if ( settings->op == &guestinfo_settings_operations ) {
|
|
||||||
DBGC ( settings, "GuestInfo %p unregistered for %s\n",
|
|
||||||
settings, netdev->name );
|
|
||||||
unregister_settings ( settings );
|
|
||||||
free ( settings );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GuestInfo per-netdevice driver */
|
/** GuestInfo per-netdevice driver */
|
||||||
struct net_driver guestinfo_net_driver __net_driver = {
|
struct net_driver guestinfo_net_driver __net_driver = {
|
||||||
.name = "GuestInfo",
|
.name = "GuestInfo",
|
||||||
|
.priv_len = sizeof ( struct settings ),
|
||||||
.probe = guestinfo_net_probe,
|
.probe = guestinfo_net_probe,
|
||||||
.remove = guestinfo_net_remove,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define STACK_SEG 0x0200
|
#define STACK_SEG 0x0200
|
||||||
#define STACK_SIZE 0x2000
|
#define STACK_SIZE 0x2000
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
.code16
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find active partition
|
* Find active partition
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ FILE_LICENCE ( GPL2_ONLY )
|
|||||||
|
|
||||||
.equ SYSSEG, 0x1000 /* system loaded at SYSSEG<<4 */
|
.equ SYSSEG, 0x1000 /* system loaded at SYSSEG<<4 */
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.org 0
|
.org 0
|
||||||
.arch i386
|
|
||||||
.text
|
|
||||||
.section ".prefix", "ax", @progbits
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
|
.section ".prefix", "ax", @progbits
|
||||||
.globl _dsk_start
|
.globl _dsk_start
|
||||||
_dsk_start:
|
_dsk_start:
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define PSP_CMDLINE_LEN 0x80
|
#define PSP_CMDLINE_LEN 0x80
|
||||||
#define PSP_CMDLINE_START 0x81
|
#define PSP_CMDLINE_START 0x81
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
.code16
|
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
|
|
||||||
signature:
|
signature:
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
.code16
|
|
||||||
.org 0
|
.org 0
|
||||||
.globl _hd_start
|
.globl _hd_start
|
||||||
_hd_start:
|
_hd_start:
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/* Image compression enabled */
|
/* Image compression enabled */
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#define BZI_LOAD_HIGH_ADDR 0x100000
|
#define BZI_LOAD_HIGH_ADDR 0x100000
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.arch i386
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.globl _lkrn_start
|
.globl _lkrn_start
|
||||||
_lkrn_start:
|
_lkrn_start:
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
.code16
|
|
||||||
.org 0
|
.org 0
|
||||||
|
|
||||||
.globl mbr
|
.globl mbr
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define _pcirom_start _mrom_start
|
#define _pcirom_start _mrom_start
|
||||||
#include "pciromprefix.S"
|
#include "pciromprefix.S"
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.arch i386
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
|
|
||||||
/* Obtain access to payload by exposing the expansion ROM BAR at the
|
/* Obtain access to payload by exposing the expansion ROM BAR at the
|
||||||
* address currently used by a suitably large memory BAR on the same
|
* address currently used by a suitably large memory BAR on the same
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.arch i386
|
|
||||||
.code16
|
.code16
|
||||||
|
.arch i386
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.org 0
|
.org 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.org 0
|
.org 0
|
||||||
.text
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
.code16
|
|
||||||
_prefix:
|
_prefix:
|
||||||
|
|
||||||
.section ".text16", "ax", @progbits
|
.section ".text16", "ax", @progbits
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#define PXE_HACK_EB54 0x0001
|
#define PXE_HACK_EB54 0x0001
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
.code16
|
|
||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
#include <undi.h>
|
#include <undi.h>
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
.code16
|
|
||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define BUSTYPE "PCIR"
|
#define BUSTYPE "PCIR"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.code16
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.code16
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "ax", @progbits
|
.section ".prefix", "ax", @progbits
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
****************************************************************************
|
****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code32
|
||||||
.arch i486
|
.arch i486
|
||||||
.section ".prefix.lib", "ax", @progbits
|
.section ".prefix.lib", "ax", @progbits
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <config/console.h>
|
#include <config/console.h>
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
.code16
|
|
||||||
.org 0
|
.org 0
|
||||||
|
|
||||||
#include "mbr.S"
|
#include "mbr.S"
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
/* Breakpoint for when debugging under bochs */
|
/* Breakpoint for when debugging under bochs */
|
||||||
#define BOCHSBP xchgw %bx, %bx
|
#define BOCHSBP xchgw %bx, %bx
|
||||||
|
|
||||||
.text
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".text16", "awx", @progbits
|
.section ".text16", "awx", @progbits
|
||||||
.code16
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* init_libkir (real-mode or 16:xx protected-mode far call)
|
* init_libkir (real-mode or 16:xx protected-mode far call)
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define if64 if 0
|
#define if64 if 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Global descriptor table
|
* Global descriptor table
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define SIGFPE 8
|
#define SIGFPE 8
|
||||||
#define SIGSTKFLT 16
|
#define SIGSTKFLT 16
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.section ".text.gdbmach_interrupt", "ax", @progbits
|
.section ".text.gdbmach_interrupt", "ax", @progbits
|
||||||
.code64
|
.code64
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
|
.section ".note.GNU-stack", "", @progbits
|
||||||
.text
|
.text
|
||||||
.code64
|
.code64
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
*
|
*
|
||||||
|
!.gitignore
|
||||||
|
|||||||
@@ -290,6 +290,9 @@ REQUIRE_OBJECT ( cert_cmd );
|
|||||||
#ifdef IMAGE_MEM_CMD
|
#ifdef IMAGE_MEM_CMD
|
||||||
REQUIRE_OBJECT ( image_mem_cmd );
|
REQUIRE_OBJECT ( image_mem_cmd );
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SHIM_CMD
|
||||||
|
REQUIRE_OBJECT ( shim_cmd );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drag in miscellaneous objects
|
* Drag in miscellaneous objects
|
||||||
@@ -352,6 +355,9 @@ REQUIRE_OBJECT ( vram_settings );
|
|||||||
#ifdef ACPI_SETTINGS
|
#ifdef ACPI_SETTINGS
|
||||||
REQUIRE_OBJECT ( acpi_settings );
|
REQUIRE_OBJECT ( acpi_settings );
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef EFI_SETTINGS
|
||||||
|
REQUIRE_OBJECT ( efi_settings );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drag in selected keyboard map
|
* Drag in selected keyboard map
|
||||||
|
|||||||
@@ -83,6 +83,11 @@ REQUIRE_OBJECT ( oid_sha512_224 );
|
|||||||
REQUIRE_OBJECT ( oid_sha512_256 );
|
REQUIRE_OBJECT ( oid_sha512_256 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* X25519 */
|
||||||
|
#if defined ( CRYPTO_CURVE_X25519 )
|
||||||
|
REQUIRE_OBJECT ( oid_x25519 );
|
||||||
|
#endif
|
||||||
|
|
||||||
/* RSA and MD5 */
|
/* RSA and MD5 */
|
||||||
#if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_MD5 )
|
#if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_MD5 )
|
||||||
REQUIRE_OBJECT ( rsa_md5 );
|
REQUIRE_OBJECT ( rsa_md5 );
|
||||||
@@ -114,25 +119,79 @@ REQUIRE_OBJECT ( rsa_sha512 );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RSA, AES-CBC, and SHA-1 */
|
/* RSA, AES-CBC, and SHA-1 */
|
||||||
#if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_CIPHER_AES_CBC ) && \
|
#if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
defined ( CRYPTO_DIGEST_SHA1 )
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
|
||||||
REQUIRE_OBJECT ( rsa_aes_cbc_sha1 );
|
REQUIRE_OBJECT ( rsa_aes_cbc_sha1 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RSA, AES-CBC, and SHA-256 */
|
/* RSA, AES-CBC, and SHA-256 */
|
||||||
#if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_CIPHER_AES_CBC ) && \
|
#if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
defined ( CRYPTO_DIGEST_SHA256 )
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
|
||||||
REQUIRE_OBJECT ( rsa_aes_cbc_sha256 );
|
REQUIRE_OBJECT ( rsa_aes_cbc_sha256 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RSA, AES-GCM, and SHA-256 */
|
/* RSA, AES-GCM, and SHA-256 */
|
||||||
#if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_CIPHER_AES_GCM ) && \
|
#if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
defined ( CRYPTO_DIGEST_SHA256 )
|
defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
|
||||||
REQUIRE_OBJECT ( rsa_aes_gcm_sha256 );
|
REQUIRE_OBJECT ( rsa_aes_gcm_sha256 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RSA, AES-GCM, and SHA-384 */
|
/* RSA, AES-GCM, and SHA-384 */
|
||||||
#if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_CIPHER_AES_GCM ) && \
|
#if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
defined ( CRYPTO_DIGEST_SHA384 )
|
defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
|
||||||
REQUIRE_OBJECT ( rsa_aes_gcm_sha384 );
|
REQUIRE_OBJECT ( rsa_aes_gcm_sha384 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* DHE, RSA, AES-CBC, and SHA-1 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
|
||||||
|
REQUIRE_OBJECT ( dhe_rsa_aes_cbc_sha1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DHE, RSA, AES-CBC, and SHA-256 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
|
||||||
|
REQUIRE_OBJECT ( dhe_rsa_aes_cbc_sha256 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DHE, RSA, AES-GCM, and SHA-256 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
|
||||||
|
REQUIRE_OBJECT ( dhe_rsa_aes_gcm_sha256 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DHE, RSA, AES-GCM, and SHA-384 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
|
||||||
|
REQUIRE_OBJECT ( dhe_rsa_aes_gcm_sha384 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ECDHE, RSA, AES-CBC, and SHA-1 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
|
||||||
|
REQUIRE_OBJECT ( ecdhe_rsa_aes_cbc_sha1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ECDHE, RSA, AES-CBC, and SHA-256 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
|
||||||
|
REQUIRE_OBJECT ( ecdhe_rsa_aes_cbc_sha256 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ECDHE, RSA, AES-CBC, and SHA-384 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA384 )
|
||||||
|
REQUIRE_OBJECT ( ecdhe_rsa_aes_cbc_sha384 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ECDHE, RSA, AES-GCM, and SHA-256 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
|
||||||
|
REQUIRE_OBJECT ( ecdhe_rsa_aes_gcm_sha256 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ECDHE, RSA, AES-GCM, and SHA-384 */
|
||||||
|
#if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
|
||||||
|
defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
|
||||||
|
REQUIRE_OBJECT ( ecdhe_rsa_aes_gcm_sha384 );
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
/** Minimum TLS version */
|
/** Minimum TLS version */
|
||||||
#define TLS_VERSION_MIN TLS_VERSION_TLS_1_1
|
#define TLS_VERSION_MIN TLS_VERSION_TLS_1_1
|
||||||
|
|
||||||
|
/** Public-key exchange algorithm */
|
||||||
|
#define CRYPTO_EXCHANGE_PUBKEY
|
||||||
|
|
||||||
|
/** DHE key exchange algorithm */
|
||||||
|
#define CRYPTO_EXCHANGE_DHE
|
||||||
|
|
||||||
|
/** ECDHE key exchange algorithm */
|
||||||
|
#define CRYPTO_EXCHANGE_ECDHE
|
||||||
|
|
||||||
/** RSA public-key algorithm */
|
/** RSA public-key algorithm */
|
||||||
#define CRYPTO_PUBKEY_RSA
|
#define CRYPTO_PUBKEY_RSA
|
||||||
|
|
||||||
@@ -48,6 +57,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
/** SHA-512/256 digest algorithm */
|
/** SHA-512/256 digest algorithm */
|
||||||
//#define CRYPTO_DIGEST_SHA512_256
|
//#define CRYPTO_DIGEST_SHA512_256
|
||||||
|
|
||||||
|
/** X25519 elliptic curve */
|
||||||
|
#define CRYPTO_CURVE_X25519
|
||||||
|
|
||||||
/** Margin of error (in seconds) allowed in signed timestamps
|
/** Margin of error (in seconds) allowed in signed timestamps
|
||||||
*
|
*
|
||||||
* We default to allowing a reasonable margin of error: 12 hours to
|
* We default to allowing a reasonable margin of error: 12 hours to
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
|
|
||||||
#define REBOOT_CMD /* Reboot command */
|
#define REBOOT_CMD /* Reboot command */
|
||||||
|
|
||||||
|
#define EFI_SETTINGS /* EFI variable settings */
|
||||||
|
|
||||||
#if defined ( __i386__ ) || defined ( __x86_64__ )
|
#if defined ( __i386__ ) || defined ( __x86_64__ )
|
||||||
#define IOAPI_X86
|
#define IOAPI_X86
|
||||||
#define NAP_EFIX86
|
#define NAP_EFIX86
|
||||||
@@ -65,4 +67,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define IMAGE_GZIP /* GZIP image support */
|
#define IMAGE_GZIP /* GZIP image support */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined ( __loongarch__ )
|
||||||
|
#define IOAPI_LOONG64
|
||||||
|
#define NAP_EFILOONG64
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_DEFAULTS_EFI_H */
|
#endif /* CONFIG_DEFAULTS_EFI_H */
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
//#define CERT_CMD /* Certificate management commands */
|
//#define CERT_CMD /* Certificate management commands */
|
||||||
//#define IMAGE_MEM_CMD /* Read memory command */
|
//#define IMAGE_MEM_CMD /* Read memory command */
|
||||||
#define IMAGE_ARCHIVE_CMD /* Archive image management commands */
|
#define IMAGE_ARCHIVE_CMD /* Archive image management commands */
|
||||||
|
#define SHIM_CMD /* EFI shim command (or dummy command) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ROM-specific options
|
* ROM-specific options
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
*
|
*
|
||||||
|
!.gitignore
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <config/defaults.h>
|
||||||
|
|
||||||
#define PCI_SETTINGS /* PCI device settings */
|
#define PCI_SETTINGS /* PCI device settings */
|
||||||
//#define CPUID_SETTINGS /* CPUID settings */
|
//#define CPUID_SETTINGS /* CPUID settings */
|
||||||
//#define MEMMAP_SETTINGS /* Memory map settings */
|
//#define MEMMAP_SETTINGS /* Memory map settings */
|
||||||
|
|||||||
@@ -295,9 +295,10 @@ struct startup_fn cachedhcp_startup_fn __startup_fn ( STARTUP_LATE ) = {
|
|||||||
* Apply cached DHCPACK to network device, if applicable
|
* Apply cached DHCPACK to network device, if applicable
|
||||||
*
|
*
|
||||||
* @v netdev Network device
|
* @v netdev Network device
|
||||||
|
* @v priv Private data
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int cachedhcp_probe ( struct net_device *netdev ) {
|
static int cachedhcp_probe ( struct net_device *netdev, void *priv __unused ) {
|
||||||
|
|
||||||
/* Apply cached DHCPACK to network device, if applicable */
|
/* Apply cached DHCPACK to network device, if applicable */
|
||||||
return cachedhcp_apply ( &cached_dhcpack, netdev );
|
return cachedhcp_apply ( &cached_dhcpack, netdev );
|
||||||
|
|||||||
+36
-33
@@ -56,8 +56,15 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
/** List of registered images */
|
/** List of registered images */
|
||||||
struct list_head images = LIST_HEAD_INIT ( images );
|
struct list_head images = LIST_HEAD_INIT ( images );
|
||||||
|
|
||||||
|
/** Image selected for execution */
|
||||||
|
struct image_tag selected_image __image_tag = {
|
||||||
|
.name = "SELECTED",
|
||||||
|
};
|
||||||
|
|
||||||
/** Currently-executing image */
|
/** Currently-executing image */
|
||||||
struct image *current_image;
|
struct image_tag current_image __image_tag = {
|
||||||
|
.name = "CURRENT",
|
||||||
|
};
|
||||||
|
|
||||||
/** Current image trust requirement */
|
/** Current image trust requirement */
|
||||||
static int require_trusted_images = 0;
|
static int require_trusted_images = 0;
|
||||||
@@ -72,8 +79,13 @@ static int require_trusted_images_permanent = 0;
|
|||||||
*/
|
*/
|
||||||
static void free_image ( struct refcnt *refcnt ) {
|
static void free_image ( struct refcnt *refcnt ) {
|
||||||
struct image *image = container_of ( refcnt, struct image, refcnt );
|
struct image *image = container_of ( refcnt, struct image, refcnt );
|
||||||
|
struct image_tag *tag;
|
||||||
|
|
||||||
DBGC ( image, "IMAGE %s freed\n", image->name );
|
DBGC ( image, "IMAGE %s freed\n", image->name );
|
||||||
|
for_each_table_entry ( tag, IMAGE_TAGS ) {
|
||||||
|
if ( tag->image == image )
|
||||||
|
tag->image = NULL;
|
||||||
|
}
|
||||||
free ( image->name );
|
free ( image->name );
|
||||||
free ( image->cmdline );
|
free ( image->cmdline );
|
||||||
uri_put ( image->uri );
|
uri_put ( image->uri );
|
||||||
@@ -261,12 +273,6 @@ int register_image ( struct image *image ) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Avoid ending up with multiple "selected" images on
|
|
||||||
* re-registration
|
|
||||||
*/
|
|
||||||
if ( image_find_selected() )
|
|
||||||
image->flags &= ~IMAGE_SELECTED;
|
|
||||||
|
|
||||||
/* Add to image list */
|
/* Add to image list */
|
||||||
image_get ( image );
|
image_get ( image );
|
||||||
image->flags |= IMAGE_REGISTERED;
|
image->flags |= IMAGE_REGISTERED;
|
||||||
@@ -320,6 +326,23 @@ struct image * find_image ( const char *name ) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find image by tag
|
||||||
|
*
|
||||||
|
* @v tag Image tag
|
||||||
|
* @ret image Executable image, or NULL
|
||||||
|
*/
|
||||||
|
struct image * find_image_tag ( struct image_tag *tag ) {
|
||||||
|
struct image *image;
|
||||||
|
|
||||||
|
for_each_image ( image ) {
|
||||||
|
if ( tag->image == image )
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute image
|
* Execute image
|
||||||
*
|
*
|
||||||
@@ -346,13 +369,13 @@ int image_exec ( struct image *image ) {
|
|||||||
if ( image->uri )
|
if ( image->uri )
|
||||||
churi ( image->uri );
|
churi ( image->uri );
|
||||||
|
|
||||||
/* Preserve record of any currently-running image */
|
/* Set as currently running image */
|
||||||
saved_current_image = current_image;
|
saved_current_image = image_tag ( image, ¤t_image );
|
||||||
|
|
||||||
/* Take out a temporary reference to the image, so that it
|
/* Take out a temporary reference to the image, so that it
|
||||||
* does not get freed when temporarily unregistered.
|
* does not get freed when temporarily unregistered.
|
||||||
*/
|
*/
|
||||||
current_image = image_get ( image );
|
image_get ( image );
|
||||||
|
|
||||||
/* Check that this image can be executed */
|
/* Check that this image can be executed */
|
||||||
if ( ! ( image->type && image->type->exec ) ) {
|
if ( ! ( image->type && image->type->exec ) ) {
|
||||||
@@ -419,7 +442,7 @@ int image_exec ( struct image *image ) {
|
|||||||
image_put ( image );
|
image_put ( image );
|
||||||
|
|
||||||
/* Restore previous currently-running image */
|
/* Restore previous currently-running image */
|
||||||
current_image = saved_current_image;
|
image_tag ( saved_current_image, ¤t_image );
|
||||||
|
|
||||||
/* Reset current working directory */
|
/* Reset current working directory */
|
||||||
churi ( old_cwuri );
|
churi ( old_cwuri );
|
||||||
@@ -442,7 +465,7 @@ int image_exec ( struct image *image ) {
|
|||||||
* registered until the currently-executing image returns.
|
* registered until the currently-executing image returns.
|
||||||
*/
|
*/
|
||||||
int image_replace ( struct image *replacement ) {
|
int image_replace ( struct image *replacement ) {
|
||||||
struct image *image = current_image;
|
struct image *image = current_image.image;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
@@ -478,37 +501,17 @@ int image_replace ( struct image *replacement ) {
|
|||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int image_select ( struct image *image ) {
|
int image_select ( struct image *image ) {
|
||||||
struct image *tmp;
|
|
||||||
|
|
||||||
/* Unselect all other images */
|
|
||||||
for_each_image ( tmp )
|
|
||||||
tmp->flags &= ~IMAGE_SELECTED;
|
|
||||||
|
|
||||||
/* Check that this image can be executed */
|
/* Check that this image can be executed */
|
||||||
if ( ! ( image->type && image->type->exec ) )
|
if ( ! ( image->type && image->type->exec ) )
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
|
|
||||||
/* Mark image as selected */
|
/* Mark image as selected */
|
||||||
image->flags |= IMAGE_SELECTED;
|
image_tag ( image, &selected_image );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find selected image
|
|
||||||
*
|
|
||||||
* @ret image Executable image, or NULL
|
|
||||||
*/
|
|
||||||
struct image * image_find_selected ( void ) {
|
|
||||||
struct image *image;
|
|
||||||
|
|
||||||
for_each_image ( image ) {
|
|
||||||
if ( image->flags & IMAGE_SELECTED )
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change image trust requirement
|
* Change image trust requirement
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ void intf_shutdown ( struct interface *intf, int rc ) {
|
|||||||
intf_nullify ( intf );
|
intf_nullify ( intf );
|
||||||
|
|
||||||
/* Transfer destination to temporary interface */
|
/* Transfer destination to temporary interface */
|
||||||
|
intf_temp_init ( &tmp, intf );
|
||||||
tmp.dest = intf->dest;
|
tmp.dest = intf->dest;
|
||||||
intf->dest = &null_intf;
|
intf->dest = &null_intf;
|
||||||
|
|
||||||
|
|||||||
+14
-1
@@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <ipxe/netdevice.h>
|
#include <ipxe/netdevice.h>
|
||||||
@@ -35,6 +36,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#include <ipxe/settings.h>
|
#include <ipxe/settings.h>
|
||||||
#include <ipxe/params.h>
|
#include <ipxe/params.h>
|
||||||
#include <ipxe/timer.h>
|
#include <ipxe/timer.h>
|
||||||
|
#include <ipxe/keys.h>
|
||||||
#include <ipxe/parseopt.h>
|
#include <ipxe/parseopt.h>
|
||||||
#include <config/branding.h>
|
#include <config/branding.h>
|
||||||
|
|
||||||
@@ -213,6 +215,7 @@ int parse_flag ( char *text __unused, int *flag ) {
|
|||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int parse_key ( char *text, unsigned int *key ) {
|
int parse_key ( char *text, unsigned int *key ) {
|
||||||
|
int rc;
|
||||||
|
|
||||||
/* Interpret single characters as being a literal key character */
|
/* Interpret single characters as being a literal key character */
|
||||||
if ( text[0] && ! text[1] ) {
|
if ( text[0] && ! text[1] ) {
|
||||||
@@ -221,7 +224,17 @@ int parse_key ( char *text, unsigned int *key ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, interpret as an integer */
|
/* Otherwise, interpret as an integer */
|
||||||
return parse_integer ( text, key );
|
if ( ( rc = parse_integer ( text, key ) ) < 0 )
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
/* For backwards compatibility with existing scripts, treat
|
||||||
|
* integers between the ASCII range and special key range as
|
||||||
|
* being relative special key values.
|
||||||
|
*/
|
||||||
|
if ( ( ! isascii ( *key ) ) && ( *key < KEY_MIN ) )
|
||||||
|
*key += KEY_MIN;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+5
-3
@@ -6,8 +6,9 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ipxe/timer.h>
|
#include <time.h>
|
||||||
|
|
||||||
static int32_t rnd_seed = 0;
|
static int32_t rnd_seed = 0;
|
||||||
|
|
||||||
@@ -30,8 +31,9 @@ void srandom ( unsigned int seed ) {
|
|||||||
long int random ( void ) {
|
long int random ( void ) {
|
||||||
int32_t q;
|
int32_t q;
|
||||||
|
|
||||||
if ( ! rnd_seed ) /* Initialize linear congruential generator */
|
/* Initialize linear congruential generator */
|
||||||
srandom ( currticks() );
|
if ( ! rnd_seed )
|
||||||
|
srandom ( time ( NULL ) );
|
||||||
|
|
||||||
/* simplified version of the LCG given in Bruce Schneier's
|
/* simplified version of the LCG given in Bruce Schneier's
|
||||||
"Applied Cryptography" */
|
"Applied Cryptography" */
|
||||||
|
|||||||
+2
-1
@@ -60,7 +60,7 @@ static struct xfer_metadata dummy_metadata;
|
|||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
|
int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
|
||||||
struct interface tmp = INTF_INIT ( null_intf_desc );
|
struct interface tmp;
|
||||||
struct interface *dest;
|
struct interface *dest;
|
||||||
xfer_vredirect_TYPE ( void * ) *op =
|
xfer_vredirect_TYPE ( void * ) *op =
|
||||||
intf_get_dest_op_no_passthru ( intf, xfer_vredirect, &dest );
|
intf_get_dest_op_no_passthru ( intf, xfer_vredirect, &dest );
|
||||||
@@ -85,6 +85,7 @@ int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
|
|||||||
* If redirection fails, then send intf_close() to the
|
* If redirection fails, then send intf_close() to the
|
||||||
* parent interface.
|
* parent interface.
|
||||||
*/
|
*/
|
||||||
|
intf_temp_init ( &tmp, intf );
|
||||||
intf_plug ( &tmp, dest );
|
intf_plug ( &tmp, dest );
|
||||||
rc = xfer_vreopen ( dest, type, args );
|
rc = xfer_vreopen ( dest, type, args );
|
||||||
if ( rc == 0 ) {
|
if ( rc == 0 ) {
|
||||||
|
|||||||
@@ -589,6 +589,32 @@ int asn1_signature_algorithm ( const struct asn1_cursor *cursor,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check ASN.1 OID-identified algorithm
|
||||||
|
*
|
||||||
|
* @v cursor ASN.1 object cursor
|
||||||
|
* @v expected Expected algorithm
|
||||||
|
* @ret rc Return status code
|
||||||
|
*/
|
||||||
|
int asn1_check_algorithm ( const struct asn1_cursor *cursor,
|
||||||
|
struct asn1_algorithm *expected ) {
|
||||||
|
struct asn1_algorithm *actual;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Parse algorithm */
|
||||||
|
if ( ( rc = asn1_algorithm ( cursor, &actual ) ) != 0 )
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
/* Check algorithm matches */
|
||||||
|
if ( actual != expected ) {
|
||||||
|
DBGC ( cursor, "ASN1 %p algorithm %s does not match %s\n",
|
||||||
|
cursor, actual->name, expected->name );
|
||||||
|
return -ENOTTY_ALGORITHM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse ASN.1 GeneralizedTime
|
* Parse ASN.1 GeneralizedTime
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -50,6 +50,31 @@ static struct profiler bigint_mod_multiply_rescale_profiler __profiler =
|
|||||||
static struct profiler bigint_mod_multiply_subtract_profiler __profiler =
|
static struct profiler bigint_mod_multiply_subtract_profiler __profiler =
|
||||||
{ .name = "bigint_mod_multiply.subtract" };
|
{ .name = "bigint_mod_multiply.subtract" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conditionally swap big integers (in constant time)
|
||||||
|
*
|
||||||
|
* @v first0 Element 0 of big integer to be conditionally swapped
|
||||||
|
* @v second0 Element 0 of big integer to be conditionally swapped
|
||||||
|
* @v size Number of elements in big integers
|
||||||
|
* @v swap Swap first and second big integers
|
||||||
|
*/
|
||||||
|
void bigint_swap_raw ( bigint_element_t *first0, bigint_element_t *second0,
|
||||||
|
unsigned int size, int swap ) {
|
||||||
|
bigint_element_t mask;
|
||||||
|
bigint_element_t xor;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
/* Construct mask */
|
||||||
|
mask = ( ( bigint_element_t ) ( ! swap ) - 1 );
|
||||||
|
|
||||||
|
/* Conditionally swap elements */
|
||||||
|
for ( i = 0 ; i < size ; i++ ) {
|
||||||
|
xor = ( mask & ( first0[i] ^ second0[i] ) );
|
||||||
|
first0[i] ^= xor;
|
||||||
|
second0[i] ^= xor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform modular multiplication of big integers
|
* Perform modular multiplication of big integers
|
||||||
*
|
*
|
||||||
|
|||||||
+4
-4
@@ -472,10 +472,10 @@ void gcm_setiv ( struct gcm_context *context, const void *iv, size_t ivlen ) {
|
|||||||
union gcm_block *check = ( ( void * ) context );
|
union gcm_block *check = ( ( void * ) context );
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
linker_assert ( &context->hash == check, gcm_bad_layout );
|
build_assert ( &context->hash == check );
|
||||||
linker_assert ( &context->len == check + 1, gcm_bad_layout );
|
build_assert ( &context->len == check + 1 );
|
||||||
linker_assert ( &context->ctr == check + 2, gcm_bad_layout );
|
build_assert ( &context->ctr == check + 2 );
|
||||||
linker_assert ( &context->key == check + 3, gcm_bad_layout );
|
build_assert ( &context->key == check + 3 );
|
||||||
|
|
||||||
/* Reset non-key state */
|
/* Reset non-key state */
|
||||||
memset ( context, 0, offsetof ( typeof ( *context ), key ) );
|
memset ( context, 0, offsetof ( typeof ( *context ), key ) );
|
||||||
|
|||||||
+5
-5
@@ -155,11 +155,11 @@ static void md4_digest ( struct md4_context *context ) {
|
|||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
assert ( ( context->len % sizeof ( context->ddd.dd.data ) ) == 0 );
|
assert ( ( context->len % sizeof ( context->ddd.dd.data ) ) == 0 );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[0] == a, md4_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[0] == a );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[1] == b, md4_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[1] == b );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[2] == c, md4_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[2] == c );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[3] == d, md4_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[3] == d );
|
||||||
linker_assert ( &u.ddd.dd.data.dword[0] == w, md4_bad_layout );
|
build_assert ( &u.ddd.dd.data.dword[0] == w );
|
||||||
|
|
||||||
DBGC ( context, "MD4 digesting:\n" );
|
DBGC ( context, "MD4 digesting:\n" );
|
||||||
DBGC_HDA ( context, 0, &context->ddd.dd.digest,
|
DBGC_HDA ( context, 0, &context->ddd.dd.digest,
|
||||||
|
|||||||
+5
-5
@@ -178,11 +178,11 @@ static void md5_digest ( struct md5_context *context ) {
|
|||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
assert ( ( context->len % sizeof ( context->ddd.dd.data ) ) == 0 );
|
assert ( ( context->len % sizeof ( context->ddd.dd.data ) ) == 0 );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[0] == a, md5_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[0] == a );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[1] == b, md5_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[1] == b );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[2] == c, md5_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[2] == c );
|
||||||
linker_assert ( &u.ddd.dd.digest.h[3] == d, md5_bad_layout );
|
build_assert ( &u.ddd.dd.digest.h[3] == d );
|
||||||
linker_assert ( &u.ddd.dd.data.dword[0] == w, md5_bad_layout );
|
build_assert ( &u.ddd.dd.data.dword[0] == w );
|
||||||
|
|
||||||
DBGC ( context, "MD5 digesting:\n" );
|
DBGC ( context, "MD5 digesting:\n" );
|
||||||
DBGC_HDA ( context, 0, &context->ddd.dd.digest,
|
DBGC_HDA ( context, 0, &context->ddd.dd.digest,
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha1.h>
|
||||||
|
#include <ipxe/sha256.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_DHE_RSA_WITH_AES_128_CBC_SHA cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_dhe_rsa_with_aes_128_cbc_sha __tls_cipher_suite ( 15 ) = {
|
||||||
|
.code = htons ( TLS_DHE_RSA_WITH_AES_128_CBC_SHA ),
|
||||||
|
.key_len = ( 128 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA1_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_dhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha1_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** TLS_DHE_RSA_WITH_AES_256_CBC_SHA cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_dhe_rsa_with_aes_256_cbc_sha __tls_cipher_suite ( 16 ) = {
|
||||||
|
.code = htons ( TLS_DHE_RSA_WITH_AES_256_CBC_SHA ),
|
||||||
|
.key_len = ( 256 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA1_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_dhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha1_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2015 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha256.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_dhe_rsa_with_aes_128_cbc_sha256 __tls_cipher_suite ( 13 ) = {
|
||||||
|
.code = htons ( TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ),
|
||||||
|
.key_len = ( 128 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA256_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_dhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha256_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_dhe_rsa_with_aes_256_cbc_sha256 __tls_cipher_suite ( 14 ) = {
|
||||||
|
.code = htons ( TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ),
|
||||||
|
.key_len = ( 256 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA256_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_dhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha256_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha256.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_dhe_rsa_with_aes_128_gcm_sha256 __tls_cipher_suite ( 11 ) = {
|
||||||
|
.code = htons ( TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 ),
|
||||||
|
.key_len = ( 128 / 8 ),
|
||||||
|
.fixed_iv_len = 4,
|
||||||
|
.record_iv_len = 8,
|
||||||
|
.mac_len = 0,
|
||||||
|
.exchange = &tls_dhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_gcm_algorithm,
|
||||||
|
.digest = &sha256_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha512.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_dhe_rsa_with_aes_256_gcm_sha384 __tls_cipher_suite ( 12 ) = {
|
||||||
|
.code = htons ( TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ),
|
||||||
|
.key_len = ( 256 / 8 ),
|
||||||
|
.fixed_iv_len = 4,
|
||||||
|
.record_iv_len = 8,
|
||||||
|
.mac_len = 0,
|
||||||
|
.exchange = &tls_dhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_gcm_algorithm,
|
||||||
|
.digest = &sha384_algorithm,
|
||||||
|
.handshake = &sha384_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha1.h>
|
||||||
|
#include <ipxe/sha256.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_ecdhe_rsa_with_aes_128_cbc_sha __tls_cipher_suite ( 05 ) = {
|
||||||
|
.code = htons ( TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA ),
|
||||||
|
.key_len = ( 128 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA1_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_ecdhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha1_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
|
|
||||||
|
/** TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_ecdhe_rsa_with_aes_256_cbc_sha __tls_cipher_suite ( 06 ) = {
|
||||||
|
.code = htons ( TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA ),
|
||||||
|
.key_len = ( 256 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA1_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_ecdhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha1_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha256.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_ecdhe_rsa_with_aes_128_cbc_sha256 __tls_cipher_suite ( 03 ) = {
|
||||||
|
.code = htons ( TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 ),
|
||||||
|
.key_len = ( 128 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA256_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_ecdhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha256_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha512.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_ecdhe_rsa_with_aes_256_cbc_sha384 __tls_cipher_suite ( 04 ) = {
|
||||||
|
.code = htons ( TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 ),
|
||||||
|
.key_len = ( 256 / 8 ),
|
||||||
|
.fixed_iv_len = 0,
|
||||||
|
.record_iv_len = AES_BLOCKSIZE,
|
||||||
|
.mac_len = SHA384_DIGEST_SIZE,
|
||||||
|
.exchange = &tls_ecdhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_cbc_algorithm,
|
||||||
|
.digest = &sha384_algorithm,
|
||||||
|
.handshake = &sha384_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha256.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_ecdhe_rsa_with_aes_128_gcm_sha256 __tls_cipher_suite ( 01 ) = {
|
||||||
|
.code = htons ( TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ),
|
||||||
|
.key_len = ( 128 / 8 ),
|
||||||
|
.fixed_iv_len = 4,
|
||||||
|
.record_iv_len = 8,
|
||||||
|
.mac_len = 0,
|
||||||
|
.exchange = &tls_ecdhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_gcm_algorithm,
|
||||||
|
.digest = &sha256_algorithm,
|
||||||
|
.handshake = &sha256_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/rsa.h>
|
||||||
|
#include <ipxe/aes.h>
|
||||||
|
#include <ipxe/sha512.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 cipher suite */
|
||||||
|
struct tls_cipher_suite
|
||||||
|
tls_ecdhe_rsa_with_aes_256_gcm_sha384 __tls_cipher_suite ( 02 ) = {
|
||||||
|
.code = htons ( TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ),
|
||||||
|
.key_len = ( 256 / 8 ),
|
||||||
|
.fixed_iv_len = 4,
|
||||||
|
.record_iv_len = 8,
|
||||||
|
.mac_len = 0,
|
||||||
|
.exchange = &tls_ecdhe_exchange_algorithm,
|
||||||
|
.pubkey = &rsa_algorithm,
|
||||||
|
.cipher = &aes_gcm_algorithm,
|
||||||
|
.digest = &sha384_algorithm,
|
||||||
|
.handshake = &sha384_algorithm,
|
||||||
|
};
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* You can also choose to distribute this program under the terms of
|
||||||
|
* the Unmodified Binary Distribution Licence (as given in the file
|
||||||
|
* COPYING.UBDL), provided that you have satisfied its requirements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <byteswap.h>
|
||||||
|
#include <ipxe/x25519.h>
|
||||||
|
#include <ipxe/asn1.h>
|
||||||
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
|
/** "x25519" object identifier */
|
||||||
|
static uint8_t oid_x25519[] = { ASN1_OID_X25519 };
|
||||||
|
|
||||||
|
/** "x25519" OID-identified algorithm */
|
||||||
|
struct asn1_algorithm x25519_algorithm __asn1_algorithm = {
|
||||||
|
.name = "x25519",
|
||||||
|
.curve = &x25519_curve,
|
||||||
|
.oid = ASN1_CURSOR ( oid_x25519 ),
|
||||||
|
};
|
||||||
|
|
||||||
|
/** X25519 named curve */
|
||||||
|
struct tls_named_curve tls_x25519_named_curve __tls_named_curve ( 01 ) = {
|
||||||
|
.curve = &x25519_curve,
|
||||||
|
.code = htons ( TLS_NAMED_CURVE_X25519 ),
|
||||||
|
};
|
||||||
@@ -30,39 +30,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#include <ipxe/sha256.h>
|
#include <ipxe/sha256.h>
|
||||||
#include <ipxe/tls.h>
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
/** TLS_DHE_RSA_WITH_AES_128_CBC_SHA cipher suite */
|
|
||||||
struct tls_cipher_suite
|
|
||||||
tls_dhe_rsa_with_aes_128_cbc_sha __tls_cipher_suite ( 05 ) = {
|
|
||||||
.code = htons ( TLS_DHE_RSA_WITH_AES_128_CBC_SHA ),
|
|
||||||
.key_len = ( 128 / 8 ),
|
|
||||||
.fixed_iv_len = 0,
|
|
||||||
.record_iv_len = AES_BLOCKSIZE,
|
|
||||||
.mac_len = SHA1_DIGEST_SIZE,
|
|
||||||
.exchange = &tls_dhe_exchange_algorithm,
|
|
||||||
.pubkey = &rsa_algorithm,
|
|
||||||
.cipher = &aes_cbc_algorithm,
|
|
||||||
.digest = &sha1_algorithm,
|
|
||||||
.handshake = &sha256_algorithm,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** TLS_DHE_RSA_WITH_AES_256_CBC_SHA cipher suite */
|
|
||||||
struct tls_cipher_suite
|
|
||||||
tls_dhe_rsa_with_aes_256_cbc_sha __tls_cipher_suite ( 06 ) = {
|
|
||||||
.code = htons ( TLS_DHE_RSA_WITH_AES_256_CBC_SHA ),
|
|
||||||
.key_len = ( 256 / 8 ),
|
|
||||||
.fixed_iv_len = 0,
|
|
||||||
.record_iv_len = AES_BLOCKSIZE,
|
|
||||||
.mac_len = SHA1_DIGEST_SIZE,
|
|
||||||
.exchange = &tls_dhe_exchange_algorithm,
|
|
||||||
.pubkey = &rsa_algorithm,
|
|
||||||
.cipher = &aes_cbc_algorithm,
|
|
||||||
.digest = &sha1_algorithm,
|
|
||||||
.handshake = &sha256_algorithm,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** TLS_RSA_WITH_AES_128_CBC_SHA cipher suite */
|
/** TLS_RSA_WITH_AES_128_CBC_SHA cipher suite */
|
||||||
struct tls_cipher_suite
|
struct tls_cipher_suite
|
||||||
tls_rsa_with_aes_128_cbc_sha __tls_cipher_suite ( 15 ) = {
|
tls_rsa_with_aes_128_cbc_sha __tls_cipher_suite ( 25 ) = {
|
||||||
.code = htons ( TLS_RSA_WITH_AES_128_CBC_SHA ),
|
.code = htons ( TLS_RSA_WITH_AES_128_CBC_SHA ),
|
||||||
.key_len = ( 128 / 8 ),
|
.key_len = ( 128 / 8 ),
|
||||||
.fixed_iv_len = 0,
|
.fixed_iv_len = 0,
|
||||||
@@ -77,7 +47,7 @@ tls_rsa_with_aes_128_cbc_sha __tls_cipher_suite ( 15 ) = {
|
|||||||
|
|
||||||
/** TLS_RSA_WITH_AES_256_CBC_SHA cipher suite */
|
/** TLS_RSA_WITH_AES_256_CBC_SHA cipher suite */
|
||||||
struct tls_cipher_suite
|
struct tls_cipher_suite
|
||||||
tls_rsa_with_aes_256_cbc_sha __tls_cipher_suite ( 16 ) = {
|
tls_rsa_with_aes_256_cbc_sha __tls_cipher_suite ( 26 ) = {
|
||||||
.code = htons ( TLS_RSA_WITH_AES_256_CBC_SHA ),
|
.code = htons ( TLS_RSA_WITH_AES_256_CBC_SHA ),
|
||||||
.key_len = ( 256 / 8 ),
|
.key_len = ( 256 / 8 ),
|
||||||
.fixed_iv_len = 0,
|
.fixed_iv_len = 0,
|
||||||
|
|||||||
@@ -29,39 +29,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#include <ipxe/sha256.h>
|
#include <ipxe/sha256.h>
|
||||||
#include <ipxe/tls.h>
|
#include <ipxe/tls.h>
|
||||||
|
|
||||||
/** TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 cipher suite */
|
|
||||||
struct tls_cipher_suite
|
|
||||||
tls_dhe_rsa_with_aes_128_cbc_sha256 __tls_cipher_suite ( 03 ) = {
|
|
||||||
.code = htons ( TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 ),
|
|
||||||
.key_len = ( 128 / 8 ),
|
|
||||||
.fixed_iv_len = 0,
|
|
||||||
.record_iv_len = AES_BLOCKSIZE,
|
|
||||||
.mac_len = SHA256_DIGEST_SIZE,
|
|
||||||
.exchange = &tls_dhe_exchange_algorithm,
|
|
||||||
.pubkey = &rsa_algorithm,
|
|
||||||
.cipher = &aes_cbc_algorithm,
|
|
||||||
.digest = &sha256_algorithm,
|
|
||||||
.handshake = &sha256_algorithm,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 cipher suite */
|
|
||||||
struct tls_cipher_suite
|
|
||||||
tls_dhe_rsa_with_aes_256_cbc_sha256 __tls_cipher_suite ( 04 ) = {
|
|
||||||
.code = htons ( TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 ),
|
|
||||||
.key_len = ( 256 / 8 ),
|
|
||||||
.fixed_iv_len = 0,
|
|
||||||
.record_iv_len = AES_BLOCKSIZE,
|
|
||||||
.mac_len = SHA256_DIGEST_SIZE,
|
|
||||||
.exchange = &tls_dhe_exchange_algorithm,
|
|
||||||
.pubkey = &rsa_algorithm,
|
|
||||||
.cipher = &aes_cbc_algorithm,
|
|
||||||
.digest = &sha256_algorithm,
|
|
||||||
.handshake = &sha256_algorithm,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** TLS_RSA_WITH_AES_128_CBC_SHA256 cipher suite */
|
/** TLS_RSA_WITH_AES_128_CBC_SHA256 cipher suite */
|
||||||
struct tls_cipher_suite
|
struct tls_cipher_suite
|
||||||
tls_rsa_with_aes_128_cbc_sha256 __tls_cipher_suite ( 13 ) = {
|
tls_rsa_with_aes_128_cbc_sha256 __tls_cipher_suite ( 23 ) = {
|
||||||
.code = htons ( TLS_RSA_WITH_AES_128_CBC_SHA256 ),
|
.code = htons ( TLS_RSA_WITH_AES_128_CBC_SHA256 ),
|
||||||
.key_len = ( 128 / 8 ),
|
.key_len = ( 128 / 8 ),
|
||||||
.fixed_iv_len = 0,
|
.fixed_iv_len = 0,
|
||||||
@@ -76,7 +46,7 @@ tls_rsa_with_aes_128_cbc_sha256 __tls_cipher_suite ( 13 ) = {
|
|||||||
|
|
||||||
/** TLS_RSA_WITH_AES_256_CBC_SHA256 cipher suite */
|
/** TLS_RSA_WITH_AES_256_CBC_SHA256 cipher suite */
|
||||||
struct tls_cipher_suite
|
struct tls_cipher_suite
|
||||||
tls_rsa_with_aes_256_cbc_sha256 __tls_cipher_suite ( 14 ) = {
|
tls_rsa_with_aes_256_cbc_sha256 __tls_cipher_suite ( 24 ) = {
|
||||||
.code = htons ( TLS_RSA_WITH_AES_256_CBC_SHA256 ),
|
.code = htons ( TLS_RSA_WITH_AES_256_CBC_SHA256 ),
|
||||||
.key_len = ( 256 / 8 ),
|
.key_len = ( 256 / 8 ),
|
||||||
.fixed_iv_len = 0,
|
.fixed_iv_len = 0,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user