003 File Manager
Current Path:
/usr/src/crypto/openssl/apps
usr
/
src
/
crypto
/
openssl
/
apps
/
📁
..
📄
CA.pl.in
(7.4 KB)
📄
app_rand.c
(2.18 KB)
📄
apps.c
(72.85 KB)
📄
apps.h
(24.69 KB)
📄
asn1pars.c
(10.31 KB)
📄
bf_prefix.c
(4.77 KB)
📄
build.info
(2.32 KB)
📄
ca-cert.srl
(3 B)
📄
ca-key.pem
(916 B)
📄
ca-req.pem
(635 B)
📄
ca.c
(83.78 KB)
📄
cert.pem
(623 B)
📄
ciphers.c
(7.19 KB)
📄
client.pem
(3.21 KB)
📄
cms.c
(44.05 KB)
📄
crl.c
(10.79 KB)
📄
crl2p7.c
(6.18 KB)
📄
ct_log_list.cnf
(412 B)
📄
dgst.c
(18.17 KB)
📄
dh1024.pem
(446 B)
📄
dh2048.pem
(662 B)
📄
dh4096.pem
(1007 B)
📄
dhparam.c
(11.15 KB)
📄
dsa-ca.pem
(2.66 KB)
📄
dsa-pca.pem
(2.67 KB)
📄
dsa.c
(7.53 KB)
📄
dsa1024.pem
(455 B)
📄
dsa512.pem
(280 B)
📄
dsap.pem
(276 B)
📄
dsaparam.c
(7.8 KB)
📄
ec.c
(8.13 KB)
📄
ecparam.c
(14.65 KB)
📄
enc.c
(20.74 KB)
📄
engine.c
(15.56 KB)
📄
errstr.c
(1.83 KB)
📄
gendsa.c
(3.92 KB)
📄
genpkey.c
(8.64 KB)
📄
genrsa.c
(5.36 KB)
📄
nseq.c
(3 KB)
📄
ocsp.c
(49.51 KB)
📄
openssl.c
(21.23 KB)
📄
openssl.cnf
(10.67 KB)
📄
opt.c
(23.61 KB)
📄
passwd.c
(26.43 KB)
📄
pca-cert.srl
(3 B)
📄
pca-key.pem
(916 B)
📄
pca-req.pem
(635 B)
📄
pkcs12.c
(30.81 KB)
📄
pkcs7.c
(5.38 KB)
📄
pkcs8.c
(11.26 KB)
📄
pkey.c
(7.24 KB)
📄
pkeyparam.c
(3.66 KB)
📄
pkeyutl.c
(15.58 KB)
📄
prime.c
(3.56 KB)
📄
privkey.pem
(916 B)
📄
progs.h
(16.05 KB)
📄
progs.pl
(5.43 KB)
📄
rand.c
(3.35 KB)
📄
rehash.c
(15.3 KB)
📄
req.c
(51.46 KB)
📄
req.pem
(627 B)
📄
rsa.c
(9.3 KB)
📄
rsa8192.pem
(6.21 KB)
📄
rsautl.c
(7.81 KB)
📄
s1024key.pem
(891 B)
📄
s1024req.pem
(643 B)
📄
s512-key.pem
(497 B)
📄
s512-req.pem
(460 B)
📄
s_apps.h
(3.3 KB)
📄
s_cb.c
(47.04 KB)
📄
s_client.c
(115.39 KB)
📄
s_server.c
(116.36 KB)
📄
s_socket.c
(13.43 KB)
📄
s_time.c
(11.92 KB)
📄
server.pem
(2.79 KB)
📄
server.srl
(3 B)
📄
server2.pem
(3.21 KB)
📄
sess_id.c
(5.4 KB)
📄
smime.c
(20.95 KB)
📄
speed.c
(120.17 KB)
📄
spkac.c
(5.73 KB)
📄
srp.c
(20.09 KB)
📄
storeutl.c
(16.13 KB)
📄
testCA.pem
(432 B)
📄
testdsa.h
(11.77 KB)
📄
testrsa.h
(121.12 KB)
📄
timeouts.h
(560 B)
📄
ts.c
(30.19 KB)
📄
tsget.in
(6.45 KB)
📄
verify.c
(10.52 KB)
📄
version.c
(5.07 KB)
📄
x509.c
(39.25 KB)
Editing: bf_prefix.c
/* * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <stdio.h> #include <string.h> #include <errno.h> #include <openssl/bio.h> #include "apps.h" static int prefix_write(BIO *b, const char *out, size_t outl, size_t *numwritten); static int prefix_read(BIO *b, char *buf, size_t size, size_t *numread); static int prefix_puts(BIO *b, const char *str); static int prefix_gets(BIO *b, char *str, int size); static long prefix_ctrl(BIO *b, int cmd, long arg1, void *arg2); static int prefix_create(BIO *b); static int prefix_destroy(BIO *b); static long prefix_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); static BIO_METHOD *prefix_meth = NULL; BIO_METHOD *apps_bf_prefix(void) { if (prefix_meth == NULL) { if ((prefix_meth = BIO_meth_new(BIO_TYPE_FILTER, "Prefix filter")) == NULL || !BIO_meth_set_create(prefix_meth, prefix_create) || !BIO_meth_set_destroy(prefix_meth, prefix_destroy) || !BIO_meth_set_write_ex(prefix_meth, prefix_write) || !BIO_meth_set_read_ex(prefix_meth, prefix_read) || !BIO_meth_set_puts(prefix_meth, prefix_puts) || !BIO_meth_set_gets(prefix_meth, prefix_gets) || !BIO_meth_set_ctrl(prefix_meth, prefix_ctrl) || !BIO_meth_set_callback_ctrl(prefix_meth, prefix_callback_ctrl)) { BIO_meth_free(prefix_meth); prefix_meth = NULL; } } return prefix_meth; } typedef struct prefix_ctx_st { char *prefix; int linestart; /* flag to indicate we're at the line start */ } PREFIX_CTX; static int prefix_create(BIO *b) { PREFIX_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx == NULL) return 0; ctx->prefix = NULL; ctx->linestart = 1; BIO_set_data(b, ctx); BIO_set_init(b, 1); return 1; } static int prefix_destroy(BIO *b) { PREFIX_CTX *ctx = BIO_get_data(b); OPENSSL_free(ctx->prefix); OPENSSL_free(ctx); return 1; } static int prefix_read(BIO *b, char *in, size_t size, size_t *numread) { return BIO_read_ex(BIO_next(b), in, size, numread); } static int prefix_write(BIO *b, const char *out, size_t outl, size_t *numwritten) { PREFIX_CTX *ctx = BIO_get_data(b); if (ctx == NULL) return 0; /* If no prefix is set or if it's empty, we've got nothing to do here */ if (ctx->prefix == NULL || *ctx->prefix == '\0') { /* We do note if what comes next will be a new line, though */ if (outl > 0) ctx->linestart = (out[outl-1] == '\n'); return BIO_write_ex(BIO_next(b), out, outl, numwritten); } *numwritten = 0; while (outl > 0) { size_t i; char c; /* If we know that we're at the start of the line, output the prefix */ if (ctx->linestart) { size_t dontcare; if (!BIO_write_ex(BIO_next(b), ctx->prefix, strlen(ctx->prefix), &dontcare)) return 0; ctx->linestart = 0; } /* Now, go look for the next LF, or the end of the string */ for (i = 0, c = '\0'; i < outl && (c = out[i]) != '\n'; i++) continue; if (c == '\n') i++; /* Output what we found so far */ while (i > 0) { size_t num = 0; if (!BIO_write_ex(BIO_next(b), out, i, &num)) return 0; out += num; outl -= num; *numwritten += num; i -= num; } /* If we found a LF, what follows is a new line, so take note */ if (c == '\n') ctx->linestart = 1; } return 1; } static long prefix_ctrl(BIO *b, int cmd, long num, void *ptr) { long ret = 0; switch (cmd) { case PREFIX_CTRL_SET_PREFIX: { PREFIX_CTX *ctx = BIO_get_data(b); if (ctx == NULL) break; OPENSSL_free(ctx->prefix); ctx->prefix = OPENSSL_strdup((const char *)ptr); ret = ctx->prefix != NULL; } break; default: if (BIO_next(b) != NULL) ret = BIO_ctrl(BIO_next(b), cmd, num, ptr); break; } return ret; } static long prefix_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) { return BIO_callback_ctrl(BIO_next(b), cmd, fp); } static int prefix_gets(BIO *b, char *buf, int size) { return BIO_gets(BIO_next(b), buf, size); } static int prefix_puts(BIO *b, const char *str) { return BIO_write(b, str, strlen(str)); }
Upload File
Create Folder