return 0;
}
databuf = OPENSSL_malloc(octet->length);
+ if (databuf == NULL)
+ {
+ GOSTerr(GOST_F_PUB_DECODE_GOST94,ERR_R_MALLOC_FAILURE);
+ ASN1_OCTET_STRING_free(octet);
+ return 0;
+ }
for (i=0,j=octet->length-1;i<octet->length;i++,j--)
{
databuf[j]=octet->data[i];
}
data_len = BN_num_bytes(dsa->pub_key);
databuf = OPENSSL_malloc(data_len);
+ if (databuf == NULL)
+ {
+ GOSTerr(GOST_F_PUB_ENCODE_GOST94,ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
BN_bn2bin(dsa->pub_key,databuf);
octet = ASN1_OCTET_STRING_new();
+ if (octet == NULL)
+ {
+ GOSTerr(GOST_F_PUB_ENCODE_GOST94,ERR_R_MALLOC_FAILURE);
+ OPENSSL_free(databuf);
+ return 0;
+ }
ASN1_STRING_set(octet,NULL,data_len);
sptr = ASN1_STRING_data(octet);
for (i=0,j=data_len-1; i< data_len;i++,j--)
return 0;
}
databuf = OPENSSL_malloc(octet->length);
+ if (databuf == NULL)
+ {
+ GOSTerr(GOST_F_PUB_DECODE_GOST01,ERR_R_MALLOC_FAILURE);
+ ASN1_OCTET_STRING_free(octet);
+ return 0;
+ }
for (i=0,j=octet->length-1;i<octet->length;i++,j--)
{
databuf[j]=octet->data[i];
{
GOSTerr(GOST_F_PUB_ENCODE_GOST01,
GOST_R_PUBLIC_KEY_UNDEFINED);
+ BN_free(order);
return 0;
}
X=BN_new();
data_len = 2*BN_num_bytes(order);
BN_free(order);
databuf = OPENSSL_malloc(data_len);
+ if (databuf == NULL)
+ {
+ GOSTerr(GOST_F_PUB_ENCODE_GOST01,ERR_R_MALLOC_FAILURE);
+ BN_free(X);
+ BN_free(Y);
+ return 0;
+ }
memset(databuf,0,data_len);
store_bignum(X,databuf+data_len/2,data_len/2);
BN_free(X);
BN_free(Y);
octet = ASN1_OCTET_STRING_new();
+ if (octet == NULL)
+ {
+ GOSTerr(GOST_F_PUB_ENCODE_GOST01,ERR_R_MALLOC_FAILURE);
+ OPENSSL_free(databuf);
+ return 0;
+ }
ASN1_STRING_set(octet,NULL,data_len);
sptr=ASN1_STRING_data(octet);
for (i=0,j=data_len-1;i<data_len;i++,j--)