diff options
author | Richard Levitte <levitte@openssl.org> | 2020-03-31 16:54:43 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-04-07 11:16:56 +0200 |
commit | 1d39620b3489d957978ef038be4533300d7c4179 (patch) | |
tree | 85cc10b7ac0a12e9dae84ff52fd22d566baf7d26 /crypto/build.info | |
parent | 77de6bb38d3bc247eac548715969b01cc2b752bb (diff) | |
download | openssl-new-1d39620b3489d957978ef038be4533300d7c4179.tar.gz |
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)
Diffstat (limited to 'crypto/build.info')
-rw-r--r-- | crypto/build.info | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/build.info b/crypto/build.info index baa31ee8e1..864506a18d 100644 --- a/crypto/build.info +++ b/crypto/build.info @@ -71,7 +71,7 @@ $UTIL_COMMON=\ cryptlib.c params.c params_from_text.c bsearch.c ex_data.c o_str.c \ ctype.c threads_pthread.c threads_win.c threads_none.c initthread.c \ context.c sparse_array.c asn1_dsa.c packet.c param_build.c $CPUIDASM \ - param_build_set.c + param_build_set.c der_writer.c $UTIL_DEFINE=$CPUIDDEF SOURCE[../libcrypto]=$UTIL_COMMON \ |