OpenCoverage

p_open.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/p_open.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-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 "internal/cryptlib.h"-
11#ifdef OPENSSL_NO_RSA-
12NON_EMPTY_TRANSLATION_UNIT-
13#else-
14-
15# include <stdio.h>-
16# include <openssl/evp.h>-
17# include <openssl/objects.h>-
18# include <openssl/x509.h>-
19# include <openssl/rsa.h>-
20-
21int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,-
22 const unsigned char *ek, int ekl, const unsigned char *iv,-
23 EVP_PKEY *priv)-
24{-
25 unsigned char *key = NULL;-
26 int i, size = 0, ret = 0;-
27-
28 if (type) {
typeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
29 EVP_CIPHER_CTX_reset(ctx);-
30 if (!EVP_DecryptInit_ex(ctx, type, NULL, NULL, NULL))
!EVP_DecryptIn... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
31 return 0;
never executed: return 0;
0
32 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
33-
34 if (!priv)
!privDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
35 return 1;
never executed: return 1;
0
36-
37 if (EVP_PKEY_id(priv) != EVP_PKEY_RSA) {
EVP_PKEY_id(priv) != 6Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
38 EVPerr(EVP_F_EVP_OPENINIT, EVP_R_PUBLIC_KEY_NOT_RSA);-
39 goto err;
never executed: goto err;
0
40 }-
41-
42 size = EVP_PKEY_size(priv);-
43 key = OPENSSL_malloc(size + 2);-
44 if (key == NULL) {
key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
45 /* ERROR */-
46 EVPerr(EVP_F_EVP_OPENINIT, ERR_R_MALLOC_FAILURE);-
47 goto err;
never executed: goto err;
0
48 }-
49-
50 i = EVP_PKEY_decrypt_old(key, ek, ekl, priv);-
51 if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i)) {
(i <= 0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
!EVP_CIPHER_CT...length(ctx, i)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
52 /* ERROR */-
53 goto err;
never executed: goto err;
0
54 }-
55 if (!EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv))
!EVP_DecryptIn...)0) , key, iv)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
56 goto err;
never executed: goto err;
0
57-
58 ret = 1;-
59 err:
code before this statement executed 1 time by 1 test: err:
Executed by:
  • libcrypto.so.1.1
1
60 OPENSSL_clear_free(key, size);-
61 return ret;
executed 1 time by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1
62}-
63-
64int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
65{-
66 int i;-
67-
68 i = EVP_DecryptFinal_ex(ctx, out, outl);-
69 if (i)
iDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1
70 i = EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL);
executed 1 time by 1 test: i = EVP_DecryptInit_ex(ctx, ((void *)0) , ((void *)0) , ((void *)0) , ((void *)0) );
Executed by:
  • libcrypto.so.1.1
1
71 return i;
executed 1 time by 1 test: return i;
Executed by:
  • libcrypto.so.1.1
1
72}-
73#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2