1*b077aed3SPierre Pronchery /* 2*b077aed3SPierre Pronchery * Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved. 3*b077aed3SPierre Pronchery * 4*b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 5*b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 6*b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 7*b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 8*b077aed3SPierre Pronchery */ 9*b077aed3SPierre Pronchery 10*b077aed3SPierre Pronchery #ifndef OSSL_INTERNAL_PEM_H 11*b077aed3SPierre Pronchery # define OSSL_INTERNAL_PEM_H 12*b077aed3SPierre Pronchery # pragma once 13*b077aed3SPierre Pronchery 14*b077aed3SPierre Pronchery # include <openssl/pem.h> 15*b077aed3SPierre Pronchery # include "crypto/types.h" 16*b077aed3SPierre Pronchery 17*b077aed3SPierre Pronchery /* Found in crypto/pem/pvkfmt.c */ 18*b077aed3SPierre Pronchery 19*b077aed3SPierre Pronchery /* Maximum length of a blob after header */ 20*b077aed3SPierre Pronchery # define BLOB_MAX_LENGTH 102400 21*b077aed3SPierre Pronchery 22*b077aed3SPierre Pronchery int ossl_do_blob_header(const unsigned char **in, unsigned int length, 23*b077aed3SPierre Pronchery unsigned int *pmagic, unsigned int *pbitlen, 24*b077aed3SPierre Pronchery int *pisdss, int *pispub); 25*b077aed3SPierre Pronchery unsigned int ossl_blob_length(unsigned bitlen, int isdss, int ispub); 26*b077aed3SPierre Pronchery int ossl_do_PVK_header(const unsigned char **in, unsigned int length, 27*b077aed3SPierre Pronchery int skip_magic, 28*b077aed3SPierre Pronchery unsigned int *psaltlen, unsigned int *pkeylen); 29*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0 30*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DSA 31*b077aed3SPierre Pronchery DSA *ossl_b2i_DSA_after_header(const unsigned char **in, unsigned int bitlen, 32*b077aed3SPierre Pronchery int ispub); 33*b077aed3SPierre Pronchery # endif 34*b077aed3SPierre Pronchery RSA *ossl_b2i_RSA_after_header(const unsigned char **in, unsigned int bitlen, 35*b077aed3SPierre Pronchery int ispub); 36*b077aed3SPierre Pronchery # endif 37*b077aed3SPierre Pronchery EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub); 38*b077aed3SPierre Pronchery EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub); 39*b077aed3SPierre Pronchery 40*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DEPRECATED_3_0 41*b077aed3SPierre Pronchery # ifndef OPENSSL_NO_DSA 42*b077aed3SPierre Pronchery DSA *b2i_DSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u); 43*b077aed3SPierre Pronchery DSA *b2i_DSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, 44*b077aed3SPierre Pronchery OSSL_LIB_CTX *libctx, const char *propq); 45*b077aed3SPierre Pronchery # endif 46*b077aed3SPierre Pronchery RSA *b2i_RSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u); 47*b077aed3SPierre Pronchery RSA *b2i_RSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, 48*b077aed3SPierre Pronchery OSSL_LIB_CTX *libctx, const char *propq); 49*b077aed3SPierre Pronchery # endif 50*b077aed3SPierre Pronchery 51*b077aed3SPierre Pronchery #endif 52