|
| 1 | +/* Copyright (c) 2021 Avast Software |
| 2 | +
|
| 3 | +Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 4 | +this software and associated documentation files (the "Software"), to deal |
| 5 | +in the Software without restriction, including without limitation the rights to |
| 6 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 7 | +of the Software, and to permit persons to whom the Software is furnished to do |
| 8 | +so, subject to the following conditions: |
| 9 | +
|
| 10 | +The above copyright notice and this permission notice shall be included in all |
| 11 | +copies or substantial portions of the Software. |
| 12 | +
|
| 13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 | +SOFTWARE. |
| 20 | +*/ |
| 21 | + |
| 22 | +#include "structs.h" |
| 23 | + |
| 24 | +ASN1_CHOICE(SpcString) = { |
| 25 | + ASN1_IMP_OPT(SpcString, value.unicode, ASN1_BMPSTRING, 0), |
| 26 | + ASN1_IMP_OPT(SpcString, value.ascii, ASN1_IA5STRING, 1) |
| 27 | +} ASN1_CHOICE_END(SpcString) |
| 28 | + |
| 29 | +ASN1_SEQUENCE(SpcSerializedObject) = { |
| 30 | + ASN1_SIMPLE(SpcSerializedObject, classId, ASN1_OCTET_STRING), |
| 31 | + ASN1_SIMPLE(SpcSerializedObject, serializedData, ASN1_OCTET_STRING) |
| 32 | +} ASN1_SEQUENCE_END(SpcSerializedObject) |
| 33 | + |
| 34 | +ASN1_CHOICE(SpcLink) = { |
| 35 | + ASN1_IMP_OPT(SpcLink, value.url, ASN1_IA5STRING, 0), |
| 36 | + ASN1_IMP_OPT(SpcLink, value.moniker, SpcSerializedObject, 1), |
| 37 | + ASN1_EXP_OPT(SpcLink, value.file, SpcString, 2) |
| 38 | +} ASN1_CHOICE_END(SpcLink) |
| 39 | + |
| 40 | +ASN1_SEQUENCE(SpcAttributeTypeAndOptionalValue) = { |
| 41 | + ASN1_SIMPLE(SpcAttributeTypeAndOptionalValue, type, ASN1_OBJECT), |
| 42 | + ASN1_OPT(SpcAttributeTypeAndOptionalValue, value, ASN1_ANY) |
| 43 | +} ASN1_SEQUENCE_END(SpcAttributeTypeAndOptionalValue) |
| 44 | + |
| 45 | +ASN1_SEQUENCE(SpcPeImageData) = { |
| 46 | + ASN1_SIMPLE(SpcPeImageData, flags, ASN1_BIT_STRING), |
| 47 | + ASN1_EXP_OPT(SpcPeImageData, file, SpcLink, 0) |
| 48 | +} ASN1_SEQUENCE_END(SpcPeImageData) |
| 49 | + |
| 50 | +ASN1_SEQUENCE(AlgorithmIdentifier) = { |
| 51 | + ASN1_SIMPLE(AlgorithmIdentifier, algorithm, ASN1_OBJECT), |
| 52 | + ASN1_OPT(AlgorithmIdentifier, parameters, ASN1_ANY) |
| 53 | +} ASN1_SEQUENCE_END(AlgorithmIdentifier) |
| 54 | + |
| 55 | +ASN1_SEQUENCE(DigestInfo) = { |
| 56 | + ASN1_SIMPLE(DigestInfo, digestAlgorithm, AlgorithmIdentifier), |
| 57 | + ASN1_SIMPLE(DigestInfo, digest, ASN1_OCTET_STRING) |
| 58 | +} ASN1_SEQUENCE_END(DigestInfo) |
| 59 | + |
| 60 | +ASN1_SEQUENCE(SpcIndirectDataContent) = { |
| 61 | + ASN1_SIMPLE(SpcIndirectDataContent, data, SpcAttributeTypeAndOptionalValue), |
| 62 | + ASN1_SIMPLE(SpcIndirectDataContent, messageDigest, DigestInfo) |
| 63 | +} ASN1_SEQUENCE_END(SpcIndirectDataContent) |
| 64 | + |
| 65 | +ASN1_SEQUENCE(SpcSpOpusInfo) = { |
| 66 | + ASN1_EXP_OPT(SpcSpOpusInfo, programName, SpcString, 0), |
| 67 | + ASN1_EXP_OPT(SpcSpOpusInfo, moreInfo, SpcLink, 1) |
| 68 | +} ASN1_SEQUENCE_END(SpcSpOpusInfo) |
| 69 | + |
| 70 | +IMPLEMENT_ASN1_FUNCTIONS(SpcString) |
| 71 | +IMPLEMENT_ASN1_FUNCTIONS(SpcSerializedObject) |
| 72 | +IMPLEMENT_ASN1_FUNCTIONS(SpcLink) |
| 73 | +IMPLEMENT_ASN1_FUNCTIONS(SpcAttributeTypeAndOptionalValue) |
| 74 | +IMPLEMENT_ASN1_FUNCTIONS(SpcPeImageData) |
| 75 | +IMPLEMENT_ASN1_FUNCTIONS(AlgorithmIdentifier) |
| 76 | +IMPLEMENT_ASN1_FUNCTIONS(DigestInfo) |
| 77 | +IMPLEMENT_ASN1_FUNCTIONS(SpcIndirectDataContent) |
| 78 | +IMPLEMENT_ASN1_FUNCTIONS(SpcSpOpusInfo) |
0 commit comments