OpenCoverage

obj_lib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/objects/obj_lib.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <stdio.h>-
11#include "internal/cryptlib.h"-
12#include <openssl/objects.h>-
13#include <openssl/buffer.h>-
14#include "internal/asn1_int.h"-
15-
16ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)-
17{-
18 ASN1_OBJECT *r;-
19-
20 if (o == NULL)
o == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 121542 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-121542
21 return NULL;
never executed: return ((void *)0) ;
0
22 /* If object isn't dynamic it's an internal OID which is never freed */-
23 if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
!(o->flags & 0x01)Description
TRUEevaluated 68685 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
52857-68685
24 return (ASN1_OBJECT *)o;
executed 68685 times by 1 test: return (ASN1_OBJECT *)o;
Executed by:
  • libcrypto.so.1.1
68685
25-
26 r = ASN1_OBJECT_new();-
27 if (r == NULL) {
r == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 52857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-52857
28 OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);-
29 return NULL;
never executed: return ((void *)0) ;
0
30 }-
31-
32 /* Set dynamic flags so everything gets freed up on error */-
33-
34 r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |-
35 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |-
36 ASN1_OBJECT_FLAG_DYNAMIC_DATA);-
37-
38 if (o->length > 0 && (r->data = OPENSSL_memdup(o->data, o->length)) == NULL)
o->length > 0Description
TRUEevaluated 52857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
(r->data = CRY...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 52857 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-52857
39 goto err;
never executed: goto err;
0
40-
41 r->length = o->length;-
42 r->nid = o->nid;-
43-
44 if (o->ln != NULL && (r->ln = OPENSSL_strdup(o->ln)) == NULL)
o->ln != ((void *)0)Description
TRUEevaluated 95 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52762 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(r->ln = CRYPT...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 95 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-52762
45 goto err;
never executed: goto err;
0
46-
47 if (o->sn != NULL && (r->sn = OPENSSL_strdup(o->sn)) == NULL)
o->sn != ((void *)0)Description
TRUEevaluated 95 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52762 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(r->sn = CRYPT...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 95 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-52762
48 goto err;
never executed: goto err;
0
49-
50 return r;
executed 52857 times by 1 test: return r;
Executed by:
  • libcrypto.so.1.1
52857
51 err:-
52 ASN1_OBJECT_free(r);-
53 OBJerr(OBJ_F_OBJ_DUP, ERR_R_MALLOC_FAILURE);-
54 return NULL;
never executed: return ((void *)0) ;
0
55}-
56-
57int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b)-
58{-
59 int ret;-
60-
61 ret = (a->length - b->length);-
62 if (ret)
retDescription
TRUEevaluated 54687 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 56802 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
54687-56802
63 return ret;
executed 54687 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
54687
64 return memcmp(a->data, b->data, a->length);
executed 56802 times by 1 test: return memcmp(a->data, b->data, a->length);
Executed by:
  • libcrypto.so.1.1
56802
65}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2