Skip to content

Commit

Permalink
Merge pull request #77 from hug-dev/update-mbed-tls
Browse files Browse the repository at this point in the history
Update to version 2.25.0 of Mbed TLS
  • Loading branch information
hug-dev authored Mar 5, 2021
2 parents 9fbd3ad + 1f1832c commit b141a66
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 424 deletions.
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cargo build --no-default-features --features no-std
# Test dynamic linking
git clone https://github.com/ARMmbed/mbedtls.git
pushd mbedtls
git checkout mbedtls-2.22.0
git checkout mbedtls-2.25.0
./scripts/config.py crypto
SHARED=1 make
popd
Expand Down
22 changes: 11 additions & 11 deletions psa-crypto-sys/src/c/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,38 +338,38 @@ shim_PSA_ALG_RSA_OAEP(psa_algorithm_t hash_alg)
return PSA_ALG_RSA_OAEP(hash_alg);
}

psa_ecc_curve_t
shim_PSA_KEY_TYPE_GET_CURVE(psa_key_type_t key_type)
psa_ecc_family_t
shim_PSA_KEY_TYPE_ECC_GET_FAMILY(psa_key_type_t key_type)
{
return PSA_KEY_TYPE_GET_CURVE(key_type);
return PSA_KEY_TYPE_ECC_GET_FAMILY(key_type);
}

psa_dh_group_t
shim_PSA_KEY_TYPE_GET_GROUP(psa_key_type_t key_type)
psa_dh_family_t
shim_PSA_KEY_TYPE_DH_GET_FAMILY(psa_key_type_t key_type)
{
return PSA_KEY_TYPE_GET_GROUP(key_type);
return PSA_KEY_TYPE_DH_GET_FAMILY(key_type);
}

psa_key_type_t
shim_PSA_KEY_TYPE_ECC_KEY_PAIR(psa_ecc_curve_t curve)
shim_PSA_KEY_TYPE_ECC_KEY_PAIR(psa_ecc_family_t curve)
{
return PSA_KEY_TYPE_ECC_KEY_PAIR(curve);
}

psa_key_type_t
shim_PSA_KEY_TYPE_ECC_PUBLIC_KEY(psa_ecc_curve_t curve)
shim_PSA_KEY_TYPE_ECC_PUBLIC_KEY(psa_ecc_family_t curve)
{
return PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve);
}

psa_key_type_t
shim_PSA_KEY_TYPE_DH_KEY_PAIR(psa_dh_group_t group)
shim_PSA_KEY_TYPE_DH_KEY_PAIR(psa_dh_family_t group)
{
return PSA_KEY_TYPE_DH_KEY_PAIR(group);
}

psa_key_type_t
shim_PSA_KEY_TYPE_DH_PUBLIC_KEY(psa_dh_group_t group)
shim_PSA_KEY_TYPE_DH_PUBLIC_KEY(psa_dh_family_t group)
{
return PSA_KEY_TYPE_DH_PUBLIC_KEY(group);
}
Expand Down Expand Up @@ -438,4 +438,4 @@ size_t
shim_PSA_AEAD_DECRYPT_OUTPUT_SIZE(psa_algorithm_t aead_alg, size_t ciphertext_bytes)
{
return PSA_AEAD_DECRYPT_OUTPUT_SIZE(aead_alg, ciphertext_bytes);
}
}
85 changes: 11 additions & 74 deletions psa-crypto-sys/src/c/shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,13 @@
#include <psa/crypto.h>
#include <psa/crypto_se_driver.h>

