X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fpem%2Fpem_seal.c;h=2a6c5133481afeea02762f983ace99ed1cb96bf1;hb=7d09713d09f41778c92913d57a877a4eb1aebbfc;hp=b4b36df453b9307e1a3d655e225a9eb096e4f8d2;hpb=7dfb0b774e6592dcbfe47015168a0ac8b44e2a17;p=oweals%2Fopenssl.git diff --git a/crypto/pem/pem_seal.c b/crypto/pem/pem_seal.c index b4b36df453..2a6c513348 100644 --- a/crypto/pem/pem_seal.c +++ b/crypto/pem/pem_seal.c @@ -56,23 +56,18 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "evp.h" -#include "rand.h" -#include "objects.h" -#include "x509.h" -#include "pem.h" - -int PEM_SealInit(ctx,type,md_type,ek,ekl,iv,pubk,npubk) -PEM_ENCODE_SEAL_CTX *ctx; -EVP_CIPHER *type; -EVP_MD *md_type; -unsigned char **ek; -int *ekl; -unsigned char *iv; -EVP_PKEY **pubk; -int npubk; +#include +#include +#include +#include +#include + +int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type, + unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, + int npubk) { unsigned char key[EVP_MAX_KEY_LENGTH]; int ret= -1; @@ -89,7 +84,7 @@ int npubk; j=RSA_size(pubk[i]->pkey.rsa); if (j > max) max=j; } - s=(char *)Malloc(max*2); + s=(char *)OPENSSL_malloc(max*2); if (s == NULL) { PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE); @@ -113,17 +108,13 @@ int npubk; ret=npubk; err: - if (s != NULL) Free(s); + if (s != NULL) OPENSSL_free(s); memset(key,0,EVP_MAX_KEY_LENGTH); return(ret); } -void PEM_SealUpdate(ctx,out,outl,in,inl) -PEM_ENCODE_SEAL_CTX *ctx; -unsigned char *out; -int *outl; -unsigned char *in; -int inl; +void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl) { unsigned char buffer[1600]; int i,j; @@ -146,13 +137,8 @@ int inl; } } -int PEM_SealFinal(ctx,sig,sigl,out,outl,priv) -PEM_ENCODE_SEAL_CTX *ctx; -unsigned char *sig; -int *sigl; -unsigned char *out; -int *outl; -EVP_PKEY *priv; +int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl, + unsigned char *out, int *outl, EVP_PKEY *priv) { unsigned char *s=NULL; int ret=0,j; @@ -165,7 +151,7 @@ EVP_PKEY *priv; } i=RSA_size(priv->pkey.rsa); if (i < 100) i=100; - s=(unsigned char *)Malloc(i*2); + s=(unsigned char *)OPENSSL_malloc(i*2); if (s == NULL) { PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE); @@ -186,6 +172,13 @@ EVP_PKEY *priv; err: memset((char *)&(ctx->md),0,sizeof(ctx->md)); memset((char *)&(ctx->cipher),0,sizeof(ctx->cipher)); - if (s != NULL) Free(s); + if (s != NULL) OPENSSL_free(s); return(ret); } +#else /* !NO_RSA */ + +# if PEDANTIC +static void *dummy=&dummy; +# endif + +#endif