Skip to content

Commit f46f9ba

Browse files
committed
CHANGE: replaced the old ECDH and ECDSA implementation with code from mbedTLS`
1 parent d6db6f5 commit f46f9ba

28 files changed

+15086
-156
lines changed

make/rebol3.nest

+10-3
Original file line numberDiff line numberDiff line change
@@ -458,16 +458,19 @@ include-cryptography: [
458458
core-files: [
459459
%core/n-crypt.c
460460
%core/u-aes.c
461-
%core/u-bigint.c ;needed for RSA abd DH which is needed in TLS protocol (HTTPS)
461+
;%core/deprecated/u-bigint.c ;needed for RSA abd DH which is needed in TLS protocol (HTTPS)
462462
%core/u-chacha20.c
463-
%core/u-dh.c
463+
;%core/deprecated/u-dh.c
464464
%core/u-poly1305.c
465465
%core/u-rc4.c
466466
;%core/deprecated/u-rsa.c
467-
%core/u-uECC.c
467+
;%core/deprecated/u-uECC.c
468468

469469
%core/p-crypt.c
470470
%core/mbedtls/aes.c
471+
%core/mbedtls/asn1parse.c
472+
%core/mbedtls/asn1write.c
473+
%core/mbedtls/dhm.c
471474
%core/mbedtls/md.c
472475
%core/mbedtls/oid.c
473476
%core/mbedtls/bignum.c
@@ -477,6 +480,10 @@ include-cryptography: [
477480
%core/mbedtls/ctr_drbg.c
478481
%core/mbedtls/entropy.c
479482
%core/mbedtls/entropy_poll.c
483+
%core/mbedtls/ecdh.c
484+
%core/mbedtls/ecdsa.c
485+
%core/mbedtls/ecp.c
486+
%core/mbedtls/ecp_curves.c
480487
]
481488
:include-codec-crt
482489
:include-codec-der

src/boot/sysobj.reb

+21
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ catalog: object [
6161
]
6262
checksums: [adler32 crc24 crc32 tcp md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd160]
6363
compressions: [gzip deflate zlib lzma crush]
64+
elliptic-curves: [
65+
secp192r1 ; 192-bit curve defined by FIPS 186-4 and SEC1
66+
secp224r1 ; 224-bit curve defined by FIPS 186-4 and SEC1
67+
secp256r1 ; 256-bit curve defined by FIPS 186-4 and SEC1
68+
secp384r1 ; 384-bit curve defined by FIPS 186-4 and SEC1
69+
secp521r1 ; 521-bit curve defined by FIPS 186-4 and SEC1
70+
bp256r1 ; 256-bit Brainpool curve
71+
bp384r1 ; 384-bit Brainpool curve
72+
bp512r1 ; 512-bit Brainpool curve
73+
curve25519 ; Curve25519
74+
secp192k1 ; 192-bit "Koblitz" curve
75+
secp224k1 ; 224-bit "Koblitz" curve
76+
secp256k1 ; 256-bit "Koblitz" curve
77+
curve448 ; Curve448
78+
]
6479
]
6580

6681
contexts: construct [
@@ -267,6 +282,12 @@ standard: object [
267282
method: none
268283
]
269284

285+
port-spec-crypt: make port-spec-head [
286+
scheme: 'crypt
287+
algorithm: 'aes
288+
direction: 'encrypt
289+
]
290+
270291
port-spec-midi: make port-spec-head [
271292
scheme: 'midi
272293
device-in:

src/boot/words.reb

+17-1
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,20 @@ msdos-datetime
288288
msdos-date
289289
msdos-time
290290
octal-bytes
291-
string-bytes
291+
string-bytes
292+
293+
; group IDs for Elliptic Curves over GF(P) (ECP)
294+
; (in the same order as mbedTLS's `mbedtls_ecp_group_id` enumeration)
295+
secp192r1 ; 192-bit curve defined by FIPS 186-4 and SEC1
296+
secp224r1 ; 224-bit curve defined by FIPS 186-4 and SEC1
297+
secp256r1 ; 256-bit curve defined by FIPS 186-4 and SEC1
298+
secp384r1 ; 384-bit curve defined by FIPS 186-4 and SEC1
299+
secp521r1 ; 521-bit curve defined by FIPS 186-4 and SEC1
300+
bp256r1 ; 256-bit Brainpool curve
301+
bp384r1 ; 384-bit Brainpool curve
302+
bp512r1 ; 512-bit Brainpool curve
303+
curve25519 ; Curve25519
304+
secp192k1 ; 192-bit "Koblitz" curve
305+
secp224k1 ; 224-bit "Koblitz" curve
306+
secp256k1 ; 256-bit "Koblitz" curve
307+
curve448 ; Curve448
File renamed without changes.

0 commit comments

Comments
 (0)