const size_t shim_PSA_MAX_KEY_BITS = PSA_MAX_KEY_BITS;
const psa_key_bits_t shim_PSA_KEY_BITS_TOO_LARGE = PSA_KEY_BITS_TOO_LARGE;
const psa_key_type_t shim_PSA_KEY_TYPE_NONE = PSA_KEY_TYPE_NONE;
const psa_key_type_t shim_PSA_KEY_TYPE_VENDOR_FLAG = PSA_KEY_TYPE_VENDOR_FLAG;
const psa_key_type_t shim_PSA_KEY_TYPE_CATEGORY_MASK =
PSA_KEY_TYPE_CATEGORY_MASK;
const psa_key_type_t shim_PSA_KEY_TYPE_CATEGORY_SYMMETRIC =
PSA_KEY_TYPE_CATEGORY_SYMMETRIC;
const psa_key_type_t shim_PSA_KEY_TYPE_CATEGORY_RAW = PSA_KEY_TYPE_CATEGORY_RAW;
const psa_key_type_t shim_PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY =
PSA_KEY_TYPE_CATEGORY_PUBLIC_KEY;
const psa_key_type_t shim_PSA_KEY_TYPE_CATEGORY_KEY_PAIR =
PSA_KEY_TYPE_CATEGORY_KEY_PAIR;
const psa_key_type_t shim_PSA_KEY_TYPE_CATEGORY_FLAG_PAIR =
PSA_KEY_TYPE_CATEGORY_FLAG_PAIR;
const psa_key_type_t shim_PSA_KEY_TYPE_DSA_PUBLIC_KEY =
PSA_KEY_TYPE_DSA_PUBLIC_KEY;
const psa_key_type_t shim_PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE =
PSA_KEY_TYPE_ECC_PUBLIC_KEY_BASE;
const psa_key_type_t shim_PSA_KEY_TYPE_ECC_KEY_PAIR_BASE =
PSA_KEY_TYPE_ECC_KEY_PAIR_BASE;
const psa_key_type_t shim_PSA_KEY_TYPE_ECC_CURVE_MASK =
PSA_KEY_TYPE_ECC_CURVE_MASK;
const psa_algorithm_t shim_PSA_ALG_VENDOR_FLAG = PSA_ALG_VENDOR_FLAG;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_MASK = PSA_ALG_CATEGORY_MASK;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_HASH = PSA_ALG_CATEGORY_HASH;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_MAC = PSA_ALG_CATEGORY_MAC;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_CIPHER = PSA_ALG_CATEGORY_CIPHER;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_AEAD = PSA_ALG_CATEGORY_AEAD;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_SIGN = PSA_ALG_CATEGORY_SIGN;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION =
PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_KEY_AGREEMENT =
PSA_ALG_CATEGORY_KEY_AGREEMENT;
const psa_algorithm_t shim_PSA_ALG_CATEGORY_KEY_DERIVATION =
PSA_ALG_CATEGORY_KEY_DERIVATION;
const psa_algorithm_t shim_PSA_ALG_HASH_MASK = PSA_ALG_HASH_MASK;
const psa_algorithm_t shim_PSA_ALG_MAC_SUBCATEGORY_MASK =
PSA_ALG_MAC_SUBCATEGORY_MASK;
const psa_algorithm_t shim_PSA_ALG_HMAC_BASE = PSA_ALG_HMAC_BASE;
const psa_algorithm_t shim_PSA_ALG_MAC_TRUNCATION_MASK =
PSA_ALG_MAC_TRUNCATION_MASK;
const psa_algorithm_t shim_PSA_ALG_CIPHER_MAC_BASE = PSA_ALG_CIPHER_MAC_BASE;
const psa_algorithm_t shim_PSA_ALG_CIPHER_STREAM_FLAG =
PSA_ALG_CIPHER_STREAM_FLAG;
const psa_algorithm_t shim_PSA_ALG_CIPHER_FROM_BLOCK_FLAG =
PSA_ALG_CIPHER_FROM_BLOCK_FLAG;
const psa_algorithm_t shim_PSA_ALG_AEAD_TAG_LENGTH_MASK =
PSA_ALG_AEAD_TAG_LENGTH_MASK;
const psa_algorithm_t shim_PSA_ALG_RSA_PKCS1V15_SIGN_BASE =
PSA_ALG_RSA_PKCS1V15_SIGN_BASE;
const psa_algorithm_t shim_PSA_ALG_RSA_PSS_BASE = PSA_ALG_RSA_PSS_BASE;
const psa_algorithm_t shim_PSA_ALG_DSA_BASE = PSA_ALG_DSA_BASE;
const psa_algorithm_t shim_PSA_ALG_DETERMINISTIC_DSA_BASE =
PSA_ALG_DETERMINISTIC_DSA_BASE;
const psa_algorithm_t shim_PSA_ALG_DSA_DETERMINISTIC_FLAG =
PSA_ALG_DSA_DETERMINISTIC_FLAG;
const psa_algorithm_t shim_PSA_ALG_ECDSA_BASE = PSA_ALG_ECDSA_BASE;
const psa_algorithm_t shim_PSA_ALG_DETERMINISTIC_ECDSA_BASE =
PSA_ALG_DETERMINISTIC_ECDSA_BASE;
const psa_algorithm_t shim_PSA_ALG_RSA_OAEP_BASE = PSA_ALG_RSA_OAEP_BASE;
const psa_algorithm_t shim_PSA_ALG_HKDF_BASE = PSA_ALG_HKDF_BASE;
const psa_algorithm_t shim_PSA_ALG_TLS12_PRF_BASE = PSA_ALG_TLS12_PRF_BASE;
const psa_algorithm_t shim_PSA_ALG_TLS12_PSK_TO_MS_BASE =
PSA_ALG_TLS12_PSK_TO_MS_BASE;
const psa_algorithm_t shim_PSA_ALG_KEY_DERIVATION_MASK =
PSA_ALG_KEY_DERIVATION_MASK;
const psa_key_derivation_step_t shim_PSA_KEY_DERIVATION_INPUT_SECRET = PSA_KEY_DERIVATION_INPUT_SECRET;
const psa_key_derivation_step_t shim_PSA_KEY_DERIVATION_INPUT_LABEL = PSA_KEY_DERIVATION_INPUT_LABEL;
const psa_key_derivation_step_t shim_PSA_KEY_DERIVATION_INPUT_SALT = PSA_KEY_DERIVATION_INPUT_SALT;
const psa_key_derivation_step_t shim_PSA_KEY_DERIVATION_INPUT_INFO = PSA_KEY_DERIVATION_INPUT_INFO;
const psa_key_derivation_step_t shim_PSA_KEY_DERIVATION_INPUT_SEED = PSA_KEY_DERIVATION_INPUT_SEED;

