|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| |
| static int | ecdsa_parse_key (struct ecdsa_key *key, const struct asn1_cursor *raw) |
| | Parse ECDSA key. More...
|
| |
| static int | ecdsa_parse_signature (struct ecdsa_context *ctx, bigint_element_t *rs0, const struct asn1_cursor *raw) |
| | Parse ECDSA signature value. More...
|
| |
| static int | ecdsa_prepend_signature (struct ecdsa_context *ctx, bigint_element_t *rs0, struct asn1_builder *builder) |
| | Prepend ECDSA signature value. More...
|
| |
| static int | ecdsa_alloc (struct ecdsa_context *ctx) |
| | Allocate ECDSA context dynamic storage. More...
|
| |
| static void | ecdsa_free (struct ecdsa_context *ctx) |
| | Free ECDSA context dynamic storage. More...
|
| |
| static void | ecdsa_init_values (struct ecdsa_context *ctx, struct digest_algorithm *digest, const void *value) |
| | Initialise ECDSA values. More...
|
| |
| static int | ecdsa_init (struct ecdsa_context *ctx, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value) |
| | Initialise ECDSA context. More...
|
| |
| static void | ecdsa_invert (struct ecdsa_context *ctx, bigint_element_t *val0) |
| | Invert ECDSA value. More...
|
| |
| static int | ecdsa_sign_rs (struct ecdsa_context *ctx) |
| | Generate ECDSA "r" and "s" values. More...
|
| |
| static int | ecdsa_verify_rs (struct ecdsa_context *ctx) |
| | Verify ECDSA "r" and "s" values. More...
|
| |
| static int | ecdsa_encrypt (const struct asn1_cursor *key __unused, const struct asn1_cursor *plaintext __unused, struct asn1_builder *ciphertext __unused) |
| | Encrypt using ECDSA. More...
|
| |
| static int | ecdsa_decrypt (const struct asn1_cursor *key __unused, const struct asn1_cursor *ciphertext __unused, struct asn1_builder *plaintext __unused) |
| | Decrypt using ECDSA. More...
|
| |
| static int | ecdsa_sign (const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature) |
| | Sign digest value using ECDSA. More...
|
| |
| static int | ecdsa_verify (const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature) |
| | Verify signed digest using ECDSA. More...
|
| |
| static int | ecdsa_match (const struct asn1_cursor *private_key, const struct asn1_cursor *public_key) |
| | Check for matching ECDSA public/private key pair. More...
|
| |
Elliptic curve digital signature algorithm (ECDSA)
The elliptic curve public key format is documented in RFC 5480. The original private key format is documented in RFC 5915, and the generic container PKCS#8 format documented in RFC 5208.
Definition in file ecdsa.c.
Parse ECDSA key.
- Parameters
-
| key | ECDSA key |
| raw | ASN.1 cursor |
- Return values
-
Definition at line 140 of file ecdsa.c.
151 memcpy ( &cursor,
raw,
sizeof ( cursor ) );
169 DBGC (
key,
"ECDSA %p is in PKCS#8 format\n",
key );
172 memcpy ( &curve, &cursor,
sizeof ( curve ) );
186 memcpy ( &
private, &cursor,
sizeof (
private ) );
192 memcpy ( &curve, &cursor,
sizeof ( curve ) );
206 memcpy ( &curve, &cursor,
sizeof ( curve ) );
216 DBGC (
key,
"ECDSA %p unknown curve: %s\n",
223 key->curve->name, ( is_private ?
"private" :
"public" ) );
226 if ( cursor.len != ( sizeof ( *compression ) +
227 key->curve->pointsize ) ) {
228 DBGC (
key,
"ECDSA %p invalid public key length %zd\n",
235 compression = cursor.data;
237 DBGC (
key,
"ECDSA %p invalid compression %#02x\n",
244 key->public = ( cursor.data +
sizeof ( *compression ) );
245 DBGC (
key,
"ECDSA %p public curve point:\n",
key );
250 DBGC (
key,
"ECDSA %p public curve point is infinity\n",
key );
258 if (
private.
len !=
key->curve->keysize ) {
259 DBGC (
key,
"ECDSA %p invalid private key length " 260 "%zd\n",
key,
private.
len );
266 key->private =
private.data;
267 DBGC (
key,
"ECDSA %p private multiplier:\n",
key );
An ASN.1 OID-identified algorithm.
struct arbelprm_rc_send_wqe rc
int asn1_enter(struct asn1_cursor *cursor, unsigned int type)
Enter ASN.1 object.
static int elliptic_is_infinity(struct elliptic_curve *curve, const void *point)
int asn1_enter_bits(struct asn1_cursor *cursor, unsigned int *unused)
Enter ASN.1 bit string.
static unsigned int asn1_type(const struct asn1_cursor *cursor)
Extract ASN.1 type.
int asn1_skip_any(struct asn1_cursor *cursor)
Skip ASN.1 object of any type.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define EINVAL_COMPRESSION
char * strerror(int errno)
Retrieve string representation of error number.
static void asn1_invalidate_cursor(struct asn1_cursor *cursor)
Invalidate ASN.1 object cursor.
int asn1_enter_any(struct asn1_cursor *cursor)
Enter ASN.1 object of any type.
#define ECDSA_UNCOMPRESSED
Uncompressed curve point.
#define ASN1_SEQUENCE
ASN.1 sequence.
#define ASN1_INTEGER
ASN.1 integer.
u16 algorithm
Authentication algorithm (Open System or Shared Key)
int asn1_skip(struct asn1_cursor *cursor, unsigned int type)
Skip ASN.1 object.
#define ASN1_EXPLICIT_TAG(number)
ASN.1 explicit tag.
#define ASN1_OCTET_STRING
ASN.1 octet string.
#define NULL
NULL pointer (VOID *)
int asn1_curve_algorithm(const struct asn1_cursor *cursor, struct asn1_algorithm *wrapper, struct asn1_algorithm **algorithm)
Parse ASN.1 OID-identified elliptic curve algorithm.
References algorithm, asn1_curve_algorithm(), asn1_enter(), asn1_enter_any(), asn1_enter_bits(), ASN1_EXPLICIT_TAG, ASN1_INTEGER, asn1_invalidate_cursor(), ASN1_OCTET_STRING, ASN1_SEQUENCE, asn1_skip(), asn1_skip_any(), asn1_type(), asn1_cursor::data, DBGC, DBGC_HDA, ECDSA_UNCOMPRESSED, EINVAL_COMPRESSION, EINVAL_INFINITY, EINVAL_KEYSIZE, EINVAL_POINTSIZE, elliptic_is_infinity(), key, asn1_cursor::len, len, memcpy(), NULL, raw, rc, and strerror().
Referenced by ecdsa_init(), and ecdsa_match().
Parse ECDSA signature value.
- Parameters
-
| ctx | ECDSA context |
| rs0 | Element 0 of signature "r" or "s" value |
| raw | ASN.1 cursor |
- Return values
-
Definition at line 287 of file ecdsa.c.
293 ( (
void * )
ctx->modulus0 );
300 memcpy ( &cursor,
raw,
sizeof ( cursor ) );
302 DBGC (
ctx,
"ECDSA %p invalid integer:\n",
ctx );
309 DBGC (
ctx,
"ECDSA %p invalid signature value:\n",
ctx );
317 DBGC (
ctx,
"ECDSA %p out-of-range signature value:\n",
ctx );
int asn1_enter_unsigned(struct asn1_cursor *cursor)
Enter ASN.1 unsigned integer.
struct arbelprm_rc_send_wqe rc
uint16_t size
Buffer size.
#define bigint_init(value, data, len)
Initialise big integer.
struct golan_eq_context ctx
#define bigint_is_zero(value)
Test if big integer is equal to zero.
#define bigint_is_geq(value, reference)
Compare big integers.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define ERANGE
Result too large.
u16 keysize
Length of encryption key to be used, network byte order.
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
References __attribute__, asn1_enter_unsigned(), bigint_init, bigint_is_geq, bigint_is_zero, bigint_t(), ctx, asn1_cursor::data, DBGC, DBGC_HDA, EINVAL_KEYSIZE, ERANGE, keysize, asn1_cursor::len, memcpy(), raw, rc, and size.
Referenced by ecdsa_verify().
Prepend ECDSA signature value.
- Parameters
-
| ctx | ECDSA context |
| rs0 | Element 0 of signature "r" or "s" value |
| builder | ASN.1 builder |
- Return values
-
Definition at line 333 of file ecdsa.c.
351 len =
sizeof ( buf );
352 while ( (
len > 1 ) && (
data[0] == 0 ) && (
data[1] < 0x80 ) ) {
struct arbelprm_rc_send_wqe rc
uint16_t size
Buffer size.
struct golan_eq_context ctx
#define bigint_done(value, out, len)
Finalise big integer.
u16 keysize
Length of encryption key to be used, network byte order.
#define ASN1_INTEGER
ASN.1 integer.
int asn1_prepend(struct asn1_builder *builder, unsigned int type, const void *data, size_t len)
Prepend data to ASN.1 builder.
uint8_t data[48]
Additional event data.
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
References __attribute__, ASN1_INTEGER, asn1_prepend(), bigint_done, bigint_t(), ctx, data, keysize, len, rc, and size.
Referenced by ecdsa_sign().
Allocate ECDSA context dynamic storage.
- Parameters
-
- Return values
-
Definition at line 370 of file ecdsa.c.
394 dynamic =
malloc (
sizeof ( *dynamic ) );
400 ctx->dynamic = dynamic;
401 ctx->modulus0 = dynamic->modulus.element;
402 ctx->fermat0 = dynamic->fermat.element;
403 ctx->square0 = dynamic->square.element;
404 ctx->one0 = dynamic->one.element;
405 ctx->z0 = dynamic->z.element;
406 ctx->k0 = dynamic->k.element;
407 ctx->r0 = dynamic->r.element;
408 ctx->s0 = dynamic->s.element;
409 ctx->temp0 = dynamic->temp.element;
410 ctx->product0 = dynamic->product.element;
411 ctx->point1 = dynamic->point1;
412 ctx->point2 = dynamic->point2;
413 ctx->scalar = dynamic->scalar;
414 ctx->drbg = &dynamic->drbg;
uint16_t size
Buffer size.
struct golan_eq_context ctx
#define ENOMEM
Not enough space.
size_t keysize
Scalar (and private key) size.
#define bigint_required_size(len)
Determine number of elements required for a big-integer type.
u16 keysize
Length of encryption key to be used, network byte order.
static const uint32_t k[64]
MD5 constants.
void * malloc(size_t size)
Allocate memory.
HMAC_DRBG internal state.
uint8_t product
Product string.
size_t pointsize
Point (and public key) size.
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
static const uint8_t r[3][4]
MD4 shift amounts.
References bigint_required_size, bigint_t(), ctx, ENOMEM, k, keysize, elliptic_curve::keysize, malloc(), elliptic_curve::pointsize, product, r, and size.
Referenced by ecdsa_init().
Initialise ECDSA values.
- Parameters
-
| ctx | ECDSA context |
| digest | Digest algorithm |
| value | Digest value |
Definition at line 437 of file ecdsa.c.
443 ( (
void * )
ctx->modulus0 );
445 ( (
void * )
ctx->fermat0 );
447 ( (
void * )
ctx->square0 );
449 ( (
void * )
ctx->one0 );
451 ( (
void * )
ctx->z0 );
453 ( (
void * )
ctx->product0 );
454 static const uint8_t two_raw[] = { 2 };
463 bigint_init ( square, two_raw,
sizeof ( two_raw ) );
468 DBGC2 (
ctx,
"ECDSA %p R^2 = %s mod N\n",
474 DBGC2 (
ctx,
"ECDSA %p R = %s mod N\n",
478 ctx->digest = digest;
479 zlen =
ctx->key.curve->keysize;
484 DBGC2 (
ctx,
"ECDSA %p z = %s (%s)\n",
const void * order
Order of the generator (if prime)
uint16_t size
Buffer size.
#define bigint_grow(source, dest)
Grow big integer.
#define bigint_init(value, data, len)
Initialise big integer.
struct golan_eq_context ctx
pseudo_bit_t value[0x00020]
#define bigint_copy(source, dest)
Copy big integer.
size_t keysize
Scalar (and private key) size.
#define bigint_montgomery(modulus, value, result)
Perform classic Montgomery reduction (REDC) of a big integer.
size_t digestsize
Digest size.
const char * name
Algorithm name.
#define bigint_reduce(modulus, result)
Reduce big integer R^2 modulo N.
uint8_t product
Product string.
#define bigint_subtract(subtrahend, value)
Subtract big integers.
#define bigint_ntoa(value)
Transcribe big integer (for debugging)
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
References __attribute__, bigint_copy, bigint_grow, bigint_init, bigint_montgomery, bigint_ntoa, bigint_reduce, bigint_subtract, bigint_t(), ctx, DBGC2, digest_algorithm::digestsize, elliptic_curve::keysize, digest_algorithm::name, elliptic_curve::order, product, size, and value.
Referenced by ecdsa_init().
Initialise ECDSA context.
- Parameters
-
| ctx | ECDSA context |
| key | Key |
| digest | Digest algorithm |
| value | Digest value |
- Return values
-
Definition at line 497 of file ecdsa.c.
static void ecdsa_free(struct ecdsa_context *ctx)
Free ECDSA context dynamic storage.
static int ecdsa_parse_key(struct ecdsa_key *key, const struct asn1_cursor *raw)
Parse ECDSA key.
struct arbelprm_rc_send_wqe rc
struct golan_eq_context ctx
pseudo_bit_t value[0x00020]
static int ecdsa_alloc(struct ecdsa_context *ctx)
Allocate ECDSA context dynamic storage.
static void ecdsa_init_values(struct ecdsa_context *ctx, struct digest_algorithm *digest, const void *value)
Initialise ECDSA values.
References ctx, ecdsa_alloc(), ecdsa_free(), ecdsa_init_values(), ecdsa_parse_key(), key, rc, and value.
Referenced by ecdsa_sign(), and ecdsa_verify().
Invert ECDSA value.
- Parameters
-
| ctx | ECDSA context |
| val0 | Element 0 of value to invert |
Definition at line 528 of file ecdsa.c.
532 ( (
void * )
ctx->modulus0 );
534 ( (
void * )
ctx->fermat0 );
536 ( (
void * )
ctx->square0 );
538 ( (
void * )
ctx->one0 );
540 ( (
void * )
ctx->temp0 );
542 ( (
void * )
ctx->product0 );
uint16_t size
Buffer size.
struct golan_eq_context ctx
#define bigint_copy(source, dest)
Copy big integer.
#define bigint_montgomery(modulus, value, result)
Perform classic Montgomery reduction (REDC) of a big integer.
#define bigint_multiply(multiplicand, multiplier, result)
Multiply big integers.
uint8_t product
Product string.
#define bigint_ladder(result, multiple, exponent, op, ctx, tmp)
Perform generalised exponentiation via a Montgomery ladder.
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
void bigint_mod_exp_ladder(const bigint_element_t *multiplier0, bigint_element_t *result0, unsigned int size, const void *ctx, void *tmp)
Perform modular multiplication as part of a Montgomery ladder.
References __attribute__, bigint_copy, bigint_ladder, bigint_mod_exp_ladder(), bigint_montgomery, bigint_multiply, bigint_t(), ctx, product, size, and val.
Referenced by ecdsa_sign_rs(), and ecdsa_verify_rs().
Generate ECDSA "r" and "s" values.
- Parameters
-
| ctx | ECDSA context |
| sig | Signature |
- Return values
-
Definition at line 563 of file ecdsa.c.
570 ( (
void * )
ctx->modulus0 );
572 ( (
void * )
ctx->square0 );
574 ( (
void * )
ctx->one0 );
576 ( (
void * )
ctx->z0 );
578 ( (
void * )
ctx->k0 );
580 ( (
void * )
ctx->r0 );
582 ( (
void * )
ctx->s0 );
584 ( (
void * )
ctx->temp0 );
586 ( (
void * )
ctx->product0 );
589 void *point1 =
ctx->point1;
590 void *scalar =
ctx->scalar;
599 DBGC (
ctx,
"ECDSA %p could not generate: %s\n",
616 DBGC2 (
ctx,
"ECDSA %p x1 = %s mod N\n",
631 DBGC2 (
ctx,
"ECDSA %p (k^-1)R = %s mod N\n",
642 DBGC2 (
ctx,
"ECDSA %p r*dA = %s mod N\n",
647 DBGC2 (
ctx,
"ECDSA %p z+r*dA = %s mod N\n",
int hmac_drbg_generate(struct digest_algorithm *hash, struct hmac_drbg_state *state, const void *additional, size_t additional_len, void *data, size_t len)
Generate pseudorandom bits using HMAC_DRBG.
struct arbelprm_rc_send_wqe rc
static int elliptic_multiply(struct elliptic_curve *curve, const void *base, const void *scalar, void *result)
uint16_t size
Buffer size.
static void ecdsa_invert(struct ecdsa_context *ctx, bigint_element_t *val0)
Invert ECDSA value.
#define bigint_init(value, data, len)
Initialise big integer.
struct golan_eq_context ctx
#define bigint_is_zero(value)
Test if big integer is equal to zero.
#define bigint_is_geq(value, reference)
Compare big integers.
size_t keysize
Scalar (and private key) size.
char * strerror(int errno)
Retrieve string representation of error number.
u16 keysize
Length of encryption key to be used, network byte order.
static const uint32_t k[64]
MD5 constants.
#define bigint_montgomery(modulus, value, result)
Perform classic Montgomery reduction (REDC) of a big integer.
#define bigint_multiply(multiplicand, multiplier, result)
Multiply big integers.
A message digest algorithm.
const void * base
Generator base point.
uint8_t product
Product string.
size_t pointsize
Point (and public key) size.
#define bigint_add(addend, value)
Add big integers.
#define bigint_ntoa(value)
Transcribe big integer (for debugging)
#define NULL
NULL pointer (VOID *)
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
static const uint8_t r[3][4]
MD4 shift amounts.
References __attribute__, elliptic_curve::base, bigint_add, bigint_init, bigint_is_geq, bigint_is_zero, bigint_montgomery, bigint_multiply, bigint_ntoa, bigint_t(), ctx, DBGC, DBGC2, ecdsa_invert(), elliptic_multiply(), hmac_drbg_generate(), k, keysize, elliptic_curve::keysize, NULL, elliptic_curve::pointsize, product, r, rc, size, and strerror().
Referenced by ecdsa_sign().
Verify ECDSA "r" and "s" values.
- Parameters
-
| ctx | ECDSA context |
| sig | Signature |
- Return values
-
Definition at line 669 of file ecdsa.c.
673 const void *
public =
ctx->key.public;
676 ( (
void * )
ctx->modulus0 );
678 ( (
void * )
ctx->one0 );
680 ( (
void * )
ctx->z0 );
682 ( (
void * )
ctx->r0 );
684 ( (
void * )
ctx->s0 );
686 ( (
void * )
ctx->temp0 );
688 ( (
void * )
ctx->product0 );
695 void *point1 =
ctx->point1;
696 void *point2 =
ctx->point2;
697 void *scalar =
ctx->scalar;
711 DBGC2 (
ctx,
"ECDSA %p u1 = %s mod N\n",
718 DBGC (
ctx,
"ECDSA %p could not calculate u1*G: %s\n",
727 DBGC2 (
ctx,
"ECDSA %p u2 = %s mod N\n",
733 DBGC (
ctx,
"ECDSA %p could not calculate u2*Qa: %s\n",
739 if ( (
rc =
elliptic_add ( curve, point1, point2, point1 ) ) != 0 ) {
740 DBGC (
ctx,
"ECDSA %p could not calculate u1*G+u2*Qa: %s\n",
747 DBGC (
ctx,
"ECDSA %p result is point at infinity\n",
ctx );
761 DBGC2 (
ctx,
"ECDSA %p signature is%s valid\n",
762 ctx, ( valid ?
"" :
" not" ) );
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
static int elliptic_multiply(struct elliptic_curve *curve, const void *base, const void *scalar, void *result)
static int elliptic_is_infinity(struct elliptic_curve *curve, const void *point)
uint16_t size
Buffer size.
static void ecdsa_invert(struct ecdsa_context *ctx, bigint_element_t *val0)
Invert ECDSA value.
#define bigint_init(value, data, len)
Initialise big integer.
struct golan_eq_context ctx
#define bigint_is_zero(value)
Test if big integer is equal to zero.
#define bigint_done(value, out, len)
Finalise big integer.
size_t keysize
Scalar (and private key) size.
char * strerror(int errno)
Retrieve string representation of error number.
u16 keysize
Length of encryption key to be used, network byte order.
static int elliptic_add(struct elliptic_curve *curve, const void *addend, const void *augend, void *result)
#define bigint_montgomery(modulus, value, result)
Perform classic Montgomery reduction (REDC) of a big integer.
#define bigint_multiply(multiplicand, multiplier, result)
Multiply big integers.
const void * base
Generator base point.
uint8_t product
Product string.
#define bigint_subtract(subtrahend, value)
Subtract big integers.
size_t pointsize
Point (and public key) size.
#define bigint_ntoa(value)
Transcribe big integer (for debugging)
typedef bigint_t(X25519_SIZE) x25519_t
An X25519 unsigned big integer used in internal calculations.
static const uint8_t r[3][4]
MD4 shift amounts.
References __attribute__, elliptic_curve::base, bigint_done, bigint_init, bigint_is_zero, bigint_montgomery, bigint_multiply, bigint_ntoa, bigint_subtract, bigint_t(), ctx, DBGC, DBGC2, ecdsa_invert(), EINVAL, EINVAL_SIGNATURE, elliptic_add(), elliptic_is_infinity(), elliptic_multiply(), keysize, elliptic_curve::keysize, elliptic_curve::pointsize, product, r, rc, size, and strerror().
Referenced by ecdsa_verify().
Sign digest value using ECDSA.
- Parameters
-
| key | Key |
| digest | Digest algorithm |
| value | Digest value |
| signature | Signature |
- Return values
-
Definition at line 808 of file ecdsa.c.
819 if ( !
ctx.key.private ) {
static void ecdsa_free(struct ecdsa_context *ctx)
Free ECDSA context dynamic storage.
struct arbelprm_rc_send_wqe rc
void hmac_drbg_instantiate(struct digest_algorithm *hash, struct hmac_drbg_state *state, const void *entropy, size_t entropy_len, const void *personal, size_t personal_len)
Instantiate HMAC_DRBG.
struct golan_eq_context ctx
pseudo_bit_t value[0x00020]
static int ecdsa_prepend_signature(struct ecdsa_context *ctx, bigint_element_t *rs0, struct asn1_builder *builder)
Prepend ECDSA signature value.
int asn1_wrap(struct asn1_builder *builder, unsigned int type)
Wrap ASN.1 builder.
#define ASN1_SEQUENCE
ASN.1 sequence.
#define ENOTTY
Inappropriate I/O control operation.
static int ecdsa_init(struct ecdsa_context *ctx, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value)
Initialise ECDSA context.
u8 signature
CPU signature.
static int ecdsa_sign_rs(struct ecdsa_context *ctx)
Generate ECDSA "r" and "s" values.
struct digest_algorithm * digest
Digest algorithm.
References ASN1_SEQUENCE, asn1_wrap(), ctx, ecdsa_context::digest, ecdsa_free(), ecdsa_init(), ecdsa_prepend_signature(), ecdsa_sign_rs(), ENOTTY, hmac_drbg_instantiate(), key, rc, signature, and value.
Verify signed digest using ECDSA.
- Parameters
-
| key | Key |
| digest | Digest algorithm |
| value | Digest value |
| signature | Signature |
- Return values
-
Definition at line 864 of file ecdsa.c.
static void ecdsa_free(struct ecdsa_context *ctx)
Free ECDSA context dynamic storage.
struct arbelprm_rc_send_wqe rc
int asn1_enter(struct asn1_cursor *cursor, unsigned int type)
Enter ASN.1 object.
static int ecdsa_parse_signature(struct ecdsa_context *ctx, bigint_element_t *rs0, const struct asn1_cursor *raw)
Parse ECDSA signature value.
struct golan_eq_context ctx
int asn1_skip_any(struct asn1_cursor *cursor)
Skip ASN.1 object of any type.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
pseudo_bit_t value[0x00020]
#define ASN1_SEQUENCE
ASN.1 sequence.
static int ecdsa_init(struct ecdsa_context *ctx, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value)
Initialise ECDSA context.
u8 signature
CPU signature.
static int ecdsa_verify_rs(struct ecdsa_context *ctx)
Verify ECDSA "r" and "s" values.
References asn1_enter(), ASN1_SEQUENCE, asn1_skip_any(), ctx, ecdsa_free(), ecdsa_init(), ecdsa_parse_signature(), ecdsa_verify_rs(), key, memcpy(), rc, signature, and value.