diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-05 00:18:18 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-05 00:19:15 +0100 |
commit | 084bac472b02f307a093f56a262312accd6fb014 (patch) | |
tree | 5af4382b03f5e832428f2715c2528d9c4947e587 /networking/tls.c | |
parent | 5df3b12241526af543c5acd2088ce22f3524de32 (diff) | |
download | busybox-w32-084bac472b02f307a093f56a262312accd6fb014.tar.gz busybox-w32-084bac472b02f307a093f56a262312accd6fb014.tar.bz2 busybox-w32-084bac472b02f307a093f56a262312accd6fb014.zip |
tls: code shrink
function old new delta
tls_handshake 1643 1619 -24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tls.c')
-rw-r--r-- | networking/tls.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/networking/tls.c b/networking/tls.c index 7cd6a61ba..0f637a3d7 100644 --- a/networking/tls.c +++ b/networking/tls.c | |||
@@ -1115,8 +1115,6 @@ static void find_key_in_der_cert(tls_state_t *tls, uint8_t *der, int len) | |||
1115 | * We need Certificate.tbsCertificate.subjectPublicKeyInfo.publicKey | 1115 | * We need Certificate.tbsCertificate.subjectPublicKeyInfo.publicKey |
1116 | */ | 1116 | */ |
1117 | uint8_t *end = der + len; | 1117 | uint8_t *end = der + len; |
1118 | uint8_t tag_class, pc, tag_number; | ||
1119 | int version_present; | ||
1120 | 1118 | ||
1121 | /* enter "Certificate" item: [der, end) will be only Cert */ | 1119 | /* enter "Certificate" item: [der, end) will be only Cert */ |
1122 | der = enter_der_item(der, &end); | 1120 | der = enter_der_item(der, &end); |
@@ -1133,13 +1131,11 @@ static void find_key_in_der_cert(tls_state_t *tls, uint8_t *der, int len) | |||
1133 | * (constructed), and a tag number of 0 (see ITU-T X.690 sections 8.1.2 | 1131 | * (constructed), and a tag number of 0 (see ITU-T X.690 sections 8.1.2 |
1134 | * and 8.14). | 1132 | * and 8.14). |
1135 | */ | 1133 | */ |
1136 | tag_class = der[0] >> 6; /* bits 8-7 */ | 1134 | /* bits 7-6: 10 */ |
1137 | pc = (der[0] & 32) >> 5; /* bit 6 */ | 1135 | /* bit 5: 1 */ |
1138 | tag_number = der[0] & 31; /* bits 5-1 */ | 1136 | /* bits 4-0: 00000 */ |
1139 | version_present = tag_class == 2 && pc == 1 && tag_number == 0; | 1137 | if (der[0] == 0xa0) |
1140 | if (version_present) { | ||
1141 | der = skip_der_item(der, end); /* version */ | 1138 | der = skip_der_item(der, end); /* version */ |
1142 | } | ||
1143 | 1139 | ||
1144 | /* skip up to subjectPublicKeyInfo */ | 1140 | /* skip up to subjectPublicKeyInfo */ |
1145 | der = skip_der_item(der, end); /* serialNumber */ | 1141 | der = skip_der_item(der, end); /* serialNumber */ |