diff options
author | Richard Levitte <levitte@openssl.org> | 2020-03-31 17:16:59 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-04-07 11:16:56 +0200 |
commit | 8c555803476a2af366938161d1186a0d746910ea (patch) | |
tree | b660cc1390e01ee35774c2fa14cac91f25ced7c8 /crypto/dsa | |
parent | 6f5837dc1621882a3a9f34a2910321751ab002c2 (diff) |
PROV: Add DERlib support for DSA
This replaces crypto/dsa/dsa_aid.c with new code and generated OIDs
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11450)
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/build.info | 2 | ||||
-rw-r--r-- | crypto/dsa/dsa_aid.c | 70 |
2 files changed, 1 insertions, 71 deletions
diff --git a/crypto/dsa/build.info b/crypto/dsa/build.info index d8f035000d..fb5a4fee2a 100644 --- a/crypto/dsa/build.info +++ b/crypto/dsa/build.info @@ -1,6 +1,6 @@ LIBS=../../libcrypto -$COMMON=dsa_sign.c dsa_vrf.c dsa_lib.c dsa_ossl.c dsa_aid.c dsa_check.c \ +$COMMON=dsa_sign.c dsa_vrf.c dsa_lib.c dsa_ossl.c dsa_check.c \ dsa_key.c dsa_backend.c SOURCE[../../libcrypto]=$COMMON\ diff --git a/crypto/dsa/dsa_aid.c b/crypto/dsa/dsa_aid.c deleted file mode 100644 index 505e2e2f40..0000000000 --- a/crypto/dsa/dsa_aid.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the Apache License 2.0 (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include <stdlib.h> - -#include <openssl/objects.h> -#include "crypto/dsa.h" - -#define ASN1_SEQUENCE 0x30 -#define ASN1_OID 0x06 - -/* - * id-dsa-with-sha1 OBJECT IDENTIFIER ::= { - * iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 3 - * } - */ -#define ENCODE_ALGORITHMIDENTIFIER_RFC3279(name, n) \ - static const unsigned char algorithmidentifier_##name##_der[] = { \ - ASN1_SEQUENCE, 0x09, \ - ASN1_OID, 0x07, 1 * 40 + 2, 134, 72, 206, 56, 4, n \ -} - -ENCODE_ALGORITHMIDENTIFIER_RFC3279(sha1, 3); - -/* - * dsaWithSHAx OIDs are of the form: (sigAlgs |n|) - * where sigAlgs OBJECT IDENTIFIER ::= { 2 16 840 1 101 3 4 3 } - */ -#define ENCODE_ALGORITHMIDENTIFIER_SIGALGS(name, n) \ - static const unsigned char algorithmidentifier_##name##_der[] = { \ - ASN1_SEQUENCE, 0x0b, \ - ASN1_OID, 0x09, 2 * 40 + 16, 0x86, 0x48, 1, 101, 3, 4, 3, n \ -} - -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha224, 1); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha256, 2); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha384, 3); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha512, 4); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha3_224, 5); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha3_256, 6); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha3_384, 7); -ENCODE_ALGORITHMIDENTIFIER_SIGALGS(sha3_512, 8); - -#define MD_CASE(name) \ - case NID_##name: \ - *len = sizeof(algorithmidentifier_##name##_der); \ - return algorithmidentifier_##name##_der - -const unsigned char *dsa_algorithmidentifier_encoding(int md_nid, size_t *len) -{ - switch (md_nid) { - MD_CASE(sha1); - MD_CASE(sha224); - MD_CASE(sha256); - MD_CASE(sha384); - MD_CASE(sha512); - MD_CASE(sha3_224); - MD_CASE(sha3_256); - MD_CASE(sha3_384); - MD_CASE(sha3_512); - default: - return NULL; - } -} |