psa_algorithm_t shim_get_key_algorithm(const psa_key_attributes_t *attributes);
psa_status_t shim_get_key_attributes(psa_key_handle_t key_handle, psa_key_attributes_t *attributes);
size_t shim_get_key_bits(const psa_key_attributes_t *attributes);
psa_key_id_t shim_get_key_id(const psa_key_attributes_t *attributes);
psa_key_lifetime_t shim_get_key_lifetime(const psa_key_attributes_t *attributes);
Expand Down Expand Up @@ -136,12 +73,12 @@ int shim_PSA_KEY_TYPE_IS_ECC_KEY_PAIR(psa_key_type_t key_type);
int shim_PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(psa_key_type_t key_type);
int shim_PSA_KEY_TYPE_IS_DH_PUBLIC_KEY(psa_key_type_t key_type);
int shim_PSA_KEY_TYPE_IS_DH_KEY_PAIR(psa_key_type_t key_type);
psa_ecc_curve_t shim_PSA_KEY_TYPE_GET_CURVE(psa_key_type_t key_type);
psa_dh_group_t shim_PSA_KEY_TYPE_GET_GROUP(psa_key_type_t key_type);
psa_key_type_t shim_PSA_KEY_TYPE_ECC_KEY_PAIR(psa_ecc_curve_t curve);
psa_key_type_t shim_PSA_KEY_TYPE_ECC_PUBLIC_KEY(psa_ecc_curve_t curve);
psa_key_type_t shim_PSA_KEY_TYPE_DH_KEY_PAIR(psa_dh_group_t group);
psa_key_type_t shim_PSA_KEY_TYPE_DH_PUBLIC_KEY(psa_dh_group_t group);
psa_ecc_family_t shim_PSA_KEY_TYPE_ECC_GET_FAMILY(psa_key_type_t key_type);
psa_dh_family_t shim_PSA_KEY_TYPE_DH_GET_FAMILY(psa_key_type_t key_type);
psa_key_type_t shim_PSA_KEY_TYPE_ECC_KEY_PAIR(psa_ecc_family_t curve);
psa_key_type_t shim_PSA_KEY_TYPE_ECC_PUBLIC_KEY(psa_ecc_family_t curve);
psa_key_type_t shim_PSA_KEY_TYPE_DH_KEY_PAIR(psa_dh_family_t group);
psa_key_type_t shim_PSA_KEY_TYPE_DH_PUBLIC_KEY(psa_dh_family_t group);
psa_key_type_t shim_PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(psa_key_type_t key_type);
size_t shim_PSA_SIGN_OUTPUT_SIZE(psa_key_type_t key_type, size_t key_bits, psa_algorithm_t alg);
size_t shim_PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(psa_key_type_t key_type, size_t key_bits, psa_algorithm_t alg);
Expand Down
188 changes: 98 additions & 90 deletions psa-crypto-sys/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,104 +1,112 @@
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0

