#include "includes.h"
#include "common.h"
#include "crypto.h"
#include "tls/rsa.h"
#include "tls/bignum.h"
#include "tls/pkcs1.h"
#include "tls/pkcs8.h"
Go to the source code of this file.
Functions | |
int | crypto_private_key_decrypt_pkcs1_v15 (struct crypto_private_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen) |
void | crypto_private_key_free (struct crypto_private_key *key) |
struct crypto_private_key * | crypto_private_key_import (const u8 *key, size_t len, const char *passwd) |
int | crypto_private_key_sign_pkcs1 (struct crypto_private_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen) |
int | crypto_public_key_decrypt_pkcs1 (struct crypto_public_key *key, const u8 *crypt, size_t crypt_len, u8 *plain, size_t *plain_len) |
int | crypto_public_key_encrypt_pkcs1_v15 (struct crypto_public_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen) |
void | crypto_public_key_free (struct crypto_public_key *key) |
struct crypto_public_key * | crypto_public_key_from_cert (const u8 *buf, size_t len) |
struct crypto_public_key * | crypto_public_key_import (const u8 *key, size_t len) |
int crypto_private_key_decrypt_pkcs1_v15 | ( | struct crypto_private_key * | key, |
const u8 * | in, | ||
size_t | inlen, | ||
u8 * | out, | ||
size_t * | outlen | ||
) |
crypto_private_key_decrypt_pkcs1_v15 - Private key decryption (PKCS #1 v1.5) : Private key : Encrypted buffer : Length of encrypted buffer in bytes : Output buffer for encrypted data : Length of output buffer in bytes; set to used length on success Returns: 0 on success, -1 on failure
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 79 of file crypto_internal-rsa.c.
void crypto_private_key_free | ( | struct crypto_private_key * | key | ) |
crypto_private_key_free - Free private key : Private key from crypto_private_key_import()
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 103 of file crypto_internal-rsa.c.
struct crypto_private_key* crypto_private_key_import | ( | const u8 * | key, |
size_t | len, | ||
const char * | passwd | ||
) | [read] |
crypto_private_key_import - Import an RSA private key : Key buffer (DER encoded RSA private key) : Key buffer length in bytes : Key encryption password or NULL if key is not encrypted Returns: Pointer to the private key or NULL on failure
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 36 of file crypto_internal-rsa.c.
int crypto_private_key_sign_pkcs1 | ( | struct crypto_private_key * | key, |
const u8 * | in, | ||
size_t | inlen, | ||
u8 * | out, | ||
size_t * | outlen | ||
) |
crypto_private_key_sign_pkcs1 - Sign with private key (PKCS #1) : Private key from crypto_private_key_import() : Plaintext buffer : Length of plaintext buffer in bytes : Output buffer for encrypted (signed) data : Length of output buffer in bytes; set to used length on success Returns: 0 on success, -1 on failure
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 88 of file crypto_internal-rsa.c.
int crypto_public_key_decrypt_pkcs1 | ( | struct crypto_public_key * | key, |
const u8 * | crypt, | ||
size_t | crypt_len, | ||
u8 * | plain, | ||
size_t * | plain_len | ||
) |
crypto_public_key_decrypt_pkcs1 - Decrypt PKCS #1 signature : Public key : Encrypted signature data (using the private key) : Encrypted signature data length : Buffer for plaintext (at least crypt_len bytes) : Plaintext length (max buffer size on input, real len on output); Returns: 0 on success, -1 on failure
Definition at line 109 of file crypto_internal-rsa.c.
int crypto_public_key_encrypt_pkcs1_v15 | ( | struct crypto_public_key * | key, |
const u8 * | in, | ||
size_t | inlen, | ||
u8 * | out, | ||
size_t * | outlen | ||
) |
crypto_public_key_encrypt_pkcs1_v15 - Public key encryption (PKCS #1 v1.5) : Public key : Plaintext buffer : Length of plaintext buffer in bytes : Output buffer for encrypted data : Length of output buffer in bytes; set to used length on success Returns: 0 on success, -1 on failure
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 70 of file crypto_internal-rsa.c.
void crypto_public_key_free | ( | struct crypto_public_key * | key | ) |
crypto_public_key_free - Free public key : Public key
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 97 of file crypto_internal-rsa.c.
struct crypto_public_key* crypto_public_key_from_cert | ( | const u8 * | buf, |
size_t | len | ||
) | [read] |
crypto_public_key_from_cert - Import an RSA public key from a certificate : DER encoded X.509 certificate : Certificate buffer length in bytes Returns: Pointer to public key or NULL on failure
This function can just return NULL if the crypto library does not support X.509 parsing. In that case, internal code will be used to parse the certificate and public key is imported using crypto_public_key_import().
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 62 of file crypto_internal-rsa.c.
struct crypto_public_key* crypto_public_key_import | ( | const u8 * | key, |
size_t | len | ||
) | [read] |
crypto_public_key_import - Import an RSA public key : Key buffer (DER encoded RSA public key) : Key buffer length in bytes Returns: Pointer to the public key or NULL on failure
This function can just return NULL if the crypto library supports X.509 parsing. In that case, crypto_public_key_from_cert() is used to import the public key from a certificate.
This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.
Definition at line 29 of file crypto_internal-rsa.c.