X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fasn1%2Fd2i_r_pr.c;h=46037a04e639b2c950735620137396f1152fa348;hp=0c53aa94bf5808474776019540c561d3fbcc01d8;hb=0cc1115643e690c0c18eb709d34910bc2e980bd8;hpb=58964a492275ca9a59a0cd9c8155cb2491b4b909 diff --git a/crypto/asn1/d2i_r_pr.c b/crypto/asn1/d2i_r_pr.c index 0c53aa94bf..46037a04e6 100644 --- a/crypto/asn1/d2i_r_pr.c +++ b/crypto/asn1/d2i_r_pr.c @@ -56,18 +56,13 @@ * [including the GNU Public Licence.] */ +#ifndef NO_RSA #include #include "cryptlib.h" -#include "bn.h" -#include "rsa.h" -#include "objects.h" -#include "asn1_mac.h" - -/* - * ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,ASN1_R_LENGTH_MISMATCH); - * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE); - * ASN1err(ASN1_F_I2D_RSAPRIVATEKEY,ASN1_R_PARSING); - */ +#include +#include +#include +#include static ASN1_METHOD method={ (int (*)()) i2d_RSAPrivateKey, @@ -75,15 +70,12 @@ static ASN1_METHOD method={ (char *(*)())RSA_new, (void (*)()) RSA_free}; -ASN1_METHOD *RSAPrivateKey_asn1_meth() +ASN1_METHOD *RSAPrivateKey_asn1_meth(void) { return(&method); } -RSA *d2i_RSAPrivateKey(a,pp,length) -RSA **a; -unsigned char **pp; -long length; +RSA *d2i_RSAPrivateKey(RSA **a, const unsigned char **pp, long length) { int i=ASN1_R_PARSING; ASN1_INTEGER *bs=NULL; @@ -115,7 +107,8 @@ long length; if ((ret->iqmp=BN_bin2bn(bs->data,bs->length,ret->iqmp)) == NULL) goto err_bn; - ASN1_INTEGER_free(bs); + M_ASN1_INTEGER_free(bs); + bs = NULL; M_ASN1_D2I_Finish_2(a); err_bn: @@ -123,7 +116,14 @@ err_bn: err: ASN1err(ASN1_F_D2I_RSAPRIVATEKEY,i); if ((ret != NULL) && ((a == NULL) || (*a != ret))) RSA_free(ret); - if (bs != NULL) ASN1_INTEGER_free(bs); + if (bs != NULL) M_ASN1_INTEGER_free(bs); + return(NULL); } +#else /* !NO_RSA */ + +# if PEDANTIC +static void *dummy=&dummy; +# endif +#endif