VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/include/crypto/sm2.h@ 98133

最後變更 在這個檔案從98133是 97984,由 vboxsync 提交於 2 年 前

libs/openssl-3.0.7: Shut up pragma once warnings for internal headers. Added sed script for doing that. bugref:10317

檔案大小: 3.2 KB
 
1/*
2 * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright 2017 Ribose Inc. All Rights Reserved.
4 * Ported from Ribose contributions from Botan.
5 *
6 * Licensed under the Apache License 2.0 (the "License"). You may not use
7 * this file except in compliance with the License. You can obtain a copy
8 * in the file LICENSE in the source distribution or at
9 * https://www.openssl.org/source/license.html
10 */
11
12#ifndef OSSL_CRYPTO_SM2_H
13# define OSSL_CRYPTO_SM2_H
14# ifndef RT_WITHOUT_PRAGMA_ONCE /* VBOX */
15# pragma once
16# endif /* VBOX */
17
18# include <openssl/opensslconf.h>
19
20# if !defined(OPENSSL_NO_SM2) && !defined(FIPS_MODULE)
21
22# include <openssl/ec.h>
23# include "crypto/types.h"
24
25int ossl_sm2_key_private_check(const EC_KEY *eckey);
26
27/* The default user id as specified in GM/T 0009-2012 */
28# define SM2_DEFAULT_USERID "1234567812345678"
29
30int ossl_sm2_compute_z_digest(uint8_t *out,
31 const EVP_MD *digest,
32 const uint8_t *id,
33 const size_t id_len,
34 const EC_KEY *key);
35
36/*
37 * SM2 signature operation. Computes Z and then signs H(Z || msg) using SM2
38 */
39ECDSA_SIG *ossl_sm2_do_sign(const EC_KEY *key,
40 const EVP_MD *digest,
41 const uint8_t *id,
42 const size_t id_len,
43 const uint8_t *msg, size_t msg_len);
44
45int ossl_sm2_do_verify(const EC_KEY *key,
46 const EVP_MD *digest,
47 const ECDSA_SIG *signature,
48 const uint8_t *id,
49 const size_t id_len,
50 const uint8_t *msg, size_t msg_len);
51
52/*
53 * SM2 signature generation.
54 */
55int ossl_sm2_internal_sign(const unsigned char *dgst, int dgstlen,
56 unsigned char *sig, unsigned int *siglen,
57 EC_KEY *eckey);
58
59/*
60 * SM2 signature verification.
61 */
62int ossl_sm2_internal_verify(const unsigned char *dgst, int dgstlen,
63 const unsigned char *sig, int siglen,
64 EC_KEY *eckey);
65
66/*
67 * SM2 encryption
68 */
69int ossl_sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest,
70 size_t msg_len, size_t *ct_size);
71
72int ossl_sm2_plaintext_size(const unsigned char *ct, size_t ct_size,
73 size_t *pt_size);
74
75int ossl_sm2_encrypt(const EC_KEY *key,
76 const EVP_MD *digest,
77 const uint8_t *msg, size_t msg_len,
78 uint8_t *ciphertext_buf, size_t *ciphertext_len);
79
80int ossl_sm2_decrypt(const EC_KEY *key,
81 const EVP_MD *digest,
82 const uint8_t *ciphertext, size_t ciphertext_len,
83 uint8_t *ptext_buf, size_t *ptext_len);
84
85const unsigned char *ossl_sm2_algorithmidentifier_encoding(int md_nid,
86 size_t *len);
87# endif /* OPENSSL_NO_SM2 */
88#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette