Tweaks for comments due to indent's inability to handle them
Reviewed-by: Tim Hudson <tjh@openssl.org>
Matt Caswell
9 years ago
143 | 143 | |
144 | 144 | /* Callbacks */ |
145 | 145 | void cb_ssl_info(const SSL *s, int where, int ret); |
146 | void cb_ssl_info_set_output(FILE *fp); /* Called if output should be sent too */ | |
146 | /* Called if output should be sent too */ | |
147 | void cb_ssl_info_set_output(FILE *fp); | |
147 | 148 | int cb_ssl_verify(int ok, X509_STORE_CTX *ctx); |
148 | 149 | void cb_ssl_verify_set_output(FILE *fp); |
149 | 150 | void cb_ssl_verify_set_depth(unsigned int verify_depth); |
458 | 458 | } |
459 | 459 | |
460 | 460 | /* Generate all functions with appropriate opcodes */ |
461 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb, ".byte 0xf3,0x0f,0xa7,0xc8") /* rep xcryptecb */ | |
462 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc, ".byte 0xf3,0x0f,0xa7,0xd0") /* rep xcryptcbc */ | |
463 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb, ".byte 0xf3,0x0f,0xa7,0xe0") /* rep xcryptcfb */ | |
464 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb, ".byte 0xf3,0x0f,0xa7,0xe8") /* rep xcryptofb */ | |
461 | /* rep xcryptecb */ | |
462 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_ecb, ".byte 0xf3,0x0f,0xa7,0xc8") | |
463 | /* rep xcryptcbc */ | |
464 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_cbc, ".byte 0xf3,0x0f,0xa7,0xd0") | |
465 | /* rep xcryptcfb */ | |
466 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_cfb, ".byte 0xf3,0x0f,0xa7,0xe0") | |
467 | /* rep xcryptofb */ | |
468 | PADLOCK_XCRYPT_ASM(padlock_xcrypt_ofb, ".byte 0xf3,0x0f,0xa7,0xe8") | |
465 | 469 | #endif |
466 | 470 | |
467 | 471 | /* The RNG call itself */ |
387 | 387 | i = ssl2_read(s,(char *)&(buf[s->init_num]),j); |
388 | 388 | if (i != j) return(ssl2_part_read(s,SSL_F_GET_SERVER_HELLO,i)); |
389 | 389 | if (s->msg_callback) |
390 | s->msg_callback(0, s->version, 0, buf, (size_t)len, s, s->msg_callback_arg); /* SERVER-HELLO */ | |
390 | { | |
391 | /* SERVER-HELLO */ | |
392 | s->msg_callback(0, s->version, 0, buf, (size_t)len, s, s->msg_callback_arg); | |
393 | } | |
391 | 394 | |
392 | 395 | /* things are looking good */ |
393 | 396 | |
765 | 768 | return(ssl2_part_read(s,SSL_F_CLIENT_CERTIFICATE,i)); |
766 | 769 | s->init_num += i; |
767 | 770 | if (s->msg_callback) |
768 | s->msg_callback(0, s->version, 0, buf, (size_t)s->init_num, s, s->msg_callback_arg); /* REQUEST-CERTIFICATE */ | |
771 | { | |
772 | /* REQUEST-CERTIFICATE */ | |
773 | s->msg_callback(0, s->version, 0, buf, (size_t)s->init_num, s, s->msg_callback_arg); | |
774 | } | |
769 | 775 | |
770 | 776 | /* type=buf[0]; */ |
771 | 777 | /* type eq x509 */ |
934 | 940 | if (i < n) |
935 | 941 | return(ssl2_part_read(s,SSL_F_GET_SERVER_VERIFY,i)); |
936 | 942 | if (s->msg_callback) |
937 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); /* SERVER-VERIFY */ | |
943 | { | |
944 | /* SERVER-VERIFY */ | |
945 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); | |
946 | } | |
938 | 947 | p += 1; |
939 | 948 | |
940 | 949 | if (CRYPTO_memcmp(p,s->s2->challenge,s->s2->challenge_length) != 0) |
988 | 997 | len = 1 + SSL2_SSL_SESSION_ID_LENGTH; |
989 | 998 | n = len - s->init_num; |
990 | 999 | i = ssl2_read(s,(char *)&(buf[s->init_num]), n); |
991 | if (i < n) /* XXX could be shorter than SSL2_SSL_SESSION_ID_LENGTH, that's the maximum */ | |
1000 | if (i < n) | |
1001 | { | |
1002 | /* | |
1003 | * XXX could be shorter than SSL2_SSL_SESSION_ID_LENGTH, | |
1004 | * that's the maximum | |
1005 | */ | |
992 | 1006 | return(ssl2_part_read(s,SSL_F_GET_SERVER_FINISHED,i)); |
1007 | } | |
993 | 1008 | s->init_num += i; |
994 | 1009 | if (s->msg_callback) |
995 | s->msg_callback(0, s->version, 0, buf, (size_t)s->init_num, s, s->msg_callback_arg); /* SERVER-FINISHED */ | |
1010 | { | |
1011 | /* SERVER-FINISHED */ | |
1012 | s->msg_callback(0, s->version, 0, buf, (size_t)s->init_num, s, s->msg_callback_arg); | |
1013 | } | |
996 | 1014 | |
997 | 1015 | if (!s->hit) /* new session */ |
998 | 1016 | { |
536 | 536 | |
537 | 537 | if (s->error == 0) |
538 | 538 | if (s->msg_callback) |
539 | s->msg_callback(1, s->version, 0, buf, 3, s, s->msg_callback_arg); /* ERROR */ | |
539 | { | |
540 | /* ERROR */ | |
541 | s->msg_callback(1, s->version, 0, buf, 3, s, s->msg_callback_arg); | |
542 | } | |
540 | 543 | } |
541 | 544 | } |
542 | 545 |
441 | 441 | i = ssl2_read(s,(char *)&(p[s->init_num]),n); |
442 | 442 | if (i != n) return(ssl2_part_read(s,SSL_F_GET_CLIENT_MASTER_KEY,i)); |
443 | 443 | if (s->msg_callback) |
444 | s->msg_callback(0, s->version, 0, p, (size_t)len, s, s->msg_callback_arg); /* CLIENT-MASTER-KEY */ | |
444 | { | |
445 | /* CLIENT-MASTER-KEY */ | |
446 | s->msg_callback(0, s->version, 0, p, (size_t)len, s, s->msg_callback_arg); | |
447 | } | |
445 | 448 | p += 10; |
446 | 449 | |
447 | 450 | memcpy(s->session->key_arg,&(p[s->s2->tmp.clear+s->s2->tmp.enc]), |
590 | 593 | i = ssl2_read(s,(char *)&(p[s->init_num]),n); |
591 | 594 | if (i != n) return(ssl2_part_read(s,SSL_F_GET_CLIENT_HELLO,i)); |
592 | 595 | if (s->msg_callback) |
593 | s->msg_callback(0, s->version, 0, p, (size_t)len, s, s->msg_callback_arg); /* CLIENT-HELLO */ | |
596 | { | |
597 | /* CLIENT-HELLO */ | |
598 | s->msg_callback(0, s->version, 0, p, (size_t)len, s, s->msg_callback_arg); | |
599 | } | |
594 | 600 | p += 9; |
595 | 601 | |
596 | 602 | /* get session-id before cipher stuff so we can get out session |
863 | 869 | return(ssl2_part_read(s,SSL_F_GET_CLIENT_FINISHED,i)); |
864 | 870 | } |
865 | 871 | if (s->msg_callback) |
866 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); /* CLIENT-FINISHED */ | |
872 | { | |
873 | /* CLIENT-FINISHED */ | |
874 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); | |
875 | } | |
867 | 876 | p += 1; |
868 | 877 | if (memcmp(p,s->s2->conn_id,s->s2->conn_id_length) != 0) |
869 | 878 | { |
986 | 995 | } |
987 | 996 | |
988 | 997 | if (s->msg_callback) |
989 | s->msg_callback(0, s->version, 0, p, 3, s, s->msg_callback_arg); /* ERROR */ | |
998 | { | |
999 | /* ERROR */ | |
1000 | s->msg_callback(0, s->version, 0, p, 3, s, s->msg_callback_arg); | |
1001 | } | |
990 | 1002 | |
991 | 1003 | /* this is the one place where we can recover from an SSL 2.0 error */ |
992 | 1004 | |
1041 | 1053 | goto end; |
1042 | 1054 | } |
1043 | 1055 | if (s->msg_callback) |
1044 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); /* CLIENT-CERTIFICATE */ | |
1056 | { | |
1057 | /* CLIENT-CERTIFICATE */ | |
1058 | s->msg_callback(0, s->version, 0, p, len, s, s->msg_callback_arg); | |
1059 | } | |
1045 | 1060 | p += 6; |
1046 | 1061 | |
1047 | 1062 | cp = p; |