source: swig/perl/SSL_keyid.c @ 2e92c62

abac0-leak
Last change on this file since 2e92c62 was 2e92c62, checked in by Mei <mei@…>, 11 years ago

1) take out debug statement and fix SSL_keyid.c's compiler warning

  • Property mode set to 100644
File size: 398 bytes
RevLine 
[2e92c62]1#include <stdlib.h>
[f7040d8]2
3#include <openssl/x509.h>
4
[756011e]5char *SSL_keyid(void *ptr) {
[f7040d8]6    int i;
[17ec3b0]7    unsigned char sha1_hash[SHA_DIGEST_LENGTH];
[2e92c62]8    char *hash;
[f7040d8]9    X509 *x = (X509 *)ptr;
10
[17ec3b0]11    X509_pubkey_digest(x, EVP_sha1(), sha1_hash, NULL);
12
[2e92c62]13    hash = malloc(SHA_DIGEST_LENGTH * 2 + 1);
[f7040d8]14    for (i = 0; i < SHA_DIGEST_LENGTH; ++i)
[17ec3b0]15        sprintf(&hash[2*i], "%02x", sha1_hash[i]);
[f7040d8]16
17    return hash;
18}
Note: See TracBrowser for help on using the repository browser.