diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/restricted/aws/s2n/crypto/s2n_pkey.h | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/aws/s2n/crypto/s2n_pkey.h')
-rw-r--r-- | contrib/restricted/aws/s2n/crypto/s2n_pkey.h | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/contrib/restricted/aws/s2n/crypto/s2n_pkey.h b/contrib/restricted/aws/s2n/crypto/s2n_pkey.h index 1da8f785c6..c39468695a 100644 --- a/contrib/restricted/aws/s2n/crypto/s2n_pkey.h +++ b/contrib/restricted/aws/s2n/crypto/s2n_pkey.h @@ -1,73 +1,73 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -#pragma once - -#include <openssl/evp.h> - -#include "crypto/s2n_signature.h" -#include "crypto/s2n_ecdsa.h" -#include "crypto/s2n_hash.h" -#include "crypto/s2n_rsa.h" - -#include "utils/s2n_blob.h" - -/* Public/Private Key Type */ -typedef enum { - S2N_PKEY_TYPE_UNKNOWN = -1, - S2N_PKEY_TYPE_RSA = 0, - S2N_PKEY_TYPE_ECDSA, - S2N_PKEY_TYPE_RSA_PSS, - S2N_PKEY_TYPE_SENTINEL -} s2n_pkey_type; - -/* Structure that models a public or private key and type-specific operations */ -struct s2n_pkey { - /* Legacy OpenSSL APIs operate on specific keys, but the more recent - * APIs all operate on EVP_PKEY. Let's store both for backwards compatibility. */ - union { - struct s2n_rsa_key rsa_key; - struct s2n_ecdsa_key ecdsa_key; - } key; - EVP_PKEY *pkey; - - int (*size)(const struct s2n_pkey *key); - int (*sign)(const struct s2n_pkey *priv_key, s2n_signature_algorithm sig_alg, - struct s2n_hash_state *digest, struct s2n_blob *signature); - int (*verify)(const struct s2n_pkey *pub_key, s2n_signature_algorithm sig_alg, - struct s2n_hash_state *digest, struct s2n_blob *signature); - int (*encrypt)(const struct s2n_pkey *key, struct s2n_blob *in, struct s2n_blob *out); - int (*decrypt)(const struct s2n_pkey *key, struct s2n_blob *in, struct s2n_blob *out); - int (*match)(const struct s2n_pkey *pub_key, const struct s2n_pkey *priv_key); - int (*free)(struct s2n_pkey *key); - int (*check_key)(const struct s2n_pkey *key); -}; - -int s2n_pkey_zero_init(struct s2n_pkey *pkey); -int s2n_pkey_setup_for_type(struct s2n_pkey *pkey, s2n_pkey_type pkey_type); -int s2n_pkey_check_key_exists(const struct s2n_pkey *pkey); - -int s2n_pkey_size(const struct s2n_pkey *pkey); -int s2n_pkey_sign(const struct s2n_pkey *pkey, s2n_signature_algorithm sig_alg, - struct s2n_hash_state *digest, struct s2n_blob *signature); -int s2n_pkey_verify(const struct s2n_pkey *pkey, s2n_signature_algorithm sig_alg, - struct s2n_hash_state *digest, struct s2n_blob *signature); -int s2n_pkey_encrypt(const struct s2n_pkey *pkey, struct s2n_blob *in, struct s2n_blob *out); -int s2n_pkey_decrypt(const struct s2n_pkey *pkey, struct s2n_blob *in, struct s2n_blob *out); -int s2n_pkey_match(const struct s2n_pkey *pub_key, const struct s2n_pkey *priv_key); -int s2n_pkey_free(struct s2n_pkey *pkey); - -int s2n_asn1der_to_private_key(struct s2n_pkey *priv_key, struct s2n_blob *asn1der); -int s2n_asn1der_to_public_key_and_type(struct s2n_pkey *pub_key, s2n_pkey_type *pkey_type, struct s2n_blob *asn1der); +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +#pragma once + +#include <openssl/evp.h> + +#include "crypto/s2n_signature.h" +#include "crypto/s2n_ecdsa.h" +#include "crypto/s2n_hash.h" +#include "crypto/s2n_rsa.h" + +#include "utils/s2n_blob.h" + +/* Public/Private Key Type */ +typedef enum { + S2N_PKEY_TYPE_UNKNOWN = -1, + S2N_PKEY_TYPE_RSA = 0, + S2N_PKEY_TYPE_ECDSA, + S2N_PKEY_TYPE_RSA_PSS, + S2N_PKEY_TYPE_SENTINEL +} s2n_pkey_type; + +/* Structure that models a public or private key and type-specific operations */ +struct s2n_pkey { + /* Legacy OpenSSL APIs operate on specific keys, but the more recent + * APIs all operate on EVP_PKEY. Let's store both for backwards compatibility. */ + union { + struct s2n_rsa_key rsa_key; + struct s2n_ecdsa_key ecdsa_key; + } key; + EVP_PKEY *pkey; + + int (*size)(const struct s2n_pkey *key); + int (*sign)(const struct s2n_pkey *priv_key, s2n_signature_algorithm sig_alg, + struct s2n_hash_state *digest, struct s2n_blob *signature); + int (*verify)(const struct s2n_pkey *pub_key, s2n_signature_algorithm sig_alg, + struct s2n_hash_state *digest, struct s2n_blob *signature); + int (*encrypt)(const struct s2n_pkey *key, struct s2n_blob *in, struct s2n_blob *out); + int (*decrypt)(const struct s2n_pkey *key, struct s2n_blob *in, struct s2n_blob *out); + int (*match)(const struct s2n_pkey *pub_key, const struct s2n_pkey *priv_key); + int (*free)(struct s2n_pkey *key); + int (*check_key)(const struct s2n_pkey *key); +}; + +int s2n_pkey_zero_init(struct s2n_pkey *pkey); +int s2n_pkey_setup_for_type(struct s2n_pkey *pkey, s2n_pkey_type pkey_type); +int s2n_pkey_check_key_exists(const struct s2n_pkey *pkey); + +int s2n_pkey_size(const struct s2n_pkey *pkey); +int s2n_pkey_sign(const struct s2n_pkey *pkey, s2n_signature_algorithm sig_alg, + struct s2n_hash_state *digest, struct s2n_blob *signature); +int s2n_pkey_verify(const struct s2n_pkey *pkey, s2n_signature_algorithm sig_alg, + struct s2n_hash_state *digest, struct s2n_blob *signature); +int s2n_pkey_encrypt(const struct s2n_pkey *pkey, struct s2n_blob *in, struct s2n_blob *out); +int s2n_pkey_decrypt(const struct s2n_pkey *pkey, struct s2n_blob *in, struct s2n_blob *out); +int s2n_pkey_match(const struct s2n_pkey *pub_key, const struct s2n_pkey *priv_key); +int s2n_pkey_free(struct s2n_pkey *pkey); + +int s2n_asn1der_to_private_key(struct s2n_pkey *priv_key, struct s2n_blob *asn1der); +int s2n_asn1der_to_public_key_and_type(struct s2n_pkey *pub_key, s2n_pkey_type *pkey_type, struct s2n_blob *asn1der); |