1/* 2 * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved. 3 * 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 8 */ 9 10#ifndef OSSL_INTERNAL_PEM_H 11# define OSSL_INTERNAL_PEM_H 12# pragma once 13 14# include <openssl/pem.h> 15# include "crypto/types.h" 16 17/* Found in crypto/pem/pvkfmt.c */ 18 19/* Maximum length of a blob after header */ 20# define BLOB_MAX_LENGTH 102400 21 22int ossl_do_blob_header(const unsigned char **in, unsigned int length, 23 unsigned int *pmagic, unsigned int *pbitlen, 24 int *pisdss, int *pispub); 25unsigned int ossl_blob_length(unsigned bitlen, int isdss, int ispub); 26int ossl_do_PVK_header(const unsigned char **in, unsigned int length, 27 int skip_magic, 28 unsigned int *psaltlen, unsigned int *pkeylen); 29# ifndef OPENSSL_NO_DEPRECATED_3_0 30# ifndef OPENSSL_NO_DSA 31DSA *ossl_b2i_DSA_after_header(const unsigned char **in, unsigned int bitlen, 32 int ispub); 33# endif 34RSA *ossl_b2i_RSA_after_header(const unsigned char **in, unsigned int bitlen, 35 int ispub); 36# endif 37EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub); 38EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub); 39 40# ifndef OPENSSL_NO_DEPRECATED_3_0 41# ifndef OPENSSL_NO_DSA 42DSA *b2i_DSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u); 43DSA *b2i_DSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, 44 OSSL_LIB_CTX *libctx, const char *propq); 45# endif 46RSA *b2i_RSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u); 47RSA *b2i_RSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, 48 OSSL_LIB_CTX *libctx, const char *propq); 49# endif 50 51#endif 52