SolidSyslog coverage report
Current view: top level - Platform/WolfSsl/Source - SolidSyslogWolfSslAesGcmPolicyPrivate.h (source / functions) Coverage Total Hit
Test: SolidSyslog Lines: 100.0 % 3 3
Test Date: 2026-11-12 23:14:35 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
       2              :  * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
       3              :  */
       4              : 
       5              : #ifndef SOLIDSYSLOGWOLFSSLAESGCMPOLICYPRIVATE_H
       6              : #define SOLIDSYSLOGWOLFSSLAESGCMPOLICYPRIVATE_H
       7              : 
       8              : #include <stdbool.h>
       9              : #include <stdint.h>
      10              : 
      11              : #include "SolidSyslogError.h"
      12              : #include "SolidSyslogWolfSslAesGcmPolicy.h"
      13              : #include "SolidSyslogWolfSslAesGcmPolicyErrors.h"
      14              : #include "SolidSyslogPrival.h"
      15              : #include "SolidSyslogSecurityPolicyDefinition.h"
      16              : 
      17              : enum
      18              : {
      19              :     SOLIDSYSLOG_WOLFSSL_AES_GCM_POLICY_KEY_SIZE = 32,
      20              :     SOLIDSYSLOG_WOLFSSL_AES_GCM_POLICY_NONCE_SIZE = 12,
      21              :     SOLIDSYSLOG_WOLFSSL_AES_GCM_POLICY_TAG_SIZE = 16,
      22              :     /* Trailer is nonce || tag - fits SOLIDSYSLOG_MAX_INTEGRITY_SIZE (32). */
      23              :     SOLIDSYSLOG_WOLFSSL_AES_GCM_POLICY_TRAILER_SIZE =
      24              :         SOLIDSYSLOG_WOLFSSL_AES_GCM_POLICY_NONCE_SIZE + SOLIDSYSLOG_WOLFSSL_AES_GCM_POLICY_TAG_SIZE
      25              : };
      26              : 
      27              : struct SolidSyslogWolfSslAesGcmPolicy
      28              : {
      29              :     struct SolidSyslogSecurityPolicy Base;
      30              :     struct SolidSyslogWolfSslAesGcmPolicyConfig Config;
      31              :     bool FaultReported; /* A run of faults is reported once; a verdict re-arms it. */
      32              : };
      33              : 
      34              : void SolidSyslogWolfSslAesGcmPolicy_Initialise(
      35              :     struct SolidSyslogSecurityPolicy* base,
      36              :     const struct SolidSyslogWolfSslAesGcmPolicyConfig* config
      37              : );
      38              : void SolidSyslogWolfSslAesGcmPolicy_Cleanup(struct SolidSyslogSecurityPolicy* base);
      39              : 
      40              : /* The two wolfCrypt calls, in their own translation unit so that a build whose
      41              :  * wc_AesGcmEncrypt does not keep wolfCrypt's exact-size buffer contract leaves
      42              :  * them undefined rather than overrunning the record. See the platform page. */
      43              : bool SolidSyslogWolfSslAesGcmPolicy_GcmEncrypt(const struct SolidSyslogSecurityRecord* record, const uint8_t* key);
      44              : enum SolidSyslogSecurityPolicyOpenResult SolidSyslogWolfSslAesGcmPolicy_GcmDecrypt(
      45              :     const struct SolidSyslogSecurityRecord* record,
      46              :     const uint8_t* key
      47              : );
      48              : 
      49           35 : static inline void WolfSslAesGcmPolicy_Report(
      50              :     enum SolidSyslogSeverity severity,
      51              :     uint16_t category,
      52              :     enum SolidSyslogAesGcmPolicyErrors code
      53              : )
      54              : {
      55           35 :     SolidSyslog_Error(severity, &SolidSyslogWolfSslAesGcmPolicyErrorSource, category, (int32_t) code);
      56           35 : }
      57              : 
      58              : #endif /* SOLIDSYSLOGWOLFSSLAESGCMPOLICYPRIVATE_H */
        

Generated by: LCOV version 2.0-1