Commit Graph

571 Commits

Author SHA1 Message Date
Simon Butcher
8c9ab6ce6f Add extra compilation conditions to X.509 samples
The sample applications programs/pkey/cert_req.c and
programs/pkey/cert_write.c use the library functions mbedtls_pk_write_csr_pem()
and mbedtls_pk_write_crt_pem() respectively and programs/pkey/gen_key.c uses
the library function mbedtls_pk_write_key_pem().

These are dependent on the configuration option POLARSSL_PEM_WRITE_C. If the
option isn't defined the build breaks.

This change adds the compilation condition POLARSSL_PEM_WRITE_C to these
sample applications.
2016-10-13 12:45:07 +01:00
Simon Butcher
23abd160cc Actually apply debug_level settings in cert_app 2016-10-13 12:44:20 +01:00
Simon Butcher
31d7f5b236 Fix for #441 - crypt and hash gcm (#546)
* Fix crypt_and_hash to support decrypting GCM encrypted files

* Fix documentation in crypt_and_hash for the generic case

* Remove unused lastn from crypt_and_hash

lastn is not used with the cipher layer as it already provides padding
and understanding of length of the original data.

Backport of fix by Paul Bakker.
2016-10-13 12:44:19 +01:00
Simon Butcher
8435f9e8ec Add missing stdlib.h header to rsa sample programs 2016-04-13 01:38:54 +01:00
Simon Butcher
de62b6e396 Fixes error and exit paths in rsa sample programs 2016-04-12 17:36:34 +01:00
Janos Follath
fa4a88a8eb Fix memory leaks in example programs. 2016-04-12 16:45:10 +01:00
Jonathan Leroy
2744df4f7a cert_write : fix "Destination buffer is too small" error
This commit fixes the `Destination buffer is too small` error returned
by `mbedtls_cert_write` command when the values of `subject_name` or
`issuer_name` parameters exceed 128 characters.

I have increased the size of these varaibles from 128 to 256 characters,
but I don't know if it's the best way to solve this issue...

Fixes #315.
2015-10-27 15:12:39 +01:00
Manuel Pégourié-Gonnard
8fbb5a32c6 Fix snprintf usage again
Sigh, switching between branches is error-prone
2015-08-31 12:38:12 +02:00
Manuel Pégourié-Gonnard
c728f9486b Fix snprintf usage on windows
Introduced in 6432c7e
2015-08-31 12:30:16 +02:00
Manuel Pégourié-Gonnard
ee7db9cb6d Fix hash buffer size in pkey programs
backport from 102a620
2015-08-31 11:32:03 +02:00
Manuel Pégourié-Gonnard
6432c7e782 Fix memory corruption in rsa sign/verify programs
backport from d74c697

see #210
2015-08-31 11:30:07 +02:00
Manuel Pégourié-Gonnard
a67fd79e8f Fix -Wshadow warnings
Backport of ea35666 and 824ba72

see #240
2015-08-31 11:07:51 +02:00
Manuel Pégourié-Gonnard
e92617b586 Run timing selftest on all platforms 2015-07-06 17:19:27 +02:00
Manuel Pégourié-Gonnard
f0dd045bbe Backport dh_genprime update from 2.0 2015-07-03 17:14:06 +02:00
Manuel Pégourié-Gonnard
006f655218 Add forgotten programs in Makefile
Closes #209
2015-06-29 18:52:57 +02:00
Manuel Pégourié-Gonnard
fa950c9480 fix bug in ssl_mail_client 2015-04-30 12:50:22 +02:00
Manuel Pégourié-Gonnard
ac90673345 Remove unused headers in o_p_test 2015-04-30 10:09:50 +02:00
Manuel Pégourié-Gonnard
637376c2fe Fix bugs in programs displaying verify flags 2015-04-29 14:28:48 +02:00
Manuel Pégourié-Gonnard
0c6ce2f536 Use x509_crt_verify_info() in programs 2015-04-17 19:57:21 +02:00
Paul Bakker
6152b0267c Fixed typos 2015-04-14 15:00:09 +02:00
Manuel Pégourié-Gonnard
0878a0d884 Add missing depends in x509 programs 2015-03-31 15:14:37 +02:00
Manuel Pégourié-Gonnard
8d649c66b3 Simplify ifdef checks in programs/x509 2015-03-31 15:10:03 +02:00
Manuel Pégourié-Gonnard
e46c6c38c9 Fix tests to work with DEPRECATED_REMOVED 2015-03-23 14:11:11 +01:00
Alon Bar-Lev
f7a9f30348 build: Makefile: cleanup CFLAGS
CFLAGS are reserved for external interaction via make variable, the
following should work:

$ make CFLAGS="-O3"
$ CFLAGS="-O3" make

1. Move internal flags to LOCAL_CFLAGS
2. Respect external CFLAGS
3. CFLAGS should be last compiler flags.
4. Default CFLAGS is -O optimization, remove OFLAGS.
5. Add WARNING_CFLAGS to control warning setting and enable to remove
   if compiler does not support flags.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2015-03-13 13:34:25 +00:00
Alon Bar-Lev
ada4105ba2 build: Makefile: cleanup LDFLAGS
LDFLAGS are reserved for external interaction via make variable, the
following should work:

$ make LDFLAGS="-L/xxx"
$ LDFLAGS="-L/xxx" make

1. Move internal flags to LOCAL_LDFLAGS
2. Respect external LDFLAGS
3. LDFLAGS should be last linkage flags.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2015-03-13 13:34:25 +00:00
Manuel Pégourié-Gonnard
fe44643b0e Rename website and repository 2015-03-06 13:17:10 +00:00
Manuel Pégourié-Gonnard
c439e7b099 Minor portability fix in benchmark
On embedded systems, argc might be 0 rather than 1 for no argument.
2015-03-03 13:12:00 +00:00
Manuel Pégourié-Gonnard
b199095ec9 Finish fixing memleak in ssl_server2 arg parsing
Fixes omission in 5c078e1
2015-02-18 09:32:06 +00:00
Manuel Pégourié-Gonnard
c3e3395c82 Fix missing #define if PLATFORM_C not here 2015-02-16 18:46:20 +00:00
Manuel Pégourié-Gonnard
714929bf0d Fix issues introduced when rebasing 2015-02-16 17:32:47 +00:00
Manuel Pégourié-Gonnard
7defc7759d Code cosmetics 2015-02-16 17:28:11 +00:00
Manuel Pégourié-Gonnard
85391f2a65 Add curve25519 to the benchmark program 2015-02-16 17:28:11 +00:00
Manuel Pégourié-Gonnard
e579dab5f0 Fix compile issue when buffer_alloc not available 2015-02-16 17:28:10 +00:00
Manuel Pégourié-Gonnard
71e75dc2f0 Fix unused variable issue in some configs 2015-02-16 17:28:10 +00:00
Manuel Pégourié-Gonnard
50da0482e0 Add heap usage for PK in benchmark 2015-02-16 17:28:10 +00:00
Manuel Pégourié-Gonnard
128657d645 Use memory_buffer_alloc() in benchmark if available
Allows to measure memory by primitive.
2015-02-16 17:24:57 +00:00
Manuel Pégourié-Gonnard
3b8926c9d1 Adapt mini-client for config-suite-b.h 2015-02-16 17:22:46 +00:00
Manuel Pégourié-Gonnard
a6fc5b2c6a Add mini_client.c 2015-02-16 17:22:46 +00:00
Manuel Pégourié-Gonnard
ab025803ed Merge remote-tracking branch 'rich/platform' into development
* rich/platform:
  modify library/memory_buffer_alloc.c, benchmark.c and the tests main code to use polarssl_exit
  modify programs/*.c to use polarssl_snprintf
2015-02-16 16:10:51 +00:00
Manuel Pégourié-Gonnard
aff2976d10 Merge branch 'build' into development
* build:
  build: make: support windows cross compile
2015-02-16 15:26:09 +00:00
Manuel Pégourié-Gonnard
09eb14c01e Revert "Require unix-utils in path for windows make"
This reverts commit 5d46cca09a.

In preparation of merging an external contribution that superseedes this

Conflicts:
	ChangeLog
2015-02-16 15:25:31 +00:00
Mansour Moufid
c531b4af3c Apply the semantic patch rm-malloc-cast.cocci.
for dir in library programs; do
        spatch --sp-file scripts/rm-malloc-cast.cocci --dir $dir \
        --in-place;
    done
2015-02-16 10:43:52 +00:00
Manuel Pégourié-Gonnard
671589d9a2 Fix return code in cert_app 2015-02-16 09:24:08 +00:00
Manuel Pégourié-Gonnard
401caadebd Align ssl_read in fork_server on ssl_server
It was the only program using a weird do while( 0 ) with a continue inside
2015-02-16 09:13:40 +00:00
Manuel Pégourié-Gonnard
f53df4fcd8 Fix unchecked return values in mpi_demo 2015-02-16 09:13:40 +00:00
Manuel Pégourié-Gonnard
5c078e17b9 Fix memory leak on bad arguments in ssl_server2
Not a big deal, but was annoying in coverity results.
2015-02-16 09:13:40 +00:00
Alon Bar-Lev
18ba0cce8b build: make: support windows cross compile
Add WINDOWS_BUILD macro to enable Windows build on *NIX host.

Add optional suffix for executables.

Fix shared object suffix logic to support multiple suffixes.

Fix soname handling to always match output.

WINDOWS macro sets WINDOWS_BUILD.

WINDOWS_BUILD sets .exe executable suffix.

WINDOWS_BUILD shared mode creates dll import library.

WINDOWS_BUILD shared mode link against dll.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2015-02-14 01:20:17 +02:00
Rich Evans
012acfc20f modify library/memory_buffer_alloc.c, benchmark.c and the tests main code to use polarssl_exit 2015-02-13 16:52:49 +00:00
Rich Evans
b92965be74 modify programs/*.c to use polarssl_snprintf 2015-02-13 16:51:44 +00:00
Manuel Pégourié-Gonnard
ac1f76c362 Merge remote-tracking branch 'rich/platform' into development
* rich/platform:
  Remove dependency on sscanf in lib x509
  Fix extra guard in memory_buffer_alloc
  rebase from development
  implemented macro overriding for polarssl_* library functions
  fix bug introduced by the addition of snprintf and assert macro which caused tests to fail without polarssl_platform_c defined
  add initial symbols to config and checks to check_config to allow use of macros to define standard functions
  reformat and arrange additions to config alphabetically
  add missing checks to check_config
  add macro definition of assert using polarssl_exit
  modify library/memory_buffer_alloc.c, benchmark.c and the tests main code to use polarssl_exit
  add POLARSSL_PLATFORM_EXIT_ALT
  modify scripts/* and tests/* to use polarssl_snprintf
  modify programs/*.c to use polarssl_snprintf
  modify library/debug.c to use polarssl_snprintf
  modify library/x509*.c to use polarssl_snprintf
  modify library/net.c to use polarssl_snprintf
  modify oid.c to use polarssl_snprintf
  add platform_set_snprintf

Conflicts:
	library/memory_buffer_alloc.c
	programs/pkey/pk_sign.c
	programs/pkey/pk_verify.c
	programs/pkey/rsa_sign_pss.c
	programs/pkey/rsa_verify_pss.c
	programs/ssl/ssl_client2.c
	programs/ssl/ssl_pthread_server.c
	programs/test/benchmark.c
	programs/test/ssl_cert_test.c
2015-02-13 15:11:24 +00:00