46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
-
+
|
static int sslIsInit = 0; /* True after global initialization */
static BIO *iBio = 0; /* OpenSSL I/O abstraction */
static char *sslErrMsg = 0; /* Text of most recent OpenSSL error */
static SSL_CTX *sslCtx; /* SSL context */
static SSL *ssl;
static struct { /* Accept this SSL cert for this session only */
char *zHost; /* Subject or host name */
char *zHash; /* SHA3 hash of the cert */
char *zHash; /* SHA2-256 hash of the cert */
} sException;
static int sslNoCertVerify = 0; /* Do not verify SSL certs */
/*
** Clear the SSL error message
*/
static void ssl_clear_errmsg(void){
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
-
+
|
BIO *mem;
unsigned char md[32];
char zHash[32*2+1];
unsigned int mdLength = (int)sizeof(md);
memset(md, 0, sizeof(md));
zHash[0] = 0;
if( X509_digest(cert, EVP_sha3_256(), md, &mdLength) ){
if( X509_digest(cert, EVP_sha256(), md, &mdLength) ){
int j;
for(j=0; j<mdLength && j*2+1<sizeof(zHash); ++j){
zHash[j*2] = "0123456789abcdef"[md[j]>>4];
zHash[j*2+1] = "0123456789abcdef"[md[j]&0xf];
}
zHash[j*2] = 0;
}
|