-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SM2 signature algorithm to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from #12536)
- Loading branch information
1 parent
7ee511d
commit d0b79f8
Showing
21 changed files
with
799 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
oscca OBJECT IDENTIFIER ::= { iso(1) member-body(2) cn(156) 10197 } | ||
|
||
sm-scheme OBJECT IDENTIFIER ::= { oscca 1 } | ||
|
||
-- OID for SM2 signatures with SM3 | ||
|
||
sm2-with-SM3 OBJECT IDENTIFIER ::= { sm-scheme 501 } | ||
|
||
-- Named Elliptic Curves of SM2 | ||
|
||
curveSM2 OBJECT IDENTIFIER ::= { sm-scheme 301 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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 "internal/der.h" | ||
|
||
/* Well known OIDs precompiled */ | ||
{- | ||
$OUT = oids_to_c::process_leaves('providers/common/der/SM2.asn1', | ||
{ dir => $config{sourcedir}, | ||
filter => \&oids_to_c::filter_to_H }); | ||
-} | ||
|
||
/* Subject Public Key Info */ | ||
int DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec); | ||
/* Signature */ | ||
int DER_w_algorithmIdentifier_SM2_with_MD(WPACKET *pkt, int cont, | ||
EC_KEY *ec, int mdnid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* 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 "prov/der_sm2.h" | ||
|
||
/* Well known OIDs precompiled */ | ||
{- | ||
$OUT = oids_to_c::process_leaves('providers/common/der/SM2.asn1', | ||
{ dir => $config{sourcedir}, | ||
filter => \&oids_to_c::filter_to_C }); | ||
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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 <openssl/obj_mac.h> | ||
#include "internal/packet.h" | ||
#include "prov/der_ec.h" | ||
#include "prov/der_sm2.h" | ||
|
||
int DER_w_algorithmIdentifier_SM2(WPACKET *pkt, int cont, EC_KEY *ec) | ||
{ | ||
return DER_w_begin_sequence(pkt, cont) | ||
/* No parameters (yet?) */ | ||
/* It seems SM2 identifier is the same to id_ecPublidKey */ | ||
&& DER_w_precompiled(pkt, -1, der_oid_id_ecPublicKey, | ||
sizeof(der_oid_id_ecPublicKey)) | ||
&& DER_w_end_sequence(pkt, cont); | ||
} |
Oops, something went wrong.