//! Constants used by the Mbed Provider for interaction with the Mbed Crypto C library.
//! Specification-defined constants
#![allow(missing_docs)]

use super::types::*;

// PSA error codes
pub const PSA_SUCCESS: psa_status_t = 0;
pub const PSA_ERROR_GENERIC_ERROR: psa_status_t = -132;
pub const PSA_ERROR_NOT_PERMITTED: psa_status_t = -133;
pub const PSA_ERROR_NOT_SUPPORTED: psa_status_t = -134;
pub const PSA_ERROR_INVALID_ARGUMENT: psa_status_t = -135;
pub const PSA_ERROR_INVALID_HANDLE: psa_status_t = -136;
pub const PSA_ALG_ANY_HASH: psa_algorithm_t = 0x020000ff;
pub const PSA_ALG_CBC_MAC: psa_algorithm_t = 0x03c00100;
pub const PSA_ALG_CBC_NO_PADDING: psa_algorithm_t = 0x04404000;
pub const PSA_ALG_CBC_PKCS7: psa_algorithm_t = 0x04404100;
pub const PSA_ALG_CCM: psa_algorithm_t = 0x05500100;
pub const PSA_ALG_CFB: psa_algorithm_t = 0x04c01100;
pub const PSA_ALG_CHACHA20_POLY1305: psa_algorithm_t = 0x05100500;
pub const PSA_ALG_CMAC: psa_algorithm_t = 0x03c00200;
pub const PSA_ALG_CTR: psa_algorithm_t = 0x04c01000;
pub const PSA_ALG_ECB_NO_PADDING: psa_algorithm_t = 0x04404400;
pub const PSA_ALG_ECDH: psa_algorithm_t = 0x09020000;
pub const PSA_ALG_ECDSA_ANY: psa_algorithm_t = 0x06000600;
pub const PSA_ALG_FFDH: psa_algorithm_t = 0x09010000;
pub const PSA_ALG_GCM: psa_algorithm_t = 0x05500200;
pub const PSA_ALG_MD2: psa_algorithm_t = 0x02000001;
pub const PSA_ALG_MD4: psa_algorithm_t = 0x02000002;
pub const PSA_ALG_MD5: psa_algorithm_t = 0x02000003;
pub const PSA_ALG_NONE: psa_algorithm_t = 0;
pub const PSA_ALG_OFB: psa_algorithm_t = 0x04c01200;
pub const PSA_ALG_RIPEMD160: psa_algorithm_t = 0x02000004;
pub const PSA_ALG_RSA_PKCS1V15_CRYPT: psa_algorithm_t = 0x07000200;
pub const PSA_ALG_RSA_PKCS1V15_SIGN_RAW: psa_algorithm_t = 0x06000200;
pub const PSA_ALG_SHA3_224: psa_algorithm_t = 0x02000010;
pub const PSA_ALG_SHA3_256: psa_algorithm_t = 0x02000011;
pub const PSA_ALG_SHA3_384: psa_algorithm_t = 0x02000012;
pub const PSA_ALG_SHA3_512: psa_algorithm_t = 0x02000013;
pub const PSA_ALG_SHA_1: psa_algorithm_t = 0x02000005;
pub const PSA_ALG_SHA_224: psa_algorithm_t = 0x02000008;
pub const PSA_ALG_SHA_256: psa_algorithm_t = 0x02000009;
pub const PSA_ALG_SHA_384: psa_algorithm_t = 0x0200000a;
pub const PSA_ALG_SHA_512: psa_algorithm_t = 0x0200000b;
pub const PSA_ALG_SHA_512_224: psa_algorithm_t = 0x0200000c;
pub const PSA_ALG_SHA_512_256: psa_algorithm_t = 0x0200000d;
pub const PSA_ALG_SM3: psa_algorithm_t = 0x02000014;
pub const PSA_ALG_STREAM_CIPHER: psa_algorithm_t = 0x04800100;
pub const PSA_ALG_XTS: psa_algorithm_t = 0x0440ff00;
pub const PSA_DH_FAMILY_RFC7919: psa_dh_family_t = 0x03;
pub const PSA_ECC_FAMILY_BRAINPOOL_P_R1: psa_ecc_family_t = 0x30;
pub const PSA_ECC_FAMILY_FRP: psa_ecc_family_t = 0x33;
pub const PSA_ECC_FAMILY_MONTGOMERY: psa_ecc_family_t = 0x41;
pub const PSA_ECC_FAMILY_SECP_K1: psa_ecc_family_t = 0x17;
pub const PSA_ECC_FAMILY_SECP_R1: psa_ecc_family_t = 0x12;
pub const PSA_ECC_FAMILY_SECP_R2: psa_ecc_family_t = 0x1b;
pub const PSA_ECC_FAMILY_SECT_K1: psa_ecc_family_t = 0x27;
pub const PSA_ECC_FAMILY_SECT_R1: psa_ecc_family_t = 0x22;
pub const PSA_ECC_FAMILY_SECT_R2: psa_ecc_family_t = 0x2b;
pub const PSA_ERROR_ALREADY_EXISTS: psa_status_t = -139;
pub const PSA_ERROR_BAD_STATE: psa_status_t = -137;
pub const PSA_ERROR_BUFFER_TOO_SMALL: psa_status_t = -138;
pub const PSA_ERROR_ALREADY_EXISTS: psa_status_t = -139;
pub const PSA_ERROR_DOES_NOT_EXIST: psa_status_t = -140;
pub const PSA_ERROR_INSUFFICIENT_MEMORY: psa_status_t = -141;
pub const PSA_ERROR_INSUFFICIENT_STORAGE: psa_status_t = -142;
pub const PSA_ERROR_INSUFFICIENT_DATA: psa_status_t = -143;
pub const PSA_ERROR_COMMUNICATION_FAILURE: psa_status_t = -145;
pub const PSA_ERROR_STORAGE_FAILURE: psa_status_t = -146;
pub const PSA_ERROR_HARDWARE_FAILURE: psa_status_t = -147;
pub const PSA_ERROR_INSUFFICIENT_ENTROPY: psa_status_t = -148;
pub const PSA_ERROR_INVALID_SIGNATURE: psa_status_t = -149;
pub const PSA_ERROR_INVALID_PADDING: psa_status_t = -150;
pub const PSA_ERROR_CORRUPTION_DETECTED: psa_status_t = -151;
pub const PSA_ERROR_DATA_CORRUPT: psa_status_t = -152;
pub const PSA_ERROR_DATA_INVALID: psa_status_t = -153;

