OpenCoverage

p_seal.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/p_seal.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-2018 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/rand.h>-
13#include <openssl/rsa.h>-
14#include <openssl/evp.h>-
15#include <openssl/objects.h>-
16#include <openssl/x509.h>-
17-
18int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,-
19 unsigned char **ek, int *ekl, unsigned char *iv,-
20 EVP_PKEY **pubk, int npubk)-
21{-
22 unsigned char key[EVP_MAX_KEY_LENGTH];-
23 int i;-
24 int rv = 0;-
25-
26 if (type) {
typeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
27 EVP_CIPHER_CTX_reset(ctx);-
28 if (!EVP_EncryptInit_ex(ctx, type, NULL, NULL, NULL))
!EVP_EncryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
29 return 0;
never executed: return 0;
0
30 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
31 if ((npubk <= 0) || !pubk)
(npubk <= 0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
!pubkDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
32 return 1;
never executed: return 1;
0
33 if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0)
EVP_CIPHER_CTX...ctx, key) <= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
34 return 0;
never executed: return 0;
0
35-
36 if (EVP_CIPHER_CTX_iv_length(ctx)
EVP_CIPHER_CTX_iv_length(ctx)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
37 && RAND_bytes(iv, EVP_CIPHER_CTX_iv_length(ctx)) <= 0)
RAND_bytes(iv,...gth(ctx)) <= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
38 goto err;
never executed: goto err;
0
39-
40 if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv))
!EVP_EncryptIn...)0) , key, iv)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
41 goto err;
never executed: goto err;
0
42-
43 for (i = 0; i < npubk; i++) {
i < npubkDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
1
44 ekl[i] =-
45 EVP_PKEY_encrypt_old(ek[i], key, EVP_CIPHER_CTX_key_length(ctx),-
46 pubk[i]);-
47 if (ekl[i] <= 0) {
ekl[i] <= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
48 rv = -1;-
49 goto err;
never executed: goto err;
0
50 }-
51 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
52 rv = npubk;-
53err:
code before this statement executed 1 time by 1 test: err:
Executed by:
  • libcrypto.so.1.1
1
54 OPENSSL_cleanse(key, sizeof(key));-
55 return rv;
executed 1 time by 1 test: return rv;
Executed by:
  • libcrypto.so.1.1
1
56}-
57-
58int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
59{-
60 int i;-
61 i = EVP_EncryptFinal_ex(ctx, out, outl);-
62 if (i)
iDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
63 i = EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, NULL);
executed 1 time by 1 test: i = EVP_EncryptInit_ex(ctx, ((void *)0) , ((void *)0) , ((void *)0) , ((void *)0) );
Executed by:
  • libcrypto.so.1.1
1
64 return i;
executed 1 time by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
1
65}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2