]>
git.ipfire.org Git - thirdparty/openssl.git/blob - crypto/encode_decode/encoder_lib.c
2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (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
10 #include <openssl/bio.h>
11 #include <openssl/encoder.h>
12 #include "encoder_local.h"
14 int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX
*ctx
, BIO
*out
)
16 return ctx
->do_output(ctx
, out
);
19 #ifndef OPENSSL_NO_STDIO
20 static BIO
*bio_from_file(FILE *fp
)
24 if ((b
= BIO_new(BIO_s_file())) == NULL
) {
25 ERR_raise(ERR_LIB_OSSL_ENCODER
, ERR_R_BUF_LIB
);
28 BIO_set_fp(b
, fp
, BIO_NOCLOSE
);
32 int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX
*ctx
, FILE *fp
)
34 BIO
*b
= bio_from_file(fp
);
38 ret
= OSSL_ENCODER_to_bio(ctx
, b
);