pub const PSA_MAX_KEY_BITS: usize = 65528;
pub const PSA_KEY_TYPE_NONE: psa_key_type_t = 0;
pub const PSA_KEY_TYPE_RAW_DATA: psa_key_type_t = 4097;
pub const PSA_KEY_TYPE_HMAC: psa_key_type_t = 4352;
pub const PSA_KEY_TYPE_DERIVE: psa_key_type_t = 4608;
pub const PSA_KEY_TYPE_AES: psa_key_type_t = 9216;
pub const PSA_KEY_TYPE_DES: psa_key_type_t = 8961;
pub const PSA_KEY_TYPE_CAMELLIA: psa_key_type_t = 9219;
pub const PSA_KEY_TYPE_ARC4: psa_key_type_t = 8194;
pub const PSA_KEY_TYPE_CHACHA20: psa_key_type_t = 8196;
pub const PSA_KEY_TYPE_RSA_PUBLIC_KEY: psa_key_type_t = 16385;
pub const PSA_KEY_TYPE_RSA_KEY_PAIR: psa_key_type_t = 28673;
pub const PSA_ECC_FAMILY_SECP_K1: psa_ecc_curve_t = 23;
pub const PSA_ECC_FAMILY_SECP_R1: psa_ecc_curve_t = 18;
pub const PSA_ECC_FAMILY_SECP_R2: psa_ecc_curve_t = 27;
pub const PSA_ECC_FAMILY_SECT_K1: psa_ecc_curve_t = 39;
pub const PSA_ECC_FAMILY_SECT_R1: psa_ecc_curve_t = 34;
pub const PSA_ECC_FAMILY_SECT_R2: psa_ecc_curve_t = 43;
pub const PSA_ECC_FAMILY_BRAINPOOL_P_R1: psa_ecc_curve_t = 48;
pub const PSA_ECC_FAMILY_MONTGOMERY: psa_ecc_curve_t = 65;
pub const PSA_DH_FAMILY_RFC7919: psa_dh_group_t = 3;
pub const PSA_ALG_MD2: psa_algorithm_t = 16_777_217;
pub const PSA_ALG_MD4: psa_algorithm_t = 16_777_218;
pub const PSA_ALG_MD5: psa_algorithm_t = 16_777_219;
pub const PSA_ALG_RIPEMD160: psa_algorithm_t = 16_777_220;
pub const PSA_ALG_SHA_1: psa_algorithm_t = 16_777_221;
pub const PSA_ALG_SHA_224: psa_algorithm_t = 16_777_224;
pub const PSA_ALG_SHA_256: psa_algorithm_t = 16_777_225;
pub const PSA_ALG_SHA_384: psa_algorithm_t = 16_777_226;
pub const PSA_ALG_SHA_512: psa_algorithm_t = 16_777_227;
pub const PSA_ALG_SHA_512_224: psa_algorithm_t = 16_777_228;
pub const PSA_ALG_SHA_512_256: psa_algorithm_t = 16_777_229;
pub const PSA_ALG_SHA3_224: psa_algorithm_t = 16_777_232;
pub const PSA_ALG_SHA3_256: psa_algorithm_t = 16_777_233;
pub const PSA_ALG_SHA3_384: psa_algorithm_t = 16_777_234;
pub const PSA_ALG_SHA3_512: psa_algorithm_t = 16_777_235;
pub const PSA_ALG_ANY_HASH: psa_algorithm_t = 16_777_471;
pub const PSA_ALG_CBC_MAC: psa_algorithm_t = 46_137_345;
pub const PSA_ALG_CMAC: psa_algorithm_t = 46_137_346;
pub const PSA_ALG_ARC4: psa_algorithm_t = 75_497_473;
pub const PSA_ALG_CTR: psa_algorithm_t = 79_691_777;
pub const PSA_ALG_CFB: psa_algorithm_t = 79_691_778;
pub const PSA_ALG_OFB: psa_algorithm_t = 79_691_779;
pub const PSA_ALG_XTS: psa_algorithm_t = 71_303_423;
pub const PSA_ALG_CBC_NO_PADDING: psa_algorithm_t = 73_400_576;
pub const PSA_ALG_CBC_PKCS7: psa_algorithm_t = 73_400_577;
pub const PSA_ALG_CCM: psa_algorithm_t = 104_861_697;
pub const PSA_ALG_GCM: psa_algorithm_t = 104_861_698;
pub const PSA_ALG_CHACHA20_POLY1305: psa_algorithm_t = 84_935_936;
pub const PSA_ALG_FFDH: psa_algorithm_t = 0x30100000; // Doesn't match latest PSA spec
pub const PSA_ALG_ECDH: psa_algorithm_t = 0x30200000; // Doesn't match latest PSA spec
pub const PSA_ALG_RSA_PKCS1V15_SIGN_RAW: psa_algorithm_t = 268_566_528;
pub const PSA_ALG_ECDSA_ANY: psa_algorithm_t = 268_828_672;
pub const PSA_ALG_RSA_PKCS1V15_CRYPT: psa_algorithm_t = 302_120_960;
pub const PSA_KEY_LIFETIME_VOLATILE: psa_key_lifetime_t = 0;
pub const PSA_KEY_LIFETIME_PERSISTENT: psa_key_lifetime_t = 1;
pub const PSA_KEY_USAGE_EXPORT: psa_key_usage_t = 1;
pub const PSA_KEY_USAGE_COPY: psa_key_usage_t = 2;
pub const PSA_KEY_USAGE_ENCRYPT: psa_key_usage_t = 256;
pub const PSA_KEY_USAGE_DECRYPT: psa_key_usage_t = 512;
pub const PSA_KEY_USAGE_SIGN: psa_key_usage_t = 1024;
pub const PSA_KEY_USAGE_VERIFY: psa_key_usage_t = 2048;
pub const PSA_KEY_USAGE_DERIVE: psa_key_usage_t = 4096;
pub const PSA_KEY_ID_USER_MIN: psa_key_id_t = 0x0000_0001;
pub const PSA_KEY_ID_USER_MAX: psa_key_id_t = 0x3fff_ffff;

pub const PSA_KEY_DERIVATION_INPUT_SECRET: psa_key_derivation_step_t = 0x0101;
pub const PSA_KEY_DERIVATION_INPUT_LABEL: psa_key_derivation_step_t = 0x0201;
pub const PSA_KEY_DERIVATION_INPUT_SALT: psa_key_derivation_step_t = 0x0202;
pub const PSA_KEY_DERIVATION_INPUT_INFO: psa_key_derivation_step_t = 0x0203;
pub const PSA_KEY_DERIVATION_INPUT_SEED: psa_key_derivation_step_t = 0x0204;
pub const PSA_ERROR_DOES_NOT_EXIST: psa_status_t = -140;
pub const PSA_ERROR_GENERIC_ERROR: psa_status_t = -132;
pub const PSA_ERROR_HARDWARE_FAILURE: psa_status_t = -147;
pub const PSA_ERROR_INSUFFICIENT_DATA: psa_status_t = -143;
pub const PSA_ERROR_INSUFFICIENT_ENTROPY: psa_status_t = -148;
pub const PSA_ERROR_INSUFFICIENT_MEMORY: psa_status_t = -141;
pub const PSA_ERROR_INSUFFICIENT_STORAGE: psa_status_t = -142;
pub const PSA_ERROR_INVALID_ARGUMENT: psa_status_t = -135;
pub const PSA_ERROR_INVALID_HANDLE: psa_status_t = -136;
pub const PSA_ERROR_INVALID_PADDING: psa_status_t = -150;
pub const PSA_ERROR_INVALID_SIGNATURE: psa_status_t = -149;
pub const PSA_ERROR_NOT_PERMITTED: psa_status_t = -133;
pub const PSA_ERROR_NOT_SUPPORTED: psa_status_t = -134;
pub const PSA_ERROR_STORAGE_FAILURE: psa_status_t = -146;
pub const PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH: usize = 4;
pub const PSA_KEY_ID_NULL: psa_key_id_t = 0;
pub const PSA_KEY_ID_USER_MAX: psa_key_id_t = 0x3fffffff;
pub const PSA_KEY_ID_USER_MIN: psa_key_id_t = 0x00000001;
pub const PSA_KEY_ID_VENDOR_MAX: psa_key_id_t = 0x7fffffff;
pub const PSA_KEY_ID_VENDOR_MIN: psa_key_id_t = 0x40000000;
pub const PSA_KEY_LIFETIME_PERSISTENT: psa_key_lifetime_t = 0x00000001;
pub const PSA_KEY_LIFETIME_VOLATILE: psa_key_lifetime_t = 0x00000000;
pub const PSA_KEY_LOCATION_LOCAL_STORAGE: psa_key_location_t = 0x000000;
pub const PSA_KEY_LOCATION_PRIMARY_SECURE_ELEMENT: psa_key_location_t = 0x000001;
pub const PSA_KEY_PERSISTENCE_DEFAULT: psa_key_persistence_t = 0x01;
pub const PSA_KEY_PERSISTENCE_READ_ONLY: psa_key_persistence_t = 0xff;
pub const PSA_KEY_PERSISTENCE_VOLATILE: psa_key_persistence_t = 0x00;
pub const PSA_KEY_TYPE_AES: psa_key_type_t = 0x2400;
pub const PSA_KEY_TYPE_ARC4: psa_key_type_t = 0x2002;
pub const PSA_KEY_TYPE_CAMELLIA: psa_key_type_t = 0x2403;
pub const PSA_KEY_TYPE_CHACHA20: psa_key_type_t = 0x2004;
pub const PSA_KEY_TYPE_DERIVE: psa_key_type_t = 0x1200;
pub const PSA_KEY_TYPE_DES: psa_key_type_t = 0x2301;
pub const PSA_KEY_TYPE_HMAC: psa_key_type_t = 0x1100;
pub const PSA_KEY_TYPE_NONE: psa_key_type_t = 0x0000;
pub const PSA_KEY_TYPE_RAW_DATA: psa_key_type_t = 0x1001;
pub const PSA_KEY_TYPE_RSA_KEY_PAIR: psa_key_type_t = 0x7001;
pub const PSA_KEY_TYPE_RSA_PUBLIC_KEY: psa_key_type_t = 0x4001;
pub const PSA_KEY_TYPE_SM4: psa_key_type_t = 0x2405;
pub const PSA_KEY_USAGE_CACHE: psa_key_usage_t = 0x00000004;
pub const PSA_KEY_USAGE_COPY: psa_key_usage_t = 0x00000002;
pub const PSA_KEY_USAGE_DECRYPT: psa_key_usage_t = 0x00000200;
pub const PSA_KEY_USAGE_DERIVE: psa_key_usage_t = 0x00004000;
pub const PSA_KEY_USAGE_ENCRYPT: psa_key_usage_t = 0x00000100;
pub const PSA_KEY_USAGE_EXPORT: psa_key_usage_t = 0x00000001;
pub const PSA_KEY_USAGE_SIGN_HASH: psa_key_usage_t = 0x00001000;
pub const PSA_KEY_USAGE_SIGN_MESSAGE: psa_key_usage_t = 0x00000400;
pub const PSA_KEY_USAGE_VERIFY_HASH: psa_key_usage_t = 0x00002000;
pub const PSA_KEY_USAGE_VERIFY_MESSAGE: psa_key_usage_t = 0x00000800;
pub const PSA_SUCCESS: psa_status_t = 0;
2 changes: 1 addition & 1 deletion psa-crypto-sys/src/extras.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
#![allow(non_snake_case)]
/// Additional functionality required that PSA Crypto does not provide
//! Additional functionality required that PSA Crypto does not provide
use crate::types::{psa_algorithm_t, psa_key_type_t};

/// Retrieves the tag length from an aead_alg.
Expand Down
Loading

0 comments on commit b141a66

Please sign in to comment.