Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP OpenSSL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP OpenSSL
Commits
cf517a6d
Commit
cf517a6d
authored
9 years ago
by
Dr. Stephen Henson
Browse files
Options
Downloads
Patches
Plain Diff
add ECDSA_size to ec_asn1.c
Reviewed-by:
Richard Levitte
<
levitte@openssl.org
>
parent
c5359791
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
crypto/ec/ec_asn1.c
+34
-0
34 additions, 0 deletions
crypto/ec/ec_asn1.c
include/openssl/ec.h
+6
-0
6 additions, 0 deletions
include/openssl/ec.h
with
40 additions
and
0 deletions
crypto/ec/ec_asn1.c
+
34
−
0
View file @
cf517a6d
...
...
@@ -1319,3 +1319,37 @@ void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, ECDSA_SIG *sig)
if
(
ps
)
*
ps
=
sig
->
s
;
}
int
ECDSA_size
(
const
EC_KEY
*
r
)
{
int
ret
,
i
;
ASN1_INTEGER
bs
;
BIGNUM
*
order
=
NULL
;
unsigned
char
buf
[
4
];
const
EC_GROUP
*
group
;
if
(
r
==
NULL
)
return
0
;
group
=
EC_KEY_get0_group
(
r
);
if
(
group
==
NULL
)
return
0
;
if
((
order
=
BN_new
())
==
NULL
)
return
0
;
if
(
!
EC_GROUP_get_order
(
group
,
order
,
NULL
))
{
BN_clear_free
(
order
);
return
0
;
}
i
=
BN_num_bits
(
order
);
bs
.
length
=
(
i
+
7
)
/
8
;
bs
.
data
=
buf
;
bs
.
type
=
V_ASN1_INTEGER
;
/* If the top bit is set the asn1 encoding is 1 larger. */
buf
[
0
]
=
0xff
;
i
=
i2d_ASN1_INTEGER
(
&
bs
,
NULL
);
i
+=
i
;
/* r and s */
ret
=
ASN1_object_size
(
1
,
i
,
V_ASN1_SEQUENCE
);
BN_clear_free
(
order
);
return
(
ret
);
}
This diff is collapsed.
Click to expand it.
include/openssl/ec.h
+
6
−
0
View file @
cf517a6d
...
...
@@ -1089,6 +1089,12 @@ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
int
ECDSA_verify
(
int
type
,
const
unsigned
char
*
dgst
,
int
dgstlen
,
const
unsigned
char
*
sig
,
int
siglen
,
EC_KEY
*
eckey
);
/** Returns the maximum length of the DER encoded signature
* \param eckey EC_KEY object
* \return numbers of bytes required for the DER encoded signature
*/
int
ECDSA_size
(
const
EC_KEY
*
eckey
);
# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
# ifndef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment