int ssl3_cert_verify_hash(SSL *ssl, const EVP_MD **out_md, uint8_t *out, size_t *out_len, uint16_t signature_algorithm) { assert(ssl3_protocol_version(ssl) == SSL3_VERSION); if (signature_algorithm == SSL_SIGN_RSA_PKCS1_MD5_SHA1) { if (ssl3_handshake_mac(ssl, NID_md5, NULL, 0, out) == 0 || ssl3_handshake_mac(ssl, NID_sha1, NULL, 0, out + MD5_DIGEST_LENGTH) == 0) { return 0; } *out_md = EVP_md5_sha1(); *out_len = MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH; } else if (signature_algorithm == SSL_SIGN_ECDSA_SHA1) { if (ssl3_handshake_mac(ssl, NID_sha1, NULL, 0, out) == 0) { return 0; } *out_md = EVP_sha1(); *out_len = SHA_DIGEST_LENGTH; } else { OPENSSL_PUT_ERROR(SSL, ERR_R_INTERNAL_ERROR); return 0; } return 1; }
int ssl3_final_finish_mac(SSL *s, const char *sender, int len, unsigned char *p) { int ret; ret=ssl3_handshake_mac(s,NID_md5,sender,len,p); p+=ret; ret+=ssl3_handshake_mac(s,NID_sha1,sender,len,p); return(ret); }
int ssl3_final_finish_mac(SSL *s, EVP_MD_CTX *ctx1, EVP_MD_CTX *ctx2, const char *sender, int len, unsigned char *p) { int ret; ret=ssl3_handshake_mac(s,ctx1,sender,len,p); p+=ret; ret+=ssl3_handshake_mac(s,ctx2,sender,len,p); return(ret); }
int ssl3_final_finish_mac(SSL *s, const char *sender, int len, unsigned char *p) { int ret, sha1len; ret = ssl3_handshake_mac(s, NID_md5, sender, len, p); if (ret == 0) return 0; p += ret; sha1len = ssl3_handshake_mac(s, NID_sha1, sender, len, p); if (sha1len == 0) return 0; ret += sha1len; return (ret); }
int ssl3_final_finish_mac(SSL *s, const char *sender, int len, uint8_t *p) { int ret, sha1len; ret = ssl3_handshake_mac(s, NID_md5, sender, len, p); if (ret == 0) { return 0; } p += ret; sha1len = ssl3_handshake_mac(s, NID_sha1, sender, len, p); if (sha1len == 0) { return 0; } ret += sha1len; return ret; }
static int ssl3_final_finish_mac(SSL *ssl, int from_server, uint8_t *out) { const char *sender = from_server ? SSL3_MD_SERVER_FINISHED_CONST : SSL3_MD_CLIENT_FINISHED_CONST; const size_t sender_len = 4; int ret, sha1len; ret = ssl3_handshake_mac(ssl, NID_md5, sender, sender_len, out); if (ret == 0) { return 0; } out += ret; sha1len = ssl3_handshake_mac(ssl, NID_sha1, sender, sender_len, out); if (sha1len == 0) { return 0; } ret += sha1len; return ret; }
int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p) { return(ssl3_handshake_mac(s,md_nid,NULL,0,p)); }
int ssl3_cert_verify_mac(SSL *s, EVP_MD_CTX *ctx, unsigned char *p) { return(ssl3_handshake_mac(s,ctx,NULL,0,p)); }
int ssl3_cert_verify_mac(SSL *s, int md_nid, uint8_t *p) { return ssl3_handshake_mac(s, md_nid, NULL, 0, p); }