PROV: Add the beginning of a DER writing library
This library is meant to be small and quick. It's based on WPACKET,
which was extended to support DER writing. The way it's used is a
bit unusual, as it's used to write the structures backward into a
given buffer. A typical quick call looks like this:
/*
* Fill in this structure:
*
* something ::= SEQUENCE {
* id OBJECT IDENTIFIER,
* x [0] INTEGER OPTIONAL,
* y [1] BOOLEAN OPTIONAL,
* n INTEGER
* }
*/
unsigned char buf[nnnn], *p = NULL;
size_t encoded_len = 0;
WPACKET pkt;
int ok;
ok = WPACKET_init_der(&pkt, buf, sizeof(buf)
&& DER_w_start_sequence(&pkt, -1)
&& DER_w_bn(&pkt, -1, bn)
&& DER_w_boolean(&pkt, 1, bool)
&& DER_w_precompiled(&pkt, -1, OID, sizeof(OID))
&& DER_w_end_sequence(&pkt, -1)
&& WPACKET_finish(&pkt)
&& WPACKET_get_total_written(&pkt, &encoded_len)
&& (p = WPACKET_get_curr(&pkt)) != NULL;
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11450)
2020-03-31 22:54:43 +08:00
|
|
|
SUBDIRS=der
|
|
|
|
|
2020-07-20 15:11:15 +08:00
|
|
|
SOURCE[../libcommon.a]=provider_err.c provider_ctx.c
|
2020-09-04 15:55:28 +08:00
|
|
|
$FIPSCOMMON=provider_util.c capabilities.c bio_prov.c digest_to_nid.c\
|
2020-10-30 13:54:03 +08:00
|
|
|
securitycheck.c provider_seeding.c
|
2021-05-06 14:48:15 +08:00
|
|
|
SOURCE[../libdefault.a]=$FIPSCOMMON securitycheck_default.c
|
2021-02-26 13:21:47 +08:00
|
|
|
IF[{- !$disabled{module} && !$disabled{shared} -}]
|
|
|
|
SOURCE[../liblegacy.a]=provider_util.c
|
|
|
|
ENDIF
|
2020-09-04 15:55:28 +08:00
|
|
|
SOURCE[../libfips.a]=$FIPSCOMMON securitycheck_fips.c
|