*
* Returns 1 on success or 0 on error.
*/
-int encode_der_length(WPACKET *pkt, size_t cont_len)
+int ossl_encode_der_length(WPACKET *pkt, size_t cont_len)
{
if (cont_len > 0xffff)
return 0; /* Too large for supported length encodings */
*
* Returns 1 on success or 0 on error.
*/
-int encode_der_integer(WPACKET *pkt, const BIGNUM *n)
+int ossl_encode_der_integer(WPACKET *pkt, const BIGNUM *n)
{
unsigned char *bnbytes;
size_t cont_len;
if (!WPACKET_start_sub_packet(pkt)
|| !WPACKET_put_bytes_u8(pkt, ID_INTEGER)
- || !encode_der_length(pkt, cont_len)
+ || !ossl_encode_der_length(pkt, cont_len)
|| !WPACKET_allocate_bytes(pkt, cont_len, &bnbytes)
|| !WPACKET_close(pkt))
return 0;
*
* Returns 1 on success or 0 on error.
*/
-int encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s)
+int ossl_encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s)
{
WPACKET tmppkt, *dummypkt;
size_t cont_len;
}
/* Calculate the content length */
- if (!encode_der_integer(dummypkt, r)
- || !encode_der_integer(dummypkt, s)
+ if (!ossl_encode_der_integer(dummypkt, r)
+ || !ossl_encode_der_integer(dummypkt, s)
|| !WPACKET_get_length(dummypkt, &cont_len)
|| (!isnull && !WPACKET_finish(dummypkt))) {
if (!isnull)
/* Add the tag and length bytes */
if (!WPACKET_put_bytes_u8(pkt, ID_SEQUENCE)
- || !encode_der_length(pkt, cont_len)
+ || !ossl_encode_der_length(pkt, cont_len)
/*
* Really encode the integers. We already wrote to the main pkt
* if it had a NULL buffer, so don't do it again
*/
- || (!isnull && !encode_der_integer(pkt, r))
- || (!isnull && !encode_der_integer(pkt, s))
+ || (!isnull && !ossl_encode_der_integer(pkt, r))
+ || (!isnull && !ossl_encode_der_integer(pkt, s))
|| !WPACKET_close(pkt))
return 0;
*ppin += consumed;
return consumed;
}
-
return -1;
}
- if (!encode_der_dsa_sig(&pkt, sig->r, sig->s)
+ if (!ossl_encode_der_dsa_sig(&pkt, sig->r, sig->s)
|| !WPACKET_get_total_written(&pkt, &encoded_len)
|| !WPACKET_finish(&pkt)) {
BUF_MEM_free(buf);
return -1;
}
- if (!encode_der_dsa_sig(&pkt, sig->r, sig->s)
+ if (!ossl_encode_der_dsa_sig(&pkt, sig->r, sig->s)
|| !WPACKET_get_total_written(&pkt, &encoded_len)
|| !WPACKET_finish(&pkt)) {
BUF_MEM_free(buf);
#include "internal/packet.h"
-int encode_der_length(WPACKET *pkt, size_t cont_len);
-int encode_der_integer(WPACKET *pkt, const BIGNUM *n);
-int encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s);
+int ossl_encode_der_length(WPACKET *pkt, size_t cont_len);
+int ossl_encode_der_integer(WPACKET *pkt, const BIGNUM *n);
+int ossl_encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s);
int ossl_decode_der_length(PACKET *pkt, PACKET *subpkt);
int ossl_decode_der_integer(PACKET *pkt, BIGNUM *n);
size_t ossl_decode_der_dsa_sig(BIGNUM *r, BIGNUM *s, const unsigned char **ppin,
-}
/* Subject Public Key Info */
-int DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec);
+int ossl_DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec);
/* Signature */
-int DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont,
- EC_KEY *ec, int mdnid);
+int ossl_DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont,
+ EC_KEY *ec, int mdnid);
#include "prov/der_ec.h"
#include "prov/der_sm2.h"
-int DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec)
+int ossl_DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec)
{
return ossl_DER_w_begin_sequence(pkt, cont)
/* No parameters (yet?) */
precompiled_sz = sizeof(ossl_der_oid_id_sm2_with_##name); \
break;
-int DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont,
- EC_KEY *ec, int mdnid)
+int ossl_DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont,
+ EC_KEY *ec, int mdnid)
{
const unsigned char *precompiled = NULL;
size_t precompiled_sz = 0;
*/
ctx->aid_len = 0;
if (WPACKET_init_der(&pkt, ctx->aid_buf, sizeof(ctx->aid_buf))
- && DER_w_algorithmIdentifier_SM2_with_MD(&pkt, -1, ctx->ec, md_nid)
+ && ossl_DER_w_algorithmIdentifier_SM2_with_MD(&pkt, -1, ctx->ec, md_nid)
&& WPACKET_finish(&pkt)) {
WPACKET_get_total_written(&pkt, &ctx->aid_len);
ctx->aid = WPACKET_get_curr(&pkt);