Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
7a6c9464
Commit
7a6c9464
authored
Jul 09, 2013
by
Manuel Pégourié-Gonnard
Browse files
Fix error code in pk.h
parent
88380993
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
6 deletions
+19
-6
include/polarssl/error.h
include/polarssl/error.h
+2
-1
include/polarssl/pk.h
include/polarssl/pk.h
+3
-2
library/error.c
library/error.c
+12
-1
library/pk.c
library/pk.c
+1
-1
scripts/generate_errors.pl
scripts/generate_errors.pl
+1
-1
No files found.
include/polarssl/error.h
View file @
7a6c9464
...
...
@@ -76,7 +76,8 @@
* Name ID Nr of Errors
* PEM 1 9
* PKCS#12 1 4 (Started from top)
* X509 2 23
* X509 2 25
* PK 2 1 (Started from top)
* DHM 3 6
* PKCS5 3 4 (Started from top)
* RSA 4 9
...
...
include/polarssl/pk.h
View file @
7a6c9464
...
...
@@ -27,6 +27,8 @@
#ifndef POLARSSL_PK_H
#define POLARSSL_PK_H
#define POLARSSL_ERR_PK_MALLOC_FAILED -0x2F80
/**< Memory alloation failed. */
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -66,8 +68,7 @@ void pk_free( pk_context *ctx );
* \param ctx Context to initialize
* \param type Type of key
*
* \return O on success, -1 on memory allocation error
* TODO: use appropriate error constant
* \return O on success, or POLARSSL_ERR_PK_MALLOC_FAILED
*/
int
pk_set_type
(
pk_context
*
ctx
,
pk_type_t
type
);
...
...
library/error.c
View file @
7a6c9464
...
...
@@ -113,6 +113,10 @@
#include "polarssl/pem.h"
#endif
#if defined(POLARSSL_PK_C)
#include "polarssl/pk.h"
#endif
#if defined(POLARSSL_PKCS12_C)
#include "polarssl/pkcs12.h"
#endif
...
...
@@ -243,6 +247,11 @@ void polarssl_strerror( int ret, char *buf, size_t buflen )
snprintf
(
buf
,
buflen
,
"PEM - Bad input parameters to function"
);
#endif
/* POLARSSL_PEM_C */
#if defined(POLARSSL_PK_C)
if
(
use_ret
==
-
(
POLARSSL_ERR_PK_MALLOC_FAILED
)
)
snprintf
(
buf
,
buflen
,
"PK - Memory alloation failed"
);
#endif
/* POLARSSL_PK_C */
#if defined(POLARSSL_PKCS12_C)
if
(
use_ret
==
-
(
POLARSSL_ERR_PKCS12_BAD_INPUT_DATA
)
)
snprintf
(
buf
,
buflen
,
"PKCS12 - Bad input parameters to function"
);
...
...
@@ -388,7 +397,7 @@ void polarssl_strerror( int ret, char *buf, size_t buflen )
if
(
use_ret
==
-
(
POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG
)
)
snprintf
(
buf
,
buflen
,
"X509 - Signature algorithm (oid) is unsupported"
);
if
(
use_ret
==
-
(
POLARSSL_ERR_X509_UNKNOWN_PK_ALG
)
)
snprintf
(
buf
,
buflen
,
"X509 - Key algorithm is unsupported (only RSA
is
supported)"
);
snprintf
(
buf
,
buflen
,
"X509 - Key algorithm is unsupported (only RSA
and EC are
supported)"
);
if
(
use_ret
==
-
(
POLARSSL_ERR_X509_CERT_SIG_MISMATCH
)
)
snprintf
(
buf
,
buflen
,
"X509 - Certificate signature algorithms do not match. (see
\\
c ::x509_cert sig_oid)"
);
if
(
use_ret
==
-
(
POLARSSL_ERR_X509_CERT_VERIFY_FAILED
)
)
...
...
@@ -409,6 +418,8 @@ void polarssl_strerror( int ret, char *buf, size_t buflen )
snprintf
(
buf
,
buflen
,
"X509 - Private key password can't be empty"
);
if
(
use_ret
==
-
(
POLARSSL_ERR_X509_PASSWORD_MISMATCH
)
)
snprintf
(
buf
,
buflen
,
"X509 - Given private key password does not allow for correct decryption"
);
if
(
use_ret
==
-
(
POLARSSL_ERR_X509_UNKNOWN_NAMED_CURVE
)
)
snprintf
(
buf
,
buflen
,
"X509 - Elliptic curve is unsupported (only NIST curves are supported)"
);
#endif
/* POLARSSL_X509_PARSE_C */
if
(
strlen
(
buf
)
==
0
)
...
...
library/pk.c
View file @
7a6c9464
...
...
@@ -84,7 +84,7 @@ int pk_set_type( pk_context *ctx, pk_type_t type )
return
(
0
);
if
(
(
ctx
->
data
=
malloc
(
size
)
)
==
NULL
)
return
(
-
1
);
return
(
POLARSSL_ERR_PK_MALLOC_FAILED
);
memset
(
ctx
->
data
,
0
,
size
);
ctx
->
type
=
type
;
...
...
scripts/generate_errors.pl
View file @
7a6c9464
...
...
@@ -13,7 +13,7 @@ my @low_level_modules = ( "AES", "ASN1", "BLOWFISH", "CAMELLIA", "BIGNUM",
"
PADLOCK
",
"
DES
",
"
NET
",
"
CTR_DRBG
",
"
ENTROPY
",
"
MD2
",
"
MD4
",
"
MD5
",
"
SHA1
",
"
SHA256
",
"
SHA512
",
"
GCM
"
);
my
@high_level_modules
=
(
"
PEM
",
"
X509
",
"
DHM
",
"
RSA
",
"
ECP
",
"
MD
",
"
CIPHER
",
"
SSL
",
"
PKCS12
",
"
PKCS5
"
);
"
PK
",
"
PKCS12
",
"
PKCS5
"
);
my
$line_separator
=
$/
;
undef
$/
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment