| 1 | /** |
| 2 | * @file sexp-ID.c |
| 3 | * @brief S-expression object ID functions - implementation |
| 4 | * @author "Daniel Kopecek" <[email protected]> |
| 5 | * |
| 6 | * @addtogroup SEXPRESSIONS |
| 7 | * @{ |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * Copyright 2011 Red Hat Inc., Durham, North Carolina. |
| 12 | * All Rights Reserved. |
| 13 | * |
| 14 | * This library is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU Lesser General Public |
| 16 | * License as published by the Free Software Foundation; either |
| 17 | * version 2.1 of the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This library is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | * Lesser General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU Lesser General Public |
| 25 | * License along with this library; if not, write to the Free Software |
| 26 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 | * |
| 28 | * Authors: |
| 29 | * Daniel Kopecek <[email protected]> |
| 30 | */ |
| 31 | |
| 32 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 33 | #include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 34 | #endif |
| 35 | |
| 36 | #include <stdio.h> |
| 37 | #include <string.h> |
| 38 | #include <stdint.h> |
| 39 | #include <stdbool.h> |
| 40 | #include <errno.h> |
| 41 | |
| 42 | #include "_sexp-types.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-types.h`/ |
| 43 | #include "_sexp-value.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-value.h`/ |
| 44 | #include "_sexp-rawptr.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-rawptr.h`/ |
| 45 | #include "_sexp-ID.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/_sexp-ID.h`/ |
| 46 | |
| 47 | #include "MurmurHash3.h"cxx . . $ `<file>/src/OVAL/probes/SEAP/MurmurHash3.h`/ |
| 48 | |
| 49 | static SEXP_ID_tcxx . . $ SEXP_ID_t# SEXP_ID_hashcxx . . $ SEXP_ID_hash(51a22a7f57c17009).(void *buf, size_t len, SEXP_ID_tcxx . . $ SEXP_ID_t# seed, int part) |
| 50 | { |
| 51 | uint64_tcxx . . $ uint64_t# resbuf[2]; |
| 52 | |
| 53 | if (part != 0 && part != 1) { |
| 54 | return -1; |
| 55 | } |
| 56 | |
| 57 | MurmurHash3_x86_128cxx . . $ MurmurHash3_x86_128(a91a69c6ec3707ee).(buf, (int)len, (uint32_tcxx . . $ uint32_t#)((0x7C0FFEE7 ^ seed) ^ (seed >> 32)), resbuf); |
| 58 | |
| 59 | return (resbuf[part]); |
| 60 | } |
| 61 | |
| 62 | static int SEXP_ID_v_callbackcxx . . $ SEXP_ID_v_callback(4f331f90ee50c148).(const SEXP_tcxx . . $ SEXP_t# *sexp, __IDres_paircxx . . $ __IDres_pair# *pair) |
| 63 | { |
| 64 | SEXP_val_tcxx . . $ SEXP_val_t# v_dsc; |
| 65 | |
| 66 | if (sexp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || pair == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 67 | return -1; |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * Fill v_dsc with metainformation |
| 72 | */ |
| 73 | SEXP_val_dsccxx . . $ SEXP_val_dsc(57b772aa28f79f79).(&v_dsc, sexp->s_valpcxx . . $ SEXP#s_valp.); |
| 74 | |
| 75 | switch (v_dsc.typecxx . . $ $anonymous_type_7b51cd89f3d52c59_1#type.) { |
| 76 | case SEXP_VALTYPE_NUMBERcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:38:9`!: |
| 77 | case SEXP_VALTYPE_STRINGcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:37:9`!: |
| 78 | pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash. = SEXP_ID_hashcxx . . $ SEXP_ID_hash(51a22a7f57c17009).(v_dsc.memcxx . . $ $anonymous_type_7b51cd89f3d52c59_1#mem., v_dsc.hdrcxx . . $ $anonymous_type_7b51cd89f3d52c59_1#hdr.->sizecxx . . $ $anonymous_type_7b51cd89f3d52c59_0#size., pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash., pair->partcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#part.); |
| 79 | break; |
| 80 | case SEXP_VALTYPE_LISTcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:39:9`!: |
| 81 | { |
| 82 | SEXP_rawval_lblk_cbcxx . . $ SEXP_rawval_lblk_cb(c4e99b2610798569). ((uintptr_tcxx . . $ uintptr_t#)SEXP_LCASTPcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:91:9`!(v_dsc.mem)->b_addrcxx . . $ SEXP_val_list#b_addr., |
| 83 | (int (*)(SEXP_tcxx . . $ SEXP_t# *, void *)) SEXP_ID_v_callbackcxx . . $ SEXP_ID_v_callback(4f331f90ee50c148)., |
| 84 | (void *) pair, |
| 85 | SEXP_LCASTPcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:91:9`!(v_dsc.mem)->offsetcxx . . $ SEXP_val_list#offset. + 1); |
| 86 | |
| 87 | pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash. = SEXP_ID_hashcxx . . $ SEXP_ID_hash(51a22a7f57c17009).(&pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash., 1, |
| 88 | pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash. + SEXP_LCASTPcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:91:9`!(v_dsc.mem)->offsetcxx . . $ SEXP_val_list#offset., pair->partcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#part.); |
| 89 | break; |
| 90 | } |
| 91 | case SEXP_VALTYPE_EMPTYcxx . . $ `src/OVAL/probes/SEAP/_sexp-value.h:36:9`!: |
| 92 | pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash. = SEXP_ID_hashcxx . . $ SEXP_ID_hash(51a22a7f57c17009).(&pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash., 1, pair->hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash., pair->partcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#part.); |
| 93 | break; |
| 94 | default: |
| 95 | /* Unknown S-exp value type */ |
| 96 | abortcxx . . $ abort(8df32a62017fbbf6). (); |
| 97 | } |
| 98 | |
| 99 | return (0); |
| 100 | } |
| 101 | |
| 102 | SEXP_ID_tcxx . . $ SEXP_ID_t# SEXP_ID_vcxx . . $ SEXP_ID_v(7b7039adf1662ab5).(const SEXP_tcxx . . $ SEXP_t# *s) |
| 103 | { |
| 104 | __IDres_paircxx . . $ __IDres_pair# pair; |
| 105 | |
| 106 | pair.hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash. = 0xAD30917100C0FFEE; |
| 107 | pair.partcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#part. = 0; |
| 108 | |
| 109 | SEXP_ID_v_callbackcxx . . $ SEXP_ID_v_callback(4f331f90ee50c148).(s, &pair); |
| 110 | |
| 111 | return (pair.hashcxx . . $ $anonymous_type_9e117fd99fc8c7c4_0#hash.); |
| 112 | } |
| 113 | |
| 114 | /// @} |