iPXE
Defines | Functions | Variables
rsa.c File Reference

RSA public-key cryptography. More...

#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <ipxe/asn1.h>
#include <ipxe/crypto.h>
#include <ipxe/bigint.h>
#include <ipxe/random_nz.h>
#include <ipxe/rsa.h>

Go to the source code of this file.

Defines

#define EACCES_VERIFY   __einfo_error ( EINFO_EACCES_VERIFY )
#define EINFO_EACCES_VERIFY   __einfo_uniqify ( EINFO_EACCES, 0x01, "RSA signature incorrect" )

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static struct
rsa_digestinfo_prefix
rsa_find_prefix (struct digest_algorithm *digest)
 Identify RSA prefix.
static void rsa_free (struct rsa_context *context)
 Free RSA dynamic storage.
static int rsa_alloc (struct rsa_context *context, size_t modulus_len, size_t exponent_len)
 Allocate RSA dynamic storage.
static int rsa_parse_integer (struct asn1_cursor *integer, const struct asn1_cursor *raw)
 Parse RSA integer.
static int rsa_parse_mod_exp (struct asn1_cursor *modulus, struct asn1_cursor *exponent, const struct asn1_cursor *raw)
 Parse RSA modulus and exponent.
static int rsa_init (void *ctx, const void *key, size_t key_len)
 Initialise RSA cipher.
static size_t rsa_max_len (void *ctx)
 Calculate RSA maximum output length.
static void rsa_cipher (struct rsa_context *context, const void *in, void *out)
 Perform RSA cipher operation.
static int rsa_encrypt (void *ctx, const void *plaintext, size_t plaintext_len, void *ciphertext)
 Encrypt using RSA.
static int rsa_decrypt (void *ctx, const void *ciphertext, size_t ciphertext_len, void *plaintext)
 Decrypt using RSA.
static int rsa_encode_digest (struct rsa_context *context, struct digest_algorithm *digest, const void *value, void *encoded)
 Encode RSA digest.
static int rsa_sign (void *ctx, struct digest_algorithm *digest, const void *value, void *signature)
 Sign digest value using RSA.
static int rsa_verify (void *ctx, struct digest_algorithm *digest, const void *value, const void *signature, size_t signature_len)
 Verify signed digest value using RSA.
static void rsa_final (void *ctx)
 Finalise RSA cipher.
static int rsa_match (const void *private_key, size_t private_key_len, const void *public_key, size_t public_key_len)
 Check for matching RSA public/private key pair.

Variables

static uint8_t oid_rsa_encryption [] = { ASN1_OID_RSAENCRYPTION }
 "rsaEncryption" object identifier
struct asn1_algorithm
rsa_encryption_algorithm 
__asn1_algorithm
 "rsaEncryption" OID-identified algorithm
struct pubkey_algorithm rsa_algorithm
 RSA public-key algorithm.

Detailed Description

RSA public-key cryptography.

RSA is documented in RFC 3447.

Definition in file rsa.c.


Define Documentation

Definition at line 45 of file rsa.c.

Referenced by rsa_verify().

#define EINFO_EACCES_VERIFY   __einfo_uniqify ( EINFO_EACCES, 0x01, "RSA signature incorrect" )

Definition at line 47 of file rsa.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static struct rsa_digestinfo_prefix* rsa_find_prefix ( struct digest_algorithm digest) [static, read]

Identify RSA prefix.

Parameters:
digestDigest algorithm
Return values:
prefixRSA prefix, or NULL

Definition at line 68 of file rsa.c.

References rsa_digestinfo_prefix::digest, for_each_table_entry, NULL, prefix, and RSA_DIGESTINFO_PREFIXES.

Referenced by rsa_encode_digest().

                                                    {
        struct rsa_digestinfo_prefix *prefix;

        for_each_table_entry ( prefix, RSA_DIGESTINFO_PREFIXES ) {
                if ( prefix->digest == digest )
                        return prefix;
        }
        return NULL;
}
static void rsa_free ( struct rsa_context context) [static]

Free RSA dynamic storage.

Parameters:
contextRSA context

Definition at line 83 of file rsa.c.

References rsa_context::dynamic, free, and NULL.

Referenced by rsa_alloc(), rsa_final(), and rsa_init().

                                                     {

        free ( context->dynamic );
        context->dynamic = NULL;
}
static int rsa_alloc ( struct rsa_context context,
size_t  modulus_len,
size_t  exponent_len 
) [static]

