author | Tomas Kuthan <tomas.kuthan@oracle.com> |
Sun, 08 Apr 2012 02:30:08 -0700 | |
changeset 763 | 45da4d38492e |
permissions | -rw-r--r-- |
763
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
1 |
/* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
2 |
* CDDL HEADER START |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
3 |
* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
7 |
* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
11 |
* and limitations under the License. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
12 |
* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
18 |
* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
19 |
* CDDL HEADER END |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
20 |
*/ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
21 |
/* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
22 |
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
23 |
*/ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
24 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
25 |
/* Content of this file is only needed for wanboot. */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
26 |
#ifdef _BOOT |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
27 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
28 |
#include <sys/types.h> |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
29 |
#include <dirent.h> |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
30 |
#include <errno.h> |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
31 |
#include <stddef.h> |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
32 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
33 |
/* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
34 |
* In OpenSSL 0.9.7 the EVP_read_pw_string now calls into the new "ui" |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
35 |
* routines of 0.9.7, which is not compiled in the standalone, so it is |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
36 |
* stubbed out here to avoid having to add a bunch of #ifndef's elsewhere. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
37 |
*/ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
38 |
/* ARGSUSED */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
39 |
int |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
40 |
EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt, int |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
41 |
verify) |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
42 |
{ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
43 |
return (-1); /* failure */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
44 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
45 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
46 |
/* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
47 |
* In standalone issetugid() is always false. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
48 |
*/ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
49 |
int |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
50 |
OPENSSL_issetugid(void) |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
51 |
{ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
52 |
return (1); |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
53 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
54 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
55 |
/* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
56 |
* Directory routines -- currently, the only consumer of these interfaces |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
57 |
* is $SRC/common/openssl/ssl/ssl_cert.c, and it has fallback code in the |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
58 |
* case of failure, so we just fail opendir() and stub out the rest. At |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
59 |
* some point, we may need to provide a real implementation. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
60 |
*/ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
61 |
/* ARGSUSED */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
62 |
DIR * |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
63 |
opendir(const char *dirname) |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
64 |
{ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
65 |
errno = EACCES; |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
66 |
return (NULL); |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
67 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
68 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
69 |
/* ARGSUSED */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
70 |
struct dirent * |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
71 |
readdir(DIR *dirp) |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
72 |
{ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
73 |
return (NULL); |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
74 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
75 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
76 |
/* ARGSUSED */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
77 |
int |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
78 |
closedir(DIR *dirp) |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
79 |
{ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
80 |
return (0); |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
81 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
82 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
83 |
/* |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
84 |
* Atoi is used on multiple places in libcrypto. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
85 |
* This implementation is taken from stand-alone libsock library: |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
86 |
* usr/src/stand/lib/sock/sock_test.c |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
87 |
* Alternative solution: just extern it here, wanboot has -lsock anyway. |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
88 |
*/ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
89 |
#ifndef isdigit |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
90 |
#define isdigit(c) ((c) >= '0' && (c) <= '9') |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
91 |
#endif |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
92 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
93 |
#ifndef isspace |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
94 |
#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || \ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
95 |
(c) == '\r' || (c) == '\f' || (c) == '\013') |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
96 |
#endif |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
97 |
int |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
98 |
atoi(const char *p) |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
99 |
{ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
100 |
int n; |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
101 |
int c = *p++, neg = 0; |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
102 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
103 |
while (isspace(c)) { |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
104 |
c = *p++; |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
105 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
106 |
if (!isdigit(c)) { |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
107 |
switch (c) { |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
108 |
case '-': |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
109 |
neg++; |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
110 |
/* FALLTHROUGH */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
111 |
case '+': |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
112 |
c = *p++; |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
113 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
114 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
115 |
for (n = 0; isdigit(c); c = *p++) { |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
116 |
n *= 10; /* two steps to avoid unnecessary overflow */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
117 |
n += '0' - c; /* accum neg to avoid surprises at MAX */ |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
118 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
119 |
return (neg ? n : -n); |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
120 |
} |
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
121 |
|
45da4d38492e
7156086 OpenSSL for wanboot should not be build in a separate directory
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
122 |
#endif /* _BOOT */ |