Constify DSA-related code.
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER
|
||||
#endif
|
||||
|
||||
DSA *d2i_DSAparams(DSA **a, unsigned char **pp, long length)
|
||||
DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length)
|
||||
{
|
||||
int i=ERR_R_NESTED_ASN1_ERROR;
|
||||
ASN1_INTEGER *bs=NULL;
|
||||
|
||||
@@ -94,7 +94,8 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
case EVP_PKEY_DSA:
|
||||
if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL,pp,length)) == NULL)
|
||||
if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL,
|
||||
(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
|
||||
{
|
||||
ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
|
||||
goto err;
|
||||
|
||||
@@ -94,7 +94,8 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
case EVP_PKEY_DSA:
|
||||
if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,pp,length)) == NULL)
|
||||
if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
|
||||
(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
|
||||
{
|
||||
ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
|
||||
goto err;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
|
||||
DSA *d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length)
|
||||
DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length)
|
||||
{
|
||||
int i=ASN1_R_PARSING;
|
||||
ASN1_INTEGER *bs=NULL;
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
#define d2i_ASN1_INTEGER d2i_ASN1_UINTEGER
|
||||
#endif
|
||||
|
||||
DSA *d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length)
|
||||
DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length)
|
||||
{
|
||||
int i=ASN1_R_PARSING;
|
||||
ASN1_INTEGER *bs=NULL;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
#include <openssl/asn1_mac.h>
|
||||
#include <openssl/dsa.h>
|
||||
|
||||
int i2d_DSAparams(DSA *a, unsigned char **pp)
|
||||
int i2d_DSAparams(const DSA *a, unsigned char **pp)
|
||||
{
|
||||
BIGNUM *num[3];
|
||||
ASN1_INTEGER bs;
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
|
||||
int i2d_DSAPrivateKey(DSA *a, unsigned char **pp)
|
||||
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp)
|
||||
{
|
||||
BIGNUM *num[6];
|
||||
unsigned char data[1];
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
|
||||
int i2d_DSAPublicKey(DSA *a, unsigned char **pp)
|
||||
int i2d_DSAPublicKey(const DSA *a, unsigned char **pp)
|
||||
{
|
||||
BIGNUM *num[4];
|
||||
ASN1_INTEGER bs;
|
||||
|
||||
@@ -140,7 +140,7 @@ err:
|
||||
|
||||
#ifndef NO_DSA
|
||||
#ifndef NO_FP_API
|
||||
int DSA_print_fp(FILE *fp, DSA *x, int off)
|
||||
int DSA_print_fp(FILE *fp, const DSA *x, int off)
|
||||
{
|
||||
BIO *b;
|
||||
int ret;
|
||||
@@ -157,7 +157,7 @@ int DSA_print_fp(FILE *fp, DSA *x, int off)
|
||||
}
|
||||
#endif
|
||||
|
||||
int DSA_print(BIO *bp, DSA *x, int off)
|
||||
int DSA_print(BIO *bp, const DSA *x, int off)
|
||||
{
|
||||
char str[128];
|
||||
unsigned char *m=NULL;
|
||||
@@ -314,7 +314,7 @@ err:
|
||||
|
||||
#ifndef NO_DSA
|
||||
#ifndef NO_FP_API
|
||||
int DSAparams_print_fp(FILE *fp, DSA *x)
|
||||
int DSAparams_print_fp(FILE *fp, const DSA *x)
|
||||
{
|
||||
BIO *b;
|
||||
int ret;
|
||||
@@ -331,7 +331,7 @@ int DSAparams_print_fp(FILE *fp, DSA *x)
|
||||
}
|
||||
#endif
|
||||
|
||||
int DSAparams_print(BIO *bp, DSA *x)
|
||||
int DSAparams_print(BIO *bp, const DSA *x)
|
||||
{
|
||||
unsigned char *m=NULL;
|
||||
int reason=ERR_R_BUF_LIB,i,ret=0;
|
||||
|
||||
@@ -206,6 +206,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
|
||||
long j;
|
||||
int type;
|
||||
unsigned char *p;
|
||||
const unsigned char *cp;
|
||||
#ifndef NO_DSA
|
||||
X509_ALGOR *a;
|
||||
#endif
|
||||
@@ -237,9 +238,9 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
|
||||
if (a->parameter->type == V_ASN1_SEQUENCE)
|
||||
{
|
||||
ret->pkey.dsa->write_params=0;
|
||||
p=a->parameter->value.sequence->data;
|
||||
cp=p=a->parameter->value.sequence->data;
|
||||
j=a->parameter->value.sequence->length;
|
||||
if (!d2i_DSAparams(&ret->pkey.dsa,&p,(long)j))
|
||||
if (!d2i_DSAparams(&ret->pkey.dsa,&cp,(long)j))
|
||||
goto err;
|
||||
}
|
||||
ret->save_parameters=1;
|
||||
|
||||
Reference in New Issue
Block a user