| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x509_txt.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 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 <time.h> | - |
| 12 | #include <errno.h> | - |
| 13 | - | |
| 14 | #include "internal/cryptlib.h" | - |
| 15 | #include <openssl/buffer.h> | - |
| 16 | #include <openssl/evp.h> | - |
| 17 | #include <openssl/asn1.h> | - |
| 18 | #include <openssl/x509.h> | - |
| 19 | #include <openssl/objects.h> | - |
| 20 | - | |
| 21 | const char *X509_verify_cert_error_string(long n) | - |
| 22 | { | - |
| 23 | switch ((int)n) { | - |
| 24 | case X509_V_OK: executed 83 times by 1 test: case 0:Executed by:
| 83 |
| 25 | return "ok"; executed 83 times by 1 test: return "ok";Executed by:
| 83 |
| 26 | case X509_V_ERR_UNSPECIFIED: executed 3 times by 1 test: case 1:Executed by:
| 3 |
| 27 | return "unspecified certificate verification error"; executed 3 times by 1 test: return "unspecified certificate verification error";Executed by:
| 3 |
| 28 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: never executed: case 2: | 0 |
| 29 | return "unable to get issuer certificate"; never executed: return "unable to get issuer certificate"; | 0 |
| 30 | case X509_V_ERR_UNABLE_TO_GET_CRL: never executed: case 3: | 0 |
| 31 | return "unable to get certificate CRL"; never executed: return "unable to get certificate CRL"; | 0 |
| 32 | case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: never executed: case 4: | 0 |
| 33 | return "unable to decrypt certificate's signature"; never executed: return "unable to decrypt certificate's signature"; | 0 |
| 34 | case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: never executed: case 5: | 0 |
| 35 | return "unable to decrypt CRL's signature"; never executed: return "unable to decrypt CRL's signature"; | 0 |
| 36 | case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: never executed: case 6: | 0 |
| 37 | return "unable to decode issuer public key"; never executed: return "unable to decode issuer public key"; | 0 |
| 38 | case X509_V_ERR_CERT_SIGNATURE_FAILURE: executed 6 times by 1 test: case 7:Executed by:
| 6 |
| 39 | return "certificate signature failure"; executed 6 times by 1 test: return "certificate signature failure";Executed by:
| 6 |
| 40 | case X509_V_ERR_CRL_SIGNATURE_FAILURE: never executed: case 8: | 0 |
| 41 | return "CRL signature failure"; never executed: return "CRL signature failure"; | 0 |
| 42 | case X509_V_ERR_CERT_NOT_YET_VALID: never executed: case 9: | 0 |
| 43 | return "certificate is not yet valid"; never executed: return "certificate is not yet valid"; | 0 |
| 44 | case X509_V_ERR_CERT_HAS_EXPIRED: executed 1 time by 1 test: case 10:Executed by:
| 1 |
| 45 | return "certificate has expired"; executed 1 time by 1 test: return "certificate has expired";Executed by:
| 1 |
| 46 | case X509_V_ERR_CRL_NOT_YET_VALID: never executed: case 11: | 0 |
| 47 | return "CRL is not yet valid"; never executed: return "CRL is not yet valid"; | 0 |
| 48 | case X509_V_ERR_CRL_HAS_EXPIRED: never executed: case 12: | 0 |
| 49 | return "CRL has expired"; never executed: return "CRL has expired"; | 0 |
| 50 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: never executed: case 13: | 0 |
| 51 | return "format error in certificate's notBefore field"; never executed: return "format error in certificate's notBefore field"; | 0 |
| 52 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: never executed: case 14: | 0 |
| 53 | return "format error in certificate's notAfter field"; never executed: return "format error in certificate's notAfter field"; | 0 |
| 54 | case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: never executed: case 15: | 0 |
| 55 | return "format error in CRL's lastUpdate field"; never executed: return "format error in CRL's lastUpdate field"; | 0 |
| 56 | case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: never executed: case 16: | 0 |
| 57 | return "format error in CRL's nextUpdate field"; never executed: return "format error in CRL's nextUpdate field"; | 0 |
| 58 | case X509_V_ERR_OUT_OF_MEM: never executed: case 17: | 0 |
| 59 | return "out of memory"; never executed: return "out of memory"; | 0 |
| 60 | case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: never executed: case 18: | 0 |
| 61 | return "self signed certificate"; never executed: return "self signed certificate"; | 0 |
| 62 | case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: never executed: case 19: | 0 |
| 63 | return "self signed certificate in certificate chain"; never executed: return "self signed certificate in certificate chain"; | 0 |
| 64 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: executed 134 times by 1 test: case 20:Executed by:
| 134 |
| 65 | return "unable to get local issuer certificate"; executed 134 times by 1 test: return "unable to get local issuer certificate";Executed by:
| 134 |
| 66 | case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: executed 420 times by 1 test: case 21:Executed by:
| 420 |
| 67 | return "unable to verify the first certificate"; executed 420 times by 1 test: return "unable to verify the first certificate";Executed by:
| 420 |
| 68 | case X509_V_ERR_CERT_CHAIN_TOO_LONG: executed 1 time by 1 test: case 22:Executed by:
| 1 |
| 69 | return "certificate chain too long"; executed 1 time by 1 test: return "certificate chain too long";Executed by:
| 1 |
| 70 | case X509_V_ERR_CERT_REVOKED: never executed: case 23: | 0 |
| 71 | return "certificate revoked"; never executed: return "certificate revoked"; | 0 |
| 72 | case X509_V_ERR_INVALID_CA: executed 9 times by 1 test: case 24:Executed by:
| 9 |
| 73 | return "invalid CA certificate"; executed 9 times by 1 test: return "invalid CA certificate";Executed by:
| 9 |
| 74 | case X509_V_ERR_PATH_LENGTH_EXCEEDED: never executed: case 25: | 0 |
| 75 | return "path length constraint exceeded"; never executed: return "path length constraint exceeded"; | 0 |
| 76 | case X509_V_ERR_INVALID_PURPOSE: executed 9 times by 1 test: case 26:Executed by:
| 9 |
| 77 | return "unsupported certificate purpose"; executed 9 times by 1 test: return "unsupported certificate purpose";Executed by:
| 9 |
| 78 | case X509_V_ERR_CERT_UNTRUSTED: never executed: case 27: | 0 |
| 79 | return "certificate not trusted"; never executed: return "certificate not trusted"; | 0 |
| 80 | case X509_V_ERR_CERT_REJECTED: executed 26 times by 1 test: case 28:Executed by:
| 26 |
| 81 | return "certificate rejected"; executed 26 times by 1 test: return "certificate rejected";Executed by:
| 26 |
| 82 | case X509_V_ERR_SUBJECT_ISSUER_MISMATCH: never executed: case 29: | 0 |
| 83 | return "subject issuer mismatch"; never executed: return "subject issuer mismatch"; | 0 |
| 84 | case X509_V_ERR_AKID_SKID_MISMATCH: never executed: case 30: | 0 |
| 85 | return "authority and subject key identifier mismatch"; never executed: return "authority and subject key identifier mismatch"; | 0 |
| 86 | case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: never executed: case 31: | 0 |
| 87 | return "authority and issuer serial number mismatch"; never executed: return "authority and issuer serial number mismatch"; | 0 |
| 88 | case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: never executed: case 32: | 0 |
| 89 | return "key usage does not include certificate signing"; never executed: return "key usage does not include certificate signing"; | 0 |
| 90 | case X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: never executed: case 33: | 0 |
| 91 | return "unable to get CRL issuer certificate"; never executed: return "unable to get CRL issuer certificate"; | 0 |
| 92 | case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: never executed: case 34: | 0 |
| 93 | return "unhandled critical extension"; never executed: return "unhandled critical extension"; | 0 |
| 94 | case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: never executed: case 35: | 0 |
| 95 | return "key usage does not include CRL signing"; never executed: return "key usage does not include CRL signing"; | 0 |
| 96 | case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: never executed: case 36: | 0 |
| 97 | return "unhandled critical CRL extension"; never executed: return "unhandled critical CRL extension"; | 0 |
| 98 | case X509_V_ERR_INVALID_NON_CA: never executed: case 37: | 0 |
| 99 | return "invalid non-CA certificate (has CA markings)"; never executed: return "invalid non-CA certificate (has CA markings)"; | 0 |
| 100 | case X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: executed 1 time by 1 test: case 38:Executed by:
| 1 |
| 101 | return "proxy path length constraint exceeded"; executed 1 time by 1 test: return "proxy path length constraint exceeded";Executed by:
| 1 |
| 102 | case X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: never executed: case 39: | 0 |
| 103 | return "key usage does not include digital signature"; never executed: return "key usage does not include digital signature"; | 0 |
| 104 | case X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: executed 3 times by 1 test: case 40:Executed by:
| 3 |
| 105 | return executed 3 times by 1 test: return "proxy certificates not allowed, please set the appropriate flag";Executed by:
| 3 |
| 106 | "proxy certificates not allowed, please set the appropriate flag"; executed 3 times by 1 test: return "proxy certificates not allowed, please set the appropriate flag";Executed by:
| 3 |
| 107 | case X509_V_ERR_INVALID_EXTENSION: never executed: case 41: | 0 |
| 108 | return "invalid or inconsistent certificate extension"; never executed: return "invalid or inconsistent certificate extension"; | 0 |
| 109 | case X509_V_ERR_INVALID_POLICY_EXTENSION: never executed: case 42: | 0 |
| 110 | return "invalid or inconsistent certificate policy extension"; never executed: return "invalid or inconsistent certificate policy extension"; | 0 |
| 111 | case X509_V_ERR_NO_EXPLICIT_POLICY: never executed: case 43: | 0 |
| 112 | return "no explicit policy"; never executed: return "no explicit policy"; | 0 |
| 113 | case X509_V_ERR_DIFFERENT_CRL_SCOPE: never executed: case 44: | 0 |
| 114 | return "Different CRL scope"; never executed: return "Different CRL scope"; | 0 |
| 115 | case X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: never executed: case 45: | 0 |
| 116 | return "Unsupported extension feature"; never executed: return "Unsupported extension feature"; | 0 |
| 117 | case X509_V_ERR_UNNESTED_RESOURCE: never executed: case 46: | 0 |
| 118 | return "RFC 3779 resource not subset of parent's resources"; never executed: return "RFC 3779 resource not subset of parent's resources"; | 0 |
| 119 | case X509_V_ERR_PERMITTED_VIOLATION: executed 9 times by 1 test: case 47:Executed by:
| 9 |
| 120 | return "permitted subtree violation"; executed 9 times by 1 test: return "permitted subtree violation";Executed by:
| 9 |
| 121 | case X509_V_ERR_EXCLUDED_VIOLATION: executed 2 times by 1 test: case 48:Executed by:
| 2 |
| 122 | return "excluded subtree violation"; executed 2 times by 1 test: return "excluded subtree violation";Executed by:
| 2 |
| 123 | case X509_V_ERR_SUBTREE_MINMAX: never executed: case 49: | 0 |
| 124 | return "name constraints minimum and maximum not supported"; never executed: return "name constraints minimum and maximum not supported"; | 0 |
| 125 | case X509_V_ERR_APPLICATION_VERIFICATION: never executed: case 50: | 0 |
| 126 | return "application verification failure"; never executed: return "application verification failure"; | 0 |
| 127 | case X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: never executed: case 51: | 0 |
| 128 | return "unsupported name constraint type"; never executed: return "unsupported name constraint type"; | 0 |
| 129 | case X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: never executed: case 52: | 0 |
| 130 | return "unsupported or invalid name constraint syntax"; never executed: return "unsupported or invalid name constraint syntax"; | 0 |
| 131 | case X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: never executed: case 53: | 0 |
| 132 | return "unsupported or invalid name syntax"; never executed: return "unsupported or invalid name syntax"; | 0 |
| 133 | case X509_V_ERR_CRL_PATH_VALIDATION_ERROR: never executed: case 54: | 0 |
| 134 | return "CRL path validation error"; never executed: return "CRL path validation error"; | 0 |
| 135 | case X509_V_ERR_PATH_LOOP: never executed: case 55: | 0 |
| 136 | return "Path Loop"; never executed: return "Path Loop"; | 0 |
| 137 | case X509_V_ERR_SUITE_B_INVALID_VERSION: never executed: case 56: | 0 |
| 138 | return "Suite B: certificate version invalid"; never executed: return "Suite B: certificate version invalid"; | 0 |
| 139 | case X509_V_ERR_SUITE_B_INVALID_ALGORITHM: never executed: case 57: | 0 |
| 140 | return "Suite B: invalid public key algorithm"; never executed: return "Suite B: invalid public key algorithm"; | 0 |
| 141 | case X509_V_ERR_SUITE_B_INVALID_CURVE: never executed: case 58: | 0 |
| 142 | return "Suite B: invalid ECC curve"; never executed: return "Suite B: invalid ECC curve"; | 0 |
| 143 | case X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM: never executed: case 59: | 0 |
| 144 | return "Suite B: invalid signature algorithm"; never executed: return "Suite B: invalid signature algorithm"; | 0 |
| 145 | case X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED: never executed: case 60: | 0 |
| 146 | return "Suite B: curve not allowed for this LOS"; never executed: return "Suite B: curve not allowed for this LOS"; | 0 |
| 147 | case X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256: never executed: case 61: | 0 |
| 148 | return "Suite B: cannot sign P-384 with P-256"; never executed: return "Suite B: cannot sign P-384 with P-256"; | 0 |
| 149 | case X509_V_ERR_HOSTNAME_MISMATCH: never executed: case 62: | 0 |
| 150 | return "Hostname mismatch"; never executed: return "Hostname mismatch"; | 0 |
| 151 | case X509_V_ERR_EMAIL_MISMATCH: never executed: case 63: | 0 |
| 152 | return "Email address mismatch"; never executed: return "Email address mismatch"; | 0 |
| 153 | case X509_V_ERR_IP_ADDRESS_MISMATCH: never executed: case 64: | 0 |
| 154 | return "IP address mismatch"; never executed: return "IP address mismatch"; | 0 |
| 155 | case X509_V_ERR_DANE_NO_MATCH: never executed: case 65: | 0 |
| 156 | return "No matching DANE TLSA records"; never executed: return "No matching DANE TLSA records"; | 0 |
| 157 | case X509_V_ERR_EE_KEY_TOO_SMALL: executed 2 times by 1 test: case 66:Executed by:
| 2 |
| 158 | return "EE certificate key too weak"; executed 2 times by 1 test: return "EE certificate key too weak";Executed by:
| 2 |
| 159 | case X509_V_ERR_CA_KEY_TOO_SMALL: executed 2 times by 1 test: case 67:Executed by:
| 2 |
| 160 | return "CA certificate key too weak"; executed 2 times by 1 test: return "CA certificate key too weak";Executed by:
| 2 |
| 161 | case X509_V_ERR_CA_MD_TOO_WEAK: executed 3 times by 1 test: case 68:Executed by:
| 3 |
| 162 | return "CA signature digest algorithm too weak"; executed 3 times by 1 test: return "CA signature digest algorithm too weak";Executed by:
| 3 |
| 163 | case X509_V_ERR_INVALID_CALL: never executed: case 69: | 0 |
| 164 | return "Invalid certificate verification context"; never executed: return "Invalid certificate verification context"; | 0 |
| 165 | case X509_V_ERR_STORE_LOOKUP: never executed: case 70: | 0 |
| 166 | return "Issuer certificate lookup error"; never executed: return "Issuer certificate lookup error"; | 0 |
| 167 | case X509_V_ERR_NO_VALID_SCTS: never executed: case 71: | 0 |
| 168 | return "Certificate Transparency required, but no valid SCTs found"; never executed: return "Certificate Transparency required, but no valid SCTs found"; | 0 |
| 169 | case X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION: executed 1 time by 1 test: case 72:Executed by:
| 1 |
| 170 | return "proxy subject name violation"; executed 1 time by 1 test: return "proxy subject name violation";Executed by:
| 1 |
| 171 | case X509_V_ERR_OCSP_VERIFY_NEEDED: never executed: case 73: | 0 |
| 172 | return "OCSP verification needed"; never executed: return "OCSP verification needed"; | 0 |
| 173 | case X509_V_ERR_OCSP_VERIFY_FAILED: never executed: case 74: | 0 |
| 174 | return "OCSP verification failed"; never executed: return "OCSP verification failed"; | 0 |
| 175 | case X509_V_ERR_OCSP_CERT_UNKNOWN: never executed: case 75: | 0 |
| 176 | return "OCSP unknown cert"; never executed: return "OCSP unknown cert"; | 0 |
| 177 | - | |
| 178 | default: executed 1 time by 1 test: default:Executed by:
| 1 |
| 179 | /* Printing an error number into a static buffer is not thread-safe */ | - |
| 180 | return "unknown certificate verification error"; executed 1 time by 1 test: return "unknown certificate verification error";Executed by:
| 1 |
| 181 | } | - |
| 182 | } | - |
| Source code | Switch to Preprocessed file |