
From: lizhi <lizhi206@huawei.com> Remove unused functions to reduce compilation warnings. Signed-off-by: lizhi <lizhi206@huawei.com> Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com> --- src/uadk_prov_der_writer.c | 69 -------------------------------------- src/uadk_prov_der_writer.h | 4 --- 2 files changed, 73 deletions(-) diff --git a/src/uadk_prov_der_writer.c b/src/uadk_prov_der_writer.c index d20640a..affb860 100644 --- a/src/uadk_prov_der_writer.c +++ b/src/uadk_prov_der_writer.c @@ -120,16 +120,6 @@ int ossl_DER_w_precompiled(WPACKET *pkt, int tag, int_end_context(pkt, tag); } -int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b) -{ - return int_start_context(pkt, tag) && - WPACKET_start_sub_packet(pkt) && - (!b || WPACKET_put_bytes_u8(pkt, 0xFF)) && - !WPACKET_close(pkt) && - !WPACKET_put_bytes_u8(pkt, DER_P_BOOLEAN) && - int_end_context(pkt, tag); -} - int ossl_DER_w_octet_string(WPACKET *pkt, int tag, const unsigned char *data, size_t data_n) { @@ -141,19 +131,6 @@ int ossl_DER_w_octet_string(WPACKET *pkt, int tag, int_end_context(pkt, tag); } -int ossl_DER_w_octet_string_uint32(WPACKET *pkt, int tag, uint32_t value) -{ - unsigned char tmp[4] = { 0, 0, 0, 0 }; - unsigned char *pbuf = tmp + (sizeof(tmp) - 1); - - while (value > 0) { - *pbuf-- = (value & 0xFF); - value >>= LOW_BIT_SIZE; - } - - return ossl_DER_w_octet_string(pkt, tag, tmp, sizeof(tmp)); -} - static int int_der_w_integer(WPACKET *pkt, int tag, int (*put_bytes)(WPACKET *pkt, const void *v, unsigned int *top_byte), @@ -195,52 +172,6 @@ int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v) return int_der_w_integer(pkt, tag, int_put_bytes_uint32, &v); } -static BN_ULONG *bn_get_words(const BIGNUM *a) -{ - return a->d; -} - -static int int_put_bytes_bn(WPACKET *pkt, const void *v, - unsigned int *top_byte) -{ - unsigned char *p = NULL; - size_t n = BN_num_bytes(v); - - /* The BIGNUM limbs are in LE order */ - *top_byte = - ((bn_get_words(v)[(n - 1) / BN_BYTES]) - >> (BYTES_TO_BITS_OFFSET * ((n - 1) % BN_BYTES))) - & 0xFF; - - if (!WPACKET_allocate_bytes(pkt, n, &p)) - return 0; - - if (p != NULL) - BN_bn2bin(v, p); - - return 1; -} - -int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v) -{ - if (v == NULL || BN_is_negative(v)) - return 0; - - if (BN_is_zero(v)) - return ossl_DER_w_uint32(pkt, tag, 0); - - return int_der_w_integer(pkt, tag, int_put_bytes_bn, v); -} - -int ossl_DER_w_null(WPACKET *pkt, int tag) -{ - return int_start_context(pkt, tag) && - WPACKET_start_sub_packet(pkt) && - WPACKET_close(pkt) && - WPACKET_put_bytes_u8(pkt, DER_P_NULL) && - int_end_context(pkt, tag); -} - /* Constructed things need a start and an end */ int ossl_DER_w_begin_sequence(WPACKET *pkt, int tag) { diff --git a/src/uadk_prov_der_writer.h b/src/uadk_prov_der_writer.h index d2a47ea..d8d0232 100644 --- a/src/uadk_prov_der_writer.h +++ b/src/uadk_prov_der_writer.h @@ -110,13 +110,9 @@ int ossl_DER_w_precompiled(WPACKET *pkt, int tag, const unsigned char *precompiled, size_t precompiled_n); -int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b); int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v); -int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v); -int ossl_DER_w_null(WPACKET *pkt, int tag); int ossl_DER_w_octet_string(WPACKET *pkt, int tag, const unsigned char *data, size_t data_n); -int ossl_DER_w_octet_string_uint32(WPACKET *pkt, int tag, uint32_t value); /* * All constructors for constructed elements have a begin and a end function -- 2.43.0