Gilles Peskine
5bdb671404
Merge branch 'pr_403' into development-proposed
2018-03-22 21:34:15 +01:00
mohammad1603
b878805919
Verify that f_send and f_recv send and receive the expected length
...
Verify that f_send and f_recv send and receive the expected length
2018-03-22 02:58:23 -07:00
Gilles Peskine
4e4be7cf62
Optimize unnecessary zeorizing in mbedtls_mpi_copy
...
Based on a contribution by Alexey Skalozub
(https://github.com/ARMmbed/mbedtls/pull/405 ).
2018-03-21 16:29:03 +01:00
Gergely Budai
13f7fb372e
Do not define and initialize global mutexes on configurations that do not use them.
2018-03-21 15:01:55 +00:00
Azim Khan
27e8a120b2
Assign NULL after freeing psk and psk_identity
2018-03-21 14:24:11 +00:00
junyeonLEE
316b162ac3
Separate psk and psk_identity buffers free
...
Sometimes, psk_identity buffer can't released because psk buffer is NULL.
So, separate it.
2018-03-21 14:15:28 +00:00
Mitsuhiro Nakamura
5ff2ee51e9
Fix dylib linking
2018-03-21 11:10:59 +00:00
Krzysztof Stachowiak
bc231cc9b0
Add a missing buffer size check
2018-03-20 14:09:53 +01:00
Krzysztof Stachowiak
bc145f7978
Correct buffer size check
...
Further in the code the next field from the binary buffer is read. The
check contained an off by one error.
2018-03-20 11:19:50 +01:00
Gilles Peskine
ea7dbbe0de
Replace MBEDTLS_EINTR by IS_EINTR
...
check-names.sh reserves the prefix MBEDTLS_ for macros defined in
config.h so this name (or check-names.sh) had to change.
This is also more flexible because it allows for platforms that don't have
an EINTR equivalent or have multiple such values.
2018-03-19 17:10:31 +01:00
Hanno Becker
c9f4d6d448
Correct error.c
2018-03-19 09:23:13 +00:00
Jaeden Amero
8be0e6db41
Update version to 2.8.0
2018-03-16 16:25:12 +00:00
Hanno Becker
ef52796537
Fix missing return statement ssl_server2 idling
...
Also, introduce MBEDTLS_EINTR locally in net_sockets.c
for the platform-dependent return code macro used by
the `select` call to indicate that the poll was interrupted
by a signal handler: On Unix, the corresponding macro is EINTR,
while on Windows, it's WSAEINTR.
2018-03-15 15:52:31 +00:00
Hanno Becker
80e06d77d9
Use WSAEINTR instead of EINTR on Windows
2018-03-15 14:41:55 +00:00
Hanno Becker
9ac640326b
Don't exit mbedtls_net_poll on interruption of select
...
If the select UNIX system call is interrupted by a signal handler,
it is not automatically restarted but returns EINTR. This commit
modifies the use of select in mbedtls_net_poll from net_sockets.c
to retry the select call in this case.
2018-03-15 12:19:31 +00:00
Jaeden Amero
79a5e72719
Merge remote-tracking branch 'upstream-restricted/pr/463' into development-restricted-proposed
2018-03-15 08:25:05 +00:00
Jaeden Amero
24b2d6fb6d
Merge remote-tracking branch 'upstream-restricted/pr/459' into development-restricted-proposed
2018-03-15 08:24:44 +00:00
Jaeden Amero
ce183d994c
Merge remote-tracking branch 'upstream-public/pr/1448' into development-proposed
2018-03-15 08:23:53 +00:00
Jaeden Amero
d1fedc55d7
Merge remote-tracking branch 'upstream-public/pr/1440' into development-proposed
2018-03-15 08:23:35 +00:00
Jaeden Amero
95ad522ecc
Merge remote-tracking branch 'upstream-public/pr/1439' into development-proposed
2018-03-15 08:23:10 +00:00
Manuel Pégourié-Gonnard
fd3e4fbae7
x509: CRL: reject unsupported critical extensions
2018-03-14 09:15:02 +01:00
Gilles Peskine
5f1932817c
Merge remote-tracking branch 'upstream-restricted/pr/398' into development-restricted-proposed
2018-03-13 17:18:06 +01:00
Gilles Peskine
553a06f08a
Merge remote-tracking branch 'upstream-restricted/pr/351' into development-restricted-proposed
...
Move the added ChangeLog entry to the bottom so that the list remains
in merge order.
2018-03-13 17:15:34 +01:00
Manuel Pégourié-Gonnard
1ba8a3fc55
Yet another dependency issue (PKCS1_V15)
...
Found by running:
CC=clang cmake -D CMAKE_BUILD_TYPE="Check"
tests/scripts/depend-pkalgs.pl
(Also tested with same command but CC=gcc)
Another PR will address improving all.sh and/or the depend-xxx.pl scripts
themselves to catch this kind of thing.
2018-03-13 13:42:38 +01:00
Krzysztof Stachowiak
5224a7544c
Prevent arithmetic overflow on bounds check
2018-03-13 11:31:38 +01:00
Krzysztof Stachowiak
740b218386
Add bounds check before length read
2018-03-13 11:31:14 +01:00
Krzysztof Stachowiak
027f84c69f
Prevent arithmetic overflow on bounds check
2018-03-13 11:29:24 +01:00
Krzysztof Stachowiak
a1098f81c2
Add bounds check before signature length read
2018-03-13 11:28:49 +01:00
Gilles Peskine
f3ada4adb0
Merge branch 'pr_679' into development-proposed
2018-03-13 00:13:29 +01:00
Gilles Peskine
d5f7d24e84
Merge branch 'pr_1064' into development-proposed
2018-03-13 00:08:05 +01:00
Gilles Peskine
a31d8206b1
Merge remote-tracking branch 'upstream-public/pr/778' into development-proposed
2018-03-12 23:45:08 +01:00
Gilles Peskine
19c3862d0c
Merge remote-tracking branch 'upstream-public/pr/1079' into development-proposed
2018-03-11 00:45:10 +01:00
Gilles Peskine
b4c571e603
Merge remote-tracking branch 'upstream-public/pr/1296' into HEAD
2018-03-11 00:44:14 +01:00
Manuel Pégourié-Gonnard
e57d7438b0
Improve documentation of some internal functions
2018-03-07 10:00:57 +01:00
Sanne Wouda
7b2e85dd7c
Use both applicable error codes and a proper coding style
2018-03-06 23:28:46 +01:00
Sanne Wouda
b2b29d5259
Add end-of-buffer check to prevent heap-buffer-overflow
...
Dereference of *p should not happen when it points past the end of the
buffer.
Internal reference: IOTSSL-1663
2018-03-06 23:28:46 +01:00
Hanno Becker
a3389ebb09
Merge branch 'development-restricted' into iotssl-1306-rsa-is-vulnerable-to-bellcore-glitch-attack
2018-03-06 11:55:21 +00:00
Manuel Pégourié-Gonnard
05c00ed8b2
Fix some more MSVC size_t -> int warnings
2018-03-06 11:48:50 +01:00
Manuel Pégourié-Gonnard
f5bb78183a
Fix MSVC warnings
...
library\x509_crt.c(2137): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
library\x509_crt.c(2265): warning C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data
2018-03-05 12:48:53 +01:00
Manuel Pégourié-Gonnard
05e464dff7
Merge branch 'development' into iotssl-1381-x509-verify-refactor-restricted
...
* development: (557 commits)
Add attribution for #1351 report
Adapt version_features.c
Note incompatibility of truncated HMAC extension in ChangeLog
Add LinkLibraryDependencies to VS2010 app template
Add ChangeLog entry for PR #1382
MD: Make deprecated functions not inline
Add ChangeLog entry for PR #1384
Have Visual Studio handle linking to mbedTLS.lib internally
Mention in ChangeLog that this fixes #1351
Add issue number to ChangeLog
Note in the changelog that this fixes an interoperability issue.
Style fix in ChangeLog
Add ChangeLog entries for PR #1168 and #1362
Add ChangeLog entry for PR #1165
ctr_drbg: Typo fix in the file description comment.
dhm: Fix typo in RFC 5114 constants
tests_suite_pkparse: new PKCS8-v2 keys with PRF != SHA1
data_files/pkcs8-v2: add keys generated with PRF != SHA1
tests/pkcs5/pbkdf2_hmac: extend array to accommodate longer results
tests/pkcs5/pbkdf2_hmac: add unit tests for additional SHA algorithms
...
2018-03-05 11:55:38 +01:00
Gilles Peskine
df761d5a6b
Fix build with gcc -O -Wall
...
Fix warnings from gcc -O -Wall about `ret` used uninitialized in
CMAC selftest auxiliary functions. The variable was indeed
uninitialized if the function was called with num_tests=0 (which
never happens).
2018-03-01 22:18:14 +01:00
Manuel Pégourié-Gonnard
366e1b0464
aria: fix comment on aria_a function
...
The new version of the comment has been generated by the following python3
script, when the first constant is copy-pasted from RFC 5794 2.4.3.
#!/usr/bin/python3
RFC_A = """
y0 = x3 ^ x4 ^ x6 ^ x8 ^ x9 ^ x13 ^ x14,
y1 = x2 ^ x5 ^ x7 ^ x8 ^ x9 ^ x12 ^ x15,
y2 = x1 ^ x4 ^ x6 ^ x10 ^ x11 ^ x12 ^ x15,
y3 = x0 ^ x5 ^ x7 ^ x10 ^ x11 ^ x13 ^ x14,
y4 = x0 ^ x2 ^ x5 ^ x8 ^ x11 ^ x14 ^ x15,
y5 = x1 ^ x3 ^ x4 ^ x9 ^ x10 ^ x14 ^ x15,
y6 = x0 ^ x2 ^ x7 ^ x9 ^ x10 ^ x12 ^ x13,
y7 = x1 ^ x3 ^ x6 ^ x8 ^ x11 ^ x12 ^ x13,
y8 = x0 ^ x1 ^ x4 ^ x7 ^ x10 ^ x13 ^ x15,
y9 = x0 ^ x1 ^ x5 ^ x6 ^ x11 ^ x12 ^ x14,
y10 = x2 ^ x3 ^ x5 ^ x6 ^ x8 ^ x13 ^ x15,
y11 = x2 ^ x3 ^ x4 ^ x7 ^ x9 ^ x12 ^ x14,
y12 = x1 ^ x2 ^ x6 ^ x7 ^ x9 ^ x11 ^ x12,
y13 = x0 ^ x3 ^ x6 ^ x7 ^ x8 ^ x10 ^ x13,
y14 = x0 ^ x3 ^ x4 ^ x5 ^ x9 ^ x11 ^ x14,
y15 = x1 ^ x2 ^ x4 ^ x5 ^ x8 ^ x10 ^ x15.
"""
matrix = []
for l in RFC_A.split('\n')[1:-1]:
rhs = l.split('=')[1][:-1]
row = tuple(hex(int(t[2:]))[2:] for t in rhs.split('^'))
matrix.append(row)
out = {}
out['a'] = tuple(''.join(w) for w in zip(*(matrix[0:4])))
out['b'] = tuple(''.join(w) for w in zip(*(matrix[4:8])))
out['c'] = tuple(''.join(w) for w in zip(*(matrix[8:12])))
out['d'] = tuple(''.join(w) for w in zip(*(matrix[12:])))
out2 = {}
for o, r in out.items():
row = list(r)
for i in range(len(r) - 1):
w1 = row[i]
if len(set(w1)) == 2:
w2 = row[i+1]
nw1 = nw2 = ''
for j in range(len(w1)):
if w1[j] in nw1:
nw1 += w2[j]
nw2 += w1[j]
else:
nw1 += w1[j]
nw2 += w2[j]
row[i] = nw1
row[i+1] = nw2
out2[o] = row
for o in 'abcd':
print(o, '=', ' + '.join(out[o]))
print(' ', '=', ' + '.join(out2[o]))
2018-03-01 14:48:10 +01:00
Manuel Pégourié-Gonnard
21662148f7
aria: improve compiler compat by using __asm
...
gcc --std=c99 doesn't like the shorter "asm" (this broke all.sh)
2018-03-01 11:28:51 +01:00
Manuel Pégourié-Gonnard
2078725feb
aria: check arm arch version for asm
...
rev and rev16 are only supported from v6 (all profiles) and up.
arm-none-eabi-gcc picks a lower architecture version by default, which means
before this commit it would fail to build (assembler error) unless you
manually specified -march=armv6-m -mthumb or similar, which broke all.sh.
Source for version-checking macros:
- GCC/Clang: use the -E -dM - </dev/null trick
- armcc5: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0472k/chr1359125007083.html
- armclang 6: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0774g/chr1383660321827.html
Tested with the following script:
#!/bin/sh
set -eu
ARMCLANG="env ARM_TOOL_VARIANT=ult $ARMC6_BIN_DIR/armclang"
build() {
echo "$@"
"$@" -Iinclude -c library/aria.c
}
build arm-none-eabi-gcc
build arm-none-eabi-gcc -march=armv5
build clang --target=arm-none-eabi
build clang --target=arm-none-eabi -march=armv5
build armcc
build armcc --gnu
build armcc --cpu=5T
build armcc --cpu=5T --gnu
build $ARMCLANG --target=arm-arm-none-eabi
check_asm() {
rm -f aria.o
build "$@"
arm-none-eabi-objdump -d aria.o | grep rev16
}
check_asm arm-none-eabi-gcc -march=armv6-m -mthumb
check_asm arm-none-eabi-gcc -march=armv7-m -mthumb
check_asm arm-none-eabi-gcc -march=armv8-m.base -mthumb
check_asm arm-none-eabi-gcc -march=armv7-a -mthumb
check_asm arm-none-eabi-gcc -march=armv8-a -mthumb
check_asm arm-none-eabi-gcc -march=armv7-a -marm
check_asm arm-none-eabi-gcc -march=armv8-a -marm
check_asm clang --target=arm-none-eabi -march=armv6-m
check_asm clang --target=arm-none-eabi -march=armv7-a
check_asm clang --target=arm-none-eabi -march=armv7-m
check_asm clang --target=arm-none-eabi -march=armv7-r
check_asm clang --target=arm-none-eabi -march=armv8-a
check_asm armcc -O0 --cpu=6-M
check_asm armcc -O0 --cpu=7-M
check_asm armcc -O0 --cpu=6
check_asm armcc -O0 --cpu=7-A
check_asm $ARMCLANG --target=arm-arm-none-eabi -march=armv6-m
check_asm $ARMCLANG --target=arm-arm-none-eabi -march=armv7-a
check_asm $ARMCLANG --target=arm-arm-none-eabi -march=armv7-m
check_asm $ARMCLANG --target=arm-arm-none-eabi -march=armv7-r
check_asm $ARMCLANG --target=arm-arm-none-eabi -march=armv8-a
check_asm $ARMCLANG --target=arm-arm-none-eabi -march=armv8-m.base
2018-03-01 11:28:51 +01:00
Manuel Pégourié-Gonnard
7fc08795c1
aria: more whitespace fixes
2018-03-01 09:33:20 +01:00
Manuel Pégourié-Gonnard
5ad88b6d0d
aria: define constants for block size and max rounds
2018-03-01 09:25:31 +01:00
Manuel Pégourié-Gonnard
3c80009615
aria: add error codes for hw implementations
2018-03-01 09:25:05 +01:00
Manuel Pégourié-Gonnard
f3a46a9b4f
aria: fix some typos in comments
2018-03-01 09:25:05 +01:00
Manuel Pégourié-Gonnard
c0bb66f47e
aria: improve compiler inline compatibility
2018-03-01 09:25:05 +01:00
mohammad1603
5bd15cbfa0
Avoid wraparound for ssl->in_left
...
Add check to avoid wraparound for ssl->in_left
2018-02-28 04:30:59 -08:00