ASN1_OCTET_STRING_free(octet);
return 0;
}
- for (i = 0, j = octet->length - 1; i < octet->length; i++, j--) {
- databuf[j] = octet->data[i];
- }
+
+ BUF_reverse(databuf, octet->data, octet->length);
len = octet->length / 2;
ASN1_OCTET_STRING_free(octet);
goto err;
}
data_len = 2 * BN_num_bytes(order);
- databuf = OPENSSL_malloc(data_len);
+ databuf = OPENSSL_zalloc(data_len);
if (databuf == NULL) {
GOSTerr(GOST_F_PUB_ENCODE_GOST_EC, ERR_R_MALLOC_FAILURE);
goto err;
}
- memset(databuf, 0, data_len);
store_bignum(X, databuf + data_len / 2, data_len / 2);
store_bignum(Y, databuf, data_len / 2);