source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/asn1/a_digest.c@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc
File size: 1.4 KB
Line 
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include <stdio.h>
11#include <time.h>
12
13#include "internal/cryptlib.h"
14
15#ifndef NO_SYS_TYPES_H
16# include <sys/types.h>
17#endif
18
19#include <openssl/err.h>
20#include <openssl/evp.h>
21#include <openssl/buffer.h>
22#include <openssl/x509.h>
23
24#ifndef NO_ASN1_OLD
25
26int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
27 unsigned char *md, unsigned int *len)
28{
29 int i;
30 unsigned char *str, *p;
31
32 i = i2d(data, NULL);
33 if ((str = OPENSSL_malloc(i)) == NULL) {
34 ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
35 return (0);
36 }
37 p = str;
38 i2d(data, &p);
39
40 if (!EVP_Digest(str, i, md, len, type, NULL)) {
41 OPENSSL_free(str);
42 return 0;
43 }
44 OPENSSL_free(str);
45 return (1);
46}
47
48#endif
49
50int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
51 unsigned char *md, unsigned int *len)
52{
53 int i;
54 unsigned char *str = NULL;
55
56 i = ASN1_item_i2d(asn, &str, it);
57 if (!str)
58 return (0);
59
60 if (!EVP_Digest(str, i, md, len, type, NULL)) {
61 OPENSSL_free(str);
62 return 0;
63 }
64 OPENSSL_free(str);
65 return (1);
66}
Note: See TracBrowser for help on using the repository browser.