Debian Codegraph @

debian/rust-vendor/aws-lc-sys/aws-lc/crypto/x509/x509.c

raw
1 // Copyright (C) 1995-1998 Eric Young ([email protected]) All rights reserved.
2 // SPDX-License-Identifier: Apache-2.0
3
4 #include <openssl/x509.h>
5
6 #include <openssl/bio.h>
7 #include <openssl/err.h>
8 #include <openssl/mem.h>
9
10
11 // |X509_R_UNSUPPORTED_ALGORITHM| is no longer emitted, but continue to define
12 // it to avoid downstream churn.
13 OPENSSL_DECLARE_ERROR_REASON(X509, UNSUPPORTED_ALGORITHM)
14
15 int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent) {
16 const uint8_t *s;
17 int i, n;
18
19 n = sig->length;
20 s = sig->data;
21 for (i = 0; i < n; i++) {
22 if ((i % 18) == 0) {
23 if (BIO_write(bp, "\n", 1) <= 0 || BIO_indent(bp, indent, indent) <= 0) {
24 return 0;
25 }
26 }
27 if (BIO_printf(bp, "%02x%s", s[i], ((i + 1) == n) ? "" : ":") <= 0) {
28 return 0;
29 }
30 }
31 if (BIO_write(bp, "\n", 1) != 1) {
32 return 0;
33 }
34
35 return 1;
36 }