LCOV - code coverage report
Current view: top level - src/edhoc - okm.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 7 7 100.0 %
Date: 2024-09-16 20:15:30 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 18 24 75.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :    Copyright (c) 2021 Fraunhofer AISEC. See the COPYRIGHT
       3                 :            :    file at the top-level directory of this distribution.
       4                 :            : 
       5                 :            :    Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
       6                 :            :    http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
       7                 :            :    <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
       8                 :            :    option. This file may not be copied, modified, or distributed
       9                 :            :    except according to those terms.
      10                 :            : */
      11                 :            : 
      12                 :            : #include "edhoc/buffer_sizes.h"
      13                 :            : 
      14                 :            : #include "edhoc/hkdf_info.h"
      15                 :            : #include "edhoc/okm.h"
      16                 :            : 
      17                 :            : #include "common/crypto_wrapper.h"
      18                 :            : #include "common/oscore_edhoc_error.h"
      19                 :            : 
      20                 :            : #include "common/print_util.h"
      21                 :            : 
      22                 :         52 : enum err edhoc_kdf(enum hash_alg hash_alg, const struct byte_array *prk,
      23                 :            :                    uint8_t label, struct byte_array *context,
      24                 :            :                    struct byte_array *okm)
      25                 :            : {
      26                 :         52 :         PRINTF("INFO_MAX_SIZE: %d\n", INFO_MAX_SIZE);
      27                 :         52 :         PRINTF("context->len: %d\n", context->len);
      28   [ +  +  +  +  :         52 :         BYTE_ARRAY_NEW(info, INFO_MAX_SIZE,
          +  -  -  +  +  
          +  +  +  +  -  
          -  +  +  +  +  
                +  +  - ]
      29                 :            :                        AS_BSTR_SIZE(context->len) + (2 * CBOR_ENCODED_UINT));
      30                 :            : 
      31         [ -  + ]:         52 :         TRY(create_hkdf_info(label, context, okm->len, &info));
      32                 :            : 
      33                 :         52 :         PRINT_ARRAY("info", info.ptr, info.len);
      34                 :         52 :         return hkdf_expand(hash_alg, prk, &info, okm);
      35                 :            : }

Generated by: LCOV version 1.14