1279315Strasz/*- 2332615Strasz * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3332615Strasz * 4279315Strasz * Copyright (c) 2014 The FreeBSD Foundation 5279315Strasz * All rights reserved. 6279315Strasz * 7279315Strasz * This software was developed by Edward Tomasz Napierala under sponsorship 8279315Strasz * from the FreeBSD Foundation. 9279315Strasz * 10279315Strasz * Redistribution and use in source and binary forms, with or without 11279315Strasz * modification, are permitted provided that the following conditions 12279315Strasz * are met: 13279315Strasz * 1. Redistributions of source code must retain the above copyright 14279315Strasz * notice, this list of conditions and the following disclaimer. 15279315Strasz * 2. Redistributions in binary form must reproduce the above copyright 16279315Strasz * notice, this list of conditions and the following disclaimer in the 17279315Strasz * documentation and/or other materials provided with the distribution. 18279315Strasz * 19279315Strasz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20279315Strasz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21279315Strasz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22279315Strasz * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23279315Strasz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24279315Strasz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25279315Strasz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26279315Strasz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27279315Strasz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28279315Strasz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29279315Strasz * SUCH DAMAGE. 30279315Strasz * 31279315Strasz * $FreeBSD: stable/11/usr.sbin/uefisign/magic.h 332615 2018-04-16 17:13:54Z trasz $ 32279315Strasz * 33279315Strasz */ 34279315Strasz 35279315Strasz/* 36279315Strasz * This file contains Authenticode-specific ASN.1 "configuration", used, 37279315Strasz * after being processed by asprintf(3), as an input to ASN1_generate_nconf(3). 38279315Strasz */ 39279315Straszstatic const char *magic_fmt = 40279315Strasz"asn1 = SEQUENCE:SpcIndirectDataContent\n" 41279315Strasz"\n" 42279315Strasz"[SpcIndirectDataContent]\n" 43279315Strasz"a = SEQUENCE:SpcAttributeTypeAndOptionalValue\n" 44279315Strasz"b = SEQUENCE:DigestInfo\n" 45279315Strasz"\n" 46279315Strasz"[SpcAttributeTypeAndOptionalValue]\n" 47279315Strasz"# SPC_PE_IMAGE_DATAOBJ\n" 48279315Strasz"a = OID:1.3.6.1.4.1.311.2.1.15\n" 49279315Strasz"b = SEQUENCE:SpcPeImageData\n" 50279315Strasz"\n" 51279315Strasz"[SpcPeImageData]\n" 52279315Strasz"a = FORMAT:HEX,BITSTRING:00\n" 53279315Strasz/* 54279315Strasz * Well, there should be some other struct here, "SPCLink", but it doesn't 55289677Seadler * appear to be necessary for UEFI, and I have no idea how to synthesize it, 56279315Strasz * as it uses the CHOICE type. 57279315Strasz */ 58279315Strasz"\n" 59279315Strasz"[DigestInfo]\n" 60279315Strasz"a = SEQUENCE:AlgorithmIdentifier\n" 61279315Strasz/* 62279315Strasz * Here goes the digest computed from PE headers and sections. 63279315Strasz */ 64279315Strasz"b = FORMAT:HEX,OCTETSTRING:%s\n" 65279315Strasz"\n" 66279315Strasz"[AlgorithmIdentifier]\n" 67279315Strasz"a = OBJECT:sha256\n" 68279315Strasz"b = NULL\n"; 69