OpenCoverage

v3_skey.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509v3/v3_skey.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1999-2016 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/x509v3.h>-
13#include "internal/x509_int.h"-
14#include "ext_dat.h"-
15-
16static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,-
17 X509V3_CTX *ctx, char *str);-
18const X509V3_EXT_METHOD v3_skey_id = {-
19 NID_subject_key_identifier, 0, ASN1_ITEM_ref(ASN1_OCTET_STRING),-
20 0, 0, 0, 0,-
21 (X509V3_EXT_I2S)i2s_ASN1_OCTET_STRING,-
22 (X509V3_EXT_S2I)s2i_skey_id,-
23 0, 0, 0, 0,-
24 NULL-
25};-
26-
27char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,-
28 const ASN1_OCTET_STRING *oct)-
29{-
30 return OPENSSL_buf2hexstr(oct->data, oct->length);
executed 421 times by 1 test: return OPENSSL_buf2hexstr(oct->data, oct->length);
Executed by:
  • libcrypto.so.1.1
421
31}-
32-
33ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,-
34 X509V3_CTX *ctx, const char *str)-
35{-
36 ASN1_OCTET_STRING *oct;-
37 long length;-
38-
39 if ((oct = ASN1_OCTET_STRING_new()) == NULL) {
(oct = ASN1_OC...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
40 X509V3err(X509V3_F_S2I_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE);-
41 return NULL;
never executed: return ((void *)0) ;
0
42 }-
43-
44 if ((oct->data = OPENSSL_hexstr2buf(str, &length)) == NULL) {
(oct->data = O...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
45 ASN1_OCTET_STRING_free(oct);-
46 return NULL;
never executed: return ((void *)0) ;
0
47 }-
48-
49 oct->length = length;-
50-
51 return oct;
never executed: return oct;
0
52-
53}-
54-
55static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,-
56 X509V3_CTX *ctx, char *str)-
57{-
58 ASN1_OCTET_STRING *oct;-
59 X509_PUBKEY *pubkey;-
60 const unsigned char *pk;-
61 int pklen;-
62 unsigned char pkey_dig[EVP_MAX_MD_SIZE];-
63 unsigned int diglen;-
64-
65 if (strcmp(str, "hash"))
never executed: __result = (((const unsigned char *) (const char *) ( str ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "hash" ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
__extension__ ...hash" )))); })Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-32
66 return s2i_ASN1_OCTET_STRING(method, ctx, str);
never executed: return s2i_ASN1_OCTET_STRING(method, ctx, str);
0
67-
68 if ((oct = ASN1_OCTET_STRING_new()) == NULL) {
(oct = ASN1_OC...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32
69 X509V3err(X509V3_F_S2I_SKEY_ID, ERR_R_MALLOC_FAILURE);-
70 return NULL;
never executed: return ((void *)0) ;
0
71 }-
72-
73 if (ctx && (ctx->flags == CTX_TEST))
ctxDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
(ctx->flags == 0x1)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32
74 return oct;
executed 24 times by 1 test: return oct;
Executed by:
  • libcrypto.so.1.1
24
75-
76 if (!ctx || (!ctx->subject_req && !ctx->subject_cert)) {
!ctxDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!ctx->subject_reqDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!ctx->subject_certDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
77 X509V3err(X509V3_F_S2I_SKEY_ID, X509V3_R_NO_PUBLIC_KEY);-
78 goto err;
never executed: goto err;
0
79 }-
80-
81 if (ctx->subject_req)
ctx->subject_reqDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-6
82 pubkey = ctx->subject_req->req_info.pubkey;
executed 2 times by 1 test: pubkey = ctx->subject_req->req_info.pubkey;
Executed by:
  • libcrypto.so.1.1
2
83 else-
84 pubkey = ctx->subject_cert->cert_info.key;
executed 6 times by 1 test: pubkey = ctx->subject_cert->cert_info.key;
Executed by:
  • libcrypto.so.1.1
6
85-
86 if (pubkey == NULL) {
pubkey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
87 X509V3err(X509V3_F_S2I_SKEY_ID, X509V3_R_NO_PUBLIC_KEY);-
88 goto err;
never executed: goto err;
0
89 }-
90-
91 X509_PUBKEY_get0_param(NULL, &pk, &pklen, NULL, pubkey);-
92-
93 if (!EVP_Digest(pk, pklen, pkey_dig, &diglen, EVP_sha1(), NULL))
!EVP_Digest(pk... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
94 goto err;
never executed: goto err;
0
95-
96 if (!ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
!ASN1_OCTET_ST...y_dig, diglen)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
97 X509V3err(X509V3_F_S2I_SKEY_ID, ERR_R_MALLOC_FAILURE);-
98 goto err;
never executed: goto err;
0
99 }-
100-
101 return oct;
executed 8 times by 1 test: return oct;
Executed by:
  • libcrypto.so.1.1
8
102-
103 err:-
104 ASN1_OCTET_STRING_free(oct);-
105 return NULL;
never executed: return ((void *)0) ;
0
106}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2