sync code with last improvements from OpenBSD
This commit is contained in:
parent
4de47ea988
commit
f463301edc
142 changed files with 4045 additions and 1295 deletions
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile.inc,v 1.31 2023/04/24 15:31:14 krw Exp $
|
||||
# $OpenBSD: Makefile.inc,v 1.32 2023/09/25 16:42:19 sthen Exp $
|
||||
|
||||
FS= miniroot-${BOARD}-${OSrev}.img
|
||||
FSSIZE= 71424 # ffs+msdos, actually
|
||||
|
@ -24,7 +24,7 @@ ${FS}: bsd.rd
|
|||
mount -o-l /dev/`cat vnd`i ${MOUNT_POINT}
|
||||
|
||||
.for DTB in ${DTBS}
|
||||
cp ${PDTB}/${DTB} ${MOUNT_POINT}/
|
||||
cp ${PDTB}/${DTBDIR}${DTB} ${MOUNT_POINT}/
|
||||
.endfor
|
||||
.if ${PLATFORM} == "OMAP"
|
||||
cp ${PUBOOT}/${UBOOT}/{MLO,u-boot.img} ${MOUNT_POINT}/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
BOARD= am335x
|
||||
PLATFORM=OMAP
|
||||
DTBDIR= ti/omap/
|
||||
UBOOT= am335x_evm
|
||||
DTBS=\
|
||||
am335x-bone.dtb \
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
BOARD= cubie
|
||||
PLATFORM=SUNXI
|
||||
DTBDIR= allwinner/
|
||||
UBOOT= Cubieboard2
|
||||
DTBS=\
|
||||
sun7i-a20-cubieboard2.dtb
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
BOARD= cubox
|
||||
PLATFORM=IMX
|
||||
DTBDIR= nxp/imx/
|
||||
UBOOT= mx6cuboxi
|
||||
DTBS=\
|
||||
imx6dl-cubox-i.dtb \
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
BOARD= nitrogen
|
||||
PLATFORM=IMX
|
||||
DTBDIR= nxp/imx/
|
||||
UBOOT= nitrogen6q
|
||||
DTBS=\
|
||||
imx6dl-nitrogen6x.dtb \
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
BOARD= panda
|
||||
PLATFORM=OMAP
|
||||
DTBDIR= ti/omap/
|
||||
UBOOT= omap4_panda
|
||||
DTBS=\
|
||||
omap4-duovero-parlor.dtb \
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
BOARD= wandboard
|
||||
PLATFORM=IMX
|
||||
DTBDIR= nxp/imx/
|
||||
UBOOT= wandboard
|
||||
DTBS=\
|
||||
imx6dl-wandboard.dtb \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: list,v 1.48 2023/04/28 01:24:14 kevlo Exp $
|
||||
# $OpenBSD: list,v 1.49 2023/09/25 16:42:19 sthen Exp $
|
||||
|
||||
SRCDIRS distrib/special
|
||||
|
||||
|
@ -105,69 +105,69 @@ COPY ${DESTDIR}/etc/firmware/urtwn-rtl8192eu etc/firmware/urtwn-rtl8192eu
|
|||
MKDIR usr/mdec/am335x
|
||||
COPY /usr/local/share/u-boot/am335x_evm/MLO usr/mdec/am335x/MLO
|
||||
COPY /usr/local/share/u-boot/am335x_evm/u-boot.img usr/mdec/am335x/u-boot.img
|
||||
COPY /usr/local/share/dtb/arm/am335x-bone.dtb usr/mdec/am335x/am335x-bone.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-boneblack.dtb usr/mdec/am335x/am335x-boneblack.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-pocketbeagle.dtb usr/mdec/am335x/am335x-pocketbeagle.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-boneblack-wireless.dtb usr/mdec/am335x/am335x-boneblack-wireless.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-boneblue.dtb usr/mdec/am335x/am335x-boneblue.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-bonegreen.dtb usr/mdec/am335x/am335x-bonegreen.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-bonegreen-wireless.dtb usr/mdec/am335x/am335x-bonegreen-wireless.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-evm.dtb usr/mdec/am335x/am335x-evm.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-evmsk.dtb usr/mdec/am335x/am335x-evmsk.dtb
|
||||
COPY /usr/local/share/dtb/arm/am335x-icev2.dtb usr/mdec/am335x/am335x-icev2.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-bone.dtb usr/mdec/am335x/am335x-bone.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-boneblack.dtb usr/mdec/am335x/am335x-boneblack.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-pocketbeagle.dtb usr/mdec/am335x/am335x-pocketbeagle.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-boneblack-wireless.dtb usr/mdec/am335x/am335x-boneblack-wireless.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-boneblue.dtb usr/mdec/am335x/am335x-boneblue.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-bonegreen.dtb usr/mdec/am335x/am335x-bonegreen.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-bonegreen-wireless.dtb usr/mdec/am335x/am335x-bonegreen-wireless.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-evm.dtb usr/mdec/am335x/am335x-evm.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-evmsk.dtb usr/mdec/am335x/am335x-evmsk.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/am335x-icev2.dtb usr/mdec/am335x/am335x-icev2.dtb
|
||||
|
||||
MKDIR usr/mdec/cubie
|
||||
COPY /usr/local/share/u-boot/Cubieboard2/u-boot-sunxi-with-spl.bin usr/mdec/cubie/u-boot-sunxi-with-spl.bin
|
||||
COPY /usr/local/share/dtb/arm/sun7i-a20-cubieboard2.dtb usr/mdec/cubie/sun7i-a20-cubieboard2.dtb
|
||||
COPY /usr/local/share/dtb/arm/allwinner/sun7i-a20-cubieboard2.dtb usr/mdec/cubie/sun7i-a20-cubieboard2.dtb
|
||||
|
||||
MKDIR usr/mdec/panda
|
||||
COPY /usr/local/share/u-boot/omap4_panda/MLO usr/mdec/panda/MLO
|
||||
COPY /usr/local/share/u-boot/omap4_panda/u-boot.img usr/mdec/panda/u-boot.img
|
||||
COPY /usr/local/share/dtb/arm/omap4-duovero-parlor.dtb usr/mdec/panda/omap4-duovero-parlor.dtb
|
||||
COPY /usr/local/share/dtb/arm/omap4-panda-a4.dtb usr/mdec/panda/omap4-panda-a4.dtb
|
||||
COPY /usr/local/share/dtb/arm/omap4-panda-es.dtb usr/mdec/panda/omap4-panda-es.dtb
|
||||
COPY /usr/local/share/dtb/arm/omap4-panda.dtb usr/mdec/panda/omap4-panda.dtb
|
||||
COPY /usr/local/share/dtb/arm/omap4-sdp.dtb usr/mdec/panda/omap4-sdp.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/omap4-duovero-parlor.dtb usr/mdec/panda/omap4-duovero-parlor.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/omap4-panda-a4.dtb usr/mdec/panda/omap4-panda-a4.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/omap4-panda-es.dtb usr/mdec/panda/omap4-panda-es.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/omap4-panda.dtb usr/mdec/panda/omap4-panda.dtb
|
||||
COPY /usr/local/share/dtb/arm/ti/omap/omap4-sdp.dtb usr/mdec/panda/omap4-sdp.dtb
|
||||
|
||||
MKDIR usr/mdec/cubox
|
||||
COPY /usr/local/share/u-boot/mx6cuboxi/SPL usr/mdec/cubox/SPL
|
||||
COPY /usr/local/share/u-boot/mx6cuboxi/u-boot.img usr/mdec/cubox/u-boot.img
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-cubox-i.dtb usr/mdec/cubox/imx6dl-cubox-i.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-cubox-i-emmc-som-v15.dtb usr/mdec/cubox/imx6dl-cubox-i-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-cubox-i-som-v15.dtb usr/mdec/cubox/imx6dl-cubox-i-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-hummingboard.dtb usr/mdec/cubox/imx6dl-hummingboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-hummingboard-emmc-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-hummingboard-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-hummingboard2.dtb usr/mdec/cubox/imx6dl-hummingboard2.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-hummingboard2-emmc-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard2-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-hummingboard2-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard2-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-cubox-i.dtb usr/mdec/cubox/imx6q-cubox-i.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-cubox-i-emmc-som-v15.dtb usr/mdec/cubox/imx6q-cubox-i-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-cubox-i-som-v15.dtb usr/mdec/cubox/imx6q-cubox-i-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-hummingboard.dtb usr/mdec/cubox/imx6q-hummingboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-hummingboard-emmc-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-hummingboard-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-hummingboard2.dtb usr/mdec/cubox/imx6q-hummingboard2.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-hummingboard2-emmc-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard2-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-hummingboard2-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard2-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-cubox-i.dtb usr/mdec/cubox/imx6dl-cubox-i.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-cubox-i-emmc-som-v15.dtb usr/mdec/cubox/imx6dl-cubox-i-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-cubox-i-som-v15.dtb usr/mdec/cubox/imx6dl-cubox-i-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-hummingboard.dtb usr/mdec/cubox/imx6dl-hummingboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-hummingboard-emmc-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-hummingboard-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-hummingboard2.dtb usr/mdec/cubox/imx6dl-hummingboard2.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-hummingboard2-emmc-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard2-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-hummingboard2-som-v15.dtb usr/mdec/cubox/imx6dl-hummingboard2-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-cubox-i.dtb usr/mdec/cubox/imx6q-cubox-i.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-cubox-i-emmc-som-v15.dtb usr/mdec/cubox/imx6q-cubox-i-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-cubox-i-som-v15.dtb usr/mdec/cubox/imx6q-cubox-i-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-hummingboard.dtb usr/mdec/cubox/imx6q-hummingboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-hummingboard-emmc-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-hummingboard-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-hummingboard2.dtb usr/mdec/cubox/imx6q-hummingboard2.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-hummingboard2-emmc-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard2-emmc-som-v15.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-hummingboard2-som-v15.dtb usr/mdec/cubox/imx6q-hummingboard2-som-v15.dtb
|
||||
|
||||
MKDIR usr/mdec/nitrogen
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-nitrogen6x.dtb usr/mdec/nitrogen/imx6dl-nitrogen6x.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-sabrelite.dtb usr/mdec/nitrogen/imx6dl-sabrelite.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-nitrogen6_max.dtb usr/mdec/nitrogen/imx6q-nitrogen6_max.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-nitrogen6x.dtb usr/mdec/nitrogen/imx6q-nitrogen6x.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-sabrelite.dtb usr/mdec/nitrogen/imx6q-sabrelite.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-nitrogen6x.dtb usr/mdec/nitrogen/imx6dl-nitrogen6x.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-sabrelite.dtb usr/mdec/nitrogen/imx6dl-sabrelite.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-nitrogen6_max.dtb usr/mdec/nitrogen/imx6q-nitrogen6_max.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-nitrogen6x.dtb usr/mdec/nitrogen/imx6q-nitrogen6x.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-sabrelite.dtb usr/mdec/nitrogen/imx6q-sabrelite.dtb
|
||||
|
||||
MKDIR usr/mdec/wandboard
|
||||
COPY /usr/local/share/u-boot/wandboard/SPL usr/mdec/wandboard/SPL
|
||||
COPY /usr/local/share/u-boot/wandboard/u-boot.img usr/mdec/wandboard/u-boot.img
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-wandboard.dtb usr/mdec/wandboard/imx6dl-wandboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-wandboard-revb1.dtb usr/mdec/wandboard/imx6dl-wandboard-revb1.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6dl-wandboard-revd1.dtb usr/mdec/wandboard/imx6dl-wandboard-revd1.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-wandboard.dtb usr/mdec/wandboard/imx6q-wandboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-wandboard-revb1.dtb usr/mdec/wandboard/imx6q-wandboard-revb1.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6q-wandboard-revd1.dtb usr/mdec/wandboard/imx6q-wandboard-revd1.dtb
|
||||
COPY /usr/local/share/dtb/arm/imx6qp-wandboard-revd1.dtb usr/mdec/wandboard/imx6qp-wandboard-revd1.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-wandboard.dtb usr/mdec/wandboard/imx6dl-wandboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-wandboard-revb1.dtb usr/mdec/wandboard/imx6dl-wandboard-revb1.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6dl-wandboard-revd1.dtb usr/mdec/wandboard/imx6dl-wandboard-revd1.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-wandboard.dtb usr/mdec/wandboard/imx6q-wandboard.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-wandboard-revb1.dtb usr/mdec/wandboard/imx6q-wandboard-revb1.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6q-wandboard-revd1.dtb usr/mdec/wandboard/imx6q-wandboard-revd1.dtb
|
||||
COPY /usr/local/share/dtb/arm/nxp/imx/imx6qp-wandboard-revd1.dtb usr/mdec/wandboard/imx6qp-wandboard-revd1.dtb
|
||||
|
||||
# copy the MAKEDEV script and make some devices
|
||||
SCRIPT ${DESTDIR}/dev/MAKEDEV dev/MAKEDEV
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
./usr/include/arm64/reloc.h
|
||||
./usr/include/arm64/setjmp.h
|
||||
./usr/include/arm64/signal.h
|
||||
./usr/include/arm64/simplebusvar.h
|
||||
./usr/include/arm64/smbiosvar.h
|
||||
./usr/include/arm64/softintr.h
|
||||
./usr/include/arm64/spinlock.h
|
||||
|
|
|
@ -1755,6 +1755,7 @@
|
|||
./usr/share/man/man2/ypconnect.2
|
||||
./usr/share/man/man3/ACCESS_DESCRIPTION_new.3
|
||||
./usr/share/man/man3/AES_encrypt.3
|
||||
./usr/share/man/man3/ASIdentifiers_new.3
|
||||
./usr/share/man/man3/ASN1_BIT_STRING_set.3
|
||||
./usr/share/man/man3/ASN1_INTEGER_get.3
|
||||
./usr/share/man/man3/ASN1_NULL_new.3
|
||||
|
@ -1779,6 +1780,7 @@
|
|||
./usr/share/man/man3/ASN1_parse_dump.3
|
||||
./usr/share/man/man3/ASN1_put_object.3
|
||||
./usr/share/man/man3/ASN1_time_parse.3
|
||||
./usr/share/man/man3/ASRange_new.3
|
||||
./usr/share/man/man3/AUTHORITY_KEYID_new.3
|
||||
./usr/share/man/man3/BASIC_CONSTRAINTS_new.3
|
||||
./usr/share/man/man3/BF_set_key.3
|
||||
|
@ -1973,6 +1975,7 @@
|
|||
./usr/share/man/man3/EXTENDED_KEY_USAGE_new.3
|
||||
./usr/share/man/man3/GENERAL_NAME_new.3
|
||||
./usr/share/man/man3/HMAC.3
|
||||
./usr/share/man/man3/IPAddressRange_new.3
|
||||
./usr/share/man/man3/MB_CUR_MAX.3
|
||||
./usr/share/man/man3/MD5.3
|
||||
./usr/share/man/man3/MD5Init.3
|
||||
|
@ -2268,6 +2271,10 @@
|
|||
./usr/share/man/man3/X509_verify_cert.3
|
||||
./usr/share/man/man3/X509at_add1_attr.3
|
||||
./usr/share/man/man3/X509at_get_attr.3
|
||||
./usr/share/man/man3/X509v3_addr_add_inherit.3
|
||||
./usr/share/man/man3/X509v3_addr_get_range.3
|
||||
./usr/share/man/man3/X509v3_addr_inherits.3
|
||||
./usr/share/man/man3/X509v3_asid_add_id_or_range.3
|
||||
./usr/share/man/man3/X509v3_get_ext_by_NID.3
|
||||
./usr/share/man/man3/__tfork_thread.3
|
||||
./usr/share/man/man3/a2d_ASN1_OBJECT.3
|
||||
|
|
|
@ -1849,6 +1849,7 @@
|
|||
./usr/share/man/man4/qcpmicgpio.4
|
||||
./usr/share/man/man4/qcpon.4
|
||||
./usr/share/man/man4/qcpwm.4
|
||||
./usr/share/man/man4/qcrng.4
|
||||
./usr/share/man/man4/qcrtc.4
|
||||
./usr/share/man/man4/qcspmi.4
|
||||
./usr/share/man/man4/qla.4
|
||||
|
@ -1877,6 +1878,7 @@
|
|||
./usr/share/man/man4/riscv64/sfuart.4
|
||||
./usr/share/man/man4/riscv64/stfclock.4
|
||||
./usr/share/man/man4/riscv64/stfpinctrl.4
|
||||
./usr/share/man/man4/riscv64/stfrng.4
|
||||
./usr/share/man/man4/rkanxdp.4
|
||||
./usr/share/man/man4/rkclock.4
|
||||
./usr/share/man/man4/rkcomphy.4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: bgpd.conf,v 1.21 2021/02/02 00:34:03 danj Exp $
|
||||
# $OpenBSD: bgpd.conf,v 1.22 2023/09/27 10:49:21 claudio Exp $
|
||||
# example bgpd configuration file, see bgpd.conf(5)
|
||||
|
||||
# define our own ASN as a macro
|
||||
|
@ -111,7 +111,7 @@ allow from any inet6 prefixlen 16 - 48
|
|||
|
||||
# Honor requests to gracefully shutdown BGP sessions
|
||||
# https://tools.ietf.org/html/rfc8326
|
||||
match from any community GRACEFUL_SHUTDOWN set { localpref 0 }
|
||||
match from ebgp community GRACEFUL_SHUTDOWN set { localpref 0 }
|
||||
|
||||
deny quick from any prefix-set bogons
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: radiusd.conf,v 1.4 2023/09/18 14:44:21 sobrado Exp $
|
||||
# $OpenBSD: radiusd.conf,v 1.5 2023/09/24 06:09:35 yasuoka Exp $
|
||||
|
||||
listen on 0.0.0.0
|
||||
#listen on ::
|
||||
|
@ -20,8 +20,12 @@ module load radius "/usr/libexec/radiusd/radiusd_radius"
|
|||
module set radius secret "testing123"
|
||||
module set radius server "127.0.0.1"
|
||||
|
||||
module load strip-realm "/usr/libexec/radiusd/radiusd_standard"
|
||||
module set strip-realm strip-atmark-realm true
|
||||
|
||||
authenticate *@local {
|
||||
authenticate-by bsdauth
|
||||
decorate-by strip-realm
|
||||
}
|
||||
authenticate *@example.com {
|
||||
authenticate-by radius
|
||||
|
|
|
@ -1 +1 @@
|
|||
# SecBSD 1.4-d8235ebda5: Tue Sep 19 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||
# SecBSD 1.4-1a4ae3e: Thu Sep 28 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: fopen.3,v 1.32 2015/01/15 19:20:59 schwarze Exp $
|
||||
.\" $OpenBSD: fopen.3,v 1.33 2023/09/28 01:51:00 jsg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -31,7 +31,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: January 15 2015 $
|
||||
.Dd $Mdocdate: September 28 2023 $
|
||||
.Dt FOPEN 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -269,22 +269,12 @@ and
|
|||
functions first appeared in
|
||||
.At v7 .
|
||||
.Pp
|
||||
Opening a file for both reading and writing has been possible since
|
||||
.Bx 2 .
|
||||
.Pp
|
||||
Support for the
|
||||
.Dq e
|
||||
and
|
||||
.Dq x
|
||||
mode letters appeared in
|
||||
.Ox 5.7 .
|
||||
.Sh AUTHORS
|
||||
.An Dennis Ritchie
|
||||
originally implemented
|
||||
.Fn fopen
|
||||
in PDP-11 assembler.
|
||||
.An Keith Sklower
|
||||
first implemented read-write access.
|
||||
.Sh CAVEATS
|
||||
Proper code using
|
||||
.Fn fdopen
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: getc.3,v 1.16 2022/09/11 06:38:11 jmc Exp $
|
||||
.\" $OpenBSD: getc.3,v 1.17 2023/09/28 01:51:00 jsg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -31,7 +31,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 11 2022 $
|
||||
.Dd $Mdocdate: September 28 2023 $
|
||||
.Dt GETC 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -126,13 +126,6 @@ and
|
|||
.Fn fgetc
|
||||
in
|
||||
.At v7 .
|
||||
.Sh AUTHORS
|
||||
.An Dennis Ritchie
|
||||
originally implemented
|
||||
.Fn getc
|
||||
and
|
||||
.Fn getw
|
||||
in PDP-11 assembler.
|
||||
.Sh BUGS
|
||||
Since
|
||||
.Dv EOF
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: access.2,v 1.26 2022/08/02 01:23:23 jsg Exp $
|
||||
.\" $OpenBSD: access.2,v 1.27 2023/09/28 01:51:00 jsg Exp $
|
||||
.\" $NetBSD: access.2,v 1.7 1995/02/27 12:31:44 cgd Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1991, 1993
|
||||
|
@ -30,7 +30,7 @@
|
|||
.\"
|
||||
.\" @(#)access.2 8.2 (Berkeley) 4/1/94
|
||||
.\"
|
||||
.Dd $Mdocdate: August 2 2022 $
|
||||
.Dd $Mdocdate: September 28 2023 $
|
||||
.Dt ACCESS 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -232,11 +232,6 @@ The
|
|||
.Fn faccessat
|
||||
function appeared in
|
||||
.Ox 5.0 .
|
||||
.Sh AUTHORS
|
||||
.An Ken Thompson
|
||||
first implemented the
|
||||
.Fn access
|
||||
kernel function in C.
|
||||
.Sh CAVEATS
|
||||
.Fn access
|
||||
and
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ec_ameth.c,v 1.43 2023/08/21 09:52:30 tb Exp $ */
|
||||
/* $OpenBSD: ec_ameth.c,v 1.45 2023/09/24 08:08:54 tb Exp $ */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006.
|
||||
*/
|
||||
|
@ -87,37 +87,135 @@ eckey_param_free(int ptype, void *pval)
|
|||
}
|
||||
|
||||
static int
|
||||
eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
|
||||
eckey_get_curve_name(const EC_KEY *eckey, int *nid)
|
||||
{
|
||||
const EC_GROUP *group;
|
||||
int nid;
|
||||
if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) {
|
||||
|
||||
*nid = NID_undef;
|
||||
|
||||
if ((group = EC_KEY_get0_group(eckey)) == NULL) {
|
||||
ECerror(EC_R_MISSING_PARAMETERS);
|
||||
return 0;
|
||||
}
|
||||
if (EC_GROUP_get_asn1_flag(group) &&
|
||||
(nid = EC_GROUP_get_curve_name(group))) {
|
||||
/* we have a 'named curve' => just set the OID */
|
||||
*ppval = OBJ_nid2obj(nid);
|
||||
*pptype = V_ASN1_OBJECT;
|
||||
} else {
|
||||
/* explicit parameters */
|
||||
ASN1_STRING *pstr = NULL;
|
||||
pstr = ASN1_STRING_new();
|
||||
if (!pstr)
|
||||
return 0;
|
||||
pstr->length = i2d_ECParameters(ec_key, &pstr->data);
|
||||
if (pstr->length <= 0) {
|
||||
ASN1_STRING_free(pstr);
|
||||
ECerror(ERR_R_EC_LIB);
|
||||
return 0;
|
||||
}
|
||||
*ppval = pstr;
|
||||
*pptype = V_ASN1_SEQUENCE;
|
||||
}
|
||||
if (EC_GROUP_get_asn1_flag(group) != 0)
|
||||
*nid = EC_GROUP_get_curve_name(group);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_to_explicit_params(EC_KEY *eckey, void **out_val)
|
||||
{
|
||||
ASN1_STRING *astr = NULL;
|
||||
unsigned char *params = NULL;
|
||||
int params_len = 0;
|
||||
int ret = 0;
|
||||
|
||||
*out_val = NULL;
|
||||
|
||||
if ((params_len = i2d_ECParameters(eckey, ¶ms)) <= 0) {
|
||||
ECerror(ERR_R_EC_LIB);
|
||||
params_len = 0;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((astr = ASN1_STRING_new()) == NULL)
|
||||
goto err;
|
||||
ASN1_STRING_set0(astr, params, params_len);
|
||||
params = NULL;
|
||||
params_len = 0;
|
||||
|
||||
*out_val = astr;
|
||||
astr = NULL;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
freezero(params, params_len);
|
||||
ASN1_STRING_free(astr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_from_explicit_params(const ASN1_STRING *astr, EC_KEY **out_eckey)
|
||||
{
|
||||
const unsigned char *params = astr->data;
|
||||
int params_len = astr->length;
|
||||
|
||||
EC_KEY_free(*out_eckey);
|
||||
if ((*out_eckey = d2i_ECParameters(NULL, ¶ms, params_len)) == NULL) {
|
||||
ECerror(EC_R_DECODE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_to_object(const EC_KEY *eckey, void **out_val)
|
||||
{
|
||||
int nid = NID_undef;
|
||||
|
||||
*out_val = NULL;
|
||||
|
||||
if (!eckey_get_curve_name(eckey, &nid))
|
||||
return 0;
|
||||
if ((*out_val = OBJ_nid2obj(nid)) == NULL)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_from_object(const ASN1_OBJECT *aobj, EC_KEY **out_eckey)
|
||||
{
|
||||
int nid;
|
||||
|
||||
*out_eckey = NULL;
|
||||
|
||||
if ((nid = OBJ_obj2nid(aobj)) == NID_undef)
|
||||
return 0;
|
||||
if ((*out_eckey = EC_KEY_new_by_curve_name(nid)) == NULL)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_to_params(EC_KEY *eckey, int *out_type, void **out_val)
|
||||
{
|
||||
int nid;
|
||||
|
||||
*out_type = NID_undef;
|
||||
*out_val = NULL;
|
||||
|
||||
if (!eckey_get_curve_name(eckey, &nid))
|
||||
return 0;
|
||||
|
||||
if (nid == NID_undef) {
|
||||
*out_type = V_ASN1_SEQUENCE;
|
||||
return eckey_to_explicit_params(eckey, out_val);
|
||||
} else {
|
||||
*out_type = V_ASN1_OBJECT;
|
||||
return eckey_to_object(eckey, out_val);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_from_params(int ptype, const void *pval, EC_KEY **out_eckey)
|
||||
{
|
||||
*out_eckey = NULL;
|
||||
|
||||
if (ptype == V_ASN1_SEQUENCE)
|
||||
return eckey_from_explicit_params(pval, out_eckey);
|
||||
if (ptype == V_ASN1_OBJECT)
|
||||
return eckey_from_object(pval, out_eckey);
|
||||
|
||||
ECerror(EC_R_DECODE_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
||||
{
|
||||
|
@ -129,7 +227,7 @@ eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
|||
int key_len = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (!eckey_param2type(&ptype, &pval, eckey)) {
|
||||
if (!eckey_to_params(eckey, &ptype, &pval)) {
|
||||
ECerror(ERR_R_EC_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
@ -154,54 +252,6 @@ eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static EC_KEY *
|
||||
eckey_type2param(int ptype, const void *pval)
|
||||
{
|
||||
EC_GROUP *group = NULL;
|
||||
EC_KEY *eckey = NULL;
|
||||
|
||||
if (ptype == V_ASN1_SEQUENCE) {
|
||||
const ASN1_STRING *pstr = pval;
|
||||
const unsigned char *pm = NULL;
|
||||
int pmlen;
|
||||
|
||||
pm = pstr->data;
|
||||
pmlen = pstr->length;
|
||||
if (!(eckey = d2i_ECParameters(NULL, &pm, pmlen))) {
|
||||
ECerror(EC_R_DECODE_ERROR);
|
||||
goto ecerr;
|
||||
}
|
||||
} else if (ptype == V_ASN1_OBJECT) {
|
||||
const ASN1_OBJECT *poid = pval;
|
||||
|
||||
/*
|
||||
* type == V_ASN1_OBJECT => the parameters are given by an
|
||||
* asn1 OID
|
||||
*/
|
||||
if ((eckey = EC_KEY_new()) == NULL) {
|
||||
ECerror(ERR_R_MALLOC_FAILURE);
|
||||
goto ecerr;
|
||||
}
|
||||
group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(poid));
|
||||
if (group == NULL)
|
||||
goto ecerr;
|
||||
EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
|
||||
if (EC_KEY_set_group(eckey, group) == 0)
|
||||
goto ecerr;
|
||||
} else {
|
||||
ECerror(EC_R_DECODE_ERROR);
|
||||
goto ecerr;
|
||||
}
|
||||
|
||||
EC_GROUP_free(group);
|
||||
return eckey;
|
||||
|
||||
ecerr:
|
||||
EC_KEY_free(eckey);
|
||||
EC_GROUP_free(group);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
|
||||
{
|
||||
|
@ -210,37 +260,38 @@ eckey_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
|
|||
int ptype, pklen;
|
||||
EC_KEY *eckey = NULL;
|
||||
X509_ALGOR *palg;
|
||||
int ret = 0;
|
||||
|
||||
if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
|
||||
return 0;
|
||||
goto err;
|
||||
X509_ALGOR_get0(NULL, &ptype, &pval, palg);
|
||||
|
||||
eckey = eckey_type2param(ptype, pval);
|
||||
if (!eckey_from_params(ptype, pval, &eckey))
|
||||
goto err;
|
||||
|
||||
if (!eckey) {
|
||||
ECerror(ERR_R_EC_LIB);
|
||||
return 0;
|
||||
}
|
||||
/* We have parameters now set public key */
|
||||
if (!o2i_ECPublicKey(&eckey, &p, pklen)) {
|
||||
ECerror(EC_R_DECODE_ERROR);
|
||||
goto ecerr;
|
||||
goto err;
|
||||
}
|
||||
EVP_PKEY_assign_EC_KEY(pkey, eckey);
|
||||
return 1;
|
||||
if (!EVP_PKEY_assign_EC_KEY(pkey, eckey))
|
||||
goto err;
|
||||
eckey = NULL;
|
||||
|
||||
ecerr:
|
||||
if (eckey)
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
EC_KEY_free(eckey);
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
{
|
||||
int r;
|
||||
const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec);
|
||||
const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec), *pb = EC_KEY_get0_public_key(b->pkey.ec);
|
||||
const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec);
|
||||
const EC_POINT *pb = EC_KEY_get0_public_key(b->pkey.ec);
|
||||
int r;
|
||||
|
||||
r = EC_POINT_cmp(group, pa, pb, NULL);
|
||||
if (r == 0)
|
||||
|
@ -263,9 +314,7 @@ eckey_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
|
|||
return 0;
|
||||
X509_ALGOR_get0(NULL, &ptype, &pval, palg);
|
||||
|
||||
eckey = eckey_type2param(ptype, pval);
|
||||
|
||||
if (!eckey)
|
||||
if (!eckey_from_params(ptype, pval, &eckey))
|
||||
goto ecliberr;
|
||||
|
||||
/* We have parameters now set private key */
|
||||
|
@ -331,7 +380,7 @@ eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
|
|||
|
||||
flags = EC_KEY_get_enc_flags(eckey);
|
||||
|
||||
if (!eckey_param2type(&ptype, &pval, eckey)) {
|
||||
if (!eckey_to_params(eckey, &ptype, &pval)) {
|
||||
ECerror(EC_R_DECODE_ERROR);
|
||||
goto err;
|
||||
}
|
||||
|
@ -416,7 +465,9 @@ ec_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
|
|||
static int
|
||||
ec_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
|
||||
{
|
||||
const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec);
|
||||
const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec);
|
||||
const EC_GROUP *group_b = EC_KEY_get0_group(b->pkey.ec);
|
||||
|
||||
if (EC_GROUP_cmp(group_a, group_b, NULL))
|
||||
return 0;
|
||||
else
|
||||
|
@ -685,8 +736,7 @@ ecdh_cms_set_peerkey(EVP_PKEY_CTX *pctx, X509_ALGOR *alg,
|
|||
if (!EC_KEY_set_group(ecpeer, grp))
|
||||
goto err;
|
||||
} else {
|
||||
ecpeer = eckey_type2param(atype, aval);
|
||||
if (!ecpeer)
|
||||
if (!eckey_from_params(atype, aval, &ecpeer))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
134
lib/libcrypto/man/ASIdentifiers_new.3
Normal file
134
lib/libcrypto/man/ASIdentifiers_new.3
Normal file
|
@ -0,0 +1,134 @@
|
|||
.\" $OpenBSD: ASIdentifiers_new.3,v 1.7 2023/09/27 08:46:46 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt ASIDENTIFIERS_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ASIdentifiers_new ,
|
||||
.Nm ASIdentifiers_free ,
|
||||
.Nm d2i_ASIdentifiers ,
|
||||
.Nm i2d_ASIdentifiers
|
||||
.Nd RFC 3779 autonomous system identifier delegation extensions
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft ASIdentifiers *
|
||||
.Fo ASIdentifiers_new
|
||||
.Fa "void"
|
||||
.Fc
|
||||
.Ft void
|
||||
.Fo ASIdentifiers_free
|
||||
.Fa "ASIdentifiers *asid"
|
||||
.Fc
|
||||
.Ft ASIdentifiers *
|
||||
.Fo d2i_ASIdentifiers
|
||||
.Fa "ASIdentifiers **asid"
|
||||
.Fa "const unsigned char **in"
|
||||
.Fa "long len"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_ASIdentifiers
|
||||
.Fa "ASIdentifiers *asid"
|
||||
.Fa "unsigned char **out"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
RFC 3779 defines two X.509v3 certificate extensions that allow the
|
||||
delegation of
|
||||
IP address blocks and autonomous system (AS) identifiers
|
||||
from the issuer to the subject of the certificate.
|
||||
An
|
||||
.Vt ASIdentifiers
|
||||
object contains collections of individual AS numbers and
|
||||
ranges of AS numbers to be delegated.
|
||||
.Pp
|
||||
.Fn ASIdentifiers_new
|
||||
allocates and initializes a new, empty
|
||||
.Vt ASIdentifiers
|
||||
object that can be populated with
|
||||
.Xr X509v3_asid_add_id_or_range 3 .
|
||||
See
|
||||
.Xr ASRange_new 3
|
||||
for implementation details.
|
||||
.Pp
|
||||
.Fn ASIdentifiers_free
|
||||
frees
|
||||
.Fa asid
|
||||
including any data contained in it.
|
||||
If
|
||||
.Fa asid
|
||||
is
|
||||
.Dv NULL ,
|
||||
no action occurs.
|
||||
.Pp
|
||||
.Fn d2i_ASIdentifiers
|
||||
and
|
||||
.Fn i2d_ASIdentifiers
|
||||
decode and encode ASN.1
|
||||
.Vt ASIdentifiers
|
||||
objects as defined in RFC 3779, section 3.2.3.1.
|
||||
For details about the semantics, examples, caveats, and bugs, see
|
||||
.Xr ASN1_item_d2i 3 .
|
||||
In order for the encoding produced by
|
||||
.Fn i2d_ASIdentifiers
|
||||
to conform to RFC 3779,
|
||||
.Fa asid
|
||||
must be in
|
||||
.Dq canonical form ,
|
||||
see
|
||||
.Xr X509v3_asid_canonize 3 .
|
||||
.Sh RETURN VALUES
|
||||
.Fn ASIdentifiers_new
|
||||
returns a new
|
||||
.Vt ASIdentifiers
|
||||
object or
|
||||
.Dv NULL
|
||||
on if an error occurs.
|
||||
.Pp
|
||||
.Fn d2i_ASIdentifiers
|
||||
returns an
|
||||
.Vt ASIdentifiers
|
||||
object or
|
||||
.Dv NULL
|
||||
on if a decoding or memory allocation error occurs.
|
||||
.Pp
|
||||
.Fn i2d_ASIdentifiers
|
||||
returns the number of bytes successfully encoded
|
||||
or a value <= 0 if an error occurs.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASRange_new 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr IPAddressRange_new 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_asid_add_id_or_range 3 ,
|
||||
.Xr X509v3_asid_inherits 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 3: Autonomous System Identifier Delegation Extension
|
||||
.El
|
||||
.Pp
|
||||
RFC 7020: The Internet Numbers Registry System
|
||||
.Pp
|
||||
RFC 7249: Internet Numbers Registries
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
There are no corresponding functions for the RFC 3779
|
||||
IP address blocks delegation extension represented by
|
||||
.Vt IPAddrBlocks .
|
416
lib/libcrypto/man/ASRange_new.3
Normal file
416
lib/libcrypto/man/ASRange_new.3
Normal file
|
@ -0,0 +1,416 @@
|
|||
.\" $OpenBSD: ASRange_new.3,v 1.5 2023/09/27 08:46:46 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt ASRANGE_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ASRange_new ,
|
||||
.Nm ASRange_free ,
|
||||
.Nm d2i_ASRange ,
|
||||
.Nm i2d_ASRange ,
|
||||
.Nm ASIdOrRange_new ,
|
||||
.Nm ASIdOrRange_free ,
|
||||
.Nm d2i_ASIdOrRange ,
|
||||
.Nm i2d_ASIdOrRange ,
|
||||
.Nm ASIdentifierChoice_new ,
|
||||
.Nm ASIdentifierChoice_free ,
|
||||
.Nm d2i_ASIdentifierChoice ,
|
||||
.Nm i2d_ASIdentifierChoice
|
||||
.Nd RFC 3779 autonomous system identifiers and ranges
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft "ASRange *"
|
||||
.Fn ASRange_new void
|
||||
.Ft void
|
||||
.Fn ASRange_free "ASRange *asrange"
|
||||
.Ft ASRange *
|
||||
.Fo d2i_ASRange
|
||||
.Fa "ASRange **asrange"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_ASRange
|
||||
.Fa "ASRange *asrange"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Ft "ASIdOrRange *"
|
||||
.Fn ASIdOrRange_new void
|
||||
.Ft void
|
||||
.Fn ASIdOrRange_free "ASIdOrRange *aor"
|
||||
.Ft ASIdOrRange *
|
||||
.Fo d2i_ASIdOrRange
|
||||
.Fa "ASIdOrRange **aor"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_ASIdOrRange
|
||||
.Fa "ASIdOrRange *aor"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Ft "ASIdentifierChoice *"
|
||||
.Fn ASIdentifierChoice_new void
|
||||
.Ft void
|
||||
.Fn ASIdentifierChoice_free "ASIdentifierChoice *aic"
|
||||
.Ft ASIdentifierChoice *
|
||||
.Fo d2i_ASIdentifierChoice
|
||||
.Fa "ASIdentifierChoice **aic"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_ASIdentifierChoice
|
||||
.Fa "ASIdentifierChoice *aic"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
.Vt ASRange ,
|
||||
.Vt ASIdOrRange ,
|
||||
and
|
||||
.Vt ASIdentifierChoice
|
||||
are building blocks of the
|
||||
.Vt ASIdentifiers
|
||||
type representing the RFC 3779
|
||||
autonomous system identifier delegation extension.
|
||||
.Pp
|
||||
All
|
||||
.Vt ASN1_INTEGER Ns s
|
||||
in this manual should be representable as unsigned 32-bit integers.
|
||||
The API performs no corresponding checks.
|
||||
The library provides no convenient way of setting the value of an
|
||||
.Vt ASN1_INTEGER
|
||||
directly.
|
||||
A detour via a
|
||||
.Vt BIGNUM
|
||||
or a string is unavoidable.
|
||||
To retrieve the value of an
|
||||
.Vt ASN1_INTEGER ,
|
||||
use
|
||||
.Xr ASN1_INTEGER_get_uint64 3 .
|
||||
.Pp
|
||||
The
|
||||
.Vt ASRange
|
||||
type defined in RFC 3779 section 3.2.3.8 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct ASRange_st {
|
||||
ASN1_INTEGER *min;
|
||||
ASN1_INTEGER *max;
|
||||
} ASRange;
|
||||
.Ed
|
||||
.Pp
|
||||
It represents the closed range [min,max] of AS identifiers between
|
||||
.Fa min
|
||||
and
|
||||
.Fa max ,
|
||||
where
|
||||
.Fa min
|
||||
should be strictly smaller than
|
||||
.Fa max .
|
||||
.Pp
|
||||
.Fn ASRange_new
|
||||
allocates a new
|
||||
.Vt ASRange
|
||||
object with allocated, empty
|
||||
.Fa min
|
||||
and
|
||||
.Fa max ,
|
||||
thus representing the invalid range [0,0].
|
||||
.Pp
|
||||
.Fn ASRange_free
|
||||
frees
|
||||
.Fa asrange
|
||||
including any data contained in it.
|
||||
If
|
||||
.Fa asrange
|
||||
is
|
||||
.Dv NULL ,
|
||||
no action occurs.
|
||||
.Pp
|
||||
The
|
||||
.Vt ASIdOrRange
|
||||
type defined in RFC 3779 section 3.2.3.5 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct ASIdOrRange_st {
|
||||
int type;
|
||||
union {
|
||||
ASN1_INTEGER *id;
|
||||
ASRange *range;
|
||||
} u;
|
||||
} ASIdOrRange;
|
||||
.Ed
|
||||
.Pp
|
||||
representing an individual AS identifier or a range.
|
||||
When populating an
|
||||
.Vt ASIdOrRange
|
||||
object by hand, its
|
||||
.Fa type
|
||||
should be set to
|
||||
.Dv ASIdOrRange_id
|
||||
or
|
||||
.Dv ASIdOrRange_range
|
||||
to indicate which member of the union
|
||||
.Fa u
|
||||
is valid.
|
||||
.Pp
|
||||
.Fn ASIdOrRange_new
|
||||
returns a new
|
||||
.Vt ASIdOrRange
|
||||
object with invalid type and
|
||||
.Dv NULL
|
||||
members of the union
|
||||
.Fa u .
|
||||
.Pp
|
||||
.Fn ASIdOrRange_free
|
||||
frees
|
||||
.Fa aor
|
||||
including any data contained in it,
|
||||
provided
|
||||
.Fa type
|
||||
is set correctly.
|
||||
If
|
||||
.Fa asrange
|
||||
is
|
||||
.Dv NULL ,
|
||||
no action occurs.
|
||||
.Pp
|
||||
In order to express a list of AS identifiers and ranges,
|
||||
RFC 3779 section 3.2.3.4
|
||||
uses an ASN.1 SEQUENCE,
|
||||
which is implemented via a
|
||||
.Xr STACK_OF 3
|
||||
construction over
|
||||
.Vt ASIdOrRange :
|
||||
.Bd -literal -offset indent
|
||||
typedef STACK_OF(ASIdOrRange) ASIdOrRanges;
|
||||
.Ed
|
||||
.Pp
|
||||
Since an
|
||||
.Vt ASIdOrRanges
|
||||
object should be sorted in a specific way (see
|
||||
.Xr X509v3_asid_canonize 3 Ns ),
|
||||
a comparison function is needed for a correct instantiation
|
||||
with
|
||||
.Xr sk_new 3 .
|
||||
The
|
||||
.Fn ASIdOrRange_cmp
|
||||
function is not directly exposed and not easily accessible
|
||||
from outside the library,
|
||||
and it is non-trivial to implement.
|
||||
It is therefore discouraged to use
|
||||
.Vt ASIdOrRanges
|
||||
objects that are not part of an
|
||||
.Vt ASIdentifiers
|
||||
object.
|
||||
.Pp
|
||||
The
|
||||
.Dq inherit
|
||||
marker from RFC 3779 section 3.2.3.3 is implemented as
|
||||
.Vt ASN1_NULL .
|
||||
It has no dedicated type or API and can be instantiated with
|
||||
.Xr ASN1_NULL_new 3 .
|
||||
.Pp
|
||||
The
|
||||
.Vt ASIdentifierChoice
|
||||
type defined in RFC 3779 section 3.2.3.2 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct ASIdentifierChoice_st {
|
||||
int type;
|
||||
union {
|
||||
ASN1_NULL *inherit;
|
||||
ASIdOrRanges *asIdsOrRanges;
|
||||
} u;
|
||||
} ASIdentifierChoice;
|
||||
.Ed
|
||||
.Pp
|
||||
where the
|
||||
.Fa type
|
||||
member should be set to
|
||||
.Dv ASIdentifierChoice_inherit
|
||||
or
|
||||
.Dv ASIdentifierChoice_asIdsOrRanges
|
||||
to indicate whether a given
|
||||
.Vt ASIdentifierChoice
|
||||
object represents an inherited list or an explicit list.
|
||||
.Pp
|
||||
.Fn ASIdentifierChoice_new
|
||||
returns a new
|
||||
.Vt ASIdentifierChoice
|
||||
object with invalid type and
|
||||
.Dv NULL
|
||||
members of the union
|
||||
.Fa u .
|
||||
.Pp
|
||||
.Fn ASIdentifierChoice_free
|
||||
frees
|
||||
.Fa aic
|
||||
including any data contained in it,
|
||||
provided
|
||||
.Fa type
|
||||
is set correctly.
|
||||
.Pp
|
||||
The
|
||||
.Vt ASIdentifiers
|
||||
type defined in RFC 3779 section 3.2.3.1 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct ASIdentifiers_st {
|
||||
ASIdentifierChoice *asnum;
|
||||
ASIdentifierChoice *rdi;
|
||||
} ASIdentifiers;
|
||||
.Ed
|
||||
.Pp
|
||||
It should be instantiated with
|
||||
.Xr ASIdentifiers_new 3
|
||||
and populated with
|
||||
.Xr X509v3_asid_add_id_or_range 3 .
|
||||
.Pp
|
||||
.Fn d2i_ASRange ,
|
||||
.Fn i2d_ASRange ,
|
||||
.Fn d2i_ASIdOrRange ,
|
||||
.Fn i2d_ASIdOrRange ,
|
||||
.Fn d2i_ASIdentifierChoice ,
|
||||
and
|
||||
.Fn i2d_ASIdentifierChoice
|
||||
decode and encode ASN.1
|
||||
.Vt ASRange ,
|
||||
.Vt ASIdOrRange ,
|
||||
and
|
||||
.Vt ASIdentifierChoice
|
||||
objects.
|
||||
For details about the semantics, examples, caveats, and bugs, see
|
||||
.Xr ASN1_item_d2i 3 .
|
||||
In order for the encoding produced by
|
||||
.Fn i2d_ASRange
|
||||
to be correct,
|
||||
.Fa min
|
||||
must be strictly less than
|
||||
.Fa max .
|
||||
Similarly for
|
||||
.Fn i2d_ASIdOrRange
|
||||
and an
|
||||
.Fa ASIdOrRange
|
||||
object of
|
||||
.Fa type
|
||||
.Dv ASIdOrRange_range .
|
||||
.Sh RETURN VALUES
|
||||
.Fn ASRange_new
|
||||
returns a new
|
||||
.Vt ASRange
|
||||
object with allocated, empty members, or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
.Fn ASIdOrRange_new
|
||||
returns a new, empty
|
||||
.Vt ASIdOrRange
|
||||
object or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
.Fn ASIdentifierChoice_new
|
||||
returns a new, empty
|
||||
.Vt ASIdentifierChoice
|
||||
object or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
The encoding functions
|
||||
.Fn d2i_ASRange ,
|
||||
.Fn d2i_ASIdOrRange ,
|
||||
and
|
||||
.Fn d2i_ASIdentifierChoice
|
||||
return an
|
||||
.Vt ASRange ,
|
||||
an
|
||||
.Vt ASIdOrRange ,
|
||||
or an
|
||||
.Vt ASIdentifierChoice ,
|
||||
object, respectively,
|
||||
or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
The encoding functions
|
||||
.Fn i2d_ASRange ,
|
||||
.Fn i2d_ASIdOrRange ,
|
||||
and
|
||||
.Fn i2d_ASIdentifierChoice
|
||||
return the number of bytes successfully encoded
|
||||
or a value <= 0 if an error occurs.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASIdentifiers_new 3 ,
|
||||
.Xr BN_set_word 3 ,
|
||||
.Xr BN_to_ASN1_INTEGER 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr IPAddressRange_new 3 ,
|
||||
.Xr s2i_ASN1_INTEGER 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_asid_add_id_or_range 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 3.2.3: Syntax
|
||||
.It
|
||||
section 3.2.3.1: Type ASIdentifiers
|
||||
.It
|
||||
section 3.2.3.2: Elements asnum, rdi, and Type ASIdentifierChoice
|
||||
.It
|
||||
section 3.2.3.3: Element inherit
|
||||
.It
|
||||
section 3.2.3.4: Element asIdsOrRanges
|
||||
.It
|
||||
section 3.2.3.5: Type ASIdOrRange
|
||||
.It
|
||||
section 3.2.3.6: Element id
|
||||
.It
|
||||
section 3.2.3.7: Element range
|
||||
.It
|
||||
section 3.2.3.8: Type ASRange
|
||||
.It
|
||||
section 3.2.3.9: Elements min and max
|
||||
.El
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
An
|
||||
.Fn ASIdOrRanges_new
|
||||
function that installs the correct comparison function
|
||||
on the stack of
|
||||
.Vt ASIdOrRange
|
||||
should have been part of the API to make it usable.
|
||||
.Pp
|
||||
.Fn ASIdentifierChoice_new
|
||||
is of very limited use because
|
||||
.Fn ASIdOrRanges_new
|
||||
is missing.
|
||||
.Pp
|
||||
There is no way of ensuring that an
|
||||
.Vt ASIdOrRanges
|
||||
object is in canonical form unless it is part of an
|
||||
.Vt ASIdentifiers
|
||||
object.
|
||||
It is therefore difficult to guarantee that the output of
|
||||
.Fn i2d_ASIdentifierChoice
|
||||
is conformant.
|
||||
.Pp
|
||||
RFC 3779 3.2.3.4 has
|
||||
.Dq Fa asIdsOrRanges
|
||||
while its type in this implementation is
|
||||
.Vt ASIdOrRanges .
|
516
lib/libcrypto/man/IPAddressRange_new.3
Normal file
516
lib/libcrypto/man/IPAddressRange_new.3
Normal file
|
@ -0,0 +1,516 @@
|
|||
.\" $OpenBSD: IPAddressRange_new.3,v 1.4 2023/09/27 08:46:46 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt IPADDRESSRANGE_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm IPAddressRange_new ,
|
||||
.Nm IPAddressRange_free ,
|
||||
.Nm d2i_IPAddressRange ,
|
||||
.Nm i2d_IPAddressRange ,
|
||||
.Nm IPAddressOrRange_new ,
|
||||
.Nm IPAddressOrRange_free ,
|
||||
.Nm d2i_IPAddressOrRange ,
|
||||
.Nm i2d_IPAddressOrRange ,
|
||||
.Nm IPAddressChoice_new ,
|
||||
.Nm IPAddressChoice_free ,
|
||||
.Nm d2i_IPAddressChoice ,
|
||||
.Nm i2d_IPAddressChoice ,
|
||||
.Nm IPAddressFamily_new ,
|
||||
.Nm IPAddressFamily_free ,
|
||||
.Nm d2i_IPAddressFamily ,
|
||||
.Nm i2d_IPAddressFamily
|
||||
.Nd RFC 3779 IP address prefixes and ranges
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft "IPAddressRange *"
|
||||
.Fn IPAddressRange_new void
|
||||
.Ft void
|
||||
.Fn IPAddressRange_free "IPAddressRange *range"
|
||||
.Ft IPAddressRange *
|
||||
.Fo d2i_IPAddressRange
|
||||
.Fa "IPAddressRange **range"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_IPAddressRange
|
||||
.Fa "IPAddressRange *range"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Ft "IPAddressOrRange *"
|
||||
.Fn IPAddressOrRange_new void
|
||||
.Ft void
|
||||
.Fn IPAddressOrRange_free "IPAddressOrRange *aor"
|
||||
.Ft IPAddressOrRange *
|
||||
.Fo d2i_IPAddressOrRange
|
||||
.Fa "IPAddressOrRange **aor"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_IPAddressOrRange
|
||||
.Fa "IPAddressOrRange *aor"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Ft "IPAddressChoice *"
|
||||
.Fn IPAddressChoice_new void
|
||||
.Ft void
|
||||
.Fn IPAddressChoice_free "IPAddressChoice *ac"
|
||||
.Ft IPAddressChoice *
|
||||
.Fo d2i_IPAddressChoice
|
||||
.Fa "IPAddressChoice **ac"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_IPAddressChoice
|
||||
.Fa "IPAddressChoice *ac"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Ft "IPAddressFamily *"
|
||||
.Fn IPAddressFamily_new void
|
||||
.Ft void
|
||||
.Fn IPAddressFamily_free "IPAddressFamily *af"
|
||||
.Ft IPAddressFamily *
|
||||
.Fo d2i_IPAddressFamily
|
||||
.Fa "IPAddressFamily **af"
|
||||
.Fa "const unsigned char **der_in"
|
||||
.Fa "long length"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo i2d_IPAddressFamily
|
||||
.Fa "IPAddressFamily *af"
|
||||
.Fa "unsigned char **der_out"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
.Vt IPAddressRange ,
|
||||
.Vt IPAddressOrRange ,
|
||||
.Vt IPAddressChoice ,
|
||||
and
|
||||
.Vt IPAddressFamily
|
||||
are building blocks of the RFC 3779
|
||||
.Vt IPAddrBlocks
|
||||
type representing the IP address delegation extension.
|
||||
.Pp
|
||||
Per RFC 3779, section 2.1.1,
|
||||
an IPv4 or an IPv6 address is encoded in network byte order in an
|
||||
ASN.1 BIT STRING of bit size 32 or 128 bits, respectively.
|
||||
The bit size of a prefix is its prefix length.
|
||||
In other words, all insignificant zero bits are omitted
|
||||
from the encoding.
|
||||
An address range is expressed as a pair of BIT STRINGs
|
||||
where all least significant zero bits of the lower bound
|
||||
and the all least significant one bits of the upper bound are omitted.
|
||||
.Pp
|
||||
The library provides no API for directly converting an IP address or
|
||||
prefix (in any form) to and from an
|
||||
.Vt ASN1_BIT_STRING .
|
||||
It also provides no API for directly handling ranges.
|
||||
The
|
||||
.Vt ASN1_BIT_STRING
|
||||
internals are subtle and directly manipulating them in the
|
||||
context of the RFC 3779 API is discouraged.
|
||||
The bit size of an
|
||||
.Vt ASN1_BIT_STRING
|
||||
representing an IP address prefix or range is eight times its length
|
||||
member minus the lowest three bits of its flags, provided the
|
||||
.Dv ASN1_STRING_FLAG_BITS_LEFT
|
||||
flag is set.
|
||||
.Pp
|
||||
The
|
||||
.Vt IPAddressRange
|
||||
type defined in RFC 3779 section 2.2.3.9 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct IPAddressRange_st {
|
||||
ASN1_BIT_STRING *min;
|
||||
ASN1_BIT_STRING *max;
|
||||
} IPAddressRange;
|
||||
.Ed
|
||||
.Pp
|
||||
It represents the closed range [min,max] of IP addresses between
|
||||
.Fa min
|
||||
and
|
||||
.Fa max ,
|
||||
where
|
||||
.Fa min
|
||||
should be strictly smaller than
|
||||
.Fa max
|
||||
and the range should not be expressible as a prefix.
|
||||
.Pp
|
||||
.Fn IPAddressRange_new
|
||||
allocates a new
|
||||
.Vt IPAddressRange
|
||||
object with allocated, empty
|
||||
.Fa min
|
||||
and
|
||||
.Fa max ,
|
||||
thus representing the entire address space.
|
||||
.Pp
|
||||
.Fn IPAddressRange_free
|
||||
frees
|
||||
.Fa range
|
||||
including any data contained in it.
|
||||
If
|
||||
.Fa range
|
||||
is
|
||||
.Dv NULL ,
|
||||
no action occurs.
|
||||
.Pp
|
||||
There is no dedicated type representing the
|
||||
.Vt IPAddress
|
||||
type defined in RFC 3779 section 2.2.3.8.
|
||||
The API uses
|
||||
.Vt ASN1_BIT_STRING
|
||||
for this.
|
||||
.Pp
|
||||
The
|
||||
.Vt IpAddressOrRange
|
||||
type defined in RFC 3779 section 2.2.3.7 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct IPAddressOrRange_st {
|
||||
int type;
|
||||
union {
|
||||
ASN1_BIT_STRING *addressPrefix;
|
||||
IPAddressRange *addressRange;
|
||||
} u;
|
||||
} IPAddressOrRange;
|
||||
.Ed
|
||||
.Pp
|
||||
representing an individual address prefix or an address range.
|
||||
The
|
||||
.Fa type
|
||||
member should be set to
|
||||
.Dv IPAddressOrRange_addressPrefix
|
||||
or
|
||||
.Dv IPAddressOrRange_addressRange
|
||||
to indicate which member of the union
|
||||
.Fa u
|
||||
is valid.
|
||||
.Pp
|
||||
.Fn IPAddressOrRange_new
|
||||
returns a new
|
||||
.Vt IPAddressOrRange
|
||||
object with invalid type and
|
||||
.Dv NULL
|
||||
members of the union
|
||||
.Fa u .
|
||||
.Pp
|
||||
.Fn IPAddressOrRange_free
|
||||
frees
|
||||
.Fa aor
|
||||
including any data contained in it,
|
||||
provided
|
||||
.Fa type
|
||||
is set correctly.
|
||||
If
|
||||
.Fa aor
|
||||
is
|
||||
.Dv NULL ,
|
||||
no action occurs.
|
||||
.Pp
|
||||
In order to express a list of address prefixes and address ranges,
|
||||
RFC 3779 section 2.2.3.6
|
||||
uses an ASN.1 SEQUENCE,
|
||||
which is implemented via a
|
||||
.Xr STACK_OF 3
|
||||
construction over
|
||||
.Vt IPAddressOrRange :
|
||||
.Bd -literal -offset indent
|
||||
typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;
|
||||
.Ed
|
||||
.Pp
|
||||
Since an
|
||||
.Vt IPAddressOrRanges
|
||||
object should be sorted in a specific way (see
|
||||
.Xr X509v3_addr_canonize 3 Ns ),
|
||||
a comparison function is needed for a correct instantiation
|
||||
with
|
||||
.Xr sk_new 3 .
|
||||
The
|
||||
.Fn v4IPAddressOrRange_cmp
|
||||
and
|
||||
.Fn v6IPAddressOrRange_cmp
|
||||
functions are not directly exposed and not easily accessible
|
||||
from outside the library,
|
||||
and they are non-trivial to implement.
|
||||
It is therefore discouraged to use
|
||||
.Vt IPAddressOrRanges
|
||||
objects that are not part of an
|
||||
.Vt IPAddrBlocks
|
||||
object.
|
||||
.Pp
|
||||
The
|
||||
.Dq inherit
|
||||
marker from RFC 3779 section 2.2.3.5 is implemented as
|
||||
.Vt ASN1_NULL .
|
||||
It has no dedicated type or API and can be instantiated with
|
||||
.Xr ASN1_NULL_new 3 .
|
||||
.Pp
|
||||
The
|
||||
.Vt IPAddressChoice
|
||||
type defined in RFC 3779 section 2.2.3.4 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct IPAddressChoice_st {
|
||||
int type;
|
||||
union {
|
||||
ASN1_NULL *inherit;
|
||||
IPAddressOrRanges *addressesOrRanges;
|
||||
} u;
|
||||
} IPAddressChoice;
|
||||
.Ed
|
||||
.Pp
|
||||
where the
|
||||
.Fa type
|
||||
member should be set to
|
||||
.Dv IPAddressChoice_inherit
|
||||
or
|
||||
.Dv IPAddressChoice_addressesOrRanges
|
||||
to indicate whether a given
|
||||
.Vt IPAddressChoice
|
||||
object represents an inherited list or an explicit list.
|
||||
.Pp
|
||||
.Fn IPAddressChoice_new
|
||||
returns a new
|
||||
.Vt IPAddressChoice
|
||||
object with invalid type and
|
||||
.Dv NULL
|
||||
members of the union
|
||||
.Fa u .
|
||||
.Pp
|
||||
.Fn IPAddressChoice_free
|
||||
frees
|
||||
.Fa ac
|
||||
including any data contained in it,
|
||||
provided
|
||||
.Fa type
|
||||
is set correctly.
|
||||
.Pp
|
||||
The
|
||||
.Fa addressFamily
|
||||
element defined in RFC 3779 section 2.2.3.3 is implemented as an
|
||||
.Vt ASN1_OCTET_STRING
|
||||
and it contains two or three octets.
|
||||
The first two octets are always present and represent the
|
||||
address family identifier (AFI)
|
||||
in network byte order.
|
||||
The optional subsequent address family identifier (SAFI)
|
||||
occupies the third octet.
|
||||
For IPv4 and IPv6,
|
||||
.Dv IANA_AFI_IPV4
|
||||
and
|
||||
.Dv IANA_AFI_IPV6
|
||||
are predefined.
|
||||
Other AFIs are not supported by this implementation.
|
||||
.Pp
|
||||
The
|
||||
.Vt IPAddressFamily
|
||||
type defined in RFC 3779 section 2.2.3.2 is implemented as
|
||||
.Bd -literal -offset indent
|
||||
typedef struct IPAddressFamily_st {
|
||||
ASN1_OCTET_STRING *addressFamily;
|
||||
IPAddressChoice *ipAddressChoice;
|
||||
} IPAddressFamily;
|
||||
.Ed
|
||||
.Pp
|
||||
The
|
||||
.Fa addressFamily
|
||||
member indicates the address family the
|
||||
.Fa ipAddressChoice
|
||||
represents.
|
||||
.Pp
|
||||
.Fn IPAddressFamily_new
|
||||
returns a new
|
||||
.Vt IPAddressFamily
|
||||
object with empty
|
||||
.Fa addressFamily
|
||||
and invalid
|
||||
.Fa ipAddressChoice
|
||||
members.
|
||||
.Pp
|
||||
.Fn IPAddressFamily_free
|
||||
frees
|
||||
.Fa af
|
||||
including any data contained in it.
|
||||
If
|
||||
.Fa af
|
||||
is
|
||||
.Dv NULL ,
|
||||
no action occurs.
|
||||
.Pp
|
||||
The
|
||||
.Vt IPAddrBlocks
|
||||
type defined in RFC 3779 section 2.2.3.1
|
||||
uses an ASN.1 SEQUENCE,
|
||||
which is implemented via a
|
||||
.Xr STACK_OF 3
|
||||
construction over
|
||||
.Vt IPAddressFamily :
|
||||
.Bd -literal -offset indent
|
||||
typedef STACK_OF(IPAddressFamily) IPAddrBlocks;
|
||||
.Ed
|
||||
.Pp
|
||||
It can be instantiated with
|
||||
.Fn sk_IPAddressFamily_new_null
|
||||
and the correct sorting function can be installed with
|
||||
.Xr X509v3_addr_canonize 3 .
|
||||
To populate it, use
|
||||
.Xr X509v3_addr_add_prefix 3
|
||||
and related functions.
|
||||
.Pp
|
||||
.Fn d2i_IPAddressRange ,
|
||||
.Fn i2d_IPAddressRange ,
|
||||
.Fn d2i_IPAddressOrRange ,
|
||||
.Fn i2d_IPAddressOrRange ,
|
||||
.Fn d2i_IPAddressChoice ,
|
||||
.Fn i2d_IPAddressChoice ,
|
||||
.Fn d2i_IPAddressFamily ,
|
||||
and
|
||||
.Fn i2d_IPAddressFamily ,
|
||||
decode and encode ASN.1
|
||||
.Vt IPAddressRange ,
|
||||
.Vt IPAddressOrRange ,
|
||||
.Vt IPAddressChoice ,
|
||||
and
|
||||
.Vt IPAddressFamily
|
||||
objects.
|
||||
For details about the semantics, examples, caveats, and bugs, see
|
||||
.Xr ASN1_item_d2i 3 .
|
||||
There is no easy way of ensuring that the encodings generated by
|
||||
these functions are correct, unless they are applied to objects
|
||||
that are part of a canonical
|
||||
.Vt IPAddrBlocks
|
||||
structure, see
|
||||
.Xr X509v3_addr_is_canonical 3 .
|
||||
.Sh RETURN VALUES
|
||||
.Fn IPAddressRange_new
|
||||
returns a new
|
||||
.Vt IPAddressRange
|
||||
object with allocated, empty members, or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
.Fn IPAddressOrRange_new
|
||||
returns a new, empty
|
||||
.Vt IPAddressOrRange
|
||||
object or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
.Fn IPAddressChoice_new
|
||||
returns a new, empty
|
||||
.Vt IPAddressChoice
|
||||
object or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
.Fn IPAddressFamily_new
|
||||
returns a new
|
||||
.Vt IPAddressFamily
|
||||
object with allocated, empty members, or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
The encoding functions
|
||||
.Fn d2i_IPAddressRange ,
|
||||
.Fn d2i_IPAddressOrRange ,
|
||||
.Fn d2i_IPAddressChoice ,
|
||||
and
|
||||
.Fn d2i_IPAddressFamily ,
|
||||
return an
|
||||
.Vt IPAddressRange ,
|
||||
an
|
||||
.Vt IPAddressOrRange ,
|
||||
an
|
||||
.Vt IPAddressChoice ,
|
||||
or an
|
||||
.Vt IPAddressFamily
|
||||
object, respectively,
|
||||
or
|
||||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Pp
|
||||
The encoding functions
|
||||
.Fn i2d_IPAddressRange ,
|
||||
.Fn i2d_IPAddressOrRange ,
|
||||
.Fn i2d_IPAddressChoice ,
|
||||
and
|
||||
.Fn i2d_IPAddressFamily ,
|
||||
return the number of bytes successfully encoded
|
||||
or a value <= 0 if an error occurs.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASIdentifiers_new 3 ,
|
||||
.Xr ASN1_BIT_STRING_new 3 ,
|
||||
.Xr ASN1_OCTET_STRING_new 3 ,
|
||||
.Xr ASN1_OCTET_STRING_set 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_addr_add_inherit 3 ,
|
||||
.Xr X509v3_addr_inherits 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 2.2.3: Syntax
|
||||
.It
|
||||
section 2.2.3.1: Type IPAddrBlocks
|
||||
.It
|
||||
section 2.2.3.2: Type IPAddressFamily
|
||||
.It
|
||||
section 2.2.3.3: Element addressFamily
|
||||
.It
|
||||
section 2.2.3.4: Element ipAddressChoice and Type IPAddressChoice
|
||||
.It
|
||||
section 2.2.3.5: Element inherit
|
||||
.It
|
||||
section 2.2.3.6: Element addressesOrRanges
|
||||
.It
|
||||
section 2.2.3.7: Type IPAddressOrRange
|
||||
.It
|
||||
section 2.2.3.8: Element addressPrefix and Type IPAddress
|
||||
.It
|
||||
section 2.2.3.9: Elements addressRange and Type IPAddressRange
|
||||
.El
|
||||
.Pp
|
||||
ITU-T Recommendation X.690, also known as ISO/IEC 8825-1:
|
||||
Information technology - ASN.1 encoding rules:
|
||||
Specification of Basic Encoding Rules (BER), Canonical Encoding
|
||||
Rules (CER) and Distinguished Encoding Rules (DER),
|
||||
section 8.6: Encoding of a bitstring value
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
.\" The internals do not seem to consistently apply and check
|
||||
.\" .Dv ASN1_STRING_FLAG_BITS_LEFT
|
||||
.\" which may lead to incorrect encoding and misinterpretation
|
||||
As it stands, the API is barely usable
|
||||
due to missing convenience accessors, constructors and destructors
|
||||
and due to the complete absence of API that checks that the
|
||||
individual building blocks are correct.
|
||||
Extracting information from a given object can be done relatively
|
||||
safely.
|
||||
However, constructing objects is very error prone, be it
|
||||
by hand or using the bug-ridden
|
||||
.Xr X509v3_addr_add_inherit 3
|
||||
API.
|
||||
.Pp
|
||||
RFC 3779 has element
|
||||
.Dq addressesOrRanges .
|
||||
Its type in this API is
|
||||
.Vt IPAddressOrRanges .
|
|
@ -1,10 +1,11 @@
|
|||
# $OpenBSD: Makefile,v 1.268 2023/09/09 14:39:09 schwarze Exp $
|
||||
# $OpenBSD: Makefile,v 1.274 2023/09/26 20:42:45 tb Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
MAN= \
|
||||
ACCESS_DESCRIPTION_new.3 \
|
||||
AES_encrypt.3 \
|
||||
ASIdentifiers_new.3 \
|
||||
ASN1_BIT_STRING_set.3 \
|
||||
ASN1_INTEGER_get.3 \
|
||||
ASN1_NULL_new.3 \
|
||||
|
@ -29,6 +30,7 @@ MAN= \
|
|||
ASN1_parse_dump.3 \
|
||||
ASN1_put_object.3 \
|
||||
ASN1_time_parse.3 \
|
||||
ASRange_new.3 \
|
||||
AUTHORITY_KEYID_new.3 \
|
||||
BASIC_CONSTRAINTS_new.3 \
|
||||
BF_set_key.3 \
|
||||
|
@ -220,6 +222,7 @@ MAN= \
|
|||
EXTENDED_KEY_USAGE_new.3 \
|
||||
GENERAL_NAME_new.3 \
|
||||
HMAC.3 \
|
||||
IPAddressRange_new.3 \
|
||||
MD5.3 \
|
||||
NAME_CONSTRAINTS_new.3 \
|
||||
OBJ_NAME_add.3 \
|
||||
|
@ -389,6 +392,11 @@ MAN= \
|
|||
X509_verify_cert.3 \
|
||||
X509at_add1_attr.3 \
|
||||
X509at_get_attr.3 \
|
||||
X509v3_addr_add_inherit.3 \
|
||||
X509v3_addr_get_range.3 \
|
||||
X509v3_addr_inherits.3 \
|
||||
X509v3_asid_add_id_or_range.3 \
|
||||
X509v3_asid_add_id_or_range.3 \
|
||||
X509v3_get_ext_by_NID.3 \
|
||||
a2d_ASN1_OBJECT.3 \
|
||||
crypto.3 \
|
||||
|
@ -431,8 +439,8 @@ MAN= \
|
|||
i2d_PKCS7_bio_stream.3 \
|
||||
lh_new.3 \
|
||||
lh_stats.3 \
|
||||
s2i_ASN1_INTEGER.3 \
|
||||
openssl.cnf.5 \
|
||||
s2i_ASN1_INTEGER.3 \
|
||||
x509v3.cnf.5
|
||||
|
||||
all clean cleandir depend includes obj tags:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: X509V3_get_d2i.3,v 1.20 2023/02/23 18:12:32 job Exp $
|
||||
.\" $OpenBSD: X509V3_get_d2i.3,v 1.21 2023/09/25 07:47:52 tb Exp $
|
||||
.\" full merge up to: OpenSSL ff7fbfd5 Nov 2 11:52:01 2015 +0000
|
||||
.\" selective merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
|
||||
.\"
|
||||
|
@ -49,7 +49,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: February 23 2023 $
|
||||
.Dd $Mdocdate: September 25 2023 $
|
||||
.Dt X509V3_GET_D2I 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -339,6 +339,9 @@ as RFC 5280.
|
|||
.It Policy Mappings Ta Dv NID_policy_mappings
|
||||
.It Policy Constraints Ta Dv NID_policy_constraints
|
||||
.It Inhibit Any Policy Ta Dv NID_inhibit_any_policy
|
||||
.It IP Address Delegation Ta Dv NID_sbgp_ipAddrBlock
|
||||
.It Autonomous System Identifier Delegation\
|
||||
Ta Dv NID_sbgp_autonomousSysNum
|
||||
.El
|
||||
.Ss Netscape Certificate Extensions
|
||||
The following are (largely obsolete) Netscape certificate extensions.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: X509_new.3,v 1.37 2023/04/30 14:49:47 tb Exp $
|
||||
.\" $OpenBSD: X509_new.3,v 1.41 2023/09/26 20:42:45 tb Exp $
|
||||
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
|
||||
.\"
|
||||
.\" This file is a derived work.
|
||||
|
@ -66,7 +66,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: April 30 2023 $
|
||||
.Dd $Mdocdate: September 26 2023 $
|
||||
.Dt X509_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -193,10 +193,13 @@ or
|
|||
.Dv NULL
|
||||
if an error occurs.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASIdentifiers_new 3 ,
|
||||
.Xr ASRange_new 3 ,
|
||||
.Xr AUTHORITY_KEYID_new 3 ,
|
||||
.Xr BASIC_CONSTRAINTS_new 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr d2i_X509 3 ,
|
||||
.Xr IPAddressRange_new 3 ,
|
||||
.Xr PKCS8_PRIV_KEY_INFO_new 3 ,
|
||||
.Xr X509_ALGOR_new 3 ,
|
||||
.Xr X509_ATTRIBUTE_new 3 ,
|
||||
|
@ -238,7 +241,11 @@ if an error occurs.
|
|||
.Xr X509_STORE_CTX_new 3 ,
|
||||
.Xr X509_STORE_get_by_subject 3 ,
|
||||
.Xr X509_STORE_new 3 ,
|
||||
.Xr X509_TRUST_set 3
|
||||
.Xr X509_TRUST_set 3 ,
|
||||
.Xr X509v3_addr_add_inherit 3 ,
|
||||
.Xr X509v3_addr_get_range 3 ,
|
||||
.Xr X509v3_addr_inherits 3 ,
|
||||
.Xr X509v3_asid_add_id_or_range 3
|
||||
.Sh STANDARDS
|
||||
RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
|
||||
Certificate Revocation List (CRL) Profile
|
||||
|
|
472
lib/libcrypto/man/X509v3_addr_add_inherit.3
Normal file
472
lib/libcrypto/man/X509v3_addr_add_inherit.3
Normal file
|
@ -0,0 +1,472 @@
|
|||
.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.5 2023/09/27 08:46:46 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt X509V3_ADDR_ADD_INHERIT 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm X509v3_addr_add_inherit ,
|
||||
.Nm X509v3_addr_add_prefix ,
|
||||
.Nm X509v3_addr_add_range ,
|
||||
.Nm X509v3_addr_canonize ,
|
||||
.Nm X509v3_addr_is_canonical
|
||||
.Nd RFC 3779 IP address delegation extensions
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft int
|
||||
.Fo X509v3_addr_add_inherit
|
||||
.Fa "IPAddrBlocks *addrblocks"
|
||||
.Fa "const unsigned afi"
|
||||
.Fa "const unsigned *safi"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_addr_add_prefix
|
||||
.Fa "IPAddrBlocks *addrblocks"
|
||||
.Fa "const unsigned afi"
|
||||
.Fa "const unsigned *safi"
|
||||
.Fa "unsigned char *prefix"
|
||||
.Fa "const int prefixlen"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_addr_add_range
|
||||
.Fa "IPAddrBlocks *addrblocks"
|
||||
.Fa "const unsigned afi"
|
||||
.Fa "const unsigned *safi"
|
||||
.Fa "unsigned char *min"
|
||||
.Fa "unsigned char *max"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_addr_canonize
|
||||
.Fa "IPAddrBlocks *addrblocks"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_addr_is_canonical
|
||||
.Fa "IPAddrBlocks *addrblocks"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
An
|
||||
.Vt IPAddrBlocks
|
||||
object represents the content of
|
||||
an X509v3 IP address blocks delegation extension
|
||||
as defined in RFC 3779, section 2.2.3.1.
|
||||
It holds lists of IP address prefixes and IP address ranges
|
||||
delegated from the issuer to the subject of the certificate.
|
||||
It can be instantiated as explained in the EXAMPLES section
|
||||
and its internals are documented in
|
||||
.Xr IPAddressRange_new 3 .
|
||||
.Pp
|
||||
Each list in a well-formed
|
||||
.Vt IPAddrBlocks
|
||||
object is uniquely identified by
|
||||
an address family identifier (AFI) and
|
||||
an optional subsequent address family identifier (SAFI).
|
||||
Lists can be absent or can contain an
|
||||
.Dq inherit
|
||||
marker to indicate that the resources are to be inherited
|
||||
from the corresponding list of the issuer certificate.
|
||||
.Pp
|
||||
Per specification, an AFI is an unsigned 16-bit integer and
|
||||
a SAFI is an unsigned 8-bit integer.
|
||||
For IPv4 and IPv6 there are the predefined constants
|
||||
.Dv IANA_AFI_IPV4
|
||||
and
|
||||
.Dv IANA_AFI_IPV6 ,
|
||||
which should be the only values used for
|
||||
.Fa afi
|
||||
in this API.
|
||||
In practice,
|
||||
.Fa safi
|
||||
is always NULL.
|
||||
.Fa afi
|
||||
is generally silently truncated to its lowest 16 bits and, if
|
||||
.Fa safi
|
||||
is non-NULL,
|
||||
only the lowest 8 bits of the value pointed at are used.
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_inherit
|
||||
adds a list with an
|
||||
.Dq inherit
|
||||
marker to
|
||||
.Fa addrblocks .
|
||||
If a list corresponding to
|
||||
.Fa afi
|
||||
and
|
||||
.Fa safi
|
||||
already exists, no action occurs if it is marked
|
||||
.Dq inherit ,
|
||||
otherwise the call fails.
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_prefix
|
||||
adds a newly allocated internal representation of the
|
||||
.Fa prefix
|
||||
of length
|
||||
.Fa prefixlen
|
||||
to the list corresponding to
|
||||
.Fa afi
|
||||
and the optional
|
||||
.Fa safi
|
||||
in
|
||||
.Fa addrblocks .
|
||||
If no such list exists, it is created first.
|
||||
If the list exists and is marked
|
||||
.Dq inherit ,
|
||||
the call fails.
|
||||
.Fa prefix
|
||||
is expected to be a byte array in network byte order.
|
||||
It should point at enough memory to accommodate
|
||||
.Fa prefixlen
|
||||
bits and it is recommended that all the bits not covered by
|
||||
the prefixlen be set to 0.
|
||||
It is the caller's responsibility to ensure that the prefix
|
||||
has no address in common with any of
|
||||
the prefixes or ranges already in the list.
|
||||
If
|
||||
.Fa afi
|
||||
is
|
||||
.Dv IANA_AFI_IPV4 ,
|
||||
.Fa prefixlen
|
||||
should be between 0 and 32 (inclusive) and if
|
||||
.Fa afi
|
||||
is
|
||||
.Dv IANA_AFI_IPV6 ,
|
||||
.Fa prefixlen
|
||||
should be between 0 and 128 (inclusive).
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_range
|
||||
is similar to
|
||||
.Fn X509v3_addr_add_prefix
|
||||
for the closed interval of IP addresses between
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
in network presentation.
|
||||
If
|
||||
.Fa afi
|
||||
is
|
||||
.Dv IANA_AFI_IPV4 ,
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
should point at 4 bytes of memory
|
||||
and if
|
||||
.Fa afi
|
||||
is
|
||||
.Dv IANA_AFI_IPV6 ,
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
should point at 16 bytes of memory.
|
||||
In case the range of IP addresses between
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
is a prefix, a prefix will be added instead of a range.
|
||||
It is the caller's responsibility to ensure that
|
||||
.Fa min
|
||||
is less than or equal to
|
||||
.Fa max
|
||||
and that it does not contain any address already present
|
||||
in the list.
|
||||
Failure to do so will result in a subsequent failure of
|
||||
.Fn X509v3_addr_canonize .
|
||||
.Pp
|
||||
.Fn X509v3_addr_canonize
|
||||
attempts to bring the
|
||||
.Pf non- Dv NULL
|
||||
.Fa addrblocks
|
||||
into canonical form.
|
||||
An
|
||||
.Vt IPAddrBlocks
|
||||
object is said to be in canonical form if it conforms
|
||||
to the ordering specified in RFC 3779:
|
||||
section 2.2.3.3 requires that
|
||||
the list of lists be sorted first by increasing
|
||||
.Fa afi
|
||||
and then by increasing
|
||||
.Fa safi ,
|
||||
where NULL is the minimal SAFI;
|
||||
section 2.2.3.6 requires that each list be in minimal form and sorted.
|
||||
The minimality requirement is that all adjacent prefixes
|
||||
and ranges must be merged into a single range and that each
|
||||
range must be expressed as a prefix, if possible.
|
||||
In particular, any given address can be in at most one list entry.
|
||||
The order is by increasing minimal IP address in network byte order.
|
||||
.Pp
|
||||
.Fn X509v3_addr_is_canonical
|
||||
indicates whether
|
||||
.Fa addrblocks
|
||||
is in canonical form.
|
||||
.Sh RETURN VALUES
|
||||
All these functions return 1 on success and 0 on failure.
|
||||
Memory allocation failure is one possible reason for all of them.
|
||||
Sometimes an error code can be obtained by
|
||||
.Xr ERR_get_error 3 .
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_inherit
|
||||
fails if the list corresponding to
|
||||
.Fa afi
|
||||
and the optional
|
||||
.Fa safi
|
||||
already exists and is not marked
|
||||
.Dq inherit .
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_prefix
|
||||
and
|
||||
.Fn X509v3_addr_add_range
|
||||
fail if a list corresponding to
|
||||
.Fa afi
|
||||
and the optional
|
||||
.Fa safi
|
||||
already exists and is marked
|
||||
.Dq inherit ,
|
||||
or if
|
||||
.Fa prefixlen
|
||||
is outside the interval [0,32] for IPv4 addresses
|
||||
or [0,128] for IPv6 addresses.
|
||||
.Pp
|
||||
.Fn X509v3_addr_canonize
|
||||
fails if one of the lists in
|
||||
.Fa addrblocks
|
||||
is malformed,
|
||||
in particular if it contains corrupt, overlapping,
|
||||
or duplicate entries.
|
||||
Corruption includes ranges where
|
||||
.Fa max
|
||||
is strictly smaller than
|
||||
.Fa min .
|
||||
The error conditions are generally indistinguishable.
|
||||
.Pp
|
||||
.Fn X509v3_addr_is_canonical
|
||||
returns 1 if
|
||||
.Fa addrblocks
|
||||
is in canonical form.
|
||||
A return value of 0 can indicate non-canonical form or a corrupted list.
|
||||
.Sh EXAMPLES
|
||||
Construct the first extension from RFC 3779, Appendix B.
|
||||
.Bd -literal
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
const char *prefixes[6] = {
|
||||
"10.0.32/20", "10.0.64/24", "10.1/16",
|
||||
"10.2.48/20", "10.2.64/24", "10.3/16",
|
||||
};
|
||||
#define N_PREFIXES (sizeof(prefixes) / sizeof(prefixes[0]))
|
||||
|
||||
static void
|
||||
hexdump(const unsigned char *buf, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 1; i <= len; i++)
|
||||
printf(" 0x%02x,%s", buf[i - 1], i % 8 ? "" : "\en");
|
||||
if (len % 8)
|
||||
printf("\en");
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
IPAddrBlocks *addrblocks;
|
||||
X509_EXTENSION *ext;
|
||||
unsigned char *der;
|
||||
int der_len;
|
||||
size_t i;
|
||||
|
||||
if (pledge("stdio", NULL) == -1)
|
||||
err(1, "pledge");
|
||||
|
||||
/*
|
||||
* Somebody forgot to implement IPAddrBlocks_new(). IPAddrBlocks
|
||||
* is the same as STACK_OF(IPAddressFamily). As such, it should
|
||||
* have IPAddressFamily_cmp() as its comparison function. It is
|
||||
* not possible to call sk_new(3) because IPAddressFamily_cmp()
|
||||
* is not part of the public API. The correct comparison function
|
||||
* can be installed as a side-effect of X509v3_addr_canonize(3).
|
||||
*/
|
||||
if ((addrblocks = sk_IPAddressFamily_new_null()) == NULL)
|
||||
err(1, "sk_IPAddressFamily_new_null");
|
||||
if (!X509v3_addr_canonize(addrblocks))
|
||||
errx(1, "X509v3_addr_canonize");
|
||||
|
||||
/* Add the prefixes as IPv4 unicast. */
|
||||
for (i = 0; i < N_PREFIXES; i++) {
|
||||
unsigned char addr[16] = {0};
|
||||
int len;
|
||||
int unicast = 1; /* SAFI for unicast forwarding. */
|
||||
|
||||
len = inet_net_pton(AF_INET, prefixes[i], addr,
|
||||
sizeof(addr));
|
||||
if (len == -1)
|
||||
errx(1, "inet_net_pton(%s)", prefixes[i]);
|
||||
if (!X509v3_addr_add_prefix(addrblocks, IANA_AFI_IPV4,
|
||||
&unicast, addr, len))
|
||||
errx(1, "X509v3_addr_add_prefix(%s)", prefixes[i]);
|
||||
}
|
||||
if (!X509v3_addr_add_inherit(addrblocks, IANA_AFI_IPV6, NULL))
|
||||
errx(1, "X509v3_addr_add_inherit");
|
||||
|
||||
/*
|
||||
* Ensure the extension is in canonical form. Otherwise the two
|
||||
* adjacent prefixes 10.2.48/20 and 10.2.64/24 are not merged into
|
||||
* the range 10.2.48.0--10.2.64.255. This results in invalid DER
|
||||
* encoding from X509V3_EXT_i2d(3) and i2d_X509_EXTENSION(3).
|
||||
*/
|
||||
if (!X509v3_addr_canonize(addrblocks))
|
||||
errx(1, "X509v3_addr_canonize");
|
||||
|
||||
/* Create the extension. The 1 indicates that it is critical. */
|
||||
ext = X509V3_EXT_i2d(NID_sbgp_ipAddrBlock, 1, addrblocks);
|
||||
if (ext == NULL)
|
||||
errx(1, "X509V3_EXT_i2d");
|
||||
|
||||
der = NULL;
|
||||
if ((der_len = i2d_X509_EXTENSION(ext, &der)) <= 0)
|
||||
errx(1, "i2d_X509_EXTENSION");
|
||||
|
||||
hexdump(der, der_len);
|
||||
|
||||
/* One way of implementing IPAddrBlocks_free(). */
|
||||
sk_IPAddressFamily_pop_free(addrblocks, IPAddressFamily_free);
|
||||
X509_EXTENSION_free(ext);
|
||||
free(der);
|
||||
|
||||
return 0;
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
Implement the missing public API
|
||||
.Fn d2i_IPAddrBlocks
|
||||
and
|
||||
.Fn i2d_IPAddrBlocks
|
||||
using
|
||||
.Xr ASN1_item_d2i 3 :
|
||||
.Bd -literal
|
||||
IPAddrBlocks *
|
||||
d2i_IPAddrBlocks(IPAddrBlocks **addrblocks, const unsigned char **in,
|
||||
long len)
|
||||
{
|
||||
const X509V3_EXT_METHOD *v3_addr;
|
||||
|
||||
if ((v3_addr = X509V3_EXT_get_nid(NID_sbgp_ipAddrBlock)) == NULL)
|
||||
return NULL;
|
||||
return (IPAddrBlocks *)ASN1_item_d2i((ASN1_VALUE **)addrblocks,
|
||||
in, len, ASN1_ITEM_ptr(v3_addr->it));
|
||||
}
|
||||
|
||||
int
|
||||
i2d_IPAddrBlocks(IPAddrBlocks *addrblocks, unsigned char **out)
|
||||
{
|
||||
const X509V3_EXT_METHOD *v3_addr;
|
||||
|
||||
if ((v3_addr = X509V3_EXT_get_nid(NID_sbgp_ipAddrBlock)) == NULL)
|
||||
return -1;
|
||||
return ASN1_item_i2d((ASN1_VALUE *)addrblocks, out,
|
||||
ASN1_ITEM_ptr(v3_addr->it));
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
The use of the undocumented macro
|
||||
.Dv ASN1_ITEM_ptr()
|
||||
is necessary if compatibility with modern versions of other implementations
|
||||
is desired.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASIdentifiers_new 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr inet_net_ntop 3 ,
|
||||
.Xr inet_ntop 3 ,
|
||||
.Xr IPAddressRange_new 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_asid_add_id_or_range 3 ,
|
||||
.Xr X509v3_addr_get_range 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 2: IP Address delegation extension
|
||||
.El
|
||||
.Pp
|
||||
RFC 7020: The Internet Numbers Registry System
|
||||
.Pp
|
||||
RFC 7249: Internet Number Registries
|
||||
.Pp
|
||||
.Rs
|
||||
.%T Address Family Numbers
|
||||
.%U https://www.iana.org/assignments/address-family-numbers
|
||||
.Re
|
||||
.Pp
|
||||
.Rs
|
||||
.%T Subsequent Address Family Identifiers (SAFI) Parameters
|
||||
.%U https://www.iana.org/assignments/safi-namespace
|
||||
.Re
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
.Fn IPAddrBlocks_new ,
|
||||
.Fn IPAddrBlocks_free ,
|
||||
.Fn d2i_IPAddrBlocks ,
|
||||
and
|
||||
.Fn i2d_IPAddrBlocks
|
||||
do not exist and
|
||||
.Fa IPAddrBlocks_it
|
||||
is not public.
|
||||
The above examples show how to implement the four missing functions
|
||||
with public API.
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_range
|
||||
should check for inverted range bounds and overlaps
|
||||
on insertion and fail instead of creating a nonsensical
|
||||
.Fa addr
|
||||
that fails to be canonized by
|
||||
.Fn X509v3_addr_canonize .
|
||||
.Pp
|
||||
If
|
||||
.Dv NULL
|
||||
is passed to
|
||||
.Xr X509v3_asid_canonize 3 ,
|
||||
it succeeds.
|
||||
.Fn X509v3_addr_is_canonical
|
||||
considers
|
||||
.Dv NULL
|
||||
to be a canonical
|
||||
.Vt IPAddrBlocks .
|
||||
In contrast,
|
||||
.Fn X509v3_addr_canonize
|
||||
crashes with a
|
||||
.Dv NULL
|
||||
dereference.
|
||||
.Pp
|
||||
The code only supports the IPv4 and IPv6 AFIs.
|
||||
This is not consistently enforced across implementations.
|
||||
.Pp
|
||||
.Fn X509v3_addr_add_range
|
||||
fails to clear the unused bits set to 1 in the last octet of
|
||||
the
|
||||
.Vt ASN1_BIT_STRING
|
||||
representation of
|
||||
.Fa max .
|
||||
This confuses some software.
|
134
lib/libcrypto/man/X509v3_addr_get_range.3
Normal file
134
lib/libcrypto/man/X509v3_addr_get_range.3
Normal file
|
@ -0,0 +1,134 @@
|
|||
.\" $OpenBSD: X509v3_addr_get_range.3,v 1.1 2023/09/26 18:35:34 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 26 2023 $
|
||||
.Dt X509V3_ADDR_GET_RANGE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm X509v3_addr_get_afi ,
|
||||
.Nm X509v3_addr_get_range
|
||||
.Nd parse helpers for the IP address delegation extension
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft unsigned
|
||||
.Fn X509v3_addr_get_afi "const IPAddressFamily *af"
|
||||
.Ft int
|
||||
.Fo X509v3_addr_get_range
|
||||
.Fa "IPAddressOrRange *aor"
|
||||
.Fa "const unsigned afi"
|
||||
.Fa "unsigned char *min"
|
||||
.Fa "unsigned char *max"
|
||||
.Fa "const int length"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
.Fn X509v3_addr_get_afi
|
||||
returns the address family identifier (AFI) of
|
||||
.Fa af .
|
||||
.Pp
|
||||
.Fn X509v3_addr_get_range
|
||||
converts the minimum and maximum addresses in
|
||||
the address prefix or range
|
||||
.Fa aor
|
||||
from internal encoding to IP addresses in network byte order
|
||||
and places copies in the arrays
|
||||
.Fa min
|
||||
and
|
||||
.Fa max ,
|
||||
of size
|
||||
.Fa length .
|
||||
The
|
||||
.Fa length
|
||||
must be large enough to accommodate an address for
|
||||
.Fa afi ,
|
||||
which for
|
||||
.Dv IANA_AFI_IPV4 ,
|
||||
is at least 4,
|
||||
and for
|
||||
.Dv IANA_AFI_IPV6
|
||||
at least 16.
|
||||
.Sh RETURN VALUES
|
||||
.Fn X509v3_addr_get_afi
|
||||
returns the afi encoded in
|
||||
.Fa af
|
||||
or 0 if
|
||||
.Fa af
|
||||
does not contain a valid AFI, or if the AFI is not IPv4 or IPv6.
|
||||
.Pp
|
||||
.Fn X509v3_addr_get_range
|
||||
returns the number of bytes copied into
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
or 0 on error.
|
||||
An error occurs if
|
||||
.Fa aor
|
||||
is malformed, if
|
||||
.Fa afi
|
||||
is not
|
||||
.Dv IANA_AFI_IPV4
|
||||
or
|
||||
.Dv IANA_AFI_IPV6 ,
|
||||
if either
|
||||
.Fa min
|
||||
or
|
||||
.Fa max
|
||||
is
|
||||
.Dv NULL ,
|
||||
or if
|
||||
.Fa length
|
||||
is smaller than 4 or 16, respectively.
|
||||
.Sh SEE ALSO
|
||||
.Xr crypto 3 ,
|
||||
.Xr inet_ntop 3 ,
|
||||
.Xr IPAddressRange_new 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_addr_add_inherit 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 2: IP Address delegation extension
|
||||
.It
|
||||
section 2.2.3.3: Element addressFamily
|
||||
.It
|
||||
section 2.2.3.7: Type IPAddressOrRange
|
||||
.It
|
||||
section 2.2.3.8: Element addressPrefix and Type IPAddress
|
||||
.El
|
||||
.Pp
|
||||
.Rs
|
||||
.%T Address Family Numbers
|
||||
.%U https://www.iana.org/assignments/address-family-numbers
|
||||
.Re
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
There is no accessor for the SAFI of
|
||||
.Fa af .
|
||||
.Pp
|
||||
An error from
|
||||
.Fn X509v3_addr_get_afi
|
||||
is indistinguishable from the reserved AFI 0 being set on
|
||||
.Fa af .
|
||||
.Pp
|
||||
It is not entirely clear how a caller is supposed to obtain an
|
||||
.Vt IPAddressFamily
|
||||
object or an
|
||||
.Vt IPAddressOrRange
|
||||
object without reaching into various structs documented in
|
||||
.Xr IPAddressRange_new 3 .
|
106
lib/libcrypto/man/X509v3_addr_inherits.3
Normal file
106
lib/libcrypto/man/X509v3_addr_inherits.3
Normal file
|
@ -0,0 +1,106 @@
|
|||
.\" $OpenBSD: X509v3_addr_inherits.3,v 1.2 2023/09/27 08:46:46 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt X509V3_ADDR_INHERITS 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm X509v3_addr_inherits ,
|
||||
.Nm X509v3_asid_inherits
|
||||
.Nd RFC 3779 inheritance
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft int
|
||||
.Fn X509v3_addr_inherits "IPAddrBlocks *addrblocks"
|
||||
.Ft int
|
||||
.Fn X509v3_asid_inherits "ASIdentifiers *asids"
|
||||
.Sh DESCRIPTION
|
||||
.Fn X509v3_addr_inherits
|
||||
determines if there is at least one address family in
|
||||
.Fa addrblocks
|
||||
that uses inheritance.
|
||||
.Pp
|
||||
.Fn X509v3_asid_inherits
|
||||
is intended to determine if at least one of
|
||||
the list of autonomous system numbers or
|
||||
the list of routing domain identifiers
|
||||
uses inheritance.
|
||||
.Sh RETURN VALUES
|
||||
.Fn X509v3_addr_inherits
|
||||
returns 1 if and only if
|
||||
.Fa addrblocks
|
||||
contains at least one
|
||||
.Fa IPAddressFamily
|
||||
object that is correctly marked
|
||||
.Dq inherit :
|
||||
its
|
||||
.Fa IPAddressChoice
|
||||
is of
|
||||
.Fa type
|
||||
.Dv IPAddressChoice_inherit
|
||||
and its
|
||||
.Fa inherit
|
||||
element is present.
|
||||
Otherwise it returns 0.
|
||||
.Pp
|
||||
.Fn X509v3_asid_inherits
|
||||
returns 1 if and only if
|
||||
at least one of the
|
||||
.Fa asnum
|
||||
or the
|
||||
.Fa rdi
|
||||
lists has
|
||||
.Fa type
|
||||
.Dv ASIdentifierChoice_inherit .
|
||||
Otherwise
|
||||
.Fn X509v3_asid_inherits 3
|
||||
returns 0.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASIdentifiers_new 3 ,
|
||||
.Xr ASRange_new 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr IPAddressRange_new 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_addr_add_inherit 3 ,
|
||||
.Xr X509v3_asid_add_inherit 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 2: IP Address delegation extension
|
||||
.It
|
||||
section 2.2.3.5: Element inherit
|
||||
.It
|
||||
section 3: AS identifiers delegation extension
|
||||
.It
|
||||
section 3.2.3.3: Element inherit
|
||||
.El
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
.Fn X509v3_asid_inherits
|
||||
ignores whether the
|
||||
.Fa inherit
|
||||
element is present or absent in the list that is considered to use inheritance.
|
||||
.Pp
|
||||
There is no API that determines whether all lists contained in an
|
||||
.Vt ASIdentifiers
|
||||
or an
|
||||
.Vt IPAddrBlocks
|
||||
objects inherit.
|
||||
See RFC 9287, 5.1.2 for an example where this is relevant.
|
321
lib/libcrypto/man/X509v3_asid_add_id_or_range.3
Normal file
321
lib/libcrypto/man/X509v3_asid_add_id_or_range.3
Normal file
|
@ -0,0 +1,321 @@
|
|||
.\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.5 2023/09/27 08:46:46 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2021-2023 Theo Buehler <tb@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt X509V3_ASID_ADD_ID_OR_RANGE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm X509v3_asid_add_id_or_range ,
|
||||
.Nm X509v3_asid_add_inherit ,
|
||||
.Nm X509v3_asid_canonize ,
|
||||
.Nm X509v3_asid_is_canonical
|
||||
.Nd RFC 3779 autonomous system identifier delegation extension
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/x509v3.h
|
||||
.Ft int
|
||||
.Fo X509v3_asid_add_id_or_range
|
||||
.Fa "ASIdentifiers *asid"
|
||||
.Fa "int type"
|
||||
.Fa "ASN1_INTEGER *min"
|
||||
.Fa "ASN1_INTEGER *max"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_asid_add_inherit
|
||||
.Fa "ASIdentifiers *asid"
|
||||
.Fa "int type"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_asid_canonize
|
||||
.Fa "ASIdentifiers *asid"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo X509v3_asid_is_canonical
|
||||
.Fa "ASIdentifiers *asid"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
An
|
||||
.Vt ASIdentifiers
|
||||
object represents the content of the X509v3 certificate extension
|
||||
defined in RFC 3779, section 3.2.3.1.
|
||||
It can be instantiated with
|
||||
.Xr ASIdentifiers_new 3
|
||||
and its internals are documented in
|
||||
.Xr ASRange_new 3 .
|
||||
.Pp
|
||||
An autonomous system is identified by an unsigned 32-bit integer,
|
||||
called an AS identifier or AS number.
|
||||
An
|
||||
.Vt ASIdentifiers
|
||||
object can hold two lists:
|
||||
a list of
|
||||
.Fa type
|
||||
.Dv V3_ASID_ASNUM
|
||||
containing individual AS identifiers and ranges of AS identifiers,
|
||||
and an obsolete list of
|
||||
.Fa type
|
||||
.Dv V3_ASID_RDI
|
||||
containing routing domain identifiers (RDIs).
|
||||
Either of these lists may be absent, or it may contain nothing
|
||||
but a special
|
||||
.Dq inherit
|
||||
marker that indicates that the list is inherited from the issuer
|
||||
of the certificate.
|
||||
.Pp
|
||||
.Fn X509v3_asid_add_id_or_range
|
||||
adds an individual identifier or a range of identifiers to the list of
|
||||
.Fa type
|
||||
(either
|
||||
.Dv V3_ASID_ASNUM
|
||||
or
|
||||
.Dv V3_ASID_RDI )
|
||||
in
|
||||
.Fa asid .
|
||||
If no such list exists, it is created first.
|
||||
If a list of
|
||||
.Fa type
|
||||
already exists and contains the
|
||||
.Dq inherit
|
||||
marker, the call fails.
|
||||
.Fa min
|
||||
must be a
|
||||
.Pf non- Dv NULL
|
||||
.Vt ASN1_INTEGER .
|
||||
If
|
||||
.Fa max
|
||||
is
|
||||
.Dv NULL ,
|
||||
.Fa min
|
||||
is added as an individual identifier.
|
||||
Ownership of
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
is transferred to
|
||||
.Fa asid
|
||||
on success.
|
||||
It is the responsibility of the caller to ensure that
|
||||
the resulting
|
||||
.Fa asid
|
||||
does not contain lists with overlapping ranges and that
|
||||
.Fa min
|
||||
is strictly less than
|
||||
.Fa max
|
||||
if both are
|
||||
.Pf non- Dv NULL .
|
||||
The caller should also ensure that the AS identifiers are
|
||||
32-bit integers.
|
||||
Failure to do so may result in an
|
||||
.Fa asid
|
||||
that cannot be brought into canonical form by
|
||||
.Fn X509v3_asid_canonize .
|
||||
.Pp
|
||||
.Fn X509v3_asid_add_inherit
|
||||
adds the list of
|
||||
.Fa type
|
||||
(either
|
||||
.Dv V3_ASID_ASNUM
|
||||
or
|
||||
.Dv V3_ASID_RDI )
|
||||
in
|
||||
.Fa asid
|
||||
if necessary and marks it
|
||||
.Dq inherit .
|
||||
This fails if
|
||||
.Fa asid
|
||||
already contains a list of
|
||||
.Fa type
|
||||
that is not marked
|
||||
.Dq inherit .
|
||||
.Pp
|
||||
.Fn X509v3_asid_canonize
|
||||
attempts to bring both lists in
|
||||
.Fa asid
|
||||
into canonical form.
|
||||
If
|
||||
.Fa asid
|
||||
is
|
||||
.Dv NULL
|
||||
the call succeeds and no action occurs.
|
||||
A list is in canonical form if it is either one of
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
absent,
|
||||
.It
|
||||
marked
|
||||
.Dq inherit ,
|
||||
.It
|
||||
non-empty and all identifiers and ranges are listed in increasing order.
|
||||
Ranges must not overlap,
|
||||
.\" the following is not currently specified and leads to ambiguity:
|
||||
.\" contain at least two elements,
|
||||
and adjacent ranges must be fully merged.
|
||||
.El
|
||||
.Fn X509v3_asid_canonize
|
||||
merges adjacent ranges
|
||||
but refuses to merge overlapping ranges or to discard duplicates.
|
||||
For example, the adjacent ranges [a,b] and [b+1,c] are merged
|
||||
into the single range [a,c], but if both [a,b] and [b,c] appear in a list,
|
||||
this results in an error since they are considered overlapping.
|
||||
Likewise, the identifier a is absorbed into the adjacent
|
||||
range [a+1,b] to yield [a,b].
|
||||
.Fn X509v3_asid_canonize
|
||||
errors if the minimum of any range is larger than the maximum.
|
||||
In contrast, minimum and maximum of a range may be equal.
|
||||
.Pp
|
||||
.Fn X509v3_asid_is_canonical
|
||||
checks whether
|
||||
.Fa asid
|
||||
is in canonical form.
|
||||
Once
|
||||
.Fn X509v3_asid_canonize
|
||||
is called successfully on
|
||||
.Fa asid ,
|
||||
all subsequent calls to
|
||||
.Fn X509v3_asid_is_canonical
|
||||
succeed on an unmodified
|
||||
.Fa asid
|
||||
unless memory allocation fails.
|
||||
.Sh RETURN VALUES
|
||||
All these functions return 1 on success and 0 on failure.
|
||||
.Pp
|
||||
.Fn X509v3_asid_add_id_or_range
|
||||
and
|
||||
.Fn X509v3_asid_add_inherit
|
||||
fail if
|
||||
.Fa asid
|
||||
is
|
||||
.Dv NULL
|
||||
or if
|
||||
.Fa type
|
||||
is distinct from
|
||||
.Dv V3_ASID_ASNUM
|
||||
and
|
||||
.Dv V3_ASID_RDI ,
|
||||
or on memory allocation failure.
|
||||
In addition,
|
||||
.Fn X509v3_asid_add_id_or_range
|
||||
fails if
|
||||
.Fa asid
|
||||
contains a list of
|
||||
.Fa type
|
||||
that is marked
|
||||
.Dq inherit ,
|
||||
and
|
||||
.Fn X509v3_asid_add_inherit
|
||||
fails if
|
||||
.Fa asid
|
||||
contains a list of
|
||||
.Fa type
|
||||
that is not marked
|
||||
.Dq inherit .
|
||||
.Pp
|
||||
.Fn X509v3_asid_canonize
|
||||
fails if either list is empty and not marked
|
||||
.Dq inherit ,
|
||||
or if it is malformed, or if memory allocation fails.
|
||||
Malformed lists include lists containing duplicate, overlapping,
|
||||
or malformed elements, for example AS ranges where the minimum is
|
||||
larger than the maximum.
|
||||
Some of these failure modes result in an error being pushed onto the
|
||||
error stack.
|
||||
.Pp
|
||||
.Fn X509v3_asid_is_canonical
|
||||
returns 1 if
|
||||
.Fa asid
|
||||
is canonical and 0 if it is not canonical or on memory allocation
|
||||
failure.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASIdentifiers_new 3 ,
|
||||
.Xr crypto 3 ,
|
||||
.Xr s2i_ASN1_INTEGER 3 ,
|
||||
.Xr X509_new 3 ,
|
||||
.Xr X509v3_addr_add_inherit 3
|
||||
.Sh STANDARDS
|
||||
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers,
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
section 3: Autonomous System Delegation Extension
|
||||
.El
|
||||
.Pp
|
||||
.Rs
|
||||
.%T Autonomous System (AS) Numbers
|
||||
.%U https://www.iana.org/assignments/as-numbers
|
||||
.Re
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 0.9.8e
|
||||
and have been available since
|
||||
.Ox 7.1 .
|
||||
.Sh BUGS
|
||||
.Fn X509v3_asid_add_id_or_range
|
||||
does not check for inverted range bounds and overlaps
|
||||
on insertion.
|
||||
It is very easy to create an
|
||||
.Fa asid
|
||||
that fails to be canonized by
|
||||
.Fn X509v3_asid_canonize
|
||||
and it is very hard to diagnose why.
|
||||
.Pp
|
||||
Both
|
||||
.Fn X509v3_asid_add_id_or_range
|
||||
and
|
||||
.Fn X509v3_asid_add_inherit
|
||||
can leave
|
||||
.Fa asid
|
||||
in a corrupted state if memory allocation fails during their execution.
|
||||
In addition,
|
||||
.Fn X509v3_asid_add_id_or_range
|
||||
may already have freed the
|
||||
.Fa min
|
||||
and
|
||||
.Fa max
|
||||
arguments on failure.
|
||||
.Pp
|
||||
RFC 3779 does not explicitly disallow ranges where the minimum
|
||||
is equal to the maximum.
|
||||
The isolated AS identifier a and
|
||||
the AS range [a,a] where the minimum and the maximum are equal to a
|
||||
have the same semantics.
|
||||
.Fn X509v3_asid_is_canonical
|
||||
accepts both representations as valid and
|
||||
.Fn X509v3_asid_canonize
|
||||
does not prefer either representation over the other.
|
||||
The encodings of the two representations produced by
|
||||
.Xr i2d_ASIdentifiers 3
|
||||
are distinct.
|
||||
.Pp
|
||||
.Fn X509v3_asid_is_canonical
|
||||
does not fully check inheriting lists to be well formed.
|
||||
It only checks the
|
||||
.Fa type
|
||||
to be
|
||||
.Dv ASIdentifierChoice_inherit
|
||||
and ignores the presence or absence of the
|
||||
.Fa inherit
|
||||
element.
|
||||
.Fn X509v3_asid_canonize
|
||||
does not fix that up.
|
||||
This can lead to incorrect or unexpected DER encoding of
|
||||
.Dq canonical
|
||||
.Vt ASIdentifiers
|
||||
objects.
|
||||
In particular, it is possible to construct an
|
||||
.Vt ASIdentifiers
|
||||
object for which both
|
||||
.Fn X509v3_asid_is_canonical
|
||||
and
|
||||
.Xr X509v3_asid_inherits 3
|
||||
return 1, and after a round trip through DER the latter
|
||||
returns 0.
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: d2i_ASN1_NULL.3,v 1.4 2021/11/22 16:19:54 schwarze Exp $
|
||||
.\" $OpenBSD: d2i_ASN1_NULL.3,v 1.5 2023/09/26 09:36:22 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
|
||||
.\"
|
||||
|
@ -14,7 +14,7 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: November 22 2021 $
|
||||
.Dd $Mdocdate: September 26 2023 $
|
||||
.Dt D2I_ASN1_NULL 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -83,7 +83,7 @@ ITU-T Recommendation X.690, also known as ISO/IEC 8825-1:
|
|||
Information technology - ASN.1 encoding rules:
|
||||
Specification of Basic Encoding Rules (BER), Canonical Encoding
|
||||
Rules (CER) and Distinguished Encoding Rules (DER),
|
||||
section 8.8: Encoding of null value
|
||||
section 8.8: Encoding of a null value
|
||||
.Sh HISTORY
|
||||
.Fn d2i_ASN1_NULL
|
||||
and
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: x509_addr.c,v 1.89 2023/09/11 00:50:47 job Exp $ */
|
||||
/* $OpenBSD: x509_addr.c,v 1.90 2023/09/27 11:29:22 tb Exp $ */
|
||||
/*
|
||||
* Contributed to the OpenSSL Project by the American Registry for
|
||||
* Internet Numbers ("ARIN").
|
||||
|
@ -388,14 +388,17 @@ IPAddressFamily_set_inheritance(IPAddressFamily *af)
|
|||
* What's the address length associated with this AFI?
|
||||
*/
|
||||
static int
|
||||
length_from_afi(const unsigned afi)
|
||||
length_from_afi(const unsigned afi, int *length)
|
||||
{
|
||||
switch (afi) {
|
||||
case IANA_AFI_IPV4:
|
||||
return 4;
|
||||
*length = 4;
|
||||
return 1;
|
||||
case IANA_AFI_IPV6:
|
||||
return 16;
|
||||
*length = 16;
|
||||
return 1;
|
||||
default:
|
||||
*length = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -425,6 +428,9 @@ IPAddressFamily_afi_safi(const IPAddressFamily *af, uint16_t *out_afi,
|
|||
if (!CBS_get_u16(&cbs, &afi))
|
||||
return 0;
|
||||
|
||||
if (afi != IANA_AFI_IPV4 && afi != IANA_AFI_IPV6)
|
||||
return 0;
|
||||
|
||||
/* Fetch the optional SAFI. */
|
||||
if (CBS_len(&cbs) != 0) {
|
||||
if (!CBS_get_u8(&cbs, &safi))
|
||||
|
@ -471,9 +477,7 @@ IPAddressFamily_afi_length(const IPAddressFamily *af, int *out_length)
|
|||
if (!IPAddressFamily_afi(af, &afi))
|
||||
return 0;
|
||||
|
||||
*out_length = length_from_afi(afi);
|
||||
|
||||
return 1;
|
||||
return length_from_afi(afi, out_length);
|
||||
}
|
||||
|
||||
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
@ -879,16 +883,15 @@ make_addressPrefix(IPAddressOrRange **out_aor, uint8_t *addr, uint32_t afi,
|
|||
int prefix_len)
|
||||
{
|
||||
IPAddressOrRange *aor = NULL;
|
||||
int afi_len, max_len, num_bits, num_octets;
|
||||
int afi_len, num_bits, num_octets;
|
||||
uint8_t unused_bits;
|
||||
|
||||
if (prefix_len < 0)
|
||||
goto err;
|
||||
|
||||
max_len = 16;
|
||||
if ((afi_len = length_from_afi(afi)) > 0)
|
||||
max_len = afi_len;
|
||||
if (prefix_len > 8 * max_len)
|
||||
if (!length_from_afi(afi, &afi_len))
|
||||
goto err;
|
||||
if (prefix_len > 8 * afi_len)
|
||||
goto err;
|
||||
|
||||
num_octets = (prefix_len + 7) / 8;
|
||||
|
@ -1062,11 +1065,14 @@ make_IPAddressFamily(IPAddrBlocks *addr, const unsigned afi,
|
|||
if (!CBB_init(&cbb, 0))
|
||||
goto err;
|
||||
|
||||
/* XXX - should afi <= 65535 and *safi <= 255 be checked here? */
|
||||
|
||||
if (afi != IANA_AFI_IPV4 && afi != IANA_AFI_IPV6)
|
||||
goto err;
|
||||
if (!CBB_add_u16(&cbb, afi))
|
||||
goto err;
|
||||
|
||||
if (safi != NULL) {
|
||||
if (*safi > 255)
|
||||
goto err;
|
||||
if (!CBB_add_u8(&cbb, *safi))
|
||||
goto err;
|
||||
}
|
||||
|
@ -1197,7 +1203,8 @@ X509v3_addr_add_range(IPAddrBlocks *addr, const unsigned afi,
|
|||
if ((aors = make_prefix_or_range(addr, afi, safi)) == NULL)
|
||||
return 0;
|
||||
|
||||
length = length_from_afi(afi);
|
||||
if (!length_from_afi(afi, &length))
|
||||
return 0;
|
||||
|
||||
if (!make_addressRange(&aor, min, max, afi, length))
|
||||
return 0;
|
||||
|
@ -1258,7 +1265,7 @@ X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
|
|||
{
|
||||
int afi_len;
|
||||
|
||||
if ((afi_len = length_from_afi(afi)) == 0)
|
||||
if (!length_from_afi(afi, &afi_len))
|
||||
return 0;
|
||||
|
||||
if (length < afi_len)
|
||||
|
@ -1401,7 +1408,8 @@ IPAddressOrRanges_canonize(IPAddressOrRanges *aors, const unsigned afi)
|
|||
unsigned char b_min[ADDR_RAW_BUF_LEN], b_max[ADDR_RAW_BUF_LEN];
|
||||
int i, j, length;
|
||||
|
||||
length = length_from_afi(afi);
|
||||
if (!length_from_afi(afi, &length))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Sort the IPAddressOrRanges sequence.
|
||||
|
@ -1548,7 +1556,8 @@ v2i_IPAddrBlocks(const struct v3_ext_method *method, struct v3_ext_ctx *ctx,
|
|||
break;
|
||||
}
|
||||
|
||||
length = length_from_afi(afi);
|
||||
if (!length_from_afi(afi, &length))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Handle SAFI, if any, and strdup() so we can null-terminate
|
||||
|
@ -1658,7 +1667,7 @@ v2i_IPAddrBlocks(const struct v3_ext_method *method, struct v3_ext_ctx *ctx,
|
|||
X509V3_conf_err(val);
|
||||
goto err;
|
||||
}
|
||||
if (memcmp(min, max, length_from_afi(afi)) > 0) {
|
||||
if (memcmp(min, max, length) > 0) {
|
||||
X509V3error(X509V3_R_EXTENSION_VALUE_ERROR);
|
||||
X509V3_conf_err(val);
|
||||
goto err;
|
||||
|
|
|
@ -15,9 +15,12 @@
|
|||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
pthread_cond_t cond;
|
||||
pthread_mutex_t mutex;
|
||||
|
@ -39,12 +42,23 @@ void *f(void *arg)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
catch(int x)
|
||||
{
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
const struct rlimit lim = {0, 0};
|
||||
pthread_t t1, t2;
|
||||
|
||||
printf("This test is supposed to print a malloc error and create a core dump\n");
|
||||
/* prevent coredumps */
|
||||
setrlimit(RLIMIT_CORE, &lim);
|
||||
printf("This test is supposed to print a malloc error\n");
|
||||
|
||||
signal(SIGABRT, catch);
|
||||
|
||||
if (pthread_create(&t1, NULL, m, NULL))
|
||||
err(1, "pthread_create");
|
||||
|
@ -54,5 +68,5 @@ main(void)
|
|||
err(1, "pthread_create");
|
||||
pthread_join(t2, NULL);
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: intermediate.cnf,v 1.4 2022/03/14 21:30:48 tb Exp $
|
||||
# $OpenBSD: intermediate.cnf,v 1.5 2023/09/26 21:17:03 tb Exp $
|
||||
# For regression tests
|
||||
default_ca = CA_regress
|
||||
|
||||
|
@ -83,21 +83,21 @@ emailAddress_default = evilsoandsos@openbsd.org
|
|||
commonName_default = Regress Intermediate CA
|
||||
|
||||
[ v3_ca ]
|
||||
# Extensions for a typical CA (`man x509v3_config`).
|
||||
# Extensions for a typical CA (`man x509v3.cnf`).
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer
|
||||
basicConstraints = critical, CA:true
|
||||
keyUsage = critical, digitalSignature, cRLSign, keyCertSign
|
||||
|
||||
[ v3_intermediate_ca ]
|
||||
# Extensions for a typical intermediate CA (`man x509v3_config`).
|
||||
# Extensions for a typical intermediate CA (`man x509v3.cnf`).
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer
|
||||
basicConstraints = critical, CA:true, pathlen:0
|
||||
keyUsage = critical, digitalSignature, cRLSign, keyCertSign
|
||||
|
||||
[ usr_cert ]
|
||||
# Extensions for client certificates (`man x509v3_config`).
|
||||
# Extensions for client certificates (`man x509v3.cnf`).
|
||||
basicConstraints = CA:FALSE
|
||||
nsCertType = client, email
|
||||
nsComment = "OpenSSL Generated Client Certificate"
|
||||
|
@ -111,7 +111,7 @@ subjectAltName = critical, @usr_san
|
|||
email.0 = evilsoandsos@test.openbsd.org
|
||||
|
||||
[ server_cert ]
|
||||
# Extensions for server certificates (`man x509v3_config`).
|
||||
# Extensions for server certificates (`man x509v3.cnf`).
|
||||
basicConstraints = CA:FALSE
|
||||
nsCertType = server
|
||||
nsComment = "OpenSSL Generated Server Certificate"
|
||||
|
@ -121,7 +121,7 @@ keyUsage = critical, digitalSignature, keyEncipherment
|
|||
extendedKeyUsage = serverAuth
|
||||
|
||||
[ crl_ext ]
|
||||
# Extension for CRLs (`man x509v3_config`).
|
||||
# Extension for CRLs (`man x509v3.cnf`).
|
||||
authorityKeyIdentifier=keyid:always
|
||||
|
||||
[ ocsp ]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: root.cnf,v 1.4 2022/03/14 21:30:48 tb Exp $
|
||||
# $OpenBSD: root.cnf,v 1.5 2023/09/26 21:18:01 tb Exp $
|
||||
# For regression tests
|
||||
default_ca = CA_regress
|
||||
|
||||
|
@ -83,14 +83,14 @@ emailAddress_default = evilsoandsos@openbsd.org
|
|||
commonName_default = Regress Root CA
|
||||
|
||||
[ v3_ca ]
|
||||
# Extensions for a typical CA (`man x509v3_config`).
|
||||
# Extensions for a typical CA (`man x509v3.cnf`).
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer
|
||||
basicConstraints = critical, CA:true
|
||||
keyUsage = critical, digitalSignature, cRLSign, keyCertSign
|
||||
|
||||
[ v3_intermediate_ca ]
|
||||
# Extensions for a typical intermediate CA (`man x509v3_config`).
|
||||
# Extensions for a typical intermediate CA (`man x509v3.cnf`).
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer
|
||||
basicConstraints = critical, CA:true, pathlen:0
|
||||
|
@ -113,7 +113,7 @@ C = CA
|
|||
O = OpenBSD
|
||||
|
||||
[ usr_cert ]
|
||||
# Extensions for client certificates (`man x509v3_config`).
|
||||
# Extensions for client certificates (`man x509v3.cnf`).
|
||||
basicConstraints = CA:FALSE
|
||||
nsCertType = client, email
|
||||
nsComment = "OpenSSL Generated Client Certificate"
|
||||
|
@ -123,7 +123,7 @@ keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
|
|||
extendedKeyUsage = clientAuth, emailProtection
|
||||
|
||||
[ server_cert ]
|
||||
# Extensions for server certificates (`man x509v3_config`).
|
||||
# Extensions for server certificates (`man x509v3.cnf`).
|
||||
basicConstraints = CA:FALSE
|
||||
nsCertType = server
|
||||
nsComment = "OpenSSL Generated Server Certificate"
|
||||
|
@ -133,7 +133,7 @@ keyUsage = critical, digitalSignature, keyEncipherment
|
|||
extendedKeyUsage = serverAuth
|
||||
|
||||
[ crl_ext ]
|
||||
# Extension for CRLs (`man x509v3_config`).
|
||||
# Extension for CRLs (`man x509v3.cnf`).
|
||||
authorityKeyIdentifier=keyid:always
|
||||
|
||||
[ ocsp ]
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
# $OpenBSD: Makefile,v 1.10 2023/06/04 11:33:45 tb Exp $
|
||||
# $OpenBSD: Makefile,v 1.11 2023/09/24 07:01:40 tb Exp $
|
||||
|
||||
OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests
|
||||
.if exists(/usr/local/bin/ruby31)
|
||||
RUBY_BINREV = 31
|
||||
.else
|
||||
RUBY_BINREV = 32
|
||||
.endif
|
||||
RUBY = ruby${RUBY_BINREV}
|
||||
|
||||
# We work in a subdirectory of obj/ since extconf.rb generates a Makefile whose
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.47 2023/06/12 20:19:45 millert Exp $
|
||||
# $OpenBSD: Makefile,v 1.50 2023/09/21 21:22:43 bluhm Exp $
|
||||
|
||||
SUBDIR+= apply
|
||||
SUBDIR+= basename bc
|
||||
|
@ -7,19 +7,17 @@ SUBDIR+= dc diff diff3 dirname doas
|
|||
SUBDIR+= file fmt fold
|
||||
SUBDIR+= grep gzip
|
||||
SUBDIR+= join jot
|
||||
SUBDIR+= lastcomm
|
||||
SUBDIR+= m4 mail mandoc
|
||||
SUBDIR+= lastcomm libtool
|
||||
SUBDIR+= m4 mail make mandoc
|
||||
SUBDIR+= nc
|
||||
SUBDIR+= openssl
|
||||
SUBDIR+= rev
|
||||
SUBDIR+= patch pkg-config
|
||||
SUBDIR+= rcs rev rsync
|
||||
SUBDIR+= sdiff sed seq signify snmp sort
|
||||
SUBDIR+= ssh
|
||||
SUBDIR+= tsort
|
||||
SUBDIR+= ul
|
||||
SUBDIR+= wc
|
||||
SUBDIR+= xargs
|
||||
|
||||
.if defined(REGRESS_FULL) || make(clean) || make(cleandir) || make(obj)
|
||||
SUBDIR+= cap_mkdb libtool make patch pkg-config rcs ssh
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# $OpenBSD: Makefile,v 1.2 2006/03/22 02:46:17 ray Exp $
|
||||
|
||||
CAP_MKDB?= cap_mkdb
|
||||
|
||||
REGRESS_TARGETS=shortname
|
||||
CLEANFILES+= *.db
|
||||
|
||||
shortname:
|
||||
${CAP_MKDB} -if shortname ${.CURDIR}/shortname.in || case "$$?" in 1) exit 0;; esac && exit 1
|
||||
|
||||
.include <bsd.regress.mk>
|
|
@ -1 +0,0 @@
|
|||
0
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.126 2023/09/06 23:36:09 djm Exp $
|
||||
# $OpenBSD: Makefile,v 1.127 2023/09/24 08:14:13 claudio Exp $
|
||||
|
||||
OPENSSL?= yes
|
||||
|
||||
|
@ -10,8 +10,6 @@ SUBDIR+= misc
|
|||
|
||||
REGRESS_SETUP_ONCE=misc # For sk-dummy.so
|
||||
|
||||
REGRESS_FAIL_EARLY?= yes
|
||||
|
||||
# Key conversion operations are not supported when built w/out OpenSSL.
|
||||
.if !defined(LTESTS_FROM) && ${OPENSSL:L} != no
|
||||
REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# $OpenBSD: Makefile,v 1.12 2020/06/19 04:34:21 djm Exp $
|
||||
# $OpenBSD: Makefile,v 1.13 2023/09/24 08:14:13 claudio Exp $
|
||||
|
||||
REGRESS_FAIL_EARLY?= yes
|
||||
SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 match conversion
|
||||
SUBDIR+=authopt misc sshsig
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# $OpenBSD: Makefile.inc,v 1.14 2019/11/25 10:32:35 djm Exp $
|
||||
|
||||
REGRESS_FAIL_EARLY?= yes
|
||||
# $OpenBSD: Makefile.inc,v 1.15 2023/09/24 08:14:13 claudio Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
.include <bsd.obj.mk>
|
||||
|
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-aspa.c,v 1.5 2023/05/30 12:14:48 claudio Exp $ */
|
||||
/* $Id: test-aspa.c,v 1.6 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Job Snijders <job@fastly.com>
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
|
@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = aspa_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = aspa_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-gbr.c,v 1.15 2023/05/30 12:14:48 claudio Exp $ */
|
||||
/* $Id: test-gbr.c,v 1.16 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
|
@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = gbr_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = gbr_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-geofeed.c,v 1.4 2023/05/30 12:14:48 claudio Exp $ */
|
||||
/* $Id: test-geofeed.c,v 1.5 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
|
@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = geofeed_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = geofeed_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-mft.c,v 1.26 2023/06/20 12:52:32 job Exp $ */
|
||||
/* $Id: test-mft.c,v 1.27 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
|
@ -73,7 +73,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = mft_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = mft_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-roa.c,v 1.23 2023/05/30 12:14:48 claudio Exp $ */
|
||||
/* $Id: test-roa.c,v 1.24 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
|
@ -70,7 +70,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = roa_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = roa_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-rsc.c,v 1.8 2023/05/30 12:14:48 claudio Exp $ */
|
||||
/* $Id: test-rsc.c,v 1.9 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
|
@ -73,7 +73,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = rsc_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = rsc_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: test-tak.c,v 1.5 2023/05/30 12:14:48 claudio Exp $ */
|
||||
/* $Id: test-tak.c,v 1.6 2023/09/25 11:09:30 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Job Snijders <job@fastly.com>
|
||||
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
|
@ -71,7 +71,7 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++) {
|
||||
buf = load_file(argv[i], &len);
|
||||
if ((p = tak_parse(&xp, argv[i], buf, len)) == NULL) {
|
||||
if ((p = tak_parse(&xp, argv[i], -1, buf, len)) == NULL) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.11 2023/04/26 10:14:21 dv Exp $
|
||||
# $OpenBSD: Makefile,v 1.12 2023/09/27 05:18:40 anton Exp $
|
||||
|
||||
VMD ?= /usr/sbin/vmd
|
||||
|
||||
|
@ -18,7 +18,7 @@ run-pass-$n:
|
|||
REGRESS_TARGETS += run-fail-$n
|
||||
run-fail-$n:
|
||||
${VMD} -n -f ${.CURDIR}/vmd-fail-$n.conf 2>&1 | \
|
||||
cut -d : -f 2,3,4 | \
|
||||
sed -e 's/^vmd: //' -e 's|${.CURDIR}/vmd-fail-$n.conf:||' | \
|
||||
diff -u ${.CURDIR}/vmd-fail-$n.ok /dev/stdin
|
||||
.endfor
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.844 2023/08/07 03:17:42 dlg Exp $
|
||||
# $OpenBSD: Makefile,v 1.845 2023/09/27 07:50:46 phessler Exp $
|
||||
|
||||
MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \
|
||||
acpi.4 acpiac.4 acpials.4 acpiasus.4 acpibat.4 \
|
||||
|
@ -74,7 +74,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \
|
|||
pms.4 ppb.4 ppp.4 pppoe.4 pppx.4 psci.4 pty.4 puc.4 pvbus.4 \
|
||||
pvclock.4 pwdog.4 pwmbl.4 pwmfan.4 pwmleds.4 pwmreg.4 \
|
||||
qccpu.4 qcdwusb.4 qcgpio.4 qciic.4 qcpdc.4 qcpmic.4 qcpmicgpio.4 \
|
||||
qcpon.4 qcpwm.4 qcrtc.4 qcspmi.4 \
|
||||
qcpon.4 qcpwm.4 qcrng.4 qcrtc.4 qcspmi.4 \
|
||||
qla.4 qle.4 qlw.4 qsphy.4 \
|
||||
radio.4 ral.4 random.4 rdomain.4 rd.4 rdac.4 re.4 rdcphy.4 rgephy.4 \
|
||||
rge.4 ricohrtc.4 rkanxdp.4 rkclock.4 rkcomphy.4 \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: iwn.4,v 1.60 2022/01/05 17:39:24 jmc Exp $
|
||||
.\" $OpenBSD: iwn.4,v 1.61 2023/09/21 09:07:53 stsp Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007,2008
|
||||
.\" Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
|
||||
|
@ -15,7 +15,7 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: January 5 2022 $
|
||||
.Dd $Mdocdate: September 21 2023 $
|
||||
.Dt IWN 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -212,8 +212,3 @@ driver was written by
|
|||
.An Damien Bergamini Aq Mt damien.bergamini@free.fr .
|
||||
.Sh CAVEATS
|
||||
802.11n operation is currently limited to data rates MCS 0 to MCS 7.
|
||||
.Pp
|
||||
Support for 802.11n 40MHz channels is not yet implemented.
|
||||
Additional work is required in
|
||||
.Xr ieee80211 9
|
||||
before this feature can be supported.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# $OpenBSD: Makefile,v 1.10 2023/07/08 10:19:19 kettenis Exp $
|
||||
# $OpenBSD: Makefile,v 1.11 2023/09/23 19:11:00 kettenis Exp $
|
||||
|
||||
MAN= intro.4 mpfclock.4 mpfgpio.4 mpfiic.4 plic.4 \
|
||||
sfcc.4 sfclock.4 sfgpio.4 sfuart.4 \
|
||||
stfclock.4 stfpcie.4 stfpciephy.4 stfpinctrl.4
|
||||
stfclock.4 stfpcie.4 stfpciephy.4 stfpinctrl.4 stfrng.4
|
||||
|
||||
MANSUBDIR=riscv64
|
||||
|
||||
|
|
47
share/man/man4/man4.riscv64/stfrng.4
Normal file
47
share/man/man4/man4.riscv64/stfrng.4
Normal file
|
@ -0,0 +1,47 @@
|
|||
.\" $OpenBSD: stfrng.4,v 1.1 2023/09/23 19:11:00 kettenis Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 Mark Kettenis <kettenis@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 23 2023 $
|
||||
.Dt STFRNG 4 riscv64
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm stfrng
|
||||
.Nd StarFive JH7110 random number generator
|
||||
.Sh SYNOPSIS
|
||||
.Cd "stfrng* at fdt?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for the random number generator found on the
|
||||
StarFive JH7110 SoC.
|
||||
.Pp
|
||||
It feeds the random subsystem's entropy pool with 256 bits of random
|
||||
data every second.
|
||||
.Sh SEE ALSO
|
||||
.Xr intro 4 ,
|
||||
.Xr random 4 ,
|
||||
.Xr arc4random 9
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Ox 7.4 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
driver was written by
|
||||
.An Mark Kettenis Aq Mt kettenis@openbsd.org .
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: mbg.4,v 1.14 2013/07/16 16:05:49 schwarze Exp $
|
||||
.\" $OpenBSD: mbg.4,v 1.15 2023/09/25 15:39:12 deraadt Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org>
|
||||
.\"
|
||||
|
@ -14,7 +14,7 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 16 2013 $
|
||||
.Dd $Mdocdate: September 25 2023 $
|
||||
.Dt MBG 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -48,6 +48,8 @@ Currently, the following cards are supported by
|
|||
3.3V/5V DCF77 time signal station receiver card
|
||||
.It PEX511
|
||||
PCI Express DCF77 time signal station receiver card
|
||||
.It PZF180PEX
|
||||
PCI Express DCF77 time signal station receiver card
|
||||
.El
|
||||
.Pp
|
||||
The quality of the timedelta is reported as the sensor status:
|
||||
|
|
51
share/man/man4/qcrng.4
Normal file
51
share/man/man4/qcrng.4
Normal file
|
@ -0,0 +1,51 @@
|
|||
.\" $OpenBSD: qcrng.4,v 1.2 2023/09/27 20:30:19 jmc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt QCRNG 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm qcrng
|
||||
.Nd Qualcomm Snapdragon random number generator
|
||||
.Sh SYNOPSIS
|
||||
.Cd "qcrng* at fdt?"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for the random number generator found on the
|
||||
Qualcomm Snapdragon SoCs.
|
||||
.Pp
|
||||
It feeds the random subsystem's entropy pool with 32 bits of random
|
||||
data every second.
|
||||
.Sh SEE ALSO
|
||||
.Xr intro 4 ,
|
||||
.Xr random 4 ,
|
||||
.Xr arc4random 9
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Ox 7.4 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
driver was written by
|
||||
.An Peter Hessler Aq Mt phessler@openbsd.org ,
|
||||
based on the
|
||||
.Xr amlrng 4
|
||||
driver by
|
||||
.An Mark Kettenis Aq Mt kettenis@openbsd.org .
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: bsd.port.mk.5,v 1.631 2023/09/19 20:50:40 tb Exp $
|
||||
.\" $OpenBSD: bsd.port.mk.5,v 1.636 2023/09/27 12:24:22 espie Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000-2008 Marc Espie
|
||||
.\"
|
||||
|
@ -24,7 +24,7 @@
|
|||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 19 2023 $
|
||||
.Dd $Mdocdate: September 27 2023 $
|
||||
.Dt BSD.PORT.MK 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -102,9 +102,9 @@ for
|
|||
.Xr tsort 1 .
|
||||
.Pp
|
||||
Note that it is possible to obtain reverse dependency information by
|
||||
using
|
||||
using the
|
||||
.Nm show-reverse-deps
|
||||
from the
|
||||
script from the
|
||||
.Pa sqlports
|
||||
package.
|
||||
.It Cm full-{build,run,all,test}-depends
|
||||
|
@ -336,18 +336,7 @@ using ${FETCH_CMD}.
|
|||
Files are normally retrieved from the list of sites in
|
||||
.Ev SITES* .
|
||||
.Pp
|
||||
Appending
|
||||
.Sq :0
|
||||
to
|
||||
.Sq :9
|
||||
to an entry will let
|
||||
${FETCH_CMD} retrieve from
|
||||
.Ev SITES0
|
||||
to
|
||||
.Ev SITES9
|
||||
instead (deprecated).
|
||||
.Pp
|
||||
Preferably, adding a suffix to
|
||||
Adding a suffix to
|
||||
.Ev DISTFILES ,
|
||||
.Ev PATCHFILES ,
|
||||
.Ev SUPDISTFILES
|
||||
|
@ -1639,6 +1628,12 @@ below for details.
|
|||
.It Ev DEBUGINFO_ARCHS
|
||||
List of archs for which debug information may be provided as extra packages.
|
||||
Normally only amd64 for performance reasons.
|
||||
.It Ev DESCR
|
||||
Location of description file for the package, defaults to
|
||||
.Pa ${PKGDIR}/DESCR
|
||||
(or
|
||||
.Pa ${PKGDIR}/DESCR${SUBPACKAGE}
|
||||
for multi-packages).
|
||||
.It Ev DESTDIR
|
||||
See
|
||||
.Ev DESTDIRNAME .
|
||||
|
@ -2293,7 +2288,9 @@ Seldom used, as it is only needed to link binary data without using the
|
|||
compiler.
|
||||
.It Ev LLVM_ARCHS
|
||||
Set to the list of architectures where LLVM/Clang could be used,
|
||||
e.g., via lang/clang port module, see
|
||||
e.g., via
|
||||
.Sq lang/clang
|
||||
port module, see
|
||||
.Xr port-modules 5 .
|
||||
Read-only.
|
||||
Use with
|
||||
|
@ -2717,8 +2714,6 @@ see also
|
|||
Special arguments to pass to
|
||||
.Xr pkg_create 1 ,
|
||||
in addition to the default ones.
|
||||
For mips64 and pic libraries, see
|
||||
.Sx THE GENERATION OF PACKAGE INFORMATION .
|
||||
.It Ev PKG_CREATE
|
||||
User settings.
|
||||
Path to
|
||||
|
@ -2938,6 +2933,13 @@ Used in
|
|||
file names and actual contents, can be overridden for ports
|
||||
with branches, like php, e.g.,
|
||||
.Li PKGSTEM-main = php-5.6
|
||||
.It Ev PLIST
|
||||
Location of package packing-list.
|
||||
Defaults to
|
||||
.Pa ${PKGDIR}/PLIST ,
|
||||
or to
|
||||
.Pa ${PKGDIR}/PLIST${SUBPACKAGE}
|
||||
for multi-packages.
|
||||
.It Ev PLIST_DB
|
||||
Deprecated, see
|
||||
.Ev PLIST_REPOSITORY .
|
||||
|
@ -3242,9 +3244,6 @@ for details.
|
|||
Suffix should start with
|
||||
.Sq \&.
|
||||
and be all lowercase for consistency.
|
||||
.It Ev SITES0 , ... , SITES9
|
||||
Supplementary locations from which distribution files and patchfiles are
|
||||
retrieved (deprecated).
|
||||
.It Ev SKIPDIR
|
||||
See
|
||||
.Xr ports 7 .
|
||||
|
@ -3583,9 +3582,10 @@ instead just set
|
|||
.Li BUILD_DEPENDS = devel/libtool .
|
||||
.It Ev USE_LLD
|
||||
Set to
|
||||
.Sq Yes
|
||||
or
|
||||
.Sq Yes ,
|
||||
.Sq \&No
|
||||
or
|
||||
.Sq ports
|
||||
to force the use of
|
||||
.Xr ld.lld 1
|
||||
.Po
|
||||
|
@ -3593,6 +3593,11 @@ as opposed to
|
|||
bfd's
|
||||
.Xr ld 1
|
||||
.Pc .
|
||||
.Sq ports
|
||||
force the use of
|
||||
.Xr ld.lld 1
|
||||
from lang/clang module.
|
||||
.Pc
|
||||
Defaults to the appropriate value for the current architecture
|
||||
.Po
|
||||
see
|
||||
|
@ -4223,21 +4228,6 @@ or
|
|||
to
|
||||
.Ev PKG_ARGS .
|
||||
.Pp
|
||||
If libraries are built using
|
||||
.Pa bsd.lib.mk ,
|
||||
special care should be taken for mips64* architectures,
|
||||
which do not ever build
|
||||
.Pa *pic.a
|
||||
files (all mips code is pic already).
|
||||
.Nm
|
||||
automatically adds
|
||||
.Li "-Dno_mips64=1"
|
||||
or
|
||||
.Li "-Dno_mips64=0"
|
||||
to
|
||||
.Ev PKG_ARGS ,
|
||||
and the porter only needs to provide the appropriate fragment.
|
||||
.Pp
|
||||
.Xr pkg_add 1
|
||||
now calls
|
||||
.Xr ldconfig 8
|
||||
|
@ -4341,6 +4331,13 @@ Old location for scripts related to the current port.
|
|||
There is no reason for the semantic distinction, use
|
||||
.Ev FILESDIR
|
||||
for those.
|
||||
.It Ev SITES0 , ... , SITES9
|
||||
Supplementary locations from which distribution files and patchfiles were
|
||||
retrieved, superseded by the more generic
|
||||
.Ev SITES.sufx
|
||||
matching
|
||||
.Ev DISTFILES.sufx
|
||||
construct.
|
||||
.It Ev USE_BZIP2
|
||||
The framework will automatically detect the presence of
|
||||
.Pa .tar.bz2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: bsd.regress.mk.5,v 1.24 2022/03/31 17:27:22 naddy Exp $
|
||||
.\" $OpenBSD: bsd.regress.mk.5,v 1.25 2023/09/25 05:43:22 claudio Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002 Anil Madhavapeddy
|
||||
.\" Copyright (c) 2000 Marc Espie
|
||||
|
@ -25,7 +25,7 @@
|
|||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 31 2022 $
|
||||
.Dd $Mdocdate: September 25 2023 $
|
||||
.Dt BSD.REGRESS.MK 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -79,11 +79,20 @@ If this variable is set to anything but
|
|||
the
|
||||
.Cm regress
|
||||
target will abort as soon as a test fails.
|
||||
Defaults to
|
||||
.Dq yes
|
||||
unless
|
||||
.Ev REGRESS_LOG
|
||||
is set.
|
||||
.It Ev REGRESS_LOG
|
||||
Points to the fully-qualified path of a file to which regression
|
||||
results are appended.
|
||||
Defaults to
|
||||
.Pa /dev/null .
|
||||
If set to any other path,
|
||||
.Ev REGRESS_FAIL_EARLY
|
||||
defaults to
|
||||
.Dq no .
|
||||
.It Ev REGRESS_ROOT_TARGETS
|
||||
Targets for which root access is required to run the test.
|
||||
The
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
.\" $OpenBSD: ruby-module.5,v 1.42 2023/09/12 17:21:05 schwarze Exp $
|
||||
.\" $OpenBSD: ruby-module.5,v 1.44 2023/09/28 03:34:32 jsg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2008 Marc Espie, Jeremy Evans
|
||||
.\" Copyright (c) 2011-2015, 2023 Jeremy Evans <jeremy@openbsd.org>
|
||||
.\" Copyright (c) 2008, 2011 Marc Espie <espie@openbsd.org>
|
||||
.\"
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
|
@ -24,7 +25,7 @@
|
|||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 12 2023 $
|
||||
.Dd $Mdocdate: September 28 2023 $
|
||||
.Dt RUBY-MODULE 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -32,191 +33,92 @@
|
|||
.Nd lang/ruby port module
|
||||
.Sh DESCRIPTION
|
||||
This manual page documents the behavior of setting
|
||||
.Li MODULES=lang/ruby
|
||||
.Ev MODULES Ns Li =lang/ruby
|
||||
in the
|
||||
.Xr ports 7
|
||||
tree.
|
||||
.Pp
|
||||
Sets
|
||||
.Ev GEM ,
|
||||
.Ev GEM_BASE_BIN ,
|
||||
.Ev GEM_BASE_LIB ,
|
||||
.Ev GEM_BIN ,
|
||||
.Ev GEM_BIN_SUFFIX ,
|
||||
.Ev GEM_EXTENSIONS_DIR ,
|
||||
.Ev GEM_FLAGS ,
|
||||
.Ev GEM_LIB ,
|
||||
.Ev GEM_MAN_SUFFIX ,
|
||||
.Ev MODRUBY_ADJ_FILES ,
|
||||
.Ev MODRUBY_ARCH ,
|
||||
.Ev MODRUBY_BINREV ,
|
||||
.Ev MODRUBY_BIN_RSPEC ,
|
||||
.Ev MODRUBY_BUILD_DEPENDS ,
|
||||
.Ev MODRUBY_BUILDDEP ,
|
||||
.Ev MODRUBY_FLAVOR ,
|
||||
.Ev MODRUBY_HANDLE_FLAVORS ,
|
||||
.Ev MODRUBY_LIBREV ,
|
||||
.Ev MODRUBY_LIB_DEPENDS ,
|
||||
.Ev MODRUBY_PKG_PREFIX ,
|
||||
.Ev MODRUBY_RELEXAMPLEDIR ,
|
||||
.Ev MODRUBY_REV ,
|
||||
.Ev MODRUBY_RUBY_ADJ ,
|
||||
.Ev MODRUBY_RUN_DEPENDS ,
|
||||
.Ev MODRUBY_RUNDEP ,
|
||||
.Ev MODRUBY_SITEARCHDIR ,
|
||||
.Ev MODRUBY_SITEDIR ,
|
||||
.Ev MODRUBY_TEST ,
|
||||
.Ev MODRUBY_TEST_ENV ,
|
||||
.Ev MODRUBY_TEST_TARGET ,
|
||||
.Ev MODRUBY_WANTLIB ,
|
||||
.Ev RAKE ,
|
||||
and
|
||||
.Ev RUBY .
|
||||
The main usage of the lang/ruby module is to allow a single Ruby gem-based
|
||||
port to build packages for multiple versions of Ruby.
|
||||
The lang/ruby module also simplifies ports that depend on Ruby by
|
||||
automatically setting up the correct dependencies and defining commonly
|
||||
needed variables.
|
||||
.Pp
|
||||
Appends to
|
||||
.Ev CATEGORIES
|
||||
and
|
||||
.Ev SUBST_VARS .
|
||||
Appends to
|
||||
.Ev BUILD_DEPENDS
|
||||
unless
|
||||
.Ev MODRUBY_BUILDDEP
|
||||
is set to No or
|
||||
.Ev NO_BUILD
|
||||
is set to Yes.
|
||||
Appends to
|
||||
.Ev RUN_DEPENDS
|
||||
unless
|
||||
.Ev MODRUBY_RUNDEP
|
||||
is set to No.
|
||||
.Pp
|
||||
.Ev MODRUBY_RSPEC3_DEPENDS
|
||||
is set to the dependency line for the rspec 3 port for the version of ruby in
|
||||
use.
|
||||
.Ev RUBY ,
|
||||
and
|
||||
.Ev RAKE
|
||||
are the path to the ruby and rake
|
||||
binaries for the related ruby implementation.
|
||||
.Ev MODRUBY_BIN_RSPEC
|
||||
is the path to the rspec (rspec 3) binaries for the related ruby
|
||||
implementation.
|
||||
.Pp
|
||||
.Ev MODRUBY_RUBY_ADJ
|
||||
is a command that takes filename arguments and replaces
|
||||
the /usr/bin/env ruby shebang lines with
|
||||
.Ev RUBY .
|
||||
.Ev MODRUBY_ADJ_FILES
|
||||
is a list of filename patterns that will automatically have
|
||||
.Ev MODRUBY_RUBY_ADJ
|
||||
called on them during pre-configure.
|
||||
.Pp
|
||||
Creates a do-test target if
|
||||
.Ev MODRUBY_TEST
|
||||
is used and one is not already defined.
|
||||
.Ev MODRUBY_TEST
|
||||
can be set to ruby, rake, rspec3, or testrb to
|
||||
choose the appropriate binary to run the regress tests.
|
||||
.Ev MODRUBY_TEST_ENV
|
||||
can be used to set environment variables for the regress tests.
|
||||
.Ev MODRUBY_TEST_TARGET
|
||||
sets the argument to the regress test program.
|
||||
.Pp
|
||||
Supports additional
|
||||
.Ev CONFIGURE_STYLE Ns s ,
|
||||
and setting specific
|
||||
.Ev CONFIGURE_STYLE Ns s
|
||||
modifies some additional parameters:
|
||||
.Bl -bullet
|
||||
.It
|
||||
The "ruby gem"
|
||||
.Ev CONFIGURE_STYLE
|
||||
should be used for pure ruby gems without C extensions.
|
||||
To allow a single Ruby gem-based port to build packages for multiple versions
|
||||
of Ruby, set a specific
|
||||
.Ev CONFIGURE_STYLE ,
|
||||
which modifies some additional parameters:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem
|
||||
For pure Ruby gems without C extensions.
|
||||
This adds
|
||||
.Ev PKG_ARCH
|
||||
= * and adds ruby30, ruby31, and ruby32
|
||||
.Ev FLAVOR Ns s
|
||||
to the port, so the same port can build packages for multiple versions of ruby.
|
||||
.It
|
||||
The "ruby gem ext"
|
||||
.Ev CONFIGURE_STYLE
|
||||
should be used for ruby gems with C extensions.
|
||||
This adds
|
||||
.Ev MODRUBY_LIB_DEPENDS
|
||||
to
|
||||
.Ev LIB_DEPENDS
|
||||
and
|
||||
the appropriate libraries and
|
||||
.Ev MODRUBY_WANTLIB
|
||||
to
|
||||
.Ev WANTLIB .
|
||||
It also adds ruby30, ruby31, and ruby32
|
||||
.Ev FLAVOR Ns s
|
||||
to the port.
|
||||
If the C extension in the gem requires specific arguments to extconf.rb,
|
||||
set those via
|
||||
= * to the port.
|
||||
.It Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext
|
||||
For Ruby gems with C extensions.
|
||||
To pass additional arguments to
|
||||
.Sy gem Cm install
|
||||
when building the port, set
|
||||
those via
|
||||
.Ev CONFIGURE_ARGS .
|
||||
.El
|
||||
.Pp
|
||||
To ensure that dependencies use the same ruby implementation as the
|
||||
current port, all ruby gem dependencies specified in the port
|
||||
should use this format:
|
||||
.Pp
|
||||
.Dl category/ruby-foo,${MODRUBY_FLAVOR}
|
||||
.Pp
|
||||
The "ruby gem" and "ruby gem ext"
|
||||
.Ev CONFIGURE_STYLE Ns s
|
||||
cause the
|
||||
.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem
|
||||
and
|
||||
.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext
|
||||
both add ruby30, ruby31, and ruby32
|
||||
.Ev FLAVOR Ns s
|
||||
to the port.
|
||||
They also cause the
|
||||
.Ev FULLPKGNAME
|
||||
to use the
|
||||
.Ev FLAVOR
|
||||
instead of ruby as the package prefix.
|
||||
Specifying
|
||||
.Ev MODRUBY_FLAVOR
|
||||
is necessary so that if a ruby x.y package is being built for the current
|
||||
port, it depends on the ruby x.y package of the dependencies.
|
||||
.Ev FLAVOR Ns \-
|
||||
instead of ruby\- as the package prefix.
|
||||
.Pp
|
||||
The ports system defaults to using ruby 3.2 if the version of ruby is not
|
||||
The ports system defaults to using Ruby 3.2 if the version of Ruby is not
|
||||
specified.
|
||||
If you want to specify a version for a gem port, use a specific
|
||||
To specify a version for a gem port, use a specific
|
||||
.Ev FLAVOR ,
|
||||
such as ruby31 to use ruby 3.1.
|
||||
If you want to specify a version for a non-gem port, set
|
||||
such as ruby31 to use Ruby 3.1.
|
||||
To specify the Ruby version to use for a non Ruby-gem port, set
|
||||
.Ev MODRUBY_REV
|
||||
for the version of ruby you want to use (3.0, 3.1, 3.2).
|
||||
to 3.0, 3.1, or 3.2.
|
||||
.Pp
|
||||
If you do not want the ports system to automatically set up
|
||||
To ensure that dependencies use the same Ruby implementation as the
|
||||
current port, all Ruby gem dependencies specified in the port
|
||||
should use this format:
|
||||
.Pp
|
||||
.Dl category/ruby\-foo,${MODRUBY_FLAVOR}
|
||||
.Pp
|
||||
To prevent the ports system from automatically setting up
|
||||
.Ev FLAVOR Ns s
|
||||
when using a gem port, set
|
||||
in a gem port, set
|
||||
.Ev MODRUBY_HANDLE_FLAVORS
|
||||
to No.
|
||||
Similarly, if you want the ports system to automatically set up
|
||||
to
|
||||
.Cm \&No .
|
||||
Similarly, to let the ports system automatically set up
|
||||
.Ev FLAVOR Ns s
|
||||
when using a non-gem port, set
|
||||
in a non-gem port, set
|
||||
.Ev MODRUBY_HANDLE_FLAVORS
|
||||
to Yes.
|
||||
to
|
||||
.Cm Yes .
|
||||
When
|
||||
.Ev MODRUBY_HANDLE_FLAVORS
|
||||
is Yes, the ports system automatically adds the appropriate prefix to the
|
||||
is
|
||||
.Cm Yes ,
|
||||
the ports system automatically adds the appropriate prefix to the
|
||||
.Ev FULLPKGNAME
|
||||
(e.g. ruby31- for ruby 3.1, ruby32- for ruby 3.2).
|
||||
Additionally, it adds
|
||||
.Ev GEM_BIN_SUFFIX
|
||||
and
|
||||
.Ev GEM_MAN_SUFFIX
|
||||
to
|
||||
.Ev SUBST_VARS
|
||||
so that the PLISTs will work on multiple ruby versions.
|
||||
(e.g. ruby31\- for ruby 3.1, ruby32\- for ruby 3.2).
|
||||
.Pp
|
||||
For ruby gem ports that can work on multiple ruby versions or implementations,
|
||||
any binary file entries in the PLIST should be appended with
|
||||
.Ev GEM_BIN_SUFFIX .
|
||||
This is because the gem binaries for multiple ruby versions are all
|
||||
For Ruby gem ports that can work on multiple Ruby versions, append
|
||||
.Ev GEM_BIN_SUFFIX
|
||||
to every binary file entry in the PLIST.
|
||||
This is because the gem binaries for multiple Ruby versions are all
|
||||
installed to
|
||||
.Pa ${LOCALBASE}/bin ,
|
||||
and the binaries all use a version-specific suffix.
|
||||
Any man pages and other files that would be installed to locations not
|
||||
specific to a ruby implementation (such as under
|
||||
specific to a Ruby implementation (such as under
|
||||
.Pa ${LOCALBASE}/share ) ,
|
||||
should use
|
||||
.Ev GEM_MAN_SUFFIX
|
||||
|
@ -224,25 +126,269 @@ before the extension so the different
|
|||
.Ev FLAVOR Ns s
|
||||
do not conflict.
|
||||
.Pp
|
||||
make update-plist may remove
|
||||
make update\-plist may remove
|
||||
.Ev GEM_BIN_SUFFIX
|
||||
and
|
||||
.Ev GEM_MAN_SUFFIX
|
||||
from the PLIST, or use them in inappropriate places where they shouldn't be
|
||||
used, so be careful when updating gem ports with binaries or man pages.
|
||||
Additionally, for gem ports with C extensions, make update-plist will add back
|
||||
from the PLIST, or use them in inappropriate places, so be careful when
|
||||
updating gem ports with binaries or man pages.
|
||||
Additionally, for gem ports with C extensions, make update\-plist will add back
|
||||
files used by the specific
|
||||
.Ev FLAVOR
|
||||
you are using (such as files under the extension source directory), which may
|
||||
(such as files under the extension source directory), which may
|
||||
not exist for other
|
||||
.Ev FLAVOR Ns s ,
|
||||
so always manually check the result of make update-plist and manually test that
|
||||
you can build the other
|
||||
so always manually check the result of make update\-plist and manually test that
|
||||
all supported
|
||||
.Ev FLAVOR Ns s
|
||||
before committing.
|
||||
Additionally, for gems with C extensions, make update-plist may add back the
|
||||
are buildable before committing.
|
||||
Additionally, for gems with C extensions, make update\-plist may add back the
|
||||
extension source files, which shouldn't be included in the files, so make sure
|
||||
to double check that all files added by make update-plist should be included
|
||||
to double check that all files added by make update\-plist should be included
|
||||
in the package.
|
||||
.Pp
|
||||
The lang/ruby module creates a do\-test target if
|
||||
.Ev MODRUBY_TEST
|
||||
is used and one is not already defined.
|
||||
.Pp
|
||||
The lang/ruby module appends to the following variables:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev BUILD_DEPENDS
|
||||
Adds dependency on version of Ruby in use unless
|
||||
.Ev MODRUBY_BUILDDEP
|
||||
is set to
|
||||
.Cm \&No ,
|
||||
or
|
||||
.Ev NO_BUILD
|
||||
is set to
|
||||
.Cm Yes .
|
||||
.It Ev CATEGORIES
|
||||
Adds the lang/ruby category.
|
||||
.It Ev RUN_DEPENDS
|
||||
Adds dependency on version of Ruby in use unless
|
||||
.Ev MODRUBY_RUNDEP
|
||||
is set to
|
||||
.Cm \&No .
|
||||
.It Ev TEST_DEPENDS
|
||||
Adds the rspec dependency if
|
||||
.Ev MODRUBY_TEST
|
||||
is set to rspec3.
|
||||
.It Ev SUBST_VARS
|
||||
Adds
|
||||
.Ev GEM_EXTENSIONS_DIR ,
|
||||
.Ev MODRUBY_RELEXAMPLEDIR ,
|
||||
.Ev MODRUBY_SITEARCHDIR ,
|
||||
.Ev MODRUBY_SITEDIR ,
|
||||
.Ev MODRUBY_LIBREV ,
|
||||
.Ev MODRUBY_ARCH ,
|
||||
.Ev GEM_LIB ,
|
||||
.Ev GEM_BIN ,
|
||||
and
|
||||
.Ev DISTNAME .
|
||||
.It Ev UPDATE_PLIST_ARGS
|
||||
Adds options so that
|
||||
.Ev MODRUBY_RELEXAMPLEDIR ,
|
||||
.Ev MODRUBY_SITEARCHDIR ,
|
||||
.Ev MODRUBY_SITEDIR ,
|
||||
.Ev GEM_LIB ,
|
||||
and
|
||||
.Ev GEM_BIN
|
||||
are only substituted at the start of paths.
|
||||
.El
|
||||
.Pp
|
||||
If using
|
||||
.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem
|
||||
or
|
||||
.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext ,
|
||||
it also appends to the following variables:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev EXTRACT_CASES
|
||||
Adds support for extracting .gem files.
|
||||
.El
|
||||
.Pp
|
||||
If using
|
||||
.Ev CONFIGURE_STYLE Ns = Ns Qq ruby gem ext ,
|
||||
it also appends to the following variables:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev WANTLIB
|
||||
Adds libraries used by Ruby.
|
||||
.It Ev LIB_DEPENDS
|
||||
Adds
|
||||
.Ev MODRUBY_LIB_DEPENDS .
|
||||
.It Ev PKG_ARGS
|
||||
Adds additional PLIST so that loading native extensions will not attempt to
|
||||
rebuild them at runtime.
|
||||
.It Ev SUBST_VARS
|
||||
Adds
|
||||
.Ev GEM_EXTENSIONS_DIR .
|
||||
.El
|
||||
.Pp
|
||||
If using
|
||||
.Ev MODRUBY_HANDLE_FLAVORS Ns = Ns Yes ,
|
||||
it also appends to the following variables:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev SUBST_VARS
|
||||
Adds
|
||||
.Ev GEM_BIN_SUFFIX
|
||||
and
|
||||
.Ev GEM_MAN_SUFFIX
|
||||
to
|
||||
.Ev SUBST_VARS
|
||||
so that the PLISTs work on multiple Ruby versions.
|
||||
.El
|
||||
.Pp
|
||||
The lang/ruby module sets the following variables:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev GEM
|
||||
The path to the appropriate
|
||||
.Sy gem
|
||||
binary for the current Ruby version (/usr/local/bin/gem${MODRUBY_BINREV}).
|
||||
.It Ev GEM_BASE_BIN
|
||||
The absolute path where the
|
||||
.Sy gem
|
||||
program will install the executable
|
||||
files provided by the gem (if any) during the fake target.
|
||||
.It Ev GEM_BASE_LIB
|
||||
The absolute path where the
|
||||
.Sy gem
|
||||
program will install library files
|
||||
provided by the gem during the fake target.
|
||||
.It Ev GEM_BIN
|
||||
The relative path under
|
||||
.Ev PREFIX
|
||||
where the package installs the gem's executable files.
|
||||
.It Ev GEM_BIN_SUFFIX
|
||||
The suffix to use for the gem's executable files, so that separate
|
||||
.Ev FLAVOR Ns s
|
||||
of the port do not conflict.
|
||||
.It Ev GEM_EXTENSIONS_DIR
|
||||
The relative path under
|
||||
.Ev PREFIX
|
||||
where the package installs Ruby-version specific files for Ruby gems
|
||||
with C extensions.
|
||||
.It Ev GEM_FLAGS
|
||||
Option flags for
|
||||
.Sy gem Cm install
|
||||
when building the port.
|
||||
.It Ev GEM_LIB
|
||||
The relative path under
|
||||
.Ev PREFIX
|
||||
where Ruby gem files are stored for the Ruby version in use.
|
||||
.It Ev GEM_MAN_SUFFIX
|
||||
The suffix to use for the gem's manual pages, so that separate
|
||||
.Ev FLAVOR Ns s
|
||||
of the port do not conflict.
|
||||
.It Ev MODRUBY_ADJ_FILES
|
||||
A list of filename patterns that will automatically have
|
||||
.Ev MODRUBY_RUBY_ADJ
|
||||
called on them during pre\-configure.
|
||||
.It Ev MODRUBY_ARCH
|
||||
The platform-specific string used by Ruby for files installed
|
||||
into platform-specific directories.
|
||||
.It Ev MODRUBY_BINREV
|
||||
The same as
|
||||
.Ev MODRUBY_REV
|
||||
except without the dot
|
||||
.Pq Ql \&. ,
|
||||
reflecting the suffix used by the
|
||||
programs for the Ruby version in use.
|
||||
.It Ev MODRUBY_BIN_RSPEC
|
||||
The path to the rspec (rspec 3) binaries for the Ruby
|
||||
version in use.
|
||||
.It Ev MODRUBY_BUILD_DEPENDS
|
||||
The same as
|
||||
.Ev MODRUBY_RUN_DEPENDS .
|
||||
It is designed to be used in
|
||||
.Ev BUILD_DEPENDS
|
||||
values for other ports depending on Ruby.
|
||||
.It Ev MODRUBY_BUILDDEP
|
||||
If Ruby does not need to be installed
|
||||
while building the package(s), set to
|
||||
.Cm \&No .
|
||||
The default is
|
||||
.Cm Yes .
|
||||
.It Ev MODRUBY_FLAVOR
|
||||
The FLAVOR to use for Ruby dependencies to ensure that
|
||||
they use the same version of Ruby as the current port.
|
||||
.It Ev MODRUBY_HANDLE_FLAVORS
|
||||
Determines whether the port allows building with multiple
|
||||
.Ev FLAVOR Ns s,
|
||||
with each
|
||||
.Ev FLAVOR
|
||||
supporting a separate Ruby version.
|
||||
.It Ev MODRUBY_LIBREV
|
||||
The same as
|
||||
.Ev MODRUBY_REV .
|
||||
.It Ev MODRUBY_LIB_DEPENDS
|
||||
The same as
|
||||
.Ev MODRUBY_RUN_DEPENDS .
|
||||
It is designed to be used in
|
||||
.Ev LIB_DEPENDS
|
||||
values for other ports depending on Ruby.
|
||||
.It Ev MODRUBY_PKG_PREFIX
|
||||
The prefix to use for packages built using the lang/ruby module,
|
||||
if the port support building with multiple Ruby versions.
|
||||
.It Ev MODRUBY_RELEXAMPLEDIR
|
||||
The relative path under
|
||||
.Ev PREFIX
|
||||
where the package installs example files for non-Ruby gem ports.
|
||||
.It Ev MODRUBY_REV
|
||||
Includes the major and minor versions of the version of Ruby in use,
|
||||
separated by a dot
|
||||
.Pq Ql \&. .
|
||||
The port can override the value to specify which Ruby version to use,
|
||||
if the port sets or defaults to
|
||||
.Ev MODRUBY_HANDLE_FLAVORS Ns =Yes .
|
||||
.It Ev MODRUBY_RUBY_ADJ
|
||||
A command that takes filename arguments and replaces
|
||||
the
|
||||
.Pa /usr/bin/env
|
||||
ruby shebang lines with
|
||||
.Ev RUBY .
|
||||
.It Ev MODRUBY_RUN_DEPENDS
|
||||
The port path for the Ruby version in use.
|
||||
It is designed to be used in
|
||||
.Ev RUN_DEPENDS
|
||||
values for other ports depending on Ruby.
|
||||
.It Ev MODRUBY_RUNDEP
|
||||
If the packages do not depend on Ruby at runtime, set to
|
||||
.Cm \&No .
|
||||
The default is
|
||||
.Cm Yes .
|
||||
.It Ev MODRUBY_SITEARCHDIR
|
||||
The relative path under
|
||||
.Ev PREFIX
|
||||
where the package installs platform-specific library files for non-Ruby gem
|
||||
ports.
|
||||
.It Ev MODRUBY_SITEDIR
|
||||
The relative path under
|
||||
.Ev PREFIX
|
||||
where the package installs non-platform-specific library files for non-Ruby
|
||||
gem ports.
|
||||
.It Ev MODRUBY_TEST
|
||||
Set to
|
||||
.Cm ruby ,
|
||||
.Cm rake ,
|
||||
.Cm rspec3 ,
|
||||
or
|
||||
.Cm testrb
|
||||
to choose the appropriate program to run the regress tests, if the port
|
||||
includes tests.
|
||||
.It Ev MODRUBY_TEST_ENV
|
||||
Sets environment variables for the regress tests.
|
||||
.It Ev MODRUBY_TEST_TARGET
|
||||
Sets the argument to the regress test program.
|
||||
.It Ev MODRUBY_WANTLIB
|
||||
Includes the library-specs for the Ruby version in use.
|
||||
.It Ev RAKE
|
||||
The path to the
|
||||
.Sy rake
|
||||
program for the Ruby version in use (/usr/local/bin/rake${MODRUBY_BINREV}).
|
||||
.It Ev RUBY
|
||||
The path to the
|
||||
.Xr ruby 1
|
||||
program for the Ruby version in use (/usr/local/bin/ruby${MODRUBY_BINREV}).
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr bsd.port.mk 5 ,
|
||||
.Xr port-modules 5
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: bsd.regress.mk,v 1.26 2023/09/15 07:13:35 tb Exp $
|
||||
# $OpenBSD: bsd.regress.mk,v 1.27 2023/09/24 08:28:20 tb Exp $
|
||||
# Documented in bsd.regress.mk(5)
|
||||
|
||||
# No man pages for regression tests.
|
||||
|
@ -21,6 +21,9 @@ all: regress
|
|||
REGRESS_LOG?=/dev/null
|
||||
REGRESS_SKIP_TARGETS?=
|
||||
REGRESS_SKIP_SLOW?=no
|
||||
.if ${REGRESS_LOG} != "/dev/null"
|
||||
REGRESS_FAIL_EARLY?=no
|
||||
.endif
|
||||
REGRESS_FAIL_EARLY?=yes
|
||||
|
||||
.if ! ${REGRESS_LOG:M/*}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: GENERIC,v 1.518 2023/07/08 02:43:02 jcs Exp $
|
||||
# $OpenBSD: GENERIC,v 1.519 2023/09/25 15:36:35 deraadt Exp $
|
||||
#
|
||||
# For further information on compiling SecBSD kernels, see the config(8)
|
||||
# man page.
|
||||
|
@ -595,6 +595,7 @@ pgt* at cardbus? # Prism54 Full-MAC
|
|||
malo* at pci? # Marvell Libertas
|
||||
malo* at cardbus? # Marvell Libertas
|
||||
malo* at pcmcia? # Marvell 88W8385
|
||||
mbg* at pci? # Meinberg Funkuhren radio clocks
|
||||
bwfm* at pci? # Broadcom FullMAC
|
||||
|
||||
# Media Independent Interface (mii) drivers
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ampintc.c,v 1.31 2022/03/12 14:40:41 mpi Exp $ */
|
||||
/* $OpenBSD: ampintc.c,v 1.32 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
|
||||
*
|
||||
|
@ -37,7 +37,7 @@
|
|||
#include <dev/ofw/fdt.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
/* registers */
|
||||
#define ICD_DCR 0x000
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: simplebusvar.h,v 1.3 2020/04/29 15:25:07 kettenis Exp $ */
|
||||
/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: simplebus.c,v 1.19 2022/03/12 14:40:41 mpi Exp $ */
|
||||
/* $OpenBSD: simplebus.c,v 1.20 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
||||
|
@ -26,8 +26,8 @@
|
|||
#include <dev/ofw/ofw_clock.h>
|
||||
#include <dev/ofw/ofw_power.h>
|
||||
|
||||
#include <arm/fdt.h>
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/fdt.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
int simplebus_match(struct device *, void *, void *);
|
||||
void simplebus_attach(struct device *, struct device *, void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: agintc.c,v 1.53 2023/09/12 08:29:28 jmatthew Exp $ */
|
||||
/* $OpenBSD: agintc.c,v 1.54 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn <drahn@dalerahn.com>
|
||||
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
|
||||
|
@ -35,7 +35,7 @@
|
|||
#include <dev/ofw/fdt.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#define ICC_PMR s3_0_c4_c6_0
|
||||
#define ICC_IAR0 s3_0_c12_c8_0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ampintc.c,v 1.30 2022/12/21 22:30:42 kettenis Exp $ */
|
||||
/* $OpenBSD: ampintc.c,v 1.31 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org>
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
|||
#include <dev/ofw/fdt.h>
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
/* registers */
|
||||
#define ICD_DCR 0x000
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: apldart.c,v 1.17 2023/07/23 11:47:20 kettenis Exp $ */
|
||||
/* $OpenBSD: apldart.c,v 1.18 2023/09/25 19:23:34 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -64,6 +64,7 @@
|
|||
#define DART_T8110_TLB_CMD 0x0080
|
||||
#define DART_T8110_TLB_CMD_BUSY (1U << 31)
|
||||
#define DART_T8110_TLB_CMD_FLUSH_ALL (0 << 8)
|
||||
#define DART_T8110_TLB_CMD_FLUSH_SID (1 << 8)
|
||||
#define DART_T8110_ERROR 0x0100
|
||||
#define DART_T8110_ERROR_MASK 0x0104
|
||||
#define DART_T8110_ERROR_ADDR_LO 0x0170
|
||||
|
@ -90,7 +91,6 @@
|
|||
|
||||
#define DART_ALL_STREAMS(sc) ((1U << (sc)->sc_nsid) - 1)
|
||||
|
||||
|
||||
/*
|
||||
* Some hardware (e.g. bge(4)) will always use (aligned) 64-bit memory
|
||||
* access. To make sure this doesn't fault, round the subpage limits
|
||||
|
@ -134,6 +134,18 @@ apldart_trunc_offset(psize_t off)
|
|||
#define HWRITE4(sc, reg, val) \
|
||||
bus_space_write_4((sc)->sc_iot, (sc)->sc_ioh, (reg), (val))
|
||||
|
||||
struct apldart_stream {
|
||||
struct apldart_softc *as_sc;
|
||||
int as_sid;
|
||||
|
||||
struct extent *as_dvamap;
|
||||
struct mutex as_dvamap_mtx;
|
||||
struct apldart_dmamem *as_l1;
|
||||
struct apldart_dmamem **as_l2;
|
||||
|
||||
struct machine_bus_dma_tag as_dmat;
|
||||
};
|
||||
|
||||
struct apldart_softc {
|
||||
struct device sc_dev;
|
||||
bus_space_tag_t sc_iot;
|
||||
|
@ -143,24 +155,19 @@ struct apldart_softc {
|
|||
|
||||
int sc_nsid;
|
||||
int sc_nttbr;
|
||||
int sc_shift;
|
||||
bus_addr_t sc_sid_enable_base;
|
||||
bus_addr_t sc_tcr_base;
|
||||
uint32_t sc_tcr_translate_enable;
|
||||
uint32_t sc_tcr_bypass;
|
||||
bus_addr_t sc_ttbr_base;
|
||||
uint32_t sc_ttbr_valid;
|
||||
void (*sc_flush_tlb)(struct apldart_softc *);
|
||||
void (*sc_flush_tlb)(struct apldart_softc *, int);
|
||||
|
||||
bus_addr_t sc_dvabase;
|
||||
bus_addr_t sc_dvaend;
|
||||
struct extent *sc_dvamap;
|
||||
struct mutex sc_dvamap_mtx;
|
||||
|
||||
int sc_shift;
|
||||
struct apldart_dmamem *sc_l1;
|
||||
struct apldart_dmamem **sc_l2;
|
||||
|
||||
struct machine_bus_dma_tag sc_bus_dmat;
|
||||
struct apldart_stream **sc_as;
|
||||
struct iommu_device sc_id;
|
||||
|
||||
int sc_do_suspend;
|
||||
|
@ -206,10 +213,10 @@ void apldart_reserve(void *, uint32_t *, bus_addr_t, bus_size_t);
|
|||
int apldart_t8020_intr(void *);
|
||||
int apldart_t8110_intr(void *);
|
||||
|
||||
void apldart_t8020_flush_tlb(struct apldart_softc *);
|
||||
void apldart_t8110_flush_tlb(struct apldart_softc *);
|
||||
int apldart_load_map(struct apldart_softc *, bus_dmamap_t);
|
||||
void apldart_unload_map(struct apldart_softc *, bus_dmamap_t);
|
||||
void apldart_t8020_flush_tlb(struct apldart_softc *, int);
|
||||
void apldart_t8110_flush_tlb(struct apldart_softc *, int);
|
||||
int apldart_load_map(struct apldart_stream *, bus_dmamap_t);
|
||||
void apldart_unload_map(struct apldart_stream *, bus_dmamap_t);
|
||||
|
||||
int apldart_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
|
||||
bus_size_t boundary, int, bus_dmamap_t *);
|
||||
|
@ -241,9 +248,6 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
{
|
||||
struct apldart_softc *sc = (struct apldart_softc *)self;
|
||||
struct fdt_attach_args *faa = aux;
|
||||
paddr_t pa;
|
||||
volatile uint64_t *l1;
|
||||
int ntte, nl1, nl2;
|
||||
uint32_t config, params2, params4, tcr, ttbr;
|
||||
int sid, idx;
|
||||
|
||||
|
@ -367,49 +371,7 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
for (idx = 0; idx < sc->sc_nttbr; idx++)
|
||||
HWRITE4(sc, DART_TTBR(sc, sid, idx), 0);
|
||||
}
|
||||
sc->sc_flush_tlb(sc);
|
||||
|
||||
/*
|
||||
* Build translation tables. We pre-allocate the translation
|
||||
* tables for the entire aperture such that we don't have to
|
||||
* worry about growing them in an mpsafe manner later.
|
||||
*/
|
||||
|
||||
ntte = howmany(sc->sc_dvaend, DART_PAGE_SIZE);
|
||||
nl2 = howmany(ntte, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
nl1 = howmany(nl2, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
|
||||
sc->sc_l1 = apldart_dmamem_alloc(sc->sc_dmat,
|
||||
nl1 * DART_PAGE_SIZE, DART_PAGE_SIZE);
|
||||
sc->sc_l2 = mallocarray(nl2, sizeof(*sc->sc_l2),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
l1 = APLDART_DMA_KVA(sc->sc_l1);
|
||||
for (idx = 0; idx < nl2; idx++) {
|
||||
sc->sc_l2[idx] = apldart_dmamem_alloc(sc->sc_dmat,
|
||||
DART_PAGE_SIZE, DART_PAGE_SIZE);
|
||||
pa = APLDART_DMA_DVA(sc->sc_l2[idx]);
|
||||
l1[idx] = (pa >> sc->sc_shift) | DART_L1_TABLE;
|
||||
}
|
||||
|
||||
/* Install page tables. */
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++) {
|
||||
pa = APLDART_DMA_DVA(sc->sc_l1);
|
||||
for (idx = 0; idx < nl1; idx++) {
|
||||
HWRITE4(sc, DART_TTBR(sc, sid, idx),
|
||||
(pa >> DART_TTBR_SHIFT) | sc->sc_ttbr_valid);
|
||||
pa += DART_PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
sc->sc_flush_tlb(sc);
|
||||
|
||||
/* Enable all streams. */
|
||||
for (idx = 0; idx < howmany(sc->sc_nsid, 32); idx++)
|
||||
HWRITE4(sc, DART_SID_ENABLE(sc, idx), ~0);
|
||||
|
||||
/* Enable translations. */
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++)
|
||||
HWRITE4(sc, DART_TCR(sc, sid), sc->sc_tcr_translate_enable);
|
||||
sc->sc_flush_tlb(sc, -1);
|
||||
|
||||
if (OF_is_compatible(sc->sc_node, "apple,t8110-dart")) {
|
||||
HWRITE4(sc, DART_T8110_ERROR, HREAD4(sc, DART_T8110_ERROR));
|
||||
|
@ -422,21 +384,8 @@ apldart_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc, sc->sc_dev.dv_xname);
|
||||
}
|
||||
|
||||
sc->sc_dvamap = extent_create(sc->sc_dev.dv_xname,
|
||||
sc->sc_dvabase, sc->sc_dvaend, M_DEVBUF,
|
||||
NULL, 0, EX_NOCOALESCE);
|
||||
mtx_init(&sc->sc_dvamap_mtx, IPL_HIGH);
|
||||
|
||||
memcpy(&sc->sc_bus_dmat, sc->sc_dmat, sizeof(sc->sc_bus_dmat));
|
||||
sc->sc_bus_dmat._cookie = sc;
|
||||
sc->sc_bus_dmat._dmamap_create = apldart_dmamap_create;
|
||||
sc->sc_bus_dmat._dmamap_destroy = apldart_dmamap_destroy;
|
||||
sc->sc_bus_dmat._dmamap_load = apldart_dmamap_load;
|
||||
sc->sc_bus_dmat._dmamap_load_mbuf = apldart_dmamap_load_mbuf;
|
||||
sc->sc_bus_dmat._dmamap_load_uio = apldart_dmamap_load_uio;
|
||||
sc->sc_bus_dmat._dmamap_load_raw = apldart_dmamap_load_raw;
|
||||
sc->sc_bus_dmat._dmamap_unload = apldart_dmamap_unload;
|
||||
sc->sc_bus_dmat._flags |= BUS_DMA_COHERENT;
|
||||
sc->sc_as = mallocarray(sc->sc_nsid, sizeof(*sc->sc_as),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
sc->sc_id.id_node = faa->fa_node;
|
||||
sc->sc_id.id_cookie = sc;
|
||||
|
@ -460,6 +409,7 @@ apldart_resume(struct apldart_softc *sc)
|
|||
paddr_t pa;
|
||||
int ntte, nl1, nl2;
|
||||
uint32_t params2;
|
||||
uint32_t mask;
|
||||
int sid, idx;
|
||||
|
||||
if (!sc->sc_do_suspend)
|
||||
|
@ -480,22 +430,32 @@ apldart_resume(struct apldart_softc *sc)
|
|||
|
||||
/* Install page tables. */
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++) {
|
||||
pa = APLDART_DMA_DVA(sc->sc_l1);
|
||||
if (sc->sc_as[sid] == NULL)
|
||||
continue;
|
||||
pa = APLDART_DMA_DVA(sc->sc_as[sid]->as_l1);
|
||||
for (idx = 0; idx < nl1; idx++) {
|
||||
HWRITE4(sc, DART_TTBR(sc, sid, idx),
|
||||
(pa >> DART_TTBR_SHIFT) | sc->sc_ttbr_valid);
|
||||
pa += DART_PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
sc->sc_flush_tlb(sc);
|
||||
sc->sc_flush_tlb(sc, -1);
|
||||
|
||||
/* Enable all streams. */
|
||||
for (idx = 0; idx < howmany(sc->sc_nsid, 32); idx++)
|
||||
HWRITE4(sc, DART_SID_ENABLE(sc, idx), ~0);
|
||||
/* Enable all active streams. */
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++) {
|
||||
if (sc->sc_as[sid] == NULL)
|
||||
continue;
|
||||
mask = HREAD4(sc, DART_SID_ENABLE(sc, sid / 32));
|
||||
mask |= (1U << (sid % 32));
|
||||
HWRITE4(sc, DART_SID_ENABLE(sc, sid / 32), mask);
|
||||
}
|
||||
|
||||
/* Enable translations. */
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++)
|
||||
for (sid = 0; sid < sc->sc_nsid; sid++) {
|
||||
if (sc->sc_as[sid] == NULL)
|
||||
continue;
|
||||
HWRITE4(sc, DART_TCR(sc, sid), sc->sc_tcr_translate_enable);
|
||||
}
|
||||
|
||||
if (OF_is_compatible(sc->sc_node, "apple,t8110-dart")) {
|
||||
HWRITE4(sc, DART_T8110_ERROR, HREAD4(sc, DART_T8110_ERROR));
|
||||
|
@ -522,12 +482,91 @@ apldart_activate(struct device *self, int act)
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct apldart_stream *
|
||||
apldart_alloc_stream(struct apldart_softc *sc, int sid)
|
||||
{
|
||||
struct apldart_stream *as;
|
||||
paddr_t pa;
|
||||
volatile uint64_t *l1;
|
||||
int idx, ntte, nl1, nl2;
|
||||
uint32_t mask;
|
||||
|
||||
as = malloc(sizeof(*as), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
as->as_sc = sc;
|
||||
as->as_sid = sid;
|
||||
|
||||
as->as_dvamap = extent_create(sc->sc_dev.dv_xname,
|
||||
sc->sc_dvabase, sc->sc_dvaend, M_DEVBUF,
|
||||
NULL, 0, EX_NOCOALESCE);
|
||||
mtx_init(&as->as_dvamap_mtx, IPL_HIGH);
|
||||
|
||||
/*
|
||||
* Build translation tables. We pre-allocate the translation
|
||||
* tables for the entire aperture such that we don't have to
|
||||
* worry about growing them in an mpsafe manner later.
|
||||
*/
|
||||
|
||||
ntte = howmany(sc->sc_dvaend, DART_PAGE_SIZE);
|
||||
nl2 = howmany(ntte, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
nl1 = howmany(nl2, DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
|
||||
as->as_l1 = apldart_dmamem_alloc(sc->sc_dmat,
|
||||
nl1 * DART_PAGE_SIZE, DART_PAGE_SIZE);
|
||||
as->as_l2 = mallocarray(nl2, sizeof(*as->as_l2),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
l1 = APLDART_DMA_KVA(as->as_l1);
|
||||
for (idx = 0; idx < nl2; idx++) {
|
||||
as->as_l2[idx] = apldart_dmamem_alloc(sc->sc_dmat,
|
||||
DART_PAGE_SIZE, DART_PAGE_SIZE);
|
||||
pa = APLDART_DMA_DVA(as->as_l2[idx]);
|
||||
l1[idx] = (pa >> sc->sc_shift) | DART_L1_TABLE;
|
||||
}
|
||||
|
||||
/* Install page tables. */
|
||||
pa = APLDART_DMA_DVA(as->as_l1);
|
||||
for (idx = 0; idx < nl1; idx++) {
|
||||
HWRITE4(sc, DART_TTBR(sc, sid, idx),
|
||||
(pa >> DART_TTBR_SHIFT) | sc->sc_ttbr_valid);
|
||||
pa += DART_PAGE_SIZE;
|
||||
}
|
||||
sc->sc_flush_tlb(sc, sid);
|
||||
|
||||
/* Enable this stream. */
|
||||
mask = HREAD4(sc, DART_SID_ENABLE(sc, sid / 32));
|
||||
mask |= (1U << (sid % 32));
|
||||
HWRITE4(sc, DART_SID_ENABLE(sc, sid / 32), mask);
|
||||
|
||||
/* Enable translations. */
|
||||
HWRITE4(sc, DART_TCR(sc, sid), sc->sc_tcr_translate_enable);
|
||||
|
||||
memcpy(&as->as_dmat, sc->sc_dmat, sizeof(*sc->sc_dmat));
|
||||
as->as_dmat._cookie = as;
|
||||
as->as_dmat._dmamap_create = apldart_dmamap_create;
|
||||
as->as_dmat._dmamap_destroy = apldart_dmamap_destroy;
|
||||
as->as_dmat._dmamap_load = apldart_dmamap_load;
|
||||
as->as_dmat._dmamap_load_mbuf = apldart_dmamap_load_mbuf;
|
||||
as->as_dmat._dmamap_load_uio = apldart_dmamap_load_uio;
|
||||
as->as_dmat._dmamap_load_raw = apldart_dmamap_load_raw;
|
||||
as->as_dmat._dmamap_unload = apldart_dmamap_unload;
|
||||
as->as_dmat._flags |= BUS_DMA_COHERENT;
|
||||
|
||||
return as;
|
||||
}
|
||||
|
||||
bus_dma_tag_t
|
||||
apldart_map(void *cookie, uint32_t *cells, bus_dma_tag_t dmat)
|
||||
{
|
||||
struct apldart_softc *sc = cookie;
|
||||
uint32_t sid = cells[0];
|
||||
|
||||
return &sc->sc_bus_dmat;
|
||||
KASSERT(sid < sc->sc_nsid);
|
||||
|
||||
if (sc->sc_as[sid] == NULL)
|
||||
sc->sc_as[sid] = apldart_alloc_stream(sc, sid);
|
||||
|
||||
return &sc->sc_as[sid]->as_dmat;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -558,41 +597,56 @@ apldart_t8110_intr(void *arg)
|
|||
}
|
||||
|
||||
void
|
||||
apldart_t8020_flush_tlb(struct apldart_softc *sc)
|
||||
apldart_t8020_flush_tlb(struct apldart_softc *sc, int sid)
|
||||
{
|
||||
uint32_t mask;
|
||||
|
||||
__asm volatile ("dsb sy" ::: "memory");
|
||||
|
||||
HWRITE4(sc, DART_T8020_TLB_SIDMASK, DART_ALL_STREAMS(sc));
|
||||
if (sid == -1)
|
||||
mask = DART_ALL_STREAMS(sc);
|
||||
else
|
||||
mask = (1U << sid);
|
||||
|
||||
HWRITE4(sc, DART_T8020_TLB_SIDMASK, mask);
|
||||
HWRITE4(sc, DART_T8020_TLB_CMD, DART_T8020_TLB_CMD_FLUSH);
|
||||
while (HREAD4(sc, DART_T8020_TLB_CMD) & DART_T8020_TLB_CMD_BUSY)
|
||||
CPU_BUSY_CYCLE();
|
||||
}
|
||||
|
||||
void
|
||||
apldart_t8110_flush_tlb(struct apldart_softc *sc)
|
||||
apldart_t8110_flush_tlb(struct apldart_softc *sc, int sid)
|
||||
{
|
||||
uint32_t cmd;
|
||||
|
||||
__asm volatile ("dsb sy" ::: "memory");
|
||||
|
||||
HWRITE4(sc, DART_T8110_TLB_CMD, DART_T8110_TLB_CMD_FLUSH_ALL);
|
||||
if (sid == -1)
|
||||
cmd = DART_T8110_TLB_CMD_FLUSH_ALL;
|
||||
else
|
||||
cmd = DART_T8110_TLB_CMD_FLUSH_SID | sid;
|
||||
|
||||
HWRITE4(sc, DART_T8110_TLB_CMD, cmd);
|
||||
while (HREAD4(sc, DART_T8110_TLB_CMD) & DART_T8110_TLB_CMD_BUSY)
|
||||
CPU_BUSY_CYCLE();
|
||||
}
|
||||
|
||||
volatile uint64_t *
|
||||
apldart_lookup_tte(struct apldart_softc *sc, bus_addr_t dva)
|
||||
apldart_lookup_tte(struct apldart_stream *as, bus_addr_t dva)
|
||||
{
|
||||
int idx = dva / DART_PAGE_SIZE;
|
||||
int l2_idx = idx / (DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
int tte_idx = idx % (DART_PAGE_SIZE / sizeof(uint64_t));
|
||||
volatile uint64_t *l2;
|
||||
|
||||
l2 = APLDART_DMA_KVA(sc->sc_l2[l2_idx]);
|
||||
l2 = APLDART_DMA_KVA(as->as_l2[l2_idx]);
|
||||
return &l2[tte_idx];
|
||||
}
|
||||
|
||||
int
|
||||
apldart_load_map(struct apldart_softc *sc, bus_dmamap_t map)
|
||||
apldart_load_map(struct apldart_stream *as, bus_dmamap_t map)
|
||||
{
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
struct apldart_map_state *ams = map->_dm_cookie;
|
||||
volatile uint64_t *tte;
|
||||
int seg, error;
|
||||
|
@ -606,12 +660,12 @@ apldart_load_map(struct apldart_softc *sc, bus_dmamap_t map)
|
|||
|
||||
len = apldart_round_page(map->dm_segs[seg].ds_len + off);
|
||||
|
||||
mtx_enter(&sc->sc_dvamap_mtx);
|
||||
error = extent_alloc_with_descr(sc->sc_dvamap, len,
|
||||
mtx_enter(&as->as_dvamap_mtx);
|
||||
error = extent_alloc_with_descr(as->as_dvamap, len,
|
||||
DART_PAGE_SIZE, 0, 0, EX_NOWAIT, &ams[seg].ams_er, &dva);
|
||||
mtx_leave(&sc->sc_dvamap_mtx);
|
||||
mtx_leave(&as->as_dvamap_mtx);
|
||||
if (error) {
|
||||
apldart_unload_map(sc, map);
|
||||
apldart_unload_map(as, map);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -627,7 +681,7 @@ apldart_load_map(struct apldart_softc *sc, bus_dmamap_t map)
|
|||
if (len < DART_PAGE_SIZE)
|
||||
end = apldart_round_offset(len) - 1;
|
||||
|
||||
tte = apldart_lookup_tte(sc, dva);
|
||||
tte = apldart_lookup_tte(as, dva);
|
||||
*tte = (pa >> sc->sc_shift) | DART_L2_VALID |
|
||||
DART_L2_START(start) | DART_L2_END(end);
|
||||
|
||||
|
@ -638,14 +692,15 @@ apldart_load_map(struct apldart_softc *sc, bus_dmamap_t map)
|
|||
}
|
||||
}
|
||||
|
||||
sc->sc_flush_tlb(sc);
|
||||
sc->sc_flush_tlb(sc, as->as_sid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
apldart_unload_map(struct apldart_softc *sc, bus_dmamap_t map)
|
||||
apldart_unload_map(struct apldart_stream *as, bus_dmamap_t map)
|
||||
{
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
struct apldart_map_state *ams = map->_dm_cookie;
|
||||
volatile uint64_t *tte;
|
||||
int seg, error;
|
||||
|
@ -661,17 +716,17 @@ apldart_unload_map(struct apldart_softc *sc, bus_dmamap_t map)
|
|||
len = ams[seg].ams_len;
|
||||
|
||||
while (len > 0) {
|
||||
tte = apldart_lookup_tte(sc, dva);
|
||||
tte = apldart_lookup_tte(as, dva);
|
||||
*tte = DART_L2_INVAL;
|
||||
|
||||
dva += DART_PAGE_SIZE;
|
||||
len -= DART_PAGE_SIZE;
|
||||
}
|
||||
|
||||
mtx_enter(&sc->sc_dvamap_mtx);
|
||||
error = extent_free(sc->sc_dvamap, ams[seg].ams_dva,
|
||||
mtx_enter(&as->as_dvamap_mtx);
|
||||
error = extent_free(as->as_dvamap, ams[seg].ams_dva,
|
||||
ams[seg].ams_len, EX_NOWAIT);
|
||||
mtx_leave(&sc->sc_dvamap_mtx);
|
||||
mtx_leave(&as->as_dvamap_mtx);
|
||||
|
||||
KASSERT(error == 0);
|
||||
|
||||
|
@ -679,14 +734,15 @@ apldart_unload_map(struct apldart_softc *sc, bus_dmamap_t map)
|
|||
ams[seg].ams_len = 0;
|
||||
}
|
||||
|
||||
sc->sc_flush_tlb(sc);
|
||||
sc->sc_flush_tlb(sc, as->as_sid);
|
||||
}
|
||||
|
||||
int
|
||||
apldart_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
||||
bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamap)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
struct apldart_map_state *ams;
|
||||
bus_dmamap_t map;
|
||||
int error;
|
||||
|
@ -711,7 +767,8 @@ apldart_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
void
|
||||
apldart_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
struct apldart_map_state *ams = map->_dm_cookie;
|
||||
|
||||
if (map->dm_nsegs)
|
||||
|
@ -725,7 +782,8 @@ int
|
|||
apldart_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
||||
size_t buflen, struct proc *p, int flags)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
int error;
|
||||
|
||||
error = sc->sc_dmat->_dmamap_load(sc->sc_dmat, map,
|
||||
|
@ -733,7 +791,7 @@ apldart_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(sc, map);
|
||||
error = apldart_load_map(as, map);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -744,7 +802,8 @@ int
|
|||
apldart_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map,
|
||||
struct mbuf *m, int flags)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
int error;
|
||||
|
||||
error = sc->sc_dmat->_dmamap_load_mbuf(sc->sc_dmat, map,
|
||||
|
@ -752,7 +811,7 @@ apldart_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(sc, map);
|
||||
error = apldart_load_map(as, map);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -763,7 +822,8 @@ int
|
|||
apldart_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map,
|
||||
struct uio *uio, int flags)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
int error;
|
||||
|
||||
error = sc->sc_dmat->_dmamap_load_uio(sc->sc_dmat, map,
|
||||
|
@ -771,7 +831,7 @@ apldart_dmamap_load_uio(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(sc, map);
|
||||
error = apldart_load_map(as, map);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -782,7 +842,8 @@ int
|
|||
apldart_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
|
||||
bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
int error;
|
||||
|
||||
error = sc->sc_dmat->_dmamap_load_raw(sc->sc_dmat, map,
|
||||
|
@ -790,7 +851,7 @@ apldart_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
error = apldart_load_map(sc, map);
|
||||
error = apldart_load_map(as, map);
|
||||
if (error)
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
@ -800,9 +861,10 @@ apldart_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
void
|
||||
apldart_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
struct apldart_softc *sc = t->_cookie;
|
||||
struct apldart_stream *as = t->_cookie;
|
||||
struct apldart_softc *sc = as->as_sc;
|
||||
|
||||
apldart_unload_map(sc, map);
|
||||
apldart_unload_map(as, map);
|
||||
sc->sc_dmat->_dmamap_unload(sc->sc_dmat, map);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: apldc.c,v 1.10 2023/09/05 11:04:06 tobhe Exp $ */
|
||||
/* $OpenBSD: apldc.c,v 1.11 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include <dev/hid/hidmsvar.h>
|
||||
|
||||
#include <arm64/dev/rtkit.h>
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include "apldc.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: aplpcie.c,v 1.16 2023/04/16 12:09:01 kettenis Exp $ */
|
||||
/* $OpenBSD: aplpcie.c,v 1.17 2023/09/21 20:26:17 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -70,6 +70,10 @@
|
|||
#define PCIE_PORT_REFCLK_CGDIS (1 << 8)
|
||||
#define PCIE_PORT_PERST 0x0814
|
||||
#define PCIE_PORT_PERST_DIS (1 << 0)
|
||||
#define PCIE_PORT_RID2SID(idx) (0x0828 + (idx) * 4)
|
||||
#define PCIE_PORT_RID2SID_VALID (1U << 31)
|
||||
#define PCIE_PORT_RID2SID_SID_SHIFT 16
|
||||
#define PCIE_PORT_RID2SID_RID_MASK 0x0000ffff
|
||||
|
||||
#define PCIE_T6020_PORT_MSI_DOORBELL_LO 0x016c
|
||||
#define PCIE_T6020_PORT_MSI_DOORBELL_HI 0x0170
|
||||
|
@ -438,7 +442,7 @@ aplpcie_init_port(struct aplpcie_softc *sc, int node)
|
|||
uint32_t *reset_gpio;
|
||||
int pwren_gpiolen, reset_gpiolen;
|
||||
uint32_t stat;
|
||||
int port, timo;
|
||||
int idx, port, timo;
|
||||
|
||||
if (OF_getprop(node, "status", status, sizeof(status)) > 0 &&
|
||||
strcmp(status, "disabled") == 0)
|
||||
|
@ -465,6 +469,12 @@ aplpcie_init_port(struct aplpcie_softc *sc, int node)
|
|||
PWRITE4(sc, port, PCIE_PORT_MSI_REMAP, 0);
|
||||
PWRITE4(sc, port, PCIE_PORT_MSI_DOORBELL, sc->sc_msi_doorbell);
|
||||
|
||||
/*
|
||||
* Clear stream ID mappings.
|
||||
*/
|
||||
for (idx = 0; idx < 16; idx++)
|
||||
PWRITE4(sc, port, PCIE_PORT_RID2SID(idx), 0);
|
||||
|
||||
/* Check if the link is already up. */
|
||||
stat = PREAD4(sc, port, PCIE_PORT_LINK_STAT);
|
||||
if (stat & PCIE_PORT_LINK_STAT_UP)
|
||||
|
@ -748,15 +758,75 @@ aplpcie_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data)
|
|||
HWRITE4(sc, tag | reg, data);
|
||||
}
|
||||
|
||||
int
|
||||
aplpcie_find_port(struct aplpcie_softc *sc, int bus)
|
||||
{
|
||||
uint32_t bus_range[2];
|
||||
uint32_t reg[5];
|
||||
int node;
|
||||
|
||||
for (node = OF_child(sc->sc_node); node; node = OF_peer(node)) {
|
||||
/* Check if bus is in the range for this node. */
|
||||
if (OF_getpropintarray(node, "bus-range", bus_range,
|
||||
sizeof(bus_range)) != sizeof(bus_range))
|
||||
continue;
|
||||
if (bus < bus_range[0] || bus > bus_range[1])
|
||||
continue;
|
||||
|
||||
if (OF_getpropintarray(node, "reg", reg,
|
||||
sizeof(reg)) != sizeof(reg))
|
||||
continue;
|
||||
return reg[0] >> 11;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
aplpcie_probe_device_hook(void *v, struct pci_attach_args *pa)
|
||||
{
|
||||
struct aplpcie_softc *sc = v;
|
||||
uint32_t phandle, reg, sid;
|
||||
uint16_t rid;
|
||||
int idx, port;
|
||||
|
||||
rid = pci_requester_id(pa->pa_pc, pa->pa_tag);
|
||||
pa->pa_dmat = iommu_device_map_pci(sc->sc_node, rid, pa->pa_dmat);
|
||||
if (iommu_device_lookup_pci(sc->sc_node, rid, &phandle, &sid))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Create a stream ID mapping for this device. The mappings
|
||||
* are per-port so we first need to find the port for this
|
||||
* device. Then we find a free mapping slot to enter the
|
||||
* mapping. If we run out of mappings, we print a warning; as
|
||||
* long as the device doesn't do DMA, it will still work.
|
||||
*/
|
||||
|
||||
port = aplpcie_find_port(sc, pa->pa_bus);
|
||||
if (port == -1)
|
||||
return EINVAL;
|
||||
|
||||
for (idx = 0; idx < 16; idx++) {
|
||||
reg = PREAD4(sc, port, PCIE_PORT_RID2SID(idx));
|
||||
|
||||
/* If already mapped, we're done. */
|
||||
if ((reg & PCIE_PORT_RID2SID_RID_MASK) == rid)
|
||||
return 0;
|
||||
|
||||
/* Is this an empty slot? */
|
||||
if (reg & PCIE_PORT_RID2SID_VALID)
|
||||
continue;
|
||||
|
||||
/* Map using this slot. */
|
||||
reg = (sid << PCIE_PORT_RID2SID_SID_SHIFT) | rid |
|
||||
PCIE_PORT_RID2SID_VALID;
|
||||
PWRITE4(sc, port, PCIE_PORT_RID2SID(idx), reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("%s: out of stream ID mapping slots\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: simplebus.c,v 1.17 2023/07/19 20:26:11 kettenis Exp $ */
|
||||
/* $OpenBSD: simplebus.c,v 1.18 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
||||
|
@ -26,8 +26,8 @@
|
|||
#include <dev/ofw/fdt.h>
|
||||
#include <dev/ofw/ofw_misc.h>
|
||||
|
||||
#include <arm64/fdt.h>
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/fdt.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
int simplebus_match(struct device *, void *, void *);
|
||||
void simplebus_attach(struct device *, struct device *, void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: simplebusvar.h,v 1.3 2019/04/16 13:15:31 kettenis Exp $ */
|
||||
/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: exdwusb.c,v 1.5 2021/10/24 17:52:27 mpi Exp $ */
|
||||
/* $OpenBSD: exdwusb.c,v 1.6 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -19,8 +19,7 @@
|
|||
#include <sys/device.h>
|
||||
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: expower.c,v 1.10 2021/10/24 17:52:27 mpi Exp $ */
|
||||
/* $OpenBSD: expower.c,v 1.11 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
||||
|
@ -26,7 +26,7 @@
|
|||
#include <dev/ofw/ofw_misc.h>
|
||||
#include <dev/ofw/fdt.h>
|
||||
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#define HREAD4(sc, reg) \
|
||||
(bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg)))
|
||||
|
|
3
sys/arch/armv7/include/simplebusvar.h
Normal file
3
sys/arch/armv7/include/simplebusvar.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* $OpenBSD: simplebusvar.h,v 1.1 2023/09/22 01:10:43 jsg Exp $ */
|
||||
|
||||
#include <arm/simplebusvar.h>
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: mvmbus.c,v 1.4 2021/10/24 17:52:27 mpi Exp $ */
|
||||
/* $OpenBSD: mvmbus.c,v 1.5 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
#include <armv7/marvell/mvmbusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: omcm.c,v 1.3 2022/04/06 18:59:26 naddy Exp $ */
|
||||
/* $OpenBSD: omcm.c,v 1.4 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
struct omcm_softc {
|
||||
struct simplebus_softc sc_bus;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: omsysc.c,v 1.3 2022/04/06 18:59:26 naddy Exp $ */
|
||||
/* $OpenBSD: omsysc.c,v 1.4 2023/09/22 01:10:43 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -24,7 +24,7 @@
|
|||
#include <dev/ofw/ofw_clock.h>
|
||||
#include <dev/ofw/fdt.h>
|
||||
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
struct omsysc_softc {
|
||||
struct simplebus_softc sc_bus;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: GENERIC,v 1.289 2023/08/11 02:35:38 dlg Exp $
|
||||
# $OpenBSD: GENERIC,v 1.290 2023/09/27 15:18:31 deraadt Exp $
|
||||
#
|
||||
# Machine-independent option; used by all architectures for their
|
||||
# GENERIC kernel
|
||||
|
@ -16,7 +16,7 @@ option KMEMSTATS # collect malloc(9) statistics
|
|||
option PTRACE # ptrace(2) system call
|
||||
|
||||
#option KVA_GUARDPAGES # slow virtual address recycling (+ guarding)
|
||||
option POOL_DEBUG # pool corruption detection
|
||||
#option POOL_DEBUG # pool corruption detection
|
||||
#option VFSLCKDEBUG # VFS locking checks
|
||||
|
||||
option CRYPTO # Cryptographic framework
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh -
|
||||
#
|
||||
# $OpenBSD: newvers.sh,v 1.196 2023/09/18 13:16:13 deraadt Exp $
|
||||
# $OpenBSD: newvers.sh,v 1.197 2023/09/26 13:27:32 deraadt Exp $
|
||||
# $NetBSD: newvers.sh,v 1.17.2.1 1995/10/12 05:17:11 jtc Exp $
|
||||
#
|
||||
# Copyright (c) 1984, 1986, 1990, 1993
|
||||
|
@ -71,10 +71,10 @@ ost="SecBSD"
|
|||
osr="1.4"
|
||||
|
||||
cat >vers.c <<eof
|
||||
#define STATUS "-beta" /* just before a release */
|
||||
#define STATUS "" /* release */
|
||||
#if 0
|
||||
#define STATUS "-current" /* just after a release */
|
||||
#define STATUS "" /* release */
|
||||
#define STATUS "-beta" /* just before a release */
|
||||
#define STATUS "-stable" /* stable branch */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: amldwusb.c,v 1.4 2021/10/24 17:52:26 mpi Exp $ */
|
||||
/* $OpenBSD: amldwusb.c,v 1.5 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2019 Mark kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -22,8 +22,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dwpcie.c,v 1.49 2023/05/03 15:25:25 jsg Exp $ */
|
||||
/* $OpenBSD: dwpcie.c,v 1.50 2023/09/21 19:39:41 patrick Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -1601,10 +1601,40 @@ dwpcie_bus_maxdevs(void *v, int bus)
|
|||
return 32;
|
||||
}
|
||||
|
||||
int
|
||||
dwpcie_find_node(int node, int bus, int device, int function)
|
||||
{
|
||||
uint32_t reg[5];
|
||||
uint32_t phys_hi;
|
||||
int child;
|
||||
|
||||
phys_hi = ((bus << 16) | (device << 11) | (function << 8));
|
||||
|
||||
for (child = OF_child(node); child; child = OF_peer(child)) {
|
||||
if (OF_getpropintarray(child, "reg",
|
||||
reg, sizeof(reg)) != sizeof(reg))
|
||||
continue;
|
||||
|
||||
if (reg[0] == phys_hi)
|
||||
return child;
|
||||
|
||||
node = dwpcie_find_node(child, bus, device, function);
|
||||
if (node)
|
||||
return node;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pcitag_t
|
||||
dwpcie_make_tag(void *v, int bus, int device, int function)
|
||||
{
|
||||
return ((bus << 24) | (device << 19) | (function << 16));
|
||||
struct dwpcie_softc *sc = v;
|
||||
int node;
|
||||
|
||||
node = dwpcie_find_node(sc->sc_node, bus, device, function);
|
||||
return (((pcitag_t)node << 32) |
|
||||
(bus << 24) | (device << 19) | (function << 16));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1635,17 +1665,19 @@ dwpcie_conf_read(void *v, pcitag_t tag, int reg)
|
|||
if (bus == sc->sc_bus) {
|
||||
KASSERT(dev == 0);
|
||||
tag = dwpcie_make_tag(sc, 0, dev, fn);
|
||||
return HREAD4(sc, tag | reg);
|
||||
return HREAD4(sc, PCITAG_OFFSET(tag) | reg);
|
||||
}
|
||||
|
||||
if (bus == sc->sc_bus + 1) {
|
||||
dwpcie_atu_config(sc, IATU_VIEWPORT_INDEX1,
|
||||
IATU_REGION_CTRL_1_TYPE_CFG0,
|
||||
sc->sc_conf_base, tag, sc->sc_conf_size);
|
||||
sc->sc_conf_base, PCITAG_OFFSET(tag),
|
||||
sc->sc_conf_size);
|
||||
} else {
|
||||
dwpcie_atu_config(sc, IATU_VIEWPORT_INDEX1,
|
||||
IATU_REGION_CTRL_1_TYPE_CFG1,
|
||||
sc->sc_conf_base, tag, sc->sc_conf_size);
|
||||
sc->sc_conf_base, PCITAG_OFFSET(tag),
|
||||
sc->sc_conf_size);
|
||||
}
|
||||
|
||||
ret = bus_space_read_4(sc->sc_iot, sc->sc_conf_ioh, reg);
|
||||
|
@ -1669,18 +1701,20 @@ dwpcie_conf_write(void *v, pcitag_t tag, int reg, pcireg_t data)
|
|||
if (bus == sc->sc_bus) {
|
||||
KASSERT(dev == 0);
|
||||
tag = dwpcie_make_tag(sc, 0, dev, fn);
|
||||
HWRITE4(sc, tag | reg, data);
|
||||
HWRITE4(sc, PCITAG_OFFSET(tag) | reg, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bus == sc->sc_bus + 1) {
|
||||
dwpcie_atu_config(sc, IATU_VIEWPORT_INDEX1,
|
||||
IATU_REGION_CTRL_1_TYPE_CFG0,
|
||||
sc->sc_conf_base, tag, sc->sc_conf_size);
|
||||
sc->sc_conf_base, PCITAG_OFFSET(tag),
|
||||
sc->sc_conf_size);
|
||||
} else {
|
||||
dwpcie_atu_config(sc, IATU_VIEWPORT_INDEX1,
|
||||
IATU_REGION_CTRL_1_TYPE_CFG1,
|
||||
sc->sc_conf_base, tag, sc->sc_conf_size);
|
||||
sc->sc_conf_base, PCITAG_OFFSET(tag),
|
||||
sc->sc_conf_size);
|
||||
}
|
||||
|
||||
bus_space_write_4(sc->sc_iot, sc->sc_conf_ioh, reg, data);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: hidwusb.c,v 1.3 2021/10/24 17:52:26 mpi Exp $ */
|
||||
/* $OpenBSD: hidwusb.c,v 1.4 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017, 2018 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -21,8 +21,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: imxdwusb.c,v 1.5 2022/04/06 18:59:28 naddy Exp $ */
|
||||
/* $OpenBSD: imxdwusb.c,v 1.6 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017, 2018 Mark Kettenis <kettenis@openbsd.org>
|
||||
* Copyright (c) 2020 Patrick Wildt <patrick@blueri.se>
|
||||
|
@ -22,8 +22,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: mvmdio.c,v 1.4 2021/10/24 17:52:26 mpi Exp $ */
|
||||
/* $OpenBSD: mvmdio.c,v 1.5 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/* $NetBSD: if_mvneta.c,v 1.41 2015/04/15 10:15:40 hsuenaga Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
|
||||
|
@ -35,12 +35,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#ifdef __armv7__
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#else
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#endif
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: qcdwusb.c,v 1.1 2022/11/06 12:12:45 patrick Exp $ */
|
||||
/* $OpenBSD: qcdwusb.c,v 1.2 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017, 2018 Mark Kettenis <kettenis@openbsd.org>
|
||||
* Copyright (c) 2020, 2022 Patrick Wildt <patrick@blueri.se>
|
||||
|
@ -22,8 +22,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rkdwusb.c,v 1.4 2021/10/24 17:52:26 mpi Exp $ */
|
||||
/* $OpenBSD: rkdwusb.c,v 1.5 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -21,8 +21,7 @@
|
|||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/fdt.h>
|
||||
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_clock.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rkgrf.c,v 1.6 2023/04/06 19:02:29 kettenis Exp $ */
|
||||
/* $OpenBSD: rkgrf.c,v 1.7 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -27,11 +27,7 @@
|
|||
#include <dev/ofw/ofw_misc.h>
|
||||
#include <dev/ofw/fdt.h>
|
||||
|
||||
#ifdef __armv7__
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#else
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#endif
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
struct rkgrf_softc {
|
||||
struct simplebus_softc sc_sbus;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: rkpinctrl.c,v 1.13 2023/06/21 01:10:17 jsg Exp $ */
|
||||
/* $OpenBSD: rkpinctrl.c,v 1.14 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017, 2018 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
|
@ -29,11 +29,7 @@
|
|||
#include <dev/ofw/ofw_pinctrl.h>
|
||||
#include <dev/ofw/fdt.h>
|
||||
|
||||
#ifdef __armv7__
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#else
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#endif
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
/* Pin numbers (from devicetree bindings) */
|
||||
#define RK_PA0 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: syscon.c,v 1.7 2021/10/24 17:52:27 mpi Exp $ */
|
||||
/* $OpenBSD: syscon.c,v 1.8 2023/09/22 01:10:44 jsg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017 Mark Kettenis
|
||||
*
|
||||
|
@ -26,13 +26,7 @@
|
|||
#include <dev/ofw/ofw_misc.h>
|
||||
#include <dev/ofw/fdt.h>
|
||||
|
||||
#ifdef __armv7__
|
||||
#include <arm/simplebus/simplebusvar.h>
|
||||
#elif defined(__riscv64__)
|
||||
#include <riscv64/dev/simplebusvar.h>
|
||||
#else
|
||||
#include <arm64/dev/simplebusvar.h>
|
||||
#endif
|
||||
#include <machine/simplebusvar.h>
|
||||
|
||||
extern void (*cpuresetfn)(void);
|
||||
extern void (*powerdownfn)(void);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: hotplug.c,v 1.23 2023/09/08 20:00:27 mvs Exp $ */
|
||||
/* $OpenBSD: hotplug.c,v 1.24 2023/09/22 22:12:32 mvs Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
|
||||
*
|
||||
|
@ -22,27 +22,39 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/hotplug.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/selinfo.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#define HOTPLUG_MAXEVENTS 64
|
||||
|
||||
/*
|
||||
* Locks used to protect struct members and global data
|
||||
* M hotplug_mtx
|
||||
*/
|
||||
|
||||
static struct mutex hotplug_mtx = MUTEX_INITIALIZER(IPL_MPFLOOR);
|
||||
|
||||
static int opened;
|
||||
static struct hotplug_event evqueue[HOTPLUG_MAXEVENTS];
|
||||
static int evqueue_head, evqueue_tail, evqueue_count;
|
||||
static struct selinfo hotplug_sel;
|
||||
static int evqueue_head, evqueue_tail, evqueue_count; /* [M] */
|
||||
static struct klist hotplug_klist; /* [M] */
|
||||
|
||||
void filt_hotplugrdetach(struct knote *);
|
||||
int filt_hotplugread(struct knote *, long);
|
||||
int filt_hotplugmodify(struct kevent *, struct knote *);
|
||||
int filt_hotplugprocess(struct knote *, struct kevent *);
|
||||
|
||||
const struct filterops hotplugread_filtops = {
|
||||
.f_flags = FILTEROP_ISFD,
|
||||
.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
|
||||
.f_attach = NULL,
|
||||
.f_detach = filt_hotplugrdetach,
|
||||
.f_event = filt_hotplugread,
|
||||
.f_modify = filt_hotplugmodify,
|
||||
.f_process = filt_hotplugprocess,
|
||||
};
|
||||
|
||||
#define EVQUEUE_NEXT(p) (p == HOTPLUG_MAXEVENTS - 1 ? 0 : p + 1)
|
||||
|
@ -60,6 +72,8 @@ hotplugattach(int count)
|
|||
evqueue_head = 0;
|
||||
evqueue_tail = 0;
|
||||
evqueue_count = 0;
|
||||
|
||||
klist_init_mutex(&hotplug_klist, &hotplug_mtx);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -87,7 +101,9 @@ hotplug_device_detach(enum devclass class, char *name)
|
|||
int
|
||||
hotplug_put_event(struct hotplug_event *he)
|
||||
{
|
||||
mtx_enter(&hotplug_mtx);
|
||||
if (evqueue_count == HOTPLUG_MAXEVENTS && opened) {
|
||||
mtx_leave(&hotplug_mtx);
|
||||
printf("hotplug: event lost, queue full\n");
|
||||
return (1);
|
||||
}
|
||||
|
@ -98,24 +114,21 @@ hotplug_put_event(struct hotplug_event *he)
|
|||
evqueue_tail = EVQUEUE_NEXT(evqueue_tail);
|
||||
else
|
||||
evqueue_count++;
|
||||
knote_locked(&hotplug_klist, 0);
|
||||
wakeup(&evqueue);
|
||||
selwakeup(&hotplug_sel);
|
||||
mtx_leave(&hotplug_mtx);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
hotplug_get_event(struct hotplug_event *he)
|
||||
{
|
||||
int s;
|
||||
|
||||
if (evqueue_count == 0)
|
||||
return (1);
|
||||
|
||||
s = splbio();
|
||||
*he = evqueue[evqueue_tail];
|
||||
evqueue_tail = EVQUEUE_NEXT(evqueue_tail);
|
||||
evqueue_count--;
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -137,8 +150,11 @@ hotplugclose(dev_t dev, int flag, int mode, struct proc *p)
|
|||
{
|
||||
struct hotplug_event he;
|
||||
|
||||
mtx_enter(&hotplug_mtx);
|
||||
while (hotplug_get_event(&he) == 0)
|
||||
continue;
|
||||
mtx_leave(&hotplug_mtx);
|
||||
klist_invalidate(&hotplug_klist);
|
||||
opened = 0;
|
||||
return (0);
|
||||
}
|
||||
|
@ -152,16 +168,23 @@ hotplugread(dev_t dev, struct uio *uio, int flags)
|
|||
if (uio->uio_resid != sizeof(he))
|
||||
return (EINVAL);
|
||||
|
||||
again:
|
||||
if (hotplug_get_event(&he) == 0)
|
||||
return (uiomove(&he, sizeof(he), uio));
|
||||
if (flags & IO_NDELAY)
|
||||
mtx_enter(&hotplug_mtx);
|
||||
while (hotplug_get_event(&he)) {
|
||||
if (flags & IO_NDELAY) {
|
||||
mtx_leave(&hotplug_mtx);
|
||||
return (EAGAIN);
|
||||
}
|
||||
|
||||
error = tsleep_nsec(&evqueue, PRIBIO | PCATCH, "htplev", INFSLP);
|
||||
if (error)
|
||||
error = msleep_nsec(&evqueue, &hotplug_mtx, PRIBIO | PCATCH,
|
||||
"htplev", INFSLP);
|
||||
if (error) {
|
||||
mtx_leave(&hotplug_mtx);
|
||||
return (error);
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
mtx_leave(&hotplug_mtx);
|
||||
|
||||
return (uiomove(&he, sizeof(he), uio));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -183,32 +206,22 @@ hotplugioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
int
|
||||
hotplugkqfilter(dev_t dev, struct knote *kn)
|
||||
{
|
||||
struct klist *klist;
|
||||
int s;
|
||||
|
||||
switch (kn->kn_filter) {
|
||||
case EVFILT_READ:
|
||||
klist = &hotplug_sel.si_note;
|
||||
kn->kn_fop = &hotplugread_filtops;
|
||||
break;
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
s = splbio();
|
||||
klist_insert_locked(klist, kn);
|
||||
splx(s);
|
||||
klist_insert(&hotplug_klist, kn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
filt_hotplugrdetach(struct knote *kn)
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splbio();
|
||||
klist_remove_locked(&hotplug_sel.si_note, kn);
|
||||
splx(s);
|
||||
klist_remove(&hotplug_klist, kn);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -218,3 +231,27 @@ filt_hotplugread(struct knote *kn, long hint)
|
|||
|
||||
return (evqueue_count > 0);
|
||||
}
|
||||
|
||||
int
|
||||
filt_hotplugmodify(struct kevent *kev, struct knote *kn)
|
||||
{
|
||||
int active;
|
||||
|
||||
mtx_enter(&hotplug_mtx);
|
||||
active = knote_modify(kev, kn);
|
||||
mtx_leave(&hotplug_mtx);
|
||||
|
||||
return (active);
|
||||
}
|
||||
|
||||
int
|
||||
filt_hotplugprocess(struct knote *kn, struct kevent *kev)
|
||||
{
|
||||
int active;
|
||||
|
||||
mtx_enter(&hotplug_mtx);
|
||||
active = knote_process(kn, kev);
|
||||
mtx_leave(&hotplug_mtx);
|
||||
|
||||
return (active);
|
||||
}
|
||||
|
|
133
sys/dev/midi.c
133
sys/dev/midi.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: midi.c,v 1.55 2022/07/02 08:50:41 visa Exp $ */
|
||||
/* $OpenBSD: midi.c,v 1.56 2023/09/26 19:55:24 mvs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Alexandre Ratchov
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <dev/audio_if.h>
|
||||
#include <dev/midivar.h>
|
||||
|
||||
#define IPL_SOFTMIDI IPL_SOFTNET
|
||||
#define DEVNAME(sc) ((sc)->dev.dv_xname)
|
||||
|
||||
int midiopen(dev_t, int, int, struct proc *);
|
||||
|
@ -65,41 +64,38 @@ struct cfdriver midi_cd = {
|
|||
|
||||
void filt_midiwdetach(struct knote *);
|
||||
int filt_midiwrite(struct knote *, long);
|
||||
int filt_midimodify(struct kevent *, struct knote *);
|
||||
int filt_midiprocess(struct knote *, struct kevent *);
|
||||
|
||||
const struct filterops midiwrite_filtops = {
|
||||
.f_flags = FILTEROP_ISFD,
|
||||
.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
|
||||
.f_attach = NULL,
|
||||
.f_detach = filt_midiwdetach,
|
||||
.f_event = filt_midiwrite,
|
||||
.f_modify = filt_midimodify,
|
||||
.f_process = filt_midiprocess,
|
||||
};
|
||||
|
||||
void filt_midirdetach(struct knote *);
|
||||
int filt_midiread(struct knote *, long);
|
||||
|
||||
const struct filterops midiread_filtops = {
|
||||
.f_flags = FILTEROP_ISFD,
|
||||
.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
|
||||
.f_attach = NULL,
|
||||
.f_detach = filt_midirdetach,
|
||||
.f_event = filt_midiread,
|
||||
.f_modify = filt_midimodify,
|
||||
.f_process = filt_midiprocess,
|
||||
};
|
||||
|
||||
void
|
||||
midi_buf_wakeup(void *addr)
|
||||
midi_buf_wakeup(struct midi_buffer *buf)
|
||||
{
|
||||
struct midi_buffer *buf = addr;
|
||||
|
||||
if (buf->blocking) {
|
||||
wakeup(&buf->blocking);
|
||||
buf->blocking = 0;
|
||||
}
|
||||
/*
|
||||
* As long as selwakeup() grabs the KERNEL_LOCK() make sure it is
|
||||
* already held here to avoid lock ordering problems with `audio_lock'
|
||||
*/
|
||||
KERNEL_ASSERT_LOCKED();
|
||||
mtx_enter(&audio_lock);
|
||||
selwakeup(&buf->sel);
|
||||
mtx_leave(&audio_lock);
|
||||
knote_locked(&buf->klist, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -117,13 +113,7 @@ midi_iintr(void *addr, int data)
|
|||
|
||||
MIDIBUF_WRITE(mb, data);
|
||||
|
||||
/*
|
||||
* As long as selwakeup() needs to be protected by the
|
||||
* KERNEL_LOCK() we have to delay the wakeup to another
|
||||
* context to keep the interrupt context KERNEL_LOCK()
|
||||
* free.
|
||||
*/
|
||||
softintr_schedule(sc->inbuf.softintr);
|
||||
midi_buf_wakeup(mb);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -226,14 +216,7 @@ void
|
|||
midi_out_stop(struct midi_softc *sc)
|
||||
{
|
||||
sc->isbusy = 0;
|
||||
|
||||
/*
|
||||
* As long as selwakeup() needs to be protected by the
|
||||
* KERNEL_LOCK() we have to delay the wakeup to another
|
||||
* context to keep the interrupt context KERNEL_LOCK()
|
||||
* free.
|
||||
*/
|
||||
softintr_schedule(sc->outbuf.softintr);
|
||||
midi_buf_wakeup(&sc->outbuf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -342,11 +325,11 @@ midikqfilter(dev_t dev, struct knote *kn)
|
|||
error = 0;
|
||||
switch (kn->kn_filter) {
|
||||
case EVFILT_READ:
|
||||
klist = &sc->inbuf.sel.si_note;
|
||||
klist = &sc->inbuf.klist;
|
||||
kn->kn_fop = &midiread_filtops;
|
||||
break;
|
||||
case EVFILT_WRITE:
|
||||
klist = &sc->outbuf.sel.si_note;
|
||||
klist = &sc->outbuf.klist;
|
||||
kn->kn_fop = &midiwrite_filtops;
|
||||
break;
|
||||
default:
|
||||
|
@ -355,9 +338,7 @@ midikqfilter(dev_t dev, struct knote *kn)
|
|||
}
|
||||
kn->kn_hook = (void *)sc;
|
||||
|
||||
mtx_enter(&audio_lock);
|
||||
klist_insert_locked(klist, kn);
|
||||
mtx_leave(&audio_lock);
|
||||
klist_insert(klist, kn);
|
||||
done:
|
||||
device_unref(&sc->dev);
|
||||
return error;
|
||||
|
@ -368,24 +349,15 @@ filt_midirdetach(struct knote *kn)
|
|||
{
|
||||
struct midi_softc *sc = (struct midi_softc *)kn->kn_hook;
|
||||
|
||||
mtx_enter(&audio_lock);
|
||||
klist_remove_locked(&sc->inbuf.sel.si_note, kn);
|
||||
mtx_leave(&audio_lock);
|
||||
klist_remove(&sc->inbuf.klist, kn);
|
||||
}
|
||||
|
||||
int
|
||||
filt_midiread(struct knote *kn, long hint)
|
||||
{
|
||||
struct midi_softc *sc = (struct midi_softc *)kn->kn_hook;
|
||||
int retval;
|
||||
|
||||
if ((hint & NOTE_SUBMIT) == 0)
|
||||
mtx_enter(&audio_lock);
|
||||
retval = !MIDIBUF_ISEMPTY(&sc->inbuf);
|
||||
if ((hint & NOTE_SUBMIT) == 0)
|
||||
mtx_leave(&audio_lock);
|
||||
|
||||
return (retval);
|
||||
return (!MIDIBUF_ISEMPTY(&sc->inbuf));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -393,24 +365,39 @@ filt_midiwdetach(struct knote *kn)
|
|||
{
|
||||
struct midi_softc *sc = (struct midi_softc *)kn->kn_hook;
|
||||
|
||||
mtx_enter(&audio_lock);
|
||||
klist_remove_locked(&sc->outbuf.sel.si_note, kn);
|
||||
mtx_leave(&audio_lock);
|
||||
klist_remove(&sc->outbuf.klist, kn);
|
||||
}
|
||||
|
||||
int
|
||||
filt_midiwrite(struct knote *kn, long hint)
|
||||
{
|
||||
struct midi_softc *sc = (struct midi_softc *)kn->kn_hook;
|
||||
int retval;
|
||||
|
||||
if ((hint & NOTE_SUBMIT) == 0)
|
||||
return (!MIDIBUF_ISFULL(&sc->outbuf));
|
||||
}
|
||||
|
||||
int
|
||||
filt_midimodify(struct kevent *kev, struct knote *kn)
|
||||
{
|
||||
int active;
|
||||
|
||||
mtx_enter(&audio_lock);
|
||||
retval = !MIDIBUF_ISFULL(&sc->outbuf);
|
||||
if ((hint & NOTE_SUBMIT) == 0)
|
||||
active = knote_modify(kev, kn);
|
||||
mtx_leave(&audio_lock);
|
||||
|
||||
return (retval);
|
||||
return active;
|
||||
}
|
||||
|
||||
int
|
||||
filt_midiprocess(struct knote *kn, struct kevent *kev)
|
||||
{
|
||||
int active;
|
||||
|
||||
mtx_enter(&audio_lock);
|
||||
active = knote_process(kn, kev);
|
||||
mtx_leave(&audio_lock);
|
||||
|
||||
return active;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -531,20 +518,8 @@ midiattach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
#endif
|
||||
|
||||
sc->inbuf.softintr = softintr_establish(IPL_SOFTMIDI,
|
||||
midi_buf_wakeup, &sc->inbuf);
|
||||
if (sc->inbuf.softintr == NULL) {
|
||||
printf("%s: can't establish input softintr\n", DEVNAME(sc));
|
||||
return;
|
||||
}
|
||||
|
||||
sc->outbuf.softintr = softintr_establish(IPL_SOFTMIDI,
|
||||
midi_buf_wakeup, &sc->outbuf);
|
||||
if (sc->outbuf.softintr == NULL) {
|
||||
printf("%s: can't establish output softintr\n", DEVNAME(sc));
|
||||
softintr_disestablish(sc->inbuf.softintr);
|
||||
return;
|
||||
}
|
||||
klist_init_mutex(&sc->inbuf.klist, &audio_lock);
|
||||
klist_init_mutex(&sc->outbuf.klist, &audio_lock);
|
||||
|
||||
sc->hw_if = hwif;
|
||||
sc->hw_hdl = hdl;
|
||||
|
@ -578,29 +553,19 @@ mididetach(struct device *self, int flags)
|
|||
*/
|
||||
if (sc->flags) {
|
||||
KERNEL_ASSERT_LOCKED();
|
||||
if (sc->flags & FREAD) {
|
||||
if (sc->flags & FREAD)
|
||||
wakeup(&sc->inbuf.blocking);
|
||||
mtx_enter(&audio_lock);
|
||||
selwakeup(&sc->inbuf.sel);
|
||||
mtx_leave(&audio_lock);
|
||||
}
|
||||
if (sc->flags & FWRITE) {
|
||||
if (sc->flags & FWRITE)
|
||||
wakeup(&sc->outbuf.blocking);
|
||||
mtx_enter(&audio_lock);
|
||||
selwakeup(&sc->outbuf.sel);
|
||||
mtx_leave(&audio_lock);
|
||||
}
|
||||
sc->hw_if->close(sc->hw_hdl);
|
||||
sc->flags = 0;
|
||||
}
|
||||
|
||||
klist_invalidate(&sc->inbuf.sel.si_note);
|
||||
klist_invalidate(&sc->outbuf.sel.si_note);
|
||||
klist_invalidate(&sc->inbuf.klist);
|
||||
klist_invalidate(&sc->outbuf.klist);
|
||||
klist_free(&sc->inbuf.klist);
|
||||
klist_free(&sc->outbuf.klist);
|
||||
|
||||
if (sc->inbuf.softintr)
|
||||
softintr_disestablish(sc->inbuf.softintr);
|
||||
if (sc->outbuf.softintr)
|
||||
softintr_disestablish(sc->outbuf.softintr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: midivar.h,v 1.13 2022/03/21 19:22:40 miod Exp $ */
|
||||
/* $OpenBSD: midivar.h,v 1.14 2023/09/26 19:55:24 mvs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Alexandre Ratchov
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <dev/midi_if.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/selinfo.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/timeout.h>
|
||||
|
||||
|
@ -34,8 +34,7 @@
|
|||
#define MIDIBUF_MASK (MIDIBUF_SIZE - 1)
|
||||
|
||||
struct midi_buffer {
|
||||
void *softintr; /* context to call selwakeup() */
|
||||
struct selinfo sel; /* to record & wakeup poll(2) */
|
||||
struct klist klist; /* to record & wakeup poll(2) */
|
||||
int blocking; /* read/write blocking */
|
||||
unsigned char data[MIDIBUF_SIZE];
|
||||
unsigned start, used;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ofw_misc.h,v 1.30 2023/05/17 23:25:45 patrick Exp $ */
|
||||
/* $OpenBSD: ofw_misc.h,v 1.31 2023/09/21 20:26:17 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017-2021 Mark Kettenis
|
||||
*
|
||||
|
@ -278,6 +278,8 @@ struct iommu_device {
|
|||
};
|
||||
|
||||
void iommu_device_register(struct iommu_device *);
|
||||
int iommu_device_lookup(int, uint32_t *, uint32_t *);
|
||||
int iommu_device_lookup_pci(int, uint32_t, uint32_t *, uint32_t *);
|
||||
bus_dma_tag_t iommu_device_map(int, bus_dma_tag_t);
|
||||
bus_dma_tag_t iommu_device_map_pci(int, uint32_t, bus_dma_tag_t);
|
||||
void iommu_reserve_region_pci(int, uint32_t, bus_addr_t, bus_size_t);
|
||||
|
|
|
@ -1295,7 +1295,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
|
|||
void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
|
||||
int amdgpu_device_pci_reset(struct amdgpu_device *adev);
|
||||
bool amdgpu_device_need_post(struct amdgpu_device *adev);
|
||||
bool amdgpu_sg_display_supported(struct amdgpu_device *adev);
|
||||
bool amdgpu_device_pcie_dynamic_switching_supported(void);
|
||||
bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
|
||||
bool amdgpu_device_aspm_support_quirk(void);
|
||||
|
|
|
@ -120,7 +120,6 @@ static int amdgpu_cs_p1_user_fence(struct amdgpu_cs_parser *p,
|
|||
struct drm_gem_object *gobj;
|
||||
struct amdgpu_bo *bo;
|
||||
unsigned long size;
|
||||
int r;
|
||||
|
||||
gobj = drm_gem_object_lookup(p->filp, data->handle);
|
||||
if (gobj == NULL)
|
||||
|
@ -132,23 +131,14 @@ static int amdgpu_cs_p1_user_fence(struct amdgpu_cs_parser *p,
|
|||
drm_gem_object_put(gobj);
|
||||
|
||||
size = amdgpu_bo_size(bo);
|
||||
if (size != PAGE_SIZE || (data->offset + 8) > size) {
|
||||
r = -EINVAL;
|
||||
goto error_unref;
|
||||
}
|
||||
if (size != PAGE_SIZE || data->offset > (size - 8))
|
||||
return -EINVAL;
|
||||
|
||||
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
|
||||
r = -EINVAL;
|
||||
goto error_unref;
|
||||
}
|
||||
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm))
|
||||
return -EINVAL;
|
||||
|
||||
*offset = data->offset;
|
||||
|
||||
return 0;
|
||||
|
||||
error_unref:
|
||||
amdgpu_bo_unref(&bo);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int amdgpu_cs_p1_bo_handles(struct amdgpu_cs_parser *p,
|
||||
|
|
|
@ -1354,32 +1354,6 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* On APUs with >= 64GB white flickering has been observed w/ SG enabled.
|
||||
* Disable S/G on such systems until we have a proper fix.
|
||||
* https://gitlab.freedesktop.org/drm/amd/-/issues/2354
|
||||
* https://gitlab.freedesktop.org/drm/amd/-/issues/2735
|
||||
*/
|
||||
bool amdgpu_sg_display_supported(struct amdgpu_device *adev)
|
||||
{
|
||||
switch (amdgpu_sg_display) {
|
||||
case -1:
|
||||
break;
|
||||
case 0:
|
||||
return false;
|
||||
case 1:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if ((totalram_pages() << (PAGE_SHIFT - 10)) +
|
||||
(adev->gmc.real_vram_size / 1024) >= 64000000) {
|
||||
DRM_WARN("Disabling S/G due to >=64GB RAM\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
|
||||
* speed switching. Until we have confirmation from Intel that a specific host
|
||||
|
|
|
@ -1267,11 +1267,15 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_
|
|||
|
||||
pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
|
||||
|
||||
page_table_start.high_part = (u32)(adev->gmc.gart_start >> 44) & 0xF;
|
||||
page_table_start.low_part = (u32)(adev->gmc.gart_start >> 12);
|
||||
page_table_end.high_part = (u32)(adev->gmc.gart_end >> 44) & 0xF;
|
||||
page_table_end.low_part = (u32)(adev->gmc.gart_end >> 12);
|
||||
page_table_base.high_part = upper_32_bits(pt_base) & 0xF;
|
||||
page_table_start.high_part = upper_32_bits(adev->gmc.gart_start >>
|
||||
AMDGPU_GPU_PAGE_SHIFT);
|
||||
page_table_start.low_part = lower_32_bits(adev->gmc.gart_start >>
|
||||
AMDGPU_GPU_PAGE_SHIFT);
|
||||
page_table_end.high_part = upper_32_bits(adev->gmc.gart_end >>
|
||||
AMDGPU_GPU_PAGE_SHIFT);
|
||||
page_table_end.low_part = lower_32_bits(adev->gmc.gart_end >>
|
||||
AMDGPU_GPU_PAGE_SHIFT);
|
||||
page_table_base.high_part = upper_32_bits(pt_base);
|
||||
page_table_base.low_part = lower_32_bits(pt_base);
|
||||
|
||||
pa_config->system_aperture.start_addr = (uint64_t)logical_addr_low << 18;
|
||||
|
@ -1636,8 +1640,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (init_data.flags.gpu_vm_support)
|
||||
init_data.flags.gpu_vm_support = amdgpu_sg_display_supported(adev);
|
||||
if (init_data.flags.gpu_vm_support &&
|
||||
(amdgpu_sg_display == 0))
|
||||
init_data.flags.gpu_vm_support = false;
|
||||
|
||||
if (init_data.flags.gpu_vm_support)
|
||||
adev->mode_info.gpu_vm_support = true;
|
||||
|
|
|
@ -290,7 +290,8 @@ static void dccg32_set_dpstreamclk(
|
|||
struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
|
||||
|
||||
/* set the dtbclk_p source */
|
||||
dccg32_set_dtbclk_p_src(dccg, src, otg_inst);
|
||||
/* always program refclk as DTBCLK. No use-case expected to require DPREFCLK as refclk */
|
||||
dccg32_set_dtbclk_p_src(dccg, DTBCLK0, otg_inst);
|
||||
|
||||
/* enabled to select one of the DTBCLKs for pipe */
|
||||
switch (dp_hpo_inst) {
|
||||
|
|
|
@ -4133,7 +4133,9 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|||
}
|
||||
if (v->OutputFormat[k] == dm_420 && v->HActive[k] > DCN31_MAX_FMT_420_BUFFER_WIDTH
|
||||
&& v->ODMCombineEnablePerState[i][k] != dm_odm_combine_mode_4to1) {
|
||||
if (v->HActive[k] / 2 > DCN31_MAX_FMT_420_BUFFER_WIDTH) {
|
||||
if (v->Output[k] == dm_hdmi) {
|
||||
FMTBufferExceeded = true;
|
||||
} else if (v->HActive[k] / 2 > DCN31_MAX_FMT_420_BUFFER_WIDTH) {
|
||||
v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_4to1;
|
||||
v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine4To1;
|
||||
|
||||
|
|
|
@ -4225,7 +4225,9 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
|
|||
}
|
||||
if (v->OutputFormat[k] == dm_420 && v->HActive[k] > DCN314_MAX_FMT_420_BUFFER_WIDTH
|
||||
&& v->ODMCombineEnablePerState[i][k] != dm_odm_combine_mode_4to1) {
|
||||
if (v->HActive[k] / 2 > DCN314_MAX_FMT_420_BUFFER_WIDTH) {
|
||||
if (v->Output[k] == dm_hdmi) {
|
||||
FMTBufferExceeded = true;
|
||||
} else if (v->HActive[k] / 2 > DCN314_MAX_FMT_420_BUFFER_WIDTH) {
|
||||
v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_4to1;
|
||||
v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine4To1;
|
||||
|
||||
|
|
|
@ -3454,6 +3454,7 @@ bool dml32_CalculatePrefetchSchedule(
|
|||
double TimeForFetchingMetaPTE = 0;
|
||||
double TimeForFetchingRowInVBlank = 0;
|
||||
double LinesToRequestPrefetchPixelData = 0;
|
||||
double LinesForPrefetchBandwidth = 0;
|
||||
unsigned int HostVMDynamicLevelsTrips;
|
||||
double trip_to_mem;
|
||||
double Tvm_trips;
|
||||
|
@ -3883,11 +3884,15 @@ bool dml32_CalculatePrefetchSchedule(
|
|||
TimeForFetchingMetaPTE = Tvm_oto;
|
||||
TimeForFetchingRowInVBlank = Tr0_oto;
|
||||
*PrefetchBandwidth = prefetch_bw_oto;
|
||||
/* Clamp to oto for bandwidth calculation */
|
||||
LinesForPrefetchBandwidth = dst_y_prefetch_oto;
|
||||
} else {
|
||||
*DestinationLinesForPrefetch = dst_y_prefetch_equ;
|
||||
TimeForFetchingMetaPTE = Tvm_equ;
|
||||
TimeForFetchingRowInVBlank = Tr0_equ;
|
||||
*PrefetchBandwidth = prefetch_bw_equ;
|
||||
/* Clamp to equ for bandwidth calculation */
|
||||
LinesForPrefetchBandwidth = dst_y_prefetch_equ;
|
||||
}
|
||||
|
||||
*DestinationLinesToRequestVMInVBlank = dml_ceil(4.0 * TimeForFetchingMetaPTE / LineTime, 1.0) / 4.0;
|
||||
|
@ -3895,7 +3900,7 @@ bool dml32_CalculatePrefetchSchedule(
|
|||
*DestinationLinesToRequestRowInVBlank =
|
||||
dml_ceil(4.0 * TimeForFetchingRowInVBlank / LineTime, 1.0) / 4.0;
|
||||
|
||||
LinesToRequestPrefetchPixelData = *DestinationLinesForPrefetch -
|
||||
LinesToRequestPrefetchPixelData = LinesForPrefetchBandwidth -
|
||||
*DestinationLinesToRequestVMInVBlank - 2 * *DestinationLinesToRequestRowInVBlank;
|
||||
|
||||
#ifdef __DML_VBA_DEBUG__
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue