Index

A

Abstract Syntax Notation. See ASN.1

accept system call, 23

adding/subtracting machines (computers), 570

addition

double and add approach (multiplication), 106, 116, 134, 150, 153, 213, 503

"ecc.c" point addition implementation, 212213

"ecc_int.c" add_points routine, 152

huge numbers, 9398

"huge.c" add (overflow expansion), 97

"huge.c" add routine, 9495

"huge.c" add routine (addition routine), 96

"huge.c" add routine (size computation), 95

"huge."c" add with negative number support, 143144

"huge."c" add_magnitude and subtract_magnitude, 143

Adleman, Leonard, 91. See also RSA algorithm

Advanced Encryption Standard algorithm. See AES algorithm

"Advances in Cryptology '86," 114

AEAD (Authenticated Encryption with Associated Data) mode ciphers, 490523

AES-CCM, 496502

"aes.c" aes_ccm_encrypt, 498500

"aes.c" aes_ccm_process common routine for encrypt and decrypt, 500502

"aes.c" aes_ccm_process with associated data, 511512

"aes.c" main routine modified to accept associated data, 513514

AES-GCM v., 505509

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

block ciphers v., 517

diagram, 497

encryption example, 514515

overview, 496497

popularity, 502

stream ciphers v., 517

AES-GCM

"aes.c" aes_gcm_encrypt, 505508

"aes.c" aes_gcm_process with associated data length declaration, 516517

"aes.c" aes_gcm_process with associated data support, 516

"aes.c" aes_gcm_process with encrypt and decrypt support, 508509

AES-CCM v., 505509

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

block ciphers v., 517

Galois-Field authentication/CTR with, 505510

GHASH and, 505507

stream ciphers v., 517

"tls.c" init_tls with AES-GCM cipher suite, 519

"tls.h" aes-gcm cipher suite, 518

associated data, 510

"aes.c" aes_ccm_process with associated data, 511512

"aes.c" main routine modified to accept associated data, 513514

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

associated data and, 510

block ciphers v., 490

CBC-MAC, 494502

aes_cbc_mac, 495

CTR and, 496502

diagram, 495

failure of, 496

problems, 502

CTR (counter) mode, 490494

AES-CTR mode, 491492

CBC-MAC and, 496502

encryption (diagram), 491

/Galois-Field authentication, with AES-GCM, 505510

infinitely parallelizable, 491, 502

known plaintext attack, 493

OFB v., 491

embedded hardware implementers and, 523

Galois-Field authentication

"aes.c" gf_multiply, 503

/CTR, with AES-GCM, 505510

maximizing MAC throughput, 502505

GHASH, 502, 504507

"aes.c" ghash, 504505

AES-GCM and, 505507

diagram, 504

incorporating into TLS 1.2, 517523

"tls.c" send_message with AEAD encryption support, 521

"tls.c" send_message with Associated Data support, 519520

"tls.c" tls_decrypt with AEAD decryption, 522

"tls.h" CipherSuite declaration with AEAD support, 518

AES (Advanced Encryption Standard) algorithm, 6082

brute force attacks and, 60

decryption, 7480

DES v., 60, 74

encryption, 6782

key combination, 68

key schedule, 6067

key schedule computation, 128-bit, 61, 65

listings

"aes.c" add_round_key, 68

"aes.c" AES encryption and decryption routines, 8081

"aes.c" aes_block_decrypt, 7879

"aes.c" aes_block_encrypt, 7374

"aes.c" aes_encrypt and aes_decrypt, 7980

"aes.c" compute_key_schedule, 66

"aes.c" dot product, 72

"aes.c" inversion routines, 7577

"aes.c" inv_mix_columns, 7778

"aes.c" mix_columns, 73

"aes.c" rot_word, 63

"aes.c" sbox, 6364

"aes.c" shift_rows, 6970

"aes.c" sub_bytes, 69

"aes.c" sub_word, 64

matrix multiplication example, 7071

matrix operations, 7072

Rijndael algorithm and, 60, 83

row shift, 69

s-boxes, 60, 61, 77

state mapping initialization, 67

support for, 81

XOR operation and, 60, 72

AES-CCM, 496502

"aes.c" aes_ccm_encrypt, 498500

"aes.c" aes_ccm_process common routine for encrypt and decrypt, 500502

"aes.c" aes_ccm_process with associated data, 511512

"aes.c" main routine modified to accept associated data, 513514

AES-GCM v., 505509

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

block ciphers v., 517

diagram, 497

encryption example, 514515

overview, 496497

popularity, 502

stream ciphers v., 517

AES-CTR mode, 491492

AES-GCM

"aes.c" aes_gcm_encrypt, 505508

"aes.c" aes_gcm_process with associated data length declaration, 516517

"aes.c" aes_gcm_process with associated data support, 516

"aes.c" aes_gcm_process with encrypt and decrypt support, 508509

AES-CCM v., 505509

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

block ciphers v., 517

Galois-Field authentication/CTR with, 505510

GHASH and, 505507

stream ciphers v., 517

"tls.c" init_tls with AES-GCM cipher suite, 519

"tls.h" aes-gcm cipher suite, 518

AlgorithmIdentifier, 235, 236

ALU (Arithmetic Logical Unit), 568, 570

AND operation, 568569

Andreessen, Marc, 298

ANSI X9.62 format, 528, 531, 537, 540

Apache server, 27, 370, 575

Applied Cryptography (Schneier), 83

arbitrary precision binary math module, 93114. See also binary number representations; huge numbers; RSA algorithm

Arithmetic Logical Unit (ALU), 568, 570

ASN.1 (Abstract Syntax Notation), 225252. See also certificate parser

certificate structure, 225238

extensions field, 237238

issuer field, 229232

SEQUENCE, 226

serialNumber field, 227

signature field, 227229

subject field, 233235

subjectPublicKeyInfo field, 235236

validity field, 232233

version field, 226

listings

"asn1.c" asn1free, 258259

"asn1.c" asn1_get_bit, 278

"asn1.c" asn1parse, 254258

"asn1.c" asn1show, 260263

"asn1.c" pem_decode, 263264

"asn1.c" test routine, 259260

"asn1.h" asn1struct definition, 252

"asn1.h" constants, 254

online overview, 226

associated data, 510. See also AEAD mode ciphers

"aes.c" aes_ccm_process with associated data, 511512

"aes.c" main routine modified to accept associated data, 513514

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

asymmetric/public key algorithms. See public key algorithms

attachments, email, 547550

attackers, 2, 566

attacks

birthday attack, 170

bit-flipping attack, 494

Bleichenbacher attack, 412

brute force attacks, 2930

AES and, 60

birthday attack, 170

DES and, 55

SSLv2 and, 626

triple DES and, 56

denial of service attacks, 318, 559

"A Key Recovery Attack on Discrete Log-based Schemes Using a Prime Order Subgroup," 236

known plaintext attacks, 186, 493

man-in-the middle attacks, 222224

export-grade ciphers and, 626

SSLv2 and, 346, 626

"Null Prefix Attacks Against SSL Certificates" (Marlinspike), 234

OAEP and, 126

plaintext attacks, 186, 493

Pohlig-Hellman attack, 132

renegotiation attack, 468470

replay attacks, 49, 184, 304, 336, 353, 441, 593. See also HMAC function

small subgroup attack, 236237

timing attacks, 119

truncation attacks, 368, 626

Authenticated Encryption with Associated Data. See AEAD mode ciphers

authentication

with associated data, 510. See also AEAD mode ciphers

"aes.c" aes_ccm_process with associated data, 511512

"aes.c" main routine modified to accept associated data, 513514

"aes.h" AES-CCM and AES-GCM with associated data support, 510511

/decryption (secure data transfer, TLS 1.0), 361364

AUTHINFO extension, 544

authoritative name server, 553555, 557. See also DNS

B

Barrett reduction, 114

base-10 numbering system, 567

Base64 encoding (HTTP client application), 1721

BASIC, 17, 20

Basic Encoding Rules. See BER

BER (Basic Encoding Rules), 241. See also DER

big-endian number format, 571572

computers, 313

DES, 32, 36

"huge.c" set_huge (little-endian/big-endian conversion), 104, 105

little-endian v., 571572

SHA-1, 171, 176

binary number representations, 567572. See also arbitrary precision binary math module

big-endian number format, 571572

decimal number system v., 568

little-endian number format, 571572

logical operations, 568570

shifting binary numbers, 570

two's-complement arithmetic, 98, 123, 275, 570571

bind system call, 23

birthday attack, 170

birthday paradox, 169170

bit flipping functions, 160161

bit macros, "des.c", 3233

bit strings, 243

bit-flipping attack, 494

bits, 571

LSB, 39, 40, 93, 116, 504

MSB, 40, 93, 570571, 595

parity bits, 39

bit-shifting operations, 571

blacklisting certificates

with CRLs, 294295

OCSP and, 295296

Bleichenbacher, Daniel, 412

Bleichenbacher attack, 412

blob, 266, 417

block chaining. See CBC

block cipher algorithms, 3183. See also AEAD mode ciphers; AES algorithm; cipher suites; DES algorithm; stream cipher algorithms; triple DES

AEAD ciphers v., 490

AES-CCM v., 517

AES-GCM v., 517

Applied Cryptography (Schneier), 83

blowfish, 83

book information on, 83

Camelia, 83

CBC in, 4655

converting, to stream ciphers, 90

defined, 31

FEAL, 83

LOKI, 83

padding in, 4655

stream cipher algorithms v., 83, 490491

twofish, 83

types, 83

blowfish, 83

Brown, Michael, 210

browsers

Chrome, 465

error messages, 412414

Firefox, 229, 234, 244, 245, 410, 465

Internet Explorer, 230, 234, 238, 239, 244, 294, 410, 418, 465

Mosaic, 298, 543

Netscape, 4, 27, 298, 543, 579, 596

root CAs, 238239

trust issues (TLS 1.0 server-side), 412414

web clients, 4

brute force attacks, 2930

AES and, 60

birthday attack, 170

DES and, 55

SSLv2 and, 626

triple DES and, 56

build_error_response, 26

build_success_response, 26

bytes, 571

internal byte ordering, 572

least-significant bytes, 495, 571, 572

nybble, 63, 494, 571

C

C++, 198, 199

cache poisoning, DNS, 556559

"ca.cnf", 458459

Caesar cipher, 3031

Camelia, 83

Canonical Encoding Rules (CER), 549550. See also DER

case sensitive HTTP, 8

CBC (cipher block chaining)

block cipher algorithms, 4655

defined, 490

DES, 4655

RSA, 126

triple DES, 56

CBC-MAC, 494502. See also AES-CCM

aes_cbc_mac, 495

CTR and, 496502

diagram, 495

failure of, 496

problems, 502

CCM (Counter with CBC-MAC), 496. See also AES-CCM

CER (Canonical Encoding Rules), 549550. See also DER

certificates (X.509 certificates), 221296

blacklisting

with CRLs, 294295

OCSP and, 295296

components, 527

compromised, 224, 294295

defined, 221, 223

digital signatures and, 222

examples

DSA keypair and certificate, 251252

RSA keypair and certificate, 244251

expired, 232233, 235, 295, 318, 414

issuers, 224, 227

issuing, 227

LDAP-based, 234

lifecycle, 238

listings

X.509 Certificate Structure Declaration, 225226

X.509 Signed Certificate Declaration, 238

managing, 292296

naive secure channel protocol, 222224

not after date, 224

not before date, 224

problems with, 295296

purpose of, 221, 292

revoked, 224

self-signed, 227, 238

serial IDs, 224

serial numbers, 227

S/MIME and, 552

structure (ASN.1), 225238

extensions field, 237238

issuer field, 229232

SEQUENCE, 226

serialNumber field, 227

signature field, 227229

subject field, 233235

subjectPublicKeyInfo field, 235236

validity field, 232233

version field, 226

summary, 241

validity periods, 224, 232233

certificate authorities (CAs)

CA/Browser forum, 278

CSRs and, 292294

defined, 223

extended validation, 278

root, 238239

trusted intermediaries, 222223

VeriSign, 227, 230, 295, 553

Certificate Error Message, 413

certificate extensions, 237238

CertificatePolicies, 278

critical/non-critical, 277

key usage extension, 275, 277

parsing, 275279

SSLv2 and, 627

subjectAltName, 237, 278

certificate message

TLS 1.0 handshake (client-side), 324328

TLS 1.0 handshake (server-side), 391393

certificate parser, 252292

byte stream converted to ASN.1 structure, 252259

DSA support, 286291

error checking, 292

goal of, 266

listings

"asn1.c" asn1free, 258259

"asn1.c" asn1_get_bit, 278

"asn1.c" asn1parse, 254258

"asn1.c" asn1show, 260263

"asn1.c" pem_decode, 263264

"asn1.c" test routine, 259260

"asn1.h" asn1struct definition, 252

"asn1.h" constants, 254

"parse_validity", 273

"tls.c" parse_dsa_params, 289290

"x509.c" display_x509_certificate, 283285, 290291

"x509.c" free_x509_certificate, 266267

"x509.c" init_x509_certificate, 266

"x509.c" main routine, 281283, 291

"x509.c" parse_algorithm_identifier, 270

"x509.c" parse_algorithm_identifier with DSA support, 287

"x509.c" parse_dsa_signature_value, 288289

"x509.c" parse_extension, 276

"x509.c" parse_extension with key usage recognition, 277

"x509.c" parse_extensions, 276

"x509.c" parse_huge, 269270

"x509.c" parse_name, 271273

"x509.c" parse_public_key_info, 274275

"x509.c" parse_signature_value, 279

"x509.c" parse_tbs_certificate, 268269

"x509.c" parse_x509_certificate, 267268

"x509.c" parse_x509_certificate with DSA support, 287288

"x509.c" parse_x509_certificate with stored hash, 279280

"x509.c" public key info parsing with DSA support, 289

"x509.c" validate_certificate_dsa, 291

"x509.c" validate_certificate_rsa, 280281

"x509.h" structure definitions, 264265

"x509.h" with DSA support, 286287

certificate requests, 449453

CertificateRequest, 449, 450, 452

handling, 452453

"tls.c" parse_certificate_request, 451452

"tls.c" receive_tls_msg with certificate request support, 450451

"tls.c" tls_connect with support for certificate requests, 452453

"tls.h" TLSParameters with certificate request flag, 450

certificate revocation lists (CRLs), 224, 294295

certificate signing requests (CSRs), 292294

certificate verify message, 449, 453457

CertificateVerify, 449, 453

"rsa.c" rsa_encrypt and rsa_sign, 454455

supporting, 453457

"tls.c" send_certificate_verify, 455457

CertificatePolicies, 278

CertificateSerialNumber, 227

Chae Hoon Lim, 236

chaining methods. See CBC; ECB; OFB

challenge password, 295

challenge token, 584, 588, 589, 593, 600, 613, 616

change cipher spec

ChangeCipherSpec, 344, 449

TLS 1.0 handshake (client-side), 344346

TLS 1.0 handshake (server-side), 409

"tls.c" receive_tls_msg with support for change cipher spec, 345346

"tls.c" send_change_cipher_spec, 345

checksum, 158159, 170

Chrome, 465

cipher block chaining. See CBC

cipher suites, 304

client hello message (TLS 1.0), 308309

DH_anon_XXX, 448

DHE_DSS_XXX, 439, 444

DHE_RSA_XXX, 439

ECDHE_ECDSA, 533, 535, 538

ephemeral, 436. See also ephemeral key exchange

"ssl.h" CipherSuite declarations, 583584

"tls.c" cipher suites list, 340341

"tls.h" CipherSuite declaration with AEAD support, 518

"tls.h" CipherSuite structure, 340

"tls.h" CipherSuiteIdentifier list, 308309

"tls.h" ProtectionParameters with cipher suite, 322323

ciphers. See AEAD mode ciphers; block cipher algorithms; export-grade ciphers; stream cipher algorithms

client authentication (TLS 1.0 handshake), 448462

"ca.cnf", 458459

certificate request message, 449453

CertificateRequest, 449, 450, 452

handling, 452453

"tls.c" parse_certificate_request, 451452

"tls.c" receive_tls_msg with certificate request support, 450451

"tls.c" tls_connect with support for certificate requests, 452453

"tls.h" TLSParameters with certificate request flag, 450

certificate verify message, 449, 453457

CertificateVerify, 449, 453

"rsa.c" rsa_encrypt and rsa_sign, 454455

supporting, 453457

"tls.c" send_certificate_verify, 455457

mutally-authenticated TLS handshake, 460462

RKM and, 449

testing, 458460

with TLS handshake (diagram), 457

client hello

dissected (HTTPS example, TLS 1.0), 370371

with SNI, 419

SSLv2, 588592

structure diagram, 311

TLS 1.0 handshake (client-side), 304316

cipher suites, 308309

flattening/sending, 309316

with headers, 316

tracking handshake state in TLSParameters structure, 304308

TLS 1.0 handshake (server-side), 387390

client hello extensions, 415420

ECC, 540

extension 10, 540

extension 11, 540

"tls.c" client hello extension capability, 473476

"tls.c" parse_client_hello with client hello extension support, 416417

"tls.c" parse_client_hello_extensions, 417418

"tls.c" parse_server_name_extension, 418419

0xFF01, 470, 475478, 540

0xFF02, 540

close_notify alert, 378, 435436

CMS (Cryptographic Message Syntax), 550

CN field, 233, 234

cofactor, of elliptic curves, 152

collision resistance, 171, 180

column mixing, 65, 70

column-mixing step, 68

command-line test routine, "des.c", 5253

comparing huge numbers, 109112

compromised certificates, 224, 294295

compute

"aes.c" compute_key_schedule, 66

"rsa.c" rsa_compute, 114115

"ssl.c" compute_keys, 601605

"tls.c" compute_verify_data, 349350

"tls.c" compute_verify_data with temporary copy, 352353

computers

adding/subtracting machines, 570

big-endian, 313

CPUs/switches, 567568

Intel processors, PCLMUQDQ instruction, 523

little-endian, 313

connect

"https.c" http_connect, 562564

"ssl.c" ssl_connect, 586587

"tls.c" tls_connect, 306

"tls.c" tls_connect multiple handshake messages, 329

"tls.c" tls_connect with client finished message, 349

"tls.c" tls_connect with handshake digests, 347

"tls.c" tls_connect with key exchange, 337

"tls.c" tls_connect with renegotiate flag, 467

"tls.c" tls_connect with server finished support, 350

"tls.c" tls_connect with support for certificate requests, 452453

CONNECT command, 561, 562, 563

connection_end, 385

connection-id, 585

constructed types, 243

content types, 548, 550

context-specific tags, 244

coprime, 136

Counter mode. See CTR mode

Counter with CBC-MAC (CCM), 496. See also AES-CCM

CPUs/switches, 567568

critical/non-critical certificate extensions, 277

CRLFs, 9, 10, 25, 26, 378, 469, 547

CRLs. See certificate revocation lists

cryptographic algorithms, 2930. See also public key algorithms; symmetric algorithms

Cryptographic Message Syntax (CMS), 550

cryptography. See also Elliptic-Curve Cryptography

Applied Cryptography (Schneier), 83

export-grade, 463

munitions classification for, 463

server gated, 462

step-up, 465

strong, 378, 463

weak, 463

CSRs. See certificate signing requests

CTR (Counter) mode, 490494

AES-CTR mode, 491492

CBC-MAC and, 496502

encryption (diagram), 491

/Galois-Field authentication, with AES-GCM, 505510

infinitely parallelizable, 491, 502

known plaintext attack, 493

OFB v., 491

D

Data Encryption Standard algorithm. See DES algorithm

database, DNS, 555

Datagram TLS (DTLS), 559

datagram traffic, 552559

DNS security, 553559

TLS and, 559

UDP, 553, 555, 556, 559

dates (DER), 242

Daum, Magnus, 170

DC field, 234, 237

decimal number system, 568. See also binary number representations

decryption

AES, 7480

/authentication (secure data transfer, TLS 1.0), 361364

defined, 29

DES, 4546

private key/decryption, 92

RC4, 86

RSA, 119120

DELETE, 24, 303

denial of service (DOS) attacks, 318, 559

deprecation

IDEA, 83

RC2, 83

SSLv2, 298, 579, 626

DER (Distinguished Encoding Rules), 241252

bit strings, 243

dates, 242

encoded values, 241242

explicit tags, 244

sequences, 243

sets, 243

strings, 242

DES (Data Encryption Standard) algorithm, 3159

AES v., 60, 74

big-endian conventions, 32, 36

brute force attacks and, 55

decryption, 4546

DHE/RSA/DES/SHA-1 handshake, 442448

expansion function, 4045

Feistel function and, 37

initial permutation, 3438

initialization vectors and, 4950, 51, 53, 55

key schedule, 3840

listings

"des.c" bit macros, 3233

"des.c" command-line test routine, 5253

"des.c" des_block_operate, 4345

"des.c" des_block_operate with decryption support, 4546

"des.c" des_decrypt, 51

"des.c" des_encrypt with NIST 800-3A padding, 48

"des.c" des_encrypt with PKCS #5 padding, 49

"des.c" des_operate with CBC for encrypt or decrypt, 51

"des.c" des_operate with CBC support and padding removed from des_encrypt, 50

"des.c" des_operate with padding support, 4748

"des.c" expansion table, 41

"des.c" final input block permutation, 4243

"des.c" final permutation table, 38

"des.c" initial permutation table, 36

"des.c" key permutation table 1, 39

"des.c" key permutation table 2, 39

"des.c" main routine with decryption support, 5455

"des.c" permutation, 3435

"des.c" rotate left, 40

"des.c" rotate right, 46

"des.c" s-boxes, 42

"des.c" xor array, 33

"hex.c" hex_decode, 5354

"hex.c" show_hex, 54

terse initial permutation, 3536

overview diagram, 37

padding in, 4655

s-boxes, 31, 36, 41, 42, 55

TLS 1.0 and, 342343

triple DES v., 5556

XOR operation and, 3132

des_block_operate, 4345

des_block_operate with decryption support, 4546

des_decrypt, 51

des_encrypt with NIST 800-3A padding, 48

des_encrypt with PKCS #5 padding, 49

des_operate with CBC for encrypt or decrypt, 51

des_operate with CBC support and padding removed from des_encrypt, 50

des_operate with padding support, 4748

destination port, 3

DH_anon_XXX, 448

DHE_DSS_XXX, 439, 444

DHE/RSA/DES/SHA-1 handshake, 442448

DHE_RSA_XXX, 439

Dierks, Tim, 379

Diffie, Whitfield, 130

Diffie-Hellman key exchange, 130132. See also elliptic-curve Diffie-Hellman

client key exchange (TLS 1.0), 343344

"dh.c" Diffie-Hellman key agreement, 131132

DHE/RSA/DES/SHA-1 handshake, 442448

ECC primitives and, 150154

ECDH v., 523524

parsing signature types, 485489

"tls.c" parse_certificate_request with TLS 1.2 support, 488489

"tls.c" parse_server_key_exchange with signature and hash algorithm declaration, 487488

"tls.c" TLS 1.2 signature verification, 485486

"tls.h" signature and hash algorithms, 486487

RSA v., 130, 132

small subgroup attack and, 236237

S/MIME and, 550

TLS 1.0 and, 394395

"tls.c" send_client_key_exchange with Diffie-Hellman key exchange, 343

dig tool, 556

DIGEST, 17

digest functions, updateable, 190200

"digest.c" finalize digest, 194195

"digest.c" update digest function, 192194

"digest.h" digest context structure declaration, 191192

Digital Signature Algorithm. See DSA

digital signatures, 157220. See also DSA; RSA algorithm

certificates and, 222

email and, 551552

RSA support for, 157158, 201202

discrete logarithm problem, 130, 131

Dispensa, Steve, 468

Distinguished Encoding Rules. See DER

distinguished names, 229232

division

huge numbers, 106109

"huge.c" divide, 108109, 112113

"huge."c" divide with negative number support, 146147

DNS (Domain Name System), 553559

cache poisoning, 556559

database, 555

hierarchy, 554

IP addresses, 553554

protocol, 555

queries, 555556

DNS Security. See DNSSEC

DNSSEC (DNS Security), 556559

Domain Name System. See DNS

domain-name components, 234, 237

DOS (denial of service) attacks, 318, 559

dot product, 72

dot product, "aes.c", 72

dotted-decimal form/hexadecimal form, 228229

double and add approach (multiplication), 106, 116, 134, 150, 153, 213, 503

DSA (Digital Signature Algorithm), 201210. See also elliptic-curve DSA

certificate parser and, 286291

ECC primitives and, 210

ECDSA v., 524

efficient, 209210

keys, 209

listings

"dsa.c" DSA Signature generation algorithm, 203204

"dsa.c" DSA signature verification algorithm, 206207

"dsa.c" message secret generation, 204205

"dsa.c" test main routine, 207209

"dsa.h" dsa_params structure, 203

"dsa.h" dsa_signature structure, 203

"tls.c" receive_tls_msg with DSA key support, 445

"tls.h" TLSParameters with dsa key support, 444445

"x509.c" parse_x509_chain with DSA support, 445446

SHA-1 and, 202, 204

SHA-256 and, 202, 204

signature generation, 202205

signature verification, 205209

DSS, 227, 228, 229, 465, 485. See also DHE_DSS_XXX

DTLS (Datagram TLS), 559

dummy block, 48

E

ECB (electronic code book), 49, 490

ECC. See Elliptic-Curve Cryptography

ECC client hello extensions, 540

ECC extensions, 523540

ECC primitives

Diffie-Hellman and, 150154

DSA and, 210

ECDH. See elliptic-curve Diffie-Hellman

ECDHE_ECDSA cipher suites, 533, 535, 538

ecdh_key_exchange, 539540

ECDSA. See elliptic-curve DSA

e-commerce, 4, 27, 234, 298

electronic code book. See ECB

elliptic curves, 132135, 524

addition, 133

cofactor of, 152

graph, 133

named curves, 218, 524527, 530, 537, 540

order of, 152, 524

point multiplication on, 134

Elliptic-Curve Cryptography (ECC), 132155

client hello extensions, 540

Diffie-Hellman and, 150154

ECC primitives

Diffie-Hellman and, 150154

DSA and, 210

GCDs, 135137

listings

"ecc.c" point addition implementation, 212213

"ecc.c" point-doubling algorithm, 213214

"ecc.c" point-multiplication algorithm, 214215

"ecc.h" elliptic curve structure declarations, 211

"ecc_int.c" add_points routine, 152

"ecc_int.c" double_point routine, 152153

"ecc_int.c" Extended Euclidean Algorithm (small numbers), 137138

"ecc_int.c" invert routine, 152

"ecc_int.c" multiply_point routine, 153

"ecc_int.h" structure definitions, 151152

modular inversions and, 135138

negative numbers support, 138147

negative remainders support, 147149

over prime finite field, 150

purpose, 220

reasons for using, 154155

"Software Implementations of the NIST Elliptic Curves over Prime Fields" (Brown), 210

speed of, 220

TLS 1.2 and, 132133, 523524

whole integers and, 150

elliptic-curve Diffie-Hellman (ECDH), 523524

Diffie-Hellman v., 523524

ECDHE_ECDSA cipher suites, 533, 535, 538

ECDSA and, 524

TLS 1.2, 533540

"tls.c" ecdh_key_exchange, 539540

"tls.c" init_tls with ECDHE_ECDSA support, 533

"tls.c" parse_server_key_exchange with ECDH support, 534536

"tls.c" send_client_key_exchange with ECDHE support, 538

"tls.c" verify_signature with ECDSA support, 537538

"tls.h" TLSParameters with ECDH support, 534

elliptic-curve DSA (ECDSA), 210220

certificate parsing (TLS 1.2), 527533

"x509.c" parse_algorithm_identifier with ECDSA support, 528

"x509.c" parse_public_key_info with ECDSA support, 529530

"x509.c" parse_x509_certificate with ECDSA signatures, 532533

"x509.c" parse_x509_chain with ECDSA support, 531532

"x509.h" ECDSA algorithm identifier, 529

"x509.h" ecdsa algorithm identifier, 528

DSA v., 524

ECDH and, 524

ECDHE_ECDSA cipher suites, 533, 535, 538

generating ECC keypairs, 218220

implementing, 215217

listings

"ecc.c" point addition implementation, 212213

"ecc.c" point-doubling algorithm, 213214

"ecc.c" point-multiplication algorithm, 214215

"ecc.h" elliptic curve structure declarations, 211

"ecdsa.c" elliptic-curve DSA signature generation, 215216

"ecdsa.c" elliptic-curve DSA signature verification, 216217

"ecdsa.c" test routine, 218220

signature generation, 215216

signature verification, 216217

email

attachments, 547550

digital signatures and, 551552

email model, 545546

HTTP v., 547

MIME and, 547548

multiple recipients, 550552

PEM and, 246, 263, 281, 395, 396, 400, 546

PGP and, 1, 546

security mechanism, 546547

S/MIME and, 546547, 549552

SSL/TLS design and, 546547

TLS and, 552

embedded hardware implementers, 523

encoded values, 241242

encryption

AES, 6782

AES-CCM, 514515

CTR, 491

defined, 29

matrix operations, 7072

public key/encryption, 92

RC4, 86

RSA, 114119

support (secure data transfer, TLS 1.0), 355358

endian-ness, 173, 182, 183, 257

big-endian number format, 571572

computers, 313

DES, 32, 36

"huge.c" set_huge (little-endian/ big-endian conversion), 104, 105

little-endian v., 571572

SHA-1, 171, 176

little-endian number format, 571572

big-endian v., 571572

computers, 313

"huge.c" set_huge (little-endian/ big-endian conversion), 104, 105

Intel x86, 32

MD5, 161, 164, 197

"md5.c" md5 initial hash, 166

"sha.c" SHA-1 in little-endian format, 178

end-to-end example. See https application

enveloped-data, 550

ephemeral cipher suites, 436

ephemeral key exchange, 436448, 487

handshake, 442448

listings

"tls.c" parse_server_key_exchange, 437438

"tls.c" parse_server_key_exchange with signature verification, 440

"tls.c" receive_tls_msg with DSA key support, 445

"tls.c" receive_tls_msg with server key exchange, 437

"tls.c" send_client_key_exchange, 445

"tls.c" verify_signature, 441, 446448

"tls.h" TLSParameters with dsa key support, 444445

"x509.c" parse_x509_chain with DSA support, 445446

server key exchange message, 436442

Epoch field, 559

error checking, 292, 405

error messages, browser, 412414

Ethereal, 573

Euclidean algorithm, 135138

Exclusive OR. See XOR operation

expansion function, DES, 4045

expansion table, "des.c", 41

expired certificates, 232233, 235, 295, 318, 414

explicit tags, 244

export-grade ciphers, 463465

key calculation, 463464

man-in-the-middle attacks, 626

restrictions, 464465

SSLv2 and, 584, 607

export-grade cryptography, 463

extended Euclidean algorithm, 137138

extended validation, 278

extension 10 (client hello extension), 540

extension 11 (client hello extension), 540

extensions. See certificate extensions; client hello extensions

extensions field, 237238

F

FEAL, 83

Feistel function, 37

fgets, 25

"file.c" load_file_into_memory, 398399

FIN packet, 368, 626

final input block permutation, "des.c", 4243

final permutation table, "des.c", 38

find_stored_session, "tls.c", 431433

finished message

TLS 1.0 handshake (client-side), 346353

TLS 1.0 handshake (server-side), 409411

TLS 1.2, 483484

FIPS 186-3, 137, 202

Firefox, 229, 234, 244, 245, 410, 465

500 (status code), 10

501 (status code), 24

fixed-precision numeric representation, 140

flattening/sending client hello message, 309316

Fortezza, 378

forward secrecy, perfect, 130, 439, 465, 524

403 (status code), 10

404 (status code), 10, 11

fstat, 393

G

Galois field arithmetic operations, 210, 502

Galois-Field authentication

"aes.c" gf_multiply, 503

/CTR, with AES-GCM, 505510

maximizing MAC throughput, 502505

GCDs (greatest common denominators), 135137

gcrypt, 140

GeneralizedTime, 233

generating RSA keypairs, 129

generator point, 210, 524, 534, 540

GET command, 56, 810

GET_BIT macro, 36

gethostbyname, 7, 554555

GHASH, 502, 504507. See also AES-GCM

"aes.c" ghash, 504505

AES-GCM and, 505507

diagram, 504

GMP, 113, 140

GnuTLS, 27, 28, 123, 140, 155, 540, 541. See also TLS

got_client_hello, 385386

greatest common denominators (GCDs), 135137

H

handshake. See also TLS 1.0 handshake

SSLv2, 582619

TCP, 34

handshake digest initialization, TLS 1.2, 484

hash functions, updateable, 190200

HDMI video stream, 523

HEAD, 24, 303

headers, 9

Hellman, Martin, 130, 132, 185. See also Diffie-Hellman key exchange

hello request, session renegotiation and, 466467

hexadecimal form/dotted-decimal form, 228229

"hex.c" hex_decode, 5354

"hex.c" show_hex, 54

Hickman, Kipp, 298

HMAC function, 184201. See also MACs

diagram, 188

implementation, 186190

listings

"digest.c" finalize digest, 194195

"digest.c" update digest function, 192194

"digest.h" digest context structure declaration, 191192

"hmac.c" HMAC function, 186188

"hmac.c" HMAC function prototype, 188189

"hmac.c" main routine, 199200

"hmac.c" modified HMAC function to use updateable digest functions, 198199

"md5.c" MD5 digest initialization, 195

"sha.c" SHA-1 digest initialization, 195196

"sha.c" SHA-256 digest initialization, 196

MD5 hash computation of file (example), 196200

message digests and, 184

PRF and, 329332

SSL and, 200201

SSLv2 and, 611

updateable hash functions, 190200

Hongbo Yu, 170

HTTP (Hypertext Transport Protocol), 45

case sensitive, 8

CONNECT command, 561, 562, 563

email v., 547

line-oriented, 25

proxies, 1217

"proxy-less," 16

request, 2425

response, 1011

session resumption and, 421

SSL and, 5, 299, 543, 552

stateless, 544, 552

versions, 9

HTTP client (sample application). See also HTTPS client

Base64 encoding implementation, 1721

implementation, 512

listings

"base64.c" base64_decode, 1920

"base64.c" base64_encode, 1819

"http.c" display_result, 1112

"http.c" header includes, 56

"http.c" http_get, 910

"http.c" http_get (with proxy support), 1617, 2021

"http.c" main, 69

"http.c" main (with proxy support), 1314

"http.c" parse_proxy_param, 1416

"http.c" parse_url, 6

"tls.h" top-level function prototypes, 300301

proxy support added, 1217

security features, 5

TLS support added, 300303

HTTP server (sample application)

HTTPS support added, 381390

implementation, 2127

listings

"ssl_webserver.c" main routine, 382

"ssl_webserver.c" process_https_request, 382383

"ssl_webserver.c" send and read modifications, 383

"webserver.c" build responses, 2627

"webserver.c" main routine, 2123

"webserver.c" process_http_request, 2425

"webserver.c" read_line, 2526

"webserver.c" remote connection exclusion code, 24

HTTPS, 5, 27

end-to-end examples (TLS 1.0), 369378

client hello request dissected, 370371

decrypting encrypted exchange, 374377

exchanging application data, 377378

key exchange message dissected, 373374

server response messages dissected, 372373

HTTP server (sample application) and, 381390

multiple ports and, 544

https application end-to-end example (SSLv2), 619626

HTTPS client (sample application). See also HTTP client

listings

"https.c" http_connect, 562564

"https.c" http_get and display_result, 302

"https.c" http_get with SSLv2 support, 581

"https.c" main routine, 301

"https.c" main routine with proxy support, 561562

"https.c" main routine with session resumption, 425427

"https.c" main routine with SSLv2 support, 580

"https.c" with OpenSSL, 564566

proxy support, 560564

Hudson, Tim J., 575

huge numbers. See also Elliptic-Curve Cryptography; RSA algorithm

addition, 9398

arbitrary precision binary math module, 93114

comparing, 109112

division, 106109

listings

"huge.c" add (overflow expansion), 97

"huge.c" add routine, 9495

"huge.c" add routine (addition routine), 96

"huge.c" add routine (size computation), 95

"huge."c" add with negative number support, 143144

"huge."c" add_magnitude and subtract_magnitude, 143

"huge.c" compare, 109111

"huge.c" contract, 100

"huge.c" copy_huge & free huge, 103

"huge.c" divide, 108109, 112113

"huge."c" divide with negative number support, 146147

"huge.c" expand, 9798

"huge.c" exponentiate, 117118

"huge."c" initializer routines with negative number support included, 142

"huge."c" inv routine, 148149

"huge.c" left_shift, 106

"huge.c" load_huge, 123124

"huge.c" mod_pow, 118119

"huge.c" multiply, 102103

"huge."c" multiply with negative number support, 146

"huge.c" right_shift, 112

"huge.c" set_huge, 104, 105

"huge.c" subtract, 9899

"huge."c" subtract with negative number support, 145146

"huge.c" unload_huge, 124

"huge.h" huge structure, 93

"huge."h" huge structure with negative number support, 141142

modulus operations, 112114

Barrett reduction, 114

Montgomery reduction, 114

optimizing for, 112113

multiplication, 101106

subtraction, 98101

negative numbers support (ECC), 138147

Hypertext Transport Protocol. See HTTP

I

IANA (Internet Assigned Numbers Authority), 545

ICANN (Internet Corporation for Assigned Names and Numbers), 553

ICMP timeout packets, 3

IDEA, 83, 584

identity matrix, 71

"IEEE Transactions on Information Theory," 114, 132

IETF, 27, 84, 298, 299, 546, 579, 601

#ifdef, 52

illegal parameter, 318, 322, 440

indefinite-length encoding, 549550

infinitely parallelizable, 56, 170, 491, 502

initial hash, SHA-256, 184

initial permutation, DES, 3438

initial permutation table, "des.c", 36

initialization vectors, DES and, 4950, 51, 53, 55

init_parameters, "ssl.c", 587588

init_parameters, "tls.c", 306, 387

init_parameters with saved verify data, 472

init_parameters with session resumption support, "tls.c", 435

init_protection_parameters with seq_num, "tls.c", 354355

init_tls, 430

init_tls with ECDHE_ECDSA support, 533

init_x509_certificate, 266

input processing function, SHA-1, 174176

Intel processors, PCLMUQDQ instruction, 523

Intel x86 little-endian conventions, 32

internal byte ordering, 572

International Telecommunications Union. See ITU

Internet

packet-switching network, 2

security, 15

Internet Assigned Numbers Authority (IANA), 545

Internet Corporation for Assigned Names and Numbers (ICANN), 553

Internet Explorer, 230, 234, 238, 239, 244, 294, 410, 418, 465

Internet Protocol. See IP

inversion routines, "aes.c", 7577

inv_mix_columns, "aes.c", 7778

IP (Internet Protocol), 2. See also TCP/IP

IP addresses/DNS security, 553554

irreversibility, message digests, 160

issuer field, 229232

issuers, 224, 227

issuing certificates, 227

ITU (International Telecommunications Union), 225

J

Jacobian projection, 220

Java, 5, 27, 28, 113, 140

JSSE, 123

K

Kaminsky, Dan, 556

key combination, AES, 68

key escrow system, 378

key exchange. See also Diffie-Hellman key exchange

ephemeral key exchange, 436448, 487

handshake, 442448

server key exchange message, 436442

"tls.c" parse_server_key_exchange, 437438

"tls.c" parse_server_key_exchange with signature verification, 440

"tls.c" receive_tls_msg with DSA key support, 445

"tls.c" receive_tls_msg with server key exchange, 437

"tls.c" send_client_key_exchange, 445

"tls.c" verify_signature, 441, 446448

"tls.h" TLSParameters with dsa key support, 444445

"x509.c" parse_x509_chain with DSA support, 445446

key exchange message dissected (HTTPS example), 373374

RSA, TLS1.0 and, 394396

server key exchange message, 344, 436

TLS 1.0 handshake (client-side), 329344

Diffie-Hellman key exchange, 343344

master secret computation, 336337

RSA key exchange, 337343

using PRF, 329335

TLS 1.0 handshake (server-side), 394409

checking for successful decryption, 406407

completing, 407409

RSA key exchange and private key location, 395399

supporting encrypted private key files, 399406

"tls.c" tls_connect with key exchange, 337

key material block, 375376

key permutation table 1, "des.c", 39

key permutation table 2, "des.c", 39

key schedule

AES, 6067

defined, 39

DES, 3840

RC4, 8485

key usage extension, 275, 277

"A Key Recovery Attack on Discrete Log-based Schemes Using a Prime Order Subgroup," 236

keys. See also private key; public key

brute force attacks and, 29

defined, 29

DSA, 209

known plaintext attacks, 186, 493

Koblitz, Neal, 132

Koblitz curves, 525

L

large numbers. See huge numbers

LDAP-based certificates, 234

least-significant bit (LSB), 39, 40, 93, 116, 504

least-significant bytes, 495, 571, 572

least-significant digit, 571

left shift, 40, 64, 72

libpcap, 575

line-oriented HTTP, 25

Linux system

OpenSSL installation, 577

tcpdump installation, 575

Listings. See specific listings

little-endian number format, 571572

big-endian v., 571572

computers, 313

"huge.c" set_huge (little-endian/ big-endian conversion), 104, 105

Intel x86, 32

MD5, 161, 164, 197

"md5.c" md5 initial hash, 166

"sha.c" SHA-1 in little-endian format, 178

load_file_into_memory, 398399

lock icon, 1, 230, 244, 278

logical operations, binary, 568570

LOKI, 83

LSB. See least-significant bit

Lucks, Stefan, 170

LUHN consistency check, 185

M

MACs (Message Authentication Codes). See also HMAC function

GHASH, 502, 504507

maximizing MAC throughput with Galois-Field authentication, 502505

qualities, 494

magic constant, 504

magic numbers, 3

"magnitude/sign" approach, 140

main routine

"aes.c" main routine modified to accept associated data, 513514

"des.c" main routine with 3DES support, 59

"des.c" main routine with decryption support, 5455

"digest.c" main routine, 179180

"dsa.c" test main routine, 207209

"hmac.c" main routine, 199200

"https.c" main routine, 301

"https.c" main routine with proxy support, 561562

"https.c" main routine with session resumption, 425427

"https.c" main routine with SSLv2 support, 580

"prf.c" main routine, 334335

"privkey.c" test main routine, 397398

"rc4.c" main routine for testing, 87

"rsa.c" test main routine, 126129

"ssl_webserver.c" main routine, 382

"webserver.c" main routine, 2123

"x509.c" main routine, 281283, 291

man-in-the middle attacks, 222224

export-grade ciphers and, 626

SSLv2 and, 346, 626

marker request, 449

Marlinspike, Moxie, 234

master key, SSLv2, 600607

master secret, 329, 336337

"Math Computation," 114

matrix multiplication example (AES), 7071

matrix operations, 7072

MD5, 159169

birthday attack, 170

goal of, 160

implementing, 159169

listings

"md5.c" alternate md5_block_operate implementation, 164166

"md5.c" bit manipulation routines, 160161

"md5.c" MD5 digest initialization, 195

"md5.c" md5 hash algorithm, 167168

"md5.c" md5 initial hash, 166

"md5.c" md5_block_operate function, 162164

"md5.c" ROUND macro, 161162

little-endian number format, 161, 164, 197

MD5 hash computation of file (example), 196200

PRF and, 329332

SHA-1 v., 171, 174, 176

vulnerabilities, 169171

Message Authentication Codes. See MACs

message digests, 158159. See also MD5

checksum, 158159, 170

defined, 158

"digest.c" finalize digest, 194195

"digest.c" update digest function, 192194

"digest.h" digest context structure declaration, 191192

HMAC function and, 184

irreversibility, 160

updateable digest functions, 190200

METHOD, 17

Miller, Victor, 132

MIME (Multipurpose Internet Mail Extensions), 547548

mix_columns, "aes.c", 73

Modadugu, Nagendra, 559

mod_pow, 118119, 131, 207

mod_ssl, 575

modular inversions, 135138

modulus operations, 112114

Barrett reduction, 114

Montgomery reduction, 114

optimizing for, 112113

Montgomery reduction, 114

Mosaic, 298, 543

most-significant bit (MSB), 40, 93, 570571, 595

most-significant digit, 571

MSB. See most-significant bit

"multi-hop" SMTP, 545548

multiple ports, HTTPs and, 544

multiple recipients, email, 550552

multiplication

double and add approach, 106, 116, 134, 150, 153, 213, 503

"ecc.c" point-multiplication algorithm, 214215

"ecc_int.c" multiply_point routine, 153

huge numbers, 101106

"huge.c" multiply, 102103

"huge."c" multiply with negative number support, 146

matrix multiplication example (AES), 7071

point multiplication on elliptic curve, 134

square and multiply, 116

Multipurpose Internet Mail Extensions. See MIME

munitions classification, cryptography and, 463

mutally-authenticated TLS handshake, 460462

N

naive secure channel protocol, 222224

named curves, 218, 524527, 530, 537, 540

"ecc.c" get_named_curve, 525527

online list, 525

SECG, 525

National Center for Supercomputing Application, 543

National Institute for Standards and Technology. See NIST

negative numbers

ECC, 138147

two's-complement arithmetic, 570571

Netscape, 4, 27, 298, 543, 579, 596

Network News Transfer Protocol. See NNTP

nibble (nybble), 63, 494, 571

NIST (National Institute for Standards and Technology), 46, 60, 181

NNTP (Network News Transfer Protocol), 543545

nonce, 491, 492, 493, 523

not after date, 224

not before date, 224

NOT operation, 569

NSA, 31, 464

NSS, 123, 140

NTLM, 17

"Null Prefix Attacks Against SSL Certificates" (Marlinspike), 234

nybble (nibble), 63, 494, 571

O

OAEP, 126

object identifiers. See OIDs

OCSP (Online Certificate Status Protocol), 295296

OFB (output-feedback mode), 50, 90, 126, 490, 491, 494

OIDs (object identifiers), 227229

distinguished names, 231232

dotted-decimal form/hexadecimal form, 228229

public-key algorithm, 235236

one's complement arithmetic, 570

Online Certificate Status Protocol (OCSP), 295296

open-source SSL implementations, 2728

OpenSSL

generation

DSA keypair and certificate, 251252

RSA keypair and certificate, 244251

"https.c" with OpenSSL, 564566

installation, 573, 575577

Linux system, 577

Windows system, 575576

req command, 244, 293, 533

s_server, 458, 460, 619

SSL with, 564566

Young and, 27

OPTIONS, 24

OR operation, 569

order, of elliptic curves, 152, 524

output-feedback mode. See OFB

P

packets, 23

packet-switching network, 2

padding

block cipher algorithms, 4655

DES, 4655

NIST 800-3A, 48

OAEP, 126

PKCS # 5, 48, 49, 51

PKCS #1.5, 126, 395, 412

RSA, 120, 122123

triple DES, 56

zero, 123, 507, 514

padding identifiers, 120

padlock icon, 1, 230, 244, 278

paf flag, 153

parallelizable, infinitely, 56, 170, 491, 502

parity bits, 39

parse_algorithm_identifier, "x509.c", 270

parse_algorithm_identifier with DSA support, "x509.c", 287

parse_algorithm_identifier with ECDSA support, "x509.c", 528

parse_certificate_request, 451452

parse_certificate_request with TLS 1.2 support, 488489

parse_client_hello, "tls.c", 388390

parse_client_hello with client hello extension support, 416417

parse_client_hello with session resumption support, "tls.c", 433

parse_client_hello_extensions, 417418

parse_client_key_exchange, "tls.c", 407408

parse_dsa_signature_value, "x509.c", 288289

parse_extension, "x509.c", 276

parse_extension with key usage recognition, "x509.c", 277

parse_extensions, "x509.c", 276

parse_huge, "x509.c", 269270

parse_name, "x509.c", 271273

parse_pkcs8_private_key, 402406

parse_private_key, 396397

parse_proxy_param, 1416

parse_public_key_info, "x509.c", 274275

parse_public_key_info with ECDSA support, "x509.c", 529530

parse_renegotiation_info, 477478

parse_server_error, "ssl.c", 597

parse_server_finished, "ssl.c", 617

parse_server_hello, "ssl.c", 597599

parse_server_hello with extensions recognition, 476

parse_server_hello with session ID support, "tls.c", 425

parse_server_hello_extensions, 476477

parse_server_key_exchange, "tls.c", 437438

parse_server_key_exchange with ECDH support, 534536

parse_server_key_exchange with signature and hash algorithm declaration, 487488

parse_server_key_exchange with signature verification, 440

parse_server_name_extension, 418419

parse_server_verify, "ssl.c", 615616

parse_signature_value, "x509.c", 279

parse_tbs_certificate, "x509.c", 268269

parse_url, 6, 14

parse_x509_certificate, 267268

parse_x509_certificate with DSA support, 287288

parse_x509_certificate with ECDSA signatures, 532533

parse_x509_certificate with stored hash, 279280

parse_x509_chain, 325327, 531

parse_x509_chain with DSA support, 445446

parse_x509_chain with ECDSA support, 531532

parsing certificates (ECDSA, TLS 1.2), 527533

parsing signature types (Diffie-Hellman, TLS 1.2), 485489

PCLMULQDQ instruction, 523

peer_finished, 386387

PEM (Privacy-Enhanced Mail), 246, 263, 281, 395, 396, 400, 546

perfect forward secrecy, 130, 439, 465, 524

permutation, "des.c", 3435

permutations

defined, 31

DES initial permutation, 3438

PGP, 1, 546

Pil Joon Lee, 236

PKCS

PKCS #1

format, 400, 454

padding, 339

PKCS #1.5 padding, 126, 395, 412

PKCS #5

format, 400, 401

padding, 48, 49, 51

Password-Based Encryption, 406

PKCS #7, 549, 550

PKCS #7-formatted RSA signatures (validation), 280285

PKCS #8

encoded private key file, 402

format, 400, 401, 407

PKCS #10 format, 293

PKCS #12 format, 293294, 407

PKI. See public key infrastructure

plaintext attacks, known, 186, 493

P_MD5, 330, 331

Pohlig, Stephen, 132

Pohlig-Hellman attack, 132

point at infinity, 150, 153

point multiplication on elliptic curve, 134

point-doubling algorithm, 134, 150, 213

ports

destination port, 3

multiple, HTTPS and, 544

port 53, 555

port 80, 8, 13, 16, 21, 300, 381, 544, 563

port 119, 544, 545

port 443, 300, 381, 544, 563

port 563, 545

source port, 3

position shifting binary numbers, 570

POST, 24, 300, 303, 561

premaster secret, 329, 336339, 343344, 373, 374, 378379, 394, 408

PRF (pseudo-random function), 329335

client key exchange (TLS 1.0) with, 329335

diagram, 330

HMAC function and, 329332

MD5 and, 329332

modifications (TLS 1.2), 481482

"prf.c" main routine, 334335

"prf.c" PRF function, 333334

SHA-1 and, 329332

"prf.c" PRF2, 482

prime finite field, ECC over, 150

prime number 65,537, 115, 116, 129

Privacy-Enhanced Mail. See PEM

private key

decryption and, 92

/public key, reversibility and, 157

private key algorithms. See symmetric algorithms

"privkey.c" parse_pkcs8_private_key, 402406

"privkey.c" parse_private_key, 396397

"privkey.c" test main routine, 397398

process_http_request, 2425

process_https_request, 382383

proxy server, 12, 13, 14

proxy specification, 13

proxy support

HTTP client application, 1217

HTTPS client application, 560564

"proxy-less" HTTP, 16

pseudo-random function. See PRF

P_SHA1, 330, 332

public key

encryption and, 92

/private key, reversibility and, 157

public key (asymmetric) algorithms, 91155. See also RSA algorithm

arbitrary precision binary math module, 93114. See also huge numbers

OIDs, 235236

slowness, 129130

symmetric algorithms v., 30, 91, 129130

public key infrastructure (PKI), 292293, 296, 556

PUT, 24, 300, 303

Q

Qualys Research security analysis, 235

R

rainbow tables, 185, 400, 401

Ray, Marsh, 468

RC2, 83, 584

RC4 algorithm, 8490

cracking, 86

decryption, 84

encryption, 86

key schedule, 8485

listings

"rc4.c" key-length wrapper functions, 8990

"rc4.c" main routine for testing, 87

"rc4.c" rc4_operate, 8485

"rc4.c" rc4_operate with persistent state, 8889

"rc4.h" rc4_state structure, 88

"tls.c" calculate_keys with special RC4 exception, 359

RC4-compatible algorithm, 84

read_buffer, 323, 389

receive

"receive_tls_message" with alert support, 323

"receive_tls_msg" with optimal response buffer, 365

"ssl.c" receive_ssl_message, 594596

"ssl.c" receive_ssl_message with encryption support, 613614

"tls.c" receive_tls_message with session renegotiation support, 466467

"tls.c" receive_tls_msg, 317, 318, 319320

"tls.c" receive_tls_msg with buffering support, 366368

"tls.c" receive_tls_msg with certificate request support, 450451

"tls.c" receive_tls_msg with decrypt support, 361362

"tls.c" receive_tls_msg with DSA key support, 445

"tls.c" receive_tls_msg with handshake digest update, 348349

"tls.c" receive_tls_msg with multiple handshake support, 325

"tls.c" receive_tls_msg with server hello done support, 328

"tls.c" receive_tls_msg with server key exchange, 437

"tls.c" receive_tls_msg with support for change cipher spec, 345346

"tls.c" tls_receive_message with server finished support, 351

tls_recv, 365368

RelativeDistinguishedName, 231

relatively prime, 136

remember_session, "tls.c", 430431

renegotiation. See session renegotiation

renegotiation attack, 468470

replay attacks, 49, 184, 304, 336, 353, 441, 593. See also HMAC function

req command, 244, 293, 533

Rescorla, Eric, 299, 379, 559

resource records (RRs), 555

resumed session. See session resumption

resumption. See session resumption

reversibility

message digests and, 160

public key/private key, 157

XOR operation, 32, 569

revoked certificates, 224. See also certificate revocation lists

RFC 793, 3, 4

RFC 971, 2

RFC 977, 544

RFC 1321, 160, 191

RFC 2104, 184, 186

RFC 2246, 1, 2, 27, 83, 299, 309, 435, 436

RFC 2247, 234

RFC 2313, 121, 228

RFC 2459, 275

RFC 2535, 556

RFC 2560, 296

RFC 2595, 546

RFC 2616, 4, 10

RFC 2617, 17

RFC 2631, 132, 237

RFC 2817, 561

RFC 2818, 299

RFC 2980, 544, 545

RFC 3207, 546

RFC 3268, 83

RFC 3280, 234

RFC 3546, 416, 420, 462

RFC 4034, 557

RFC 4346, 27, 299, 379

RFC 4492, 523, 533, 540

RFC 4754, 218

RFC 5246, 27, 379, 476, 489, 516, 541

RFC 5280, 237, 278

RFC 5288, 518, 519

RFC 5652, 550

RFC 5746, 470

RFC 5751, 546, 552

right-shift, 107

Rijndael algorithm, 60, 83. See also AES algorithm

Rivest, Ron, 84, 91, 160. See also MD5; RC4 algorithm; RSA algorithm

RKM (RSA Key Manager), 449

root CAs, 238239

rotate left, "des.c", 40

rotate right, "des.c", 46

rot_word, "aes.c", 63

round constant, 61, 64, 66, 67, 68, 72

row-shifting step, 68

RRs (resource records), 555

RSA algorithm, 91

arbitrary precision binary math module, 93114. See also huge numbers

CBC, 126

decryption, 119120

DHE/RSA/DES/SHA-1 handshake, 442448

Diffie-Hellman v., 130, 132

digital signatures and, 157158, 201202

encryption, 114119

key exchange (TLS client key exchange), 337343

keypair generation, 129

listings

"huge.c" exponentiate, 117118

"huge.c" load_huge, 123124

"huge.c" mod_pow, 118119

"huge.c" unload_huge, 124

"rsa.c" rsa_compute, 114115

"rsa.c" rsa_decrypt, 124126

"rsa.c" rsa_encrypt, 121122

"rsa.c" rsa_encrypt and rsa_sign, 454455

"rsa.c" rsa_key structure, 120121

"rsa.c" test main routine, 126129

"tls.c" rsa_key_exchange, 339

padding, 120, 122123

PKCS #7-formatted RSA signatures, 280285

65,537 (prime number), 115, 116, 129

speeding up, 129

testing encryption/decryption, 126130

theory, 9293

TLS 1.0 and, 394396

RSA Key Manager (RKM), 449

S

salt, 49. See also initialization vectors

sbox, "aes.c", 6364

s-boxes

AES, 60, 61, 77

DES, 31, 36, 41, 42, 55

s-boxes, "des.c", 42

Schneier, Bruce, 83

SEC (Standards for Efficient Cryptography), 525

SECG (Standards for Efficient Cryptography Group), 525

secrecy, perfect forward, 130, 439, 465, 524

secure channel protocol, 222224

secure data transfer (TLS 1.0 client-side), 353369

assigning sequence numbers, 353355

decryption and authentication, 361364

encryption support (outgoing), 355358

listings

"receive_tls_msg" with optimal response buffer, 365

"tls.c" calculate_keys with special RC4 exception, 359

"tls.c" init_protection_parameters with seq_num, 354355

"tls.c" receive_tls_msg with buffering support, 366368

"tls.c" receive_tls_msg with decrypt support, 361362

"tls.c" send buffer, 357358

"tls.c" send_message with encryption, 358

"tls.c" send_message with MAC support, 355357

"tls.c" send_message with padding support, 357

"tls.c" tls_connect with receive_tls_msg calls updated, 365366

"tls.c" tls_decrypt, 362364

"tls.c" tls_recv, 365

"tls.c" tls_send, 364365

"tls.c" with protection parameters sent to send_message, 360

"tls.h" ProtectionParameters with seq_num, 354

"tls.h" TLSParameters with buffering support, 366

stream ciphers support, 358359

tls_recv, 365368

tls_send, 364365

update each invocation of send_message, 359360

Secure Hash Algorithm. See SHA-1

secure renegotiation. See also session renegotiation

example, 470471

implementation, 471478

secure sockets, 24

Secure Sockets Layer. See SSL

security

challenge, 566

Internet, 15

trade-off, 566

"security escape," 610

self-signed certificates, 227, 238

send

client hello message (flattening/sending), 309316

send_client_key_exchange with ECDHE support, 538

"ssl.c" send_client_finished, 608

"ssl.c" send_client_hello, 589590

"ssl.c" send_client_master_key, 606607

"ssl.c" send_error, 599600

"ssl.c" send_handshake_message, 590591

"ssl.c" send_message, 591592

"ssl.c" send_message with encryption support, 608611

"ssl.c" ssl_send, 617

"tls.c" send buffer, 357358

"tls.c" send_alert_message, 319

"tls.c" send_certificate_verify, 455457

"tls.c" send_change_cipher_spec, 345

"tls.c" send_client_hello, 307308, 310, 311

"tls.c" send_client_hello with session resumption, 424425

"tls.c" send_client_key_exchange, 337338

"tls.c" send_client_key_exchange with Diffie-Hellman key exchange, 343

"tls.c" send_finished, 349

"tls.c" send_handshake_message, 312313

"tls.c" send_handshake_message updates, 348

"tls.c" send_handshake_message with handshake digest update, 347348

"tls.c" send_message, 315316

"tls.c" send_message with encryption, 358

"tls.c" send_message with explicit IVs, 480

"tls.c" send_message with MAC support, 355357

"tls.c" send_message with padding support, 357

tls_send, 364365

update each invocation of send_message, 359360

SEQUENCE, 226

Sequence number field, 559

sequence numbers assigned (secure data transfer, TLS 1.0), 353355

sequences (DER), 243

serial IDs, 224

serial numbers, 227

serialNumber field, 227

server gated cryptography, 465

server hello

SSLv2, 592600

TLS 1.0 handshake (client-side), 316324

TLS 1.0 handshake (server-side), 390391

server hello done message

TLS 1.0 handshake (client-side), 328329

TLS 1.0 handshake (server-side), 393

server key exchange message, 344, 436442. See also ephemeral key exchange

server key exchange signature, 442

server name identification (SNI) extensions, 416420

client hello with, 419

"tls.c" parse_client_hello_extensions, 417418

"tls.c" parse_server_name_extension, 418419

server_finished, 350, 386, 586

server_side session resumption support, 429

session ID, 304, 308, 311, 316, 320, 372, 420

session renegotiation, 465478

hello request supported, 466467

listings

"tls.c" client hello extension capability, 473476

"tls.c" init_parameters with saved verify data, 472

"tls.c" parse_renegotiation_info, 477478

"tls.c" parse_server_hello with extensions recognition, 476

"tls.c" parse_server_hello_extensions, 476477

"tls.c" receive_tls_message with session renegotiation support, 466467

"tls.c" Saving verify data, 472473

"tls.c" tls_connect with renegotiate flag, 467

"tls.h" TLSParameters with saved verify data, 471472

pitfalls, 468470

renegotiation attack, 468470

secure renegotiation example, 470471

secure renegotiation implementation, 471478

session resumption v., 465466

session resumption, 420436

on client side TLS, 421428

drawbacks of server implementation, 435436

HTTP and, 420

listings

"https.c" main routine with session resumption, 425427

"tls.c" find_stored_session, 431433

"tls.c" init_parameters with session resumption support, 435

"tls.c" init_tls, 430

"tls.c" parse_client_hello with session resumption support, 433

"tls.c" parse_server_hello with session ID support, 425

"tls.c" remember_session, 430431

"tls.c" send_client_hello with session resumption, 424425

"tls.c" server_side session resumption support, 429

"tls.c" session storage hash table, 429430

"tls.c" tls_accept with session resumption support, 433435

"tls.c" tls_accept with session storage, 435

"tls.c" tls_resume, 422424

"tls.h" TLSParameters with session ID, 416417

requesting, 422

restoring previous session's master secret, 424425

on server side TLS, 428436

session ID storage added, 429433

session renegotiation v., 465466

session resumption logic added to client, 422424

shortened session resumption handshake sequence, 421

testing, 425427

unique session ID assigned to each session, 429

viewing, 427428

session storage hash table, 429430

SET_BIT macro, 36

sets (DER), 243

setsockopt, 23

SHA-1 (Secure Hash Algorithm), 171180

big-endian numbers, 171, 176

block computation, 171174

DHE/RSA/DES/SHA-1 handshake, 442448

DSA and, 202

finalization, 176180

input processing function, 174176

listings

"digest.c" digest_hash, 176178

"digest.c" main routine, 179180

"digest.h" digest_hash function prototype, 176

"md5.c" md5_finalize, 176

"sha.c" bit manipulation, initialization and block operation, 171174

"sha.c" SHA-1 digest initialization, 195196

"sha.c" SHA-1 hash algorithm, 174175

"sha.c" SHA-1 in little-endian format, 178179

"sha.c" sha1_finalize, 176

MD5 v., 171, 174, 176

PRF and, 329332

SHA-256 v., 181, 184

SSLv2 and, 584

SHA-256, 180184

block operation, 181184

DSA and, 202, 204

ECDSA and, 211

finalization, 184

initial hash, 184

listings

"sha.c" SHA-256 block operate, 182183

"sha.c" SHA-256 digest initialization, 196

"sha.c" SHA-256 Initial Hash, 184

"sha.c" SHA-256 Sigma Functions, 181

SHA-1 v., 181, 184

sigma functions, 181

SHA-256 digest update, 483484

Shamir, Adi, 91. See also RSA algorithm

shared key algorithms. See symmetric algorithms

shifting binary numbers, 570

shift_rows, "aes.c", 6970

Shining Light Productions, 576

shutdown (TLS 1.0 client-side), 368369

"tls.c" free_protection_parameters, 369

"tls.c" tls_shutdown, 368369

sigma functions, SHA-256, 181

signature and hash algorithms, "tls.h", 486487

signature field, 227229

signature verification, TLS 1.2, 485486

signed-ness, of variables, 571

"sign/magnitude" approach, 140

65,537 (prime number), 115, 116, 129

small subgroup attack, 236237

S/MIME, 546547, 549552

attachment format, 551

certificate management, 552

Diffie-Hellman key exchange and, 550

encoded email message, 549

multiple recipients email and, 550552

SMTP, "multi-hop," 545548

SNI extensions. See server name identification extensions

sockets, secure, 24

"Software Implementations of the NIST Elliptic Curves over Prime Fields" (Brown), 210

source port, 3

speeding up RSA decryption operation, 129

square and multiply, 116. See also double and add approach

s_server, 458, 460, 619

SSL (Secure Sockets Layer). See also OpenSSL; SSLv2; TLS

advanced topics, 415478

applications of, 543566

certificate problems and, 296

history of, 4, 27, 298299

HMAC function and, 200201

HTTP and, 5, 299, 543, 552

open-source implementations, 2728

OpenSSL with, 564566

original specification proposal, 4

purpose of, 5, 27

stateful, 552

support, 27

TLS/SSL design, email and, 546547

SSLv2, 579627

brute-force attacks and, 626

certificate extensions and, 627

client hello, 588592

deprecation, 298, 579, 626

export-grade ciphers and, 584, 607

handshake, 582619

history of, 298

HMAC function and, 611

https application (end-to-end example), 619626

implementation, 579619

listings

"https.c" http_get with SSLv2 support, 581

"https.c" main routine with SSLv2 support, 580

"ssl.c" add_mac, 611612

"ssl.c" cipher spec declarations, 584

"ssl.c" compute_keys, 601605

"ssl.c" init_parameters, 587588

"ssl.c" parse_server_error, 597

"ssl.c" parse_server_finished, 617

"ssl.c" parse_server_hello, 597599

"ssl.c" parse_server_verify, 615616

"ssl.c" receive_ssl_message, 594596

"ssl.c" receive_ssl_message with encryption support, 613614

"ssl.c" send_client_finished, 608

"ssl.c" send_client_hello, 589590

"ssl.c" send_client_master_key, 606607

"ssl.c" send_error, 599600

"ssl.c" send_handshake_message, 590591

"ssl.c" send_message, 591592

"ssl.c" send_message with encryption support, 608611

"ssl.c" ssl_connect, 586587

"ssl.c" ssl_recv, 617618

"ssl.c" ssl_send, 617

"ssl.c" verify_mac, 614615

"ssl.h" CipherSuite declarations, 583584

"ssl.h" ClientFinished declaration, 607608

"ssl.h" ClientHello declaration, 588

"ssl.h" ClientMasterKey declaration, 605606

"ssl.h" ServerFinished declaration, 616

"ssl.h" ServerHello declaration, 592594

"ssl.h" ServerVerify declaration, 613

"ssl.h" SSL function prototypes, 580

"ssl.h" SSLParameters declaration, 582583

"ssl.h" SSLv2 CipherSpec declaration, 583

man-in-the-middle attacks and, 346, 626

master key, 600607

problems with, 346, 579, 626627

server hello, 592600

SHA and, 584

successors to, 298

truncation attacks and, 368, 626

SSLv3, 27, 593, 600, 604, 619. See also TLS 1.0

history, 298299

TLS 1.0 v., 378379

Standards for Efficient Cryptography (SEC), 525

Standards for Efficient Cryptography Group (SECG), 525

STARTTLS, 545, 546

state, 67

state matrix, 74

state vector, 8889, 358, 359

stateful

NNTP, 544, 545

SSL, 552

stateless

HTTP, 544, 552

UDP, 556

status codes, 10

stdout, 10, 11, 324

step-up cryptography, 465

stored_sessions table, 432

stream cipher algorithms, 8390. See also AEAD mode ciphers; block cipher algorithms

AEAD ciphers v., 490

AES-CCM v., 517

AES-GCM v., 517

benefits, 491

block cipher algorithms v., 83, 490491

block cipher to stream cipher conversion, 90

support (TLS 1.0 client-side), 358359

XOR operation and, 83

strings (DER), 242

strong cryptography, 378, 463

sub_bytes, "aes.c", 69

subject field, 233235

subjectAltName, 237, 278

subjectPublicKeyInfo field, 235236

subtracting/adding machines (computers), 570

subtraction

huge numbers, 98101

"huge."c" add_magnitude and subtract_magnitude, 143

"huge.c" subtract, 9899

"huge."c" subtract with negative number support, 145146

sub_word, "aes.c", 64

switches/CPUs, 567568

symmetric (private/shared key) algorithms, 2990. See also block cipher algorithms; stream cipher algorithms

challenge of, 91

public key algorithms v., 30, 91, 129130

SYN (synchronize) packet, 3, 12

synchronize packet. See SYN packet

T

tag classes, 244

tbsCertificate, 244, 248

defined, 238

parsing, 268269

TCP (Transport Control Protocol), 34

handshake, 34

TLS without, 559

tcpdump, 370, 371, 416, 573575

https application and, 619626

installation

Linux system, 575

Windows system, 574

TCP/IP, 4

terse initial permutation, 3536

32-bit processors, 568

3DES. See triple DES

302 (status code), 10

TIME_WAIT, 23

timing attacks, 119

tin, 543

TLS (Transport Layer Security). See also SSL

advanced topics, 415478

applications of, 543566

challenge, 566

datagram traffic and, 559

DTLS v., 559

email and, 552. See also S/MIME

GnuTLS, 27, 28, 123, 140, 155, 540, 541

history of, 4, 27, 298299

"multi-hop" SMTP and, 545548

SSL/TLS design, email and, 546547

without TCP, 559

TLS 1.0. See also TLS 1.0 handshake

client-side, 297379

assigning sequence numbers, 353355

decryption and authentication, 361364

encryption support (outgoing), 355358

secure data transfer, 353369

stream ciphers support, 358359

tls_recv, 365368

tls_send, 364365

update each invocation of send_message, 359360

DES and, 342343

Diffie-Hellman and, 394395

HTTPS end-to-end examples, 369378

client hello request dissected, 370371

decrypting encrypted exchange, 374377

exchanging application data, 377378

key exchange message dissected, 373374

server response messages dissected, 372373

PKCS #1.5 padding, 126

PRF, 329335

client key exchange with, 329335

diagram, 330

HMAC function and, 329332

MD5 and, 329332

"prf.c" main routine, 334335

"prf.c" PRF function, 333334

SHA-1 and, 329332

RSA key exchange and, 394396

secure data transfer (client-side TLS)

"receive_tls_msg" with optimal response buffer, 365

"tls.c" calculate_keys with special RC4 exception, 359

"tls.c" init_protection_parameters with seq_num, 354355

"tls.c" receive_tls_msg with buffering support, 366368

"tls.c" receive_tls_msg with decrypt support, 361362

"tls.c" send buffer, 357358

"tls.c" send_message with encryption, 358

"tls.c" send_message with MAC support, 355357

"tls.c" send_message with padding support, 357

"tls.c" tls_connect with receive_tls_msg calls updated, 365366

"tls.c" tls_decrypt, 362364

"tls.c" tls_recv, 365

"tls.c" tls_send, 364365

"tls.c" with protection parameters sent to send_message, 360

"tls.h" ProtectionParameters with seq_num, 354

"tls.h" TLSParameters with buffering support, 366

server-side, 381414

browser trust issues, 412414

HTTPS support added to HTTP server application, 381390, 411412

shutdown, 368369

"tls.c" free_protection_parameters, 369

"tls.c" tls_shutdown, 368369

SSLv3 v., 378379

TLS 1.1 v., 299, 379, 480

TLS 1.2 (message-format level) v., 489

transparency, 299

TLS 1.0 handshake (client-side/server-side), 299353, 381411

advanced topics, 415478

certificate message, 324328, 391393

change cipher spec message, 344346, 409

client authentication, 448462

"ca.cnf", 458459

certificate request message, 449453

certificate verify message, 449, 453457

CertificateRequest, 449, 450, 452

CertificateVerify, 449, 453

mutally-authenticated TLS handshake, 460462

RKM and, 449

"rsa.c" rsa_encrypt and rsa_sign, 454455

testing, 458460

with TLS handshake (diagram), 457

"tls.c" parse_certificate_request, 451452

"tls.c" receive_tls_msg with certificate request support, 450451

"tls.c" send_certificate_verify, 455457

"tls.c" tls_connect with support for certificate requests, 452453

"tls.h" TLSParameters with certificate request flag, 450

client hello, 304316, 387390

cipher suites, 308309

flattening/sending, 309316

with headers, 316

tracking handshake state in TLSParameters structure, 304308

client hello extensions, 415420

"tls.c" client hello extension capability, 473476

"tls.c" parse_client_hello with client hello extension support, 416417

"tls.c" parse_client_hello_extensions, 417418

"tls.c" parse_server_name_extension, 418419

client key exchange, 329344, 394409

checking for successful decryption, 406407

completing, 407409

Diffie-Hellman key exchange, 343344

master secret computation, 336337

RSA key exchange, 337343

RSA key exchange and private key location, 395399

supporting encrypted private key files, 399406

using PRF, 329335

ephemeral key exchange, 436448, 487

handshake, 442448

server key exchange message, 436442

"tls.c" parse_server_key_exchange, 437438

"tls.c" parse_server_key_exchange with signature verification, 440

"tls.c" receive_tls_msg with DSA key support, 445

"tls.c" receive_tls_msg with server key exchange, 437

"tls.c" send_client_key_exchange, 445

"tls.c" verify_signature, 441, 446448

"tls.h" TLSParameters with dsa key support, 444445

"x509.c" parse_x509_chain with DSA support, 445446

finished message, 346353, 409411

computing verify message, 347351

correctly receiving, 352353

HTTPS support added to HTTP server application, 381390

HTTPS support pitfalls, 411412

less common aspects, 415

listings

"file.c" load_file_into_memory, 398399

"https.c" http_get and display_result, 302

"https.c" main routine, 301

"prf.c" main routine, 334335

"prf.c" PRF function, 333334

"privkey.c" parse_pkcs8_private_key, 402406

"privkey.c" parse_private_key, 396397

"privkey.c" test main routine, 397398

"receive_tls_message" with alert support, 323

"ssl_webserver.c" main routine, 382

"ssl_webserver.c" process_https_request, 382383

"ssl_webserver.c" send and read modifications, 383

"tls.c" append buffer, 311

"tls.c" calculate_keys, 341342

"tls.c" calculate_keys with server support, 408409

"tls.c" cipher suites list, 340341

"tls.c" client hello structure, 306307

"tls.c" compute_verify_data, 349350

"tls.c" compute_verify_data with temporary copy, 352353

"tls.c" dh_key_exchange, 343344

"tls.c" init_parameters, 306, 387

"tls.c" master secret computation, 336337

"tls.c" parse_client_hello, 388390

"tls.c" parse_client_key_exchange, 407408

"tls.c" parse_finished, 351

"tls.c" parse_server_hello, 321322

"tls.c" peer_finished, 386387

"tls.c" read_buffer, 323

"tls.c" receive_tls_message with client_hello, 387388

"tls.c" receive_tls_message with client_key_exchange, 394395

"tls.c" receive_tls_msg, 317, 318, 319320

"tls.c" receive_tls_msg with handshake digest update, 348349

"tls.c" receive_tls_msg with multiple handshake support, 325

"tls.c" receive_tls_msg with server hello done support, 328

"tls.c" receive_tls_msg with support for change cipher spec, 345346

"tls.c" report_alert, 324

"tls.c" rsa_key_exchange, 339

"tls.c" send_alert_message, 319

"tls.c" send_certificate, 392393

"tls.c" send_change_cipher_spec, 345

"tls.c" send_client_hello, 307308, 310, 311

"tls.c" send_client_key_exchange, 337338

"tls.c" send_client_key_exchange with Diffie-Hellman key exchange, 343

"tls.c" send_finished, 349

"tls.c" send_finished with server support, 410

"tls.c" send_handshake_message, 312313

"tls.c" send_handshake_message updates, 348

"tls.c" send_handshake_message with handshake digest update, 347348

"tls.c" send_message, 315316

"tls.c" send_server_hello, 390391

"tls.c" send_server_hello_done, 393

"tls.c" tls_accept, 384386

"tls.c" tls_connect, 306

"tls.c" tls_connect multiple handshake messages, 329

"tls.c" tls_connect with client finished message, 349

"tls.c" tls_connect with handshake digests, 347

"tls.c" tls_connect with key exchange, 337

"tls.c" tls_connect with server finished support, 350

"tls.c" TLSParameters, 350351

"tls.c" tls_receive_message with server finished support, 351

"tls.h" CipherSuite structure, 340

"tls.h" CipherSuiteIdentifier list, 308309

"tls.h" handshake structure, 312

"tls.h" ProtectionParameters, 304

"tls.h" ProtectionParameters with cipher suite, 322323

"tls.h" ServerHello structure, 321

"tls.h" TLSParameters, 304305

"tls.h" TLSParameters with digest contexts, 347

"tls.h" TLSParameters with server-side support, 386

"tls.h" TLSParameters with state tracking included, 328

"tls.h" TLSPlaintext header, 313315

"tls.h" top-level function prototypes, 300301

"x509.c" parse_x509_chain, 325327

mutally-authenticated, 460462

overview, 299300

procedure (high-level diagram), 303304

server hello, 390391

server hello done message, 328329, 393

server hello message, 316324

adding receive loop, 317318

parsing, 319323

reporting server alerts, 323324

sending alerts, 318319

structure diagram, 320

server name identification extensions, 416420

client hello with, 419

"tls.c" parse_client_hello_extensions, 417418

"tls.c" parse_server_name_extension, 418419

session renegotiation, 465478

hello request supported, 466467

listings

"tls.c" client hello extension capability, 473476

"tls.c" init_parameters with saved verify data, 472

"tls.c" parse_renegotiation_info, 477478

"tls.c" parse_server_hello with extensions recognition, 476

"tls.c" parse_server_hello_extensions, 476477

"tls.c" receive_tls_message with session renegotiation support, 466467

"tls.c" Saving verify data, 472473

"tls.c" tls_connect with renegotiate flag, 467

"tls.h" TLSParameters with saved verify data, 471472

pitfalls, 468470

renegotiation attack, 468470

secure renegotiation example, 470471

secure renegotiation implementation, 471478

session resumption v., 465466

session resumption, 420436

on client side TLS, 421428

drawbacks of server implementation, 435436

HTTP and, 420

"https.c" main routine with session resumption, 425427

requesting, 422

restoring previous session's master secret, 424425

on server side TLS, 428436

session ID storage added, 429433

session renegotiation v., 465466

session resumption logic added to client, 422424

shortened session resumption handshake sequence, 421

testing, 425427

"tls.c" find_stored_session, 431433

"tls.c" init_parameters with session resumption support, 435

"tls.c" init_tls, 430

"tls.c" parse_client_hello with session resumption support, 433

"tls.c" parse_server_hello with session ID support, 425

"tls.c" remember_session, 430431

"tls.c" send_client_hello with session resumption, 424425

"tls.c" server_side session resumption support, 429

"tls.c" session storage hash table, 429430

"tls.c" tls_accept with session resumption support, 433435

"tls.c" tls_accept with session storage, 435

"tls.c" tls_resume, 422424

"tls.h" TLSParameters with session ID, 416417

unique session ID assigned to each session, 429

viewing, 427428

TLS support added to HTTP client application, 300303

TLS 1.1, 299, 379, 480

TLS 1.2, 479541

AEAD mode ciphers, 490523. See also AEAD mode ciphers

current state, 540541

Diffie-Hellman key exchange, 485489

parsing signature types, 485489

"tls.c" parse_certificate_request with TLS 1.2 support, 488489

"tls.c" parse_server_key_exchange with signature and hash algorithm declaration, 487488

"tls.c" TLS 1.2 signature verification, 485486

"tls.h" signature and hash algorithms, 486487

ECC and, 132133, 523524

ECC extensions, 523540

ECDH support, 533540

"tls.c" ecdh_key_exchange, 539540

"tls.c" init_tls with ECDHE_ECDSA support, 533

"tls.c" parse_server_key_exchange with ECDH support, 534536

"tls.c" send_client_key_exchange with ECDHE support, 538

"tls.c" verify_signature with ECDSA support, 537538

"tls.h" TLSParameters with ECDH support, 534

ECDHE_ECDSA cipher suites, 533, 535, 538

ECDSA certificate parsing, 527533

"x509.c" parse_algorithm_identifier with ECDSA support, 528

"x509.c" parse_public_key_info with ECDSA support, 529530

"x509.c" parse_x509_certificate with ECDSA signatures, 532533

"x509.c" parse_x509_chain with ECDSA support, 531532

"x509.h" ECDSA algorithm identifier, 529

"x509.h" ecdsa algorithm identifier, 528

finished message support, 483484

history, 379

message-format level changes, 479, 489

named curves, 218, 524527, 530, 537, 540

"ecc.c" get_named_curve, 525527

online list, 525

SECG, 525

PRF modifications, 481482

RSA key exchange, 479484

"prf.c" PRF2, 482

"tls.c" send_message with explicit IVs, 480

"tls.c" SHA-256 digest update, 483484

"tls.c" TLS 1.2 handshake digest initialization, 484

"tls.c" tls_decrypt with explicit IVs, 481

"tls.h" TLS 1.2 version declaration, 480

"tls.h" TLSParameters, 483

TLS 1.0 (message-format level) v., 489

TLS Message header, 315

tls_accept, 384386

tls_accept with session resumption support, 433435

tls_accept with session storage, 435

tls_decrypt with explicit IVs, 481

TLSParameters, 304305, 350351, 483

TLSParameters with buffering support, 366

TLSParameters with certificate request flag, 450

TLSParameters with digest contexts, 347

TLSParameters with dsa key support, 444445

TLSParameters with ECDH support, 534

TLSParameters with saved verify data, 471472

TLSParameters with server-side support, 386

TLSParameters with session ID, 416417

TLSParameters with state tracking included, 328

tracking handshake state in, 304308

tls_resume, 422424

traceroute facility, 3

tracking certificate validity periods, 232233

trade-off, security, 566

transparency, TLS 1.0, 299

Transport Control Protocol. See TCP

Transport Layer Security. See TLS

triple DES (3DES), 5559

brute force attacks and, 56

DES v., 5556

listings

"des.c" des3_encrypt, 5859

"des.c" des_block_operate with 3DES support, 5758

"des.c" main routine with 3DES support, 59

wrinkle in, 56

truncation attacks, 368, 626

trusted intermediary, 222223. See also certificate authorities

trusted root certification authorities, 238, 413414

tunneling, 561564

200 (status code), 10

twofish, 83

two's-complement arithmetic, 98, 123, 275, 570571

U

UDP (User Datagram Protocol), 553, 555, 556, 559. See also datagram traffic

universal tags, 244

updateable digest/hash functions, 190200

Usenet, 543

User Datagram Protocol. See UDP

UTCTime, 233

UUCP systems, 17

V

validation

extended, 278

PKCS #7-formatted RSA signatures, 280285

ValidationParms, 236

validity field, 232233

validity periods, 224, 232233

vcredist_x86.exe, 576

verify_mac, "ssl.c", 614615

verify_signature, "tls.c", 441, 446448

verify_signature with ECDSA support, 537538

VeriSign, 227, 230, 295, 553

version field, 226

virtual hosting, 9, 235

Visual C++ 2008 Redistributables package, 576

W

weak cryptography, 463

web clients. See browsers

web servers, 21. See also HTTP server

WEP (Wired Equivalent Privacy), 86

wget utility, 5

whole integers, ECC and, 150

Win32 OpenSSL vx.x.x installer, 576

Windows system

OpenSSL installation, 575576

tcpdump installation, 574

WinDump, 574

WinPcap, 574

Wired Equivalent Privacy (WEP), 86

Wireshark, 573

Wireshark packet sniffer, 20

X

X series, 225

X9.62 format, 528, 531, 537, 540

X.509 certificates. See certificates

X.509 specification

online, 225

revisions, 225

"x509.c" display_x509_certificate, 283285, 290291

"x509.c" free_x509_certificate, 266267

"x509.c" init_x509_certificate, 266

"x509.c" main routine, 281283, 291

"x509.c" parse_algorithm_identifier, 270

"x509.c" parse_algorithm_identifier with DSA support, 287

"x509.c" parse_algorithm_identifier with ECDSA support, 528

"x509.c" parse_dsa_signature_value, 288289

"x509.c" parse_extension, 276

"x509.c" parse_extension with key usage recognition, 277

"x509.c" parse_extensions, 276

"x509.c" parse_huge, 269270

"x509.c" parse_name, 271273

"x509.c" parse_public_key_info, 274275

"x509.c" parse_public_key_info with ECDSA support, 529530

"x509.c" parse_signature_value, 279

"x509.c" parse_tbs_certificate, 268269

"x509.c" parse_x509_certificate, 267268

"x509.c" parse_x509_certificate with DSA support, 287288

"x509.c" parse_x509_certificate with ECDSA signatures, 532533

"x509.c" parse_x509_certificate with stored hash, 279280

"x509.c" parse_x509_chain with DSA support, 445446

"x509.c" parse_x509_chain with ECDSA support, 531532

"x509.c" public key info parsing with DSA support, 289

"x509.c" validate_certificate_dsa, 291

"x509.c" validate_certificate_rsa, 280281

"x509.h" ECDSA algorithm identifier, 529

"x509.h" ecdsa algorithm identifier, 528

"x509.h" structure definitions, 264265

"x509.h" with DSA support, 286287

Xiaoyan Wang, 170

xor array, "des.c", 33

XOR (Exclusive OR) operation, 569

AES and, 60, 72

DES and, 3132

reversibility, 32, 569

stream cipher algorithms and, 83

Y

Young, Eric A., 27, 575. See also OpenSSL

Z

zero padding, 123, 507, 514

0xFF01 client hello extension, 470, 475478, 540

0xFF02 client hello extension, 540