Allocate RSA dynamic storage.

Parameters:
contextRSA context
modulus_lenModulus length
exponent_lenExponent length
Return values:
rcReturn status code

Definition at line 97 of file rsa.c.

References __attribute__, bigint_mod_exp_tmp_len, bigint_required_size, bigint_t, rsa_context::dynamic, ENOMEM, rsa_context::exponent0, rsa_context::exponent_size, rsa_context::input0, malloc(), rsa_context::max_len, rsa_context::modulus0, rsa_context::output0, rsa_free(), rsa_context::size, size, and rsa_context::tmp.

Referenced by rsa_init().

                                             {
        unsigned int size = bigint_required_size ( modulus_len );
        unsigned int exponent_size = bigint_required_size ( exponent_len );
        bigint_t ( size ) *modulus;
        bigint_t ( exponent_size ) *exponent;
        size_t tmp_len = bigint_mod_exp_tmp_len ( modulus, exponent );
        struct {
                bigint_t ( size ) modulus;
                bigint_t ( exponent_size ) exponent;
                bigint_t ( size ) input;
                bigint_t ( size ) output;
                uint8_t tmp[tmp_len];
        } __attribute__ (( packed )) *dynamic;

        /* Free any existing dynamic storage */
        rsa_free ( context );

        /* Allocate dynamic storage */
        dynamic = malloc ( sizeof ( *dynamic ) );
        if ( ! dynamic )
                return -ENOMEM;

        /* Assign dynamic storage */
        context->dynamic = dynamic;
        context->modulus0 = &dynamic->modulus.element[0];
        context->size = size;
        context->max_len = modulus_len;
        context->exponent0 = &dynamic->exponent.element[0];
        context->exponent_size = exponent_size;
        context->input0 = &dynamic->input.element[0];
        context->output0 = &dynamic->output.element[0];
        context->tmp = &dynamic->tmp;

        return 0;
}
static int rsa_parse_integer ( struct asn1_cursor integer,
const struct asn1_cursor raw 
) [static]

Parse RSA integer.

Parameters:
integerInteger to fill in
rawASN.1 cursor
Return values:
rcReturn status code

Definition at line 141 of file rsa.c.

References asn1_enter(), ASN1_INTEGER, asn1_cursor::data, EINVAL, asn1_cursor::len, and memcpy().

Referenced by rsa_parse_mod_exp().

                                                               {

        /* Enter integer */
        memcpy ( integer, raw, sizeof ( *integer ) );
        asn1_enter ( integer, ASN1_INTEGER );

        /* Skip initial sign byte if applicable */
        if ( ( integer->len > 1 ) &&
             ( *( ( uint8_t * ) integer->data ) == 0x00 ) ) {
                integer->data++;
                integer->len--;
        }

        /* Fail if cursor or integer are invalid */
        if ( ! integer->len )
                return -EINVAL;

        return 0;
}
static int rsa_parse_mod_exp ( struct asn1_cursor modulus,
struct asn1_cursor exponent,
const struct asn1_cursor raw 
) [static]

Parse RSA modulus and exponent.

Parameters:
modulusModulus to fill in
exponentExponent to fill in
rawASN.1 cursor
Return values:
rcReturn status code

Definition at line 170 of file rsa.c.

References asn1_enter(), ASN1_INTEGER, asn1_integral_bit_string(), ASN1_SEQUENCE, asn1_skip(), asn1_skip_any(), asn1_type(), asn1_cursor::data, asn1_bit_string::data, asn1_cursor::len, asn1_bit_string::len, memcpy(), rc, and rsa_parse_integer().

Referenced by rsa_init(), and rsa_match().

                                                               {
        struct asn1_bit_string bits;
        struct asn1_cursor cursor;
        int is_private;
        int rc;

        /* Enter subjectPublicKeyInfo/RSAPrivateKey */
        memcpy ( &cursor, raw, sizeof ( cursor ) );
        asn1_enter ( &cursor, ASN1_SEQUENCE );

        /* Determine key format */
        if ( asn1_type ( &cursor ) == ASN1_INTEGER ) {

                /* Private key */
                is_private = 1;

                /* Skip version */
                asn1_skip_any ( &cursor );

        } else {

                /* Public key */
                is_private = 0;

                /* Skip algorithm */
                asn1_skip ( &cursor, ASN1_SEQUENCE );

                /* Enter subjectPublicKey */
                if ( ( rc = asn1_integral_bit_string ( &cursor, &bits ) ) != 0 )
                        return rc;
                cursor.data = bits.data;
                cursor.len = bits.len;

                /* Enter RSAPublicKey */
                asn1_enter ( &cursor, ASN1_SEQUENCE );
        }

        /* Extract modulus */
        if ( ( rc = rsa_parse_integer ( modulus, &cursor ) ) != 0 )
                return rc;
        asn1_skip_any ( &cursor );

        /* Skip public exponent, if applicable */
        if ( is_private )
                asn1_skip ( &cursor, ASN1_INTEGER );

        /* Extract publicExponent/privateExponent */
        if ( ( rc = rsa_parse_integer ( exponent, &cursor ) ) != 0 )
                return rc;

        return 0;
}
static int rsa_init ( void *  ctx,
const void *  key,
size_t  key_len 
) [static]

Initialise RSA cipher.

Parameters:
ctxRSA context
keyKey
key_lenLength of key
Return values:
rcReturn status code

Definition at line 233 of file rsa.c.

References bigint_init, bigint_t, context, ctx, asn1_cursor::data, DBGC, DBGC_HDA, rsa_context::exponent0, rsa_context::exponent_size, key, asn1_cursor::len, memset(), rsa_context::modulus0, rc, rsa_alloc(), rsa_free(), rsa_parse_mod_exp(), and rsa_context::size.

                                                                   {
        struct rsa_context *context = ctx;
        struct asn1_cursor modulus;
        struct asn1_cursor exponent;
        struct asn1_cursor cursor;
        int rc;

        /* Initialise context */
        memset ( context, 0, sizeof ( *context ) );

        /* Initialise cursor */
        cursor.data = key;
        cursor.len = key_len;

        /* Parse modulus and exponent */
        if ( ( rc = rsa_parse_mod_exp ( &modulus, &exponent, &cursor ) ) != 0 ){
                DBGC ( context, "RSA %p invalid modulus/exponent:\n", context );
                DBGC_HDA ( context, 0, cursor.data, cursor.len );
                goto err_parse;
        }

        DBGC ( context, "RSA %p modulus:\n", context );
        DBGC_HDA ( context, 0, modulus.data, modulus.len );
        DBGC ( context, "RSA %p exponent:\n", context );
        DBGC_HDA ( context, 0, exponent.data, exponent.len );

        /* Allocate dynamic storage */
        if ( ( rc = rsa_alloc ( context, modulus.len, exponent.len ) ) != 0 )
                goto err_alloc;

        /* Construct big integers */
        bigint_init ( ( ( bigint_t ( context->size ) * ) context->modulus0 ),
                      modulus.data, modulus.len );
        bigint_init ( ( ( bigint_t ( context->exponent_size ) * )
                        context->exponent0 ), exponent.data, exponent.len );

        return 0;

        rsa_free ( context );
 err_alloc:
 err_parse:
        return rc;
}
static size_t rsa_max_len ( void *  ctx) [static]

Calculate RSA maximum output length.

Parameters:
ctxRSA context
Return values:
max_lenMaximum output length

Definition at line 283 of file rsa.c.

References context, ctx, and rsa_context::max_len.

                                        {
        struct rsa_context *context = ctx;

        return context->max_len;
}
static void rsa_cipher ( struct rsa_context context,
const void *  in,
void *  out 
) [static]

Perform RSA cipher operation.

Parameters:
contextRSA context
inInput buffer
outOutput buffer

Definition at line 296 of file rsa.c.

References bigint_done, bigint_init, bigint_mod_exp, bigint_t, rsa_context::exponent0, rsa_context::exponent_size, rsa_context::input0, rsa_context::max_len, rsa_context::modulus0, rsa_context::output0, rsa_context::size, and rsa_context::tmp.

Referenced by rsa_decrypt(), rsa_encrypt(), rsa_sign(), and rsa_verify().

                                                     {
        bigint_t ( context->size ) *input = ( ( void * ) context->input0 );
        bigint_t ( context->size ) *output = ( ( void * ) context->output0 );
        bigint_t ( context->size ) *modulus = ( ( void * ) context->modulus0 );
        bigint_t ( context->exponent_size ) *exponent =
                ( ( void * ) context->exponent0 );

        /* Initialise big integer */
        bigint_init ( input, in, context->max_len );

        /* Perform modular exponentiation */
        bigint_mod_exp ( input, modulus, exponent, output, context->tmp );

        /* Copy out result */
        bigint_done ( output, out, context->max_len );
}
static int rsa_encrypt ( void *  ctx,
const void *  plaintext,
size_t  plaintext_len,
void *  ciphertext 
) [static]

Encrypt using RSA.

Parameters:
ctxRSA context
plaintextPlaintext
plaintext_lenLength of plaintext
ciphertextCiphertext
Return values:
ciphertext_lenLength of ciphertext, or negative error

Definition at line 323 of file rsa.c.

References context, ctx, DBGC, DBGC_HDA, ERANGE, get_random_nz(), rsa_context::max_len, max_len, memcpy(), rsa_context::output0, rc, rsa_cipher(), and strerror().

                                                                  {
        struct rsa_context *context = ctx;
        void *temp;
        uint8_t *encoded;
        size_t max_len = ( context->max_len - 11 );
        size_t random_nz_len = ( max_len - plaintext_len + 8 );
        int rc;

        /* Sanity check */
        if ( plaintext_len > max_len ) {
                DBGC ( context, "RSA %p plaintext too long (%zd bytes, max "
                       "%zd)\n", context, plaintext_len, max_len );
                return -ERANGE;
        }
        DBGC ( context, "RSA %p encrypting:\n", context );
        DBGC_HDA ( context, 0, plaintext, plaintext_len );

        /* Construct encoded message (using the big integer output
         * buffer as temporary storage)
         */
        temp = context->output0;
        encoded = temp;
        encoded[0] = 0x00;
        encoded[1] = 0x02;
        if ( ( rc = get_random_nz ( &encoded[2], random_nz_len ) ) != 0 ) {
                DBGC ( context, "RSA %p could not generate random data: %s\n",
                       context, strerror ( rc ) );
                return rc;
        }
        encoded[ 2 + random_nz_len ] = 0x00;
        memcpy ( &encoded[ context->max_len - plaintext_len ],
                 plaintext, plaintext_len );

        /* Encipher the encoded message */
        rsa_cipher ( context, encoded, ciphertext );
        DBGC ( context, "RSA %p encrypted:\n", context );
        DBGC_HDA ( context, 0, ciphertext, context->max_len );

        return context->max_len;
}
static int rsa_decrypt ( void *  ctx,
const void *  ciphertext,
size_t  ciphertext_len,
void *  plaintext 
) [static]

Decrypt using RSA.

Parameters:
ctxRSA context
ciphertextCiphertext
ciphertext_lenCiphertext length
plaintextPlaintext
Return values:
plaintext_lenPlaintext length, or negative error

Definition at line 374 of file rsa.c.

References context, ctx, DBGC, DBGC_HDA, EINVAL, end, ERANGE, rsa_context::input0, rsa_context::max_len, memchr(), memcpy(), rsa_cipher(), start, and zero.

                                                                  {
        struct rsa_context *context = ctx;
        void *temp;
        uint8_t *encoded;
        uint8_t *end;
        uint8_t *zero;
        uint8_t *start;
        size_t plaintext_len;

        /* Sanity check */
        if ( ciphertext_len != context->max_len ) {
                DBGC ( context, "RSA %p ciphertext incorrect length (%zd "
                       "bytes, should be %zd)\n",
                       context, ciphertext_len, context->max_len );
                return -ERANGE;
        }
        DBGC ( context, "RSA %p decrypting:\n", context );
        DBGC_HDA ( context, 0, ciphertext, ciphertext_len );

        /* Decipher the message (using the big integer input buffer as
         * temporary storage)
         */
        temp = context->input0;
        encoded = temp;
        rsa_cipher ( context, ciphertext, encoded );

        /* Parse the message */
        end = ( encoded + context->max_len );
        if ( ( encoded[0] != 0x00 ) || ( encoded[1] != 0x02 ) )
                goto invalid;
        zero = memchr ( &encoded[2], 0, ( end - &encoded[2] ) );
        if ( ! zero )
                goto invalid;
        start = ( zero + 1 );
        plaintext_len = ( end - start );

        /* Copy out message */
        memcpy ( plaintext, start, plaintext_len );
        DBGC ( context, "RSA %p decrypted:\n", context );
        DBGC_HDA ( context, 0, plaintext, plaintext_len );

        return plaintext_len;

 invalid:
        DBGC ( context, "RSA %p invalid decrypted message:\n", context );
        DBGC_HDA ( context, 0, encoded, context->max_len );
        return -EINVAL;
}
static int rsa_encode_digest ( struct rsa_context context,
struct digest_algorithm digest,
const void *  value,
void *  encoded 
) [static]

Encode RSA digest.

Parameters:
contextRSA context
digestDigest algorithm
valueDigest value
encodedEncoded digest
Return values:
rcReturn status code

Definition at line 433 of file rsa.c.

References assert, rsa_digestinfo_prefix::data, DBGC, DBGC_HDA, digest_algorithm::digestsize, ENOTSUP, ERANGE, rsa_digestinfo_prefix::len, rsa_context::max_len, max_len, memcpy(), memset(), digest_algorithm::name, prefix, and rsa_find_prefix().

Referenced by rsa_sign(), and rsa_verify().

                                                                  {
        struct rsa_digestinfo_prefix *prefix;
        size_t digest_len = digest->digestsize;
        uint8_t *temp = encoded;
        size_t digestinfo_len;
        size_t max_len;
        size_t pad_len;

        /* Identify prefix */
        prefix = rsa_find_prefix ( digest );
        if ( ! prefix ) {
                DBGC ( context, "RSA %p has no prefix for %s\n",
                       context, digest->name );
                return -ENOTSUP;
        }
        digestinfo_len = ( prefix->len + digest_len );

        /* Sanity check */
        max_len = ( context->max_len - 11 );
        if ( digestinfo_len > max_len ) {
                DBGC ( context, "RSA %p %s digestInfo too long (%zd bytes, max"
                       "%zd)\n",
                       context, digest->name, digestinfo_len, max_len );
                return -ERANGE;
        }
        DBGC ( context, "RSA %p encoding %s digest:\n",
               context, digest->name );
        DBGC_HDA ( context, 0, value, digest_len );

        /* Construct encoded message */
        *(temp++) = 0x00;
        *(temp++) = 0x01;
        pad_len = ( max_len - digestinfo_len + 8 );
        memset ( temp, 0xff, pad_len );
        temp += pad_len;
        *(temp++) = 0x00;
        memcpy ( temp, prefix->data, prefix->len );
        temp += prefix->len;
        memcpy ( temp, value, digest_len );
        temp += digest_len;
        assert ( temp == ( encoded + context->max_len ) );
        DBGC ( context, "RSA %p encoded %s digest:\n", context, digest->name );
        DBGC_HDA ( context, 0, encoded, context->max_len );

        return 0;
}
static int rsa_sign ( void *  ctx,
struct digest_algorithm digest,
const void *  value,
void *  signature 
) [static]

Sign digest value using RSA.

Parameters:
ctxRSA context
digestDigest algorithm
valueDigest value
signatureSignature
Return values:
signature_lenSignature length, or negative error

Definition at line 491 of file rsa.c.

References context, ctx, DBGC, DBGC_HDA, digest_algorithm::digestsize, rsa_context::max_len, digest_algorithm::name, rsa_context::output0, rc, rsa_cipher(), and rsa_encode_digest().

                                                           {
        struct rsa_context *context = ctx;
        void *temp;
        int rc;

        DBGC ( context, "RSA %p signing %s digest:\n", context, digest->name );
        DBGC_HDA ( context, 0, value, digest->digestsize );

        /* Encode digest (using the big integer output buffer as
         * temporary storage)
         */
        temp = context->output0;
        if ( ( rc = rsa_encode_digest ( context, digest, value, temp ) ) != 0 )
                return rc;

        /* Encipher the encoded digest */
        rsa_cipher ( context, temp, signature );
        DBGC ( context, "RSA %p signed %s digest:\n", context, digest->name );
        DBGC_HDA ( context, 0, signature, context->max_len );

        return context->max_len;
}
static int rsa_verify ( void *  ctx,
struct digest_algorithm digest,
const void *  value,
const void *  signature,
size_t  signature_len 
) [static]

Verify signed digest value using RSA.

Parameters:
ctxRSA context
digestDigest algorithm
valueDigest value
signatureSignature
signature_lenSignature length
Return values:
rcReturn status code

Definition at line 525 of file rsa.c.

References context, ctx, DBGC, DBGC_HDA, digest_algorithm::digestsize, EACCES_VERIFY, ERANGE, rsa_context::input0, rsa_context::max_len, memcmp(), digest_algorithm::name, rsa_context::output0, rc, rsa_cipher(), and rsa_encode_digest().

                                               {
        struct rsa_context *context = ctx;
        void *temp;
        void *expected;
        void *actual;
        int rc;

        /* Sanity check */
        if ( signature_len != context->max_len ) {
                DBGC ( context, "RSA %p signature incorrect length (%zd "
                       "bytes, should be %zd)\n",
                       context, signature_len, context->max_len );
                return -ERANGE;
        }
        DBGC ( context, "RSA %p verifying %s digest:\n",
               context, digest->name );
        DBGC_HDA ( context, 0, value, digest->digestsize );
        DBGC_HDA ( context, 0, signature, signature_len );

        /* Decipher the signature (using the big integer input buffer
         * as temporary storage)
         */
        temp = context->input0;
        expected = temp;
        rsa_cipher ( context, signature, expected );
        DBGC ( context, "RSA %p deciphered signature:\n", context );
        DBGC_HDA ( context, 0, expected, context->max_len );

        /* Encode digest (using the big integer output buffer as
         * temporary storage)
         */
        temp = context->output0;
        actual = temp;
        if ( ( rc = rsa_encode_digest ( context, digest, value, actual ) ) !=0 )
                return rc;

        /* Verify the signature */
        if ( memcmp ( actual, expected, context->max_len ) != 0 ) {
                DBGC ( context, "RSA %p signature verification failed\n",
                       context );
                return -EACCES_VERIFY;
        }

        DBGC ( context, "RSA %p signature verified successfully\n", context );
        return 0;
}
static void rsa_final ( void *  ctx) [static]

Finalise RSA cipher.

Parameters:
ctxRSA context

Definition at line 579 of file rsa.c.

References context, ctx, and rsa_free().

                                    {
        struct rsa_context *context = ctx;

        rsa_free ( context );
}
static int rsa_match ( const void *  private_key,
size_t  private_key_len,
const void *  public_key,
size_t  public_key_len 
) [static]

Check for matching RSA public/private key pair.

Parameters:
private_keyPrivate key
private_key_lenPrivate key length
public_keyPublic key
public_key_lenPublic key length
Return values:
rcReturn status code

Definition at line 594 of file rsa.c.

References asn1_compare(), asn1_cursor::data, ENOTTY, asn1_cursor::len, private_key, rc, and rsa_parse_mod_exp().

                                                                       {
        struct asn1_cursor private_modulus;
        struct asn1_cursor private_exponent;
        struct asn1_cursor private_cursor;
        struct asn1_cursor public_modulus;
        struct asn1_cursor public_exponent;
        struct asn1_cursor public_cursor;
        int rc;

        /* Initialise cursors */
        private_cursor.data = private_key;
        private_cursor.len = private_key_len;
        public_cursor.data = public_key;
        public_cursor.len = public_key_len;

        /* Parse moduli and exponents */
        if ( ( rc = rsa_parse_mod_exp ( &private_modulus, &private_exponent,
                                        &private_cursor ) ) != 0 )
                return rc;
        if ( ( rc = rsa_parse_mod_exp ( &public_modulus, &public_exponent,
                                        &public_cursor ) ) != 0 )
                return rc;

        /* Compare moduli */
        if ( asn1_compare ( &private_modulus, &public_modulus ) != 0 )
                return -ENOTTY;

        return 0;
}

Variable Documentation

"rsaEncryption" object identifier

Definition at line 51 of file rsa.c.

struct asn1_algorithm rsa_encryption_algorithm __asn1_algorithm
Initial value:
 {
        .name = "rsaEncryption",
        .pubkey = &rsa_algorithm,
        .digest = NULL,
        .oid = ASN1_OID_CURSOR ( oid_rsa_encryption ),
}

"rsaEncryption" OID-identified algorithm

Definition at line 54 of file rsa.c.

Initial value:
 {
        .name           = "rsa",
        .ctxsize        = RSA_CTX_SIZE,
        .init           = rsa_init,
        .max_len        = rsa_max_len,
        .encrypt        = rsa_encrypt,
        .decrypt        = rsa_decrypt,
        .sign           = rsa_sign,
        .verify         = rsa_verify,
        .final          = rsa_final,
        .match          = rsa_match,
}

RSA public-key algorithm.

Definition at line 626 of file rsa.c.