summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_asn1.c')
-rw-r--r--src/lib/libcrypto/dsa/dsa_asn1.c61
1 files changed, 13 insertions, 48 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_asn1.c b/src/lib/libcrypto/dsa/dsa_asn1.c
index 3bf044665f..daa970e316 100644
--- a/src/lib/libcrypto/dsa/dsa_asn1.c
+++ b/src/lib/libcrypto/dsa/dsa_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_asn1.c,v 1.23 2022/01/07 09:35:36 tb Exp $ */ 1/* $OpenBSD: dsa_asn1.c,v 1.24 2022/01/14 08:29:06 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -329,14 +329,15 @@ i2d_DSAparams_fp(FILE *fp, DSA *a)
329 return ASN1_item_i2d_fp(&DSAparams_it, fp, a); 329 return ASN1_item_i2d_fp(&DSAparams_it, fp, a);
330} 330}
331 331
332/* 332static const ASN1_AUX DSAPublicKey_aux = {
333 * DSA public key is a bit trickier... its effectively a CHOICE type 333 .app_data = NULL,
334 * decided by a field called write_params which can either write out 334 .flags = 0,
335 * just the public key as an INTEGER or the parameters and public key 335 .ref_offset = 0,
336 * in a SEQUENCE 336 .ref_lock = 0,
337 */ 337 .asn1_cb = dsa_cb,
338 338 .enc_offset = 0,
339static const ASN1_TEMPLATE dsa_pub_internal_seq_tt[] = { 339};
340static const ASN1_TEMPLATE DSAPublicKey_seq_tt[] = {
340 { 341 {
341 .flags = 0, 342 .flags = 0,
342 .tag = 0, 343 .tag = 0,
@@ -367,52 +368,16 @@ static const ASN1_TEMPLATE dsa_pub_internal_seq_tt[] = {
367 }, 368 },
368}; 369};
369 370
370const ASN1_ITEM dsa_pub_internal_it = { 371const ASN1_ITEM DSAPublicKey_it = {
371 .itype = ASN1_ITYPE_SEQUENCE, 372 .itype = ASN1_ITYPE_SEQUENCE,
372 .utype = V_ASN1_SEQUENCE, 373 .utype = V_ASN1_SEQUENCE,
373 .templates = dsa_pub_internal_seq_tt, 374 .templates = DSAPublicKey_seq_tt,
374 .tcount = sizeof(dsa_pub_internal_seq_tt) / sizeof(ASN1_TEMPLATE), 375 .tcount = sizeof(DSAPublicKey_seq_tt) / sizeof(ASN1_TEMPLATE),
375 .funcs = NULL,
376 .size = sizeof(DSA),
377 .sname = "DSA",
378};
379
380static const ASN1_AUX DSAPublicKey_aux = {
381 .app_data = NULL,
382 .flags = 0,
383 .ref_offset = 0,
384 .ref_lock = 0,
385 .asn1_cb = dsa_cb,
386 .enc_offset = 0,
387};
388static const ASN1_TEMPLATE DSAPublicKey_ch_tt[] = {
389 {
390 .flags = 0,
391 .tag = 0,
392 .offset = offsetof(DSA, pub_key),
393 .field_name = "pub_key",
394 .item = &BIGNUM_it,
395 },
396 {
397 .flags = 0 | ASN1_TFLG_COMBINE,
398 .tag = 0,
399 .offset = 0,
400 .field_name = NULL,
401 .item = &dsa_pub_internal_it,
402 },
403};
404
405const ASN1_ITEM DSAPublicKey_it = {
406 .itype = ASN1_ITYPE_CHOICE,
407 .utype = offsetof(DSA, write_params),
408 .templates = DSAPublicKey_ch_tt,
409 .tcount = sizeof(DSAPublicKey_ch_tt) / sizeof(ASN1_TEMPLATE),
410 .funcs = &DSAPublicKey_aux, 376 .funcs = &DSAPublicKey_aux,
411 .size = sizeof(DSA), 377 .size = sizeof(DSA),
412 .sname = "DSA", 378 .sname = "DSA",
413}; 379};
414 380
415
416DSA * 381DSA *
417d2i_DSAPublicKey(DSA **a, const unsigned char **in, long len) 382d2i_DSAPublicKey(DSA **a, const unsigned char **in, long len)
418{ 383{