Skip to content

Commit 87208e9

Browse files
authored
Failing no-op implementations for several UI functions (#2772)
1 parent e02bcd2 commit 87208e9

File tree

3 files changed

+67
-3
lines changed

3 files changed

+67
-3
lines changed

crypto/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ add_library(
576576
x509/x509name.c
577577
x509/x509rset.c
578578
x509/x509spki.c
579+
ui/ui.c
579580
decrepit/bio/base64_bio.c
580581
decrepit/blowfish/blowfish.c
581582
decrepit/cast/cast.c

crypto/ui/ui.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR ISC
3+
4+
// AWS-LC does not support the UI APIs. These functions always fail at runtime.
5+
// This file provides no-op implementations of several UI functions that return
6+
// failure when called. This allows compilation to succeed for projects that use
7+
// these functions for non-essential operations.
8+
9+
#include "openssl/ui.h"
10+
#include "openssl/mem.h"
11+
12+
UI *UI_new(void) {
13+
return NULL;
14+
}
15+
16+
void UI_free(UI *ui) {
17+
OPENSSL_free(ui);
18+
}
19+
20+
int UI_add_input_string(UI *ui, const char *prompt, int flags,
21+
char *result_buf, int minsize, int maxsize) {
22+
return 0;
23+
}
24+
int UI_add_verify_string(UI *ui, const char *prompt, int flags,
25+
char *result_buf, int minsize, int maxsize, const char *test_buf) {
26+
return 0;
27+
}
28+
29+
int UI_add_info_string(UI *ui, const char *text) {
30+
return 0;
31+
}
32+
33+
int UI_process(UI *ui) {
34+
return 0;
35+
}

include/openssl/ui.h

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,36 @@
44
#ifndef UI_H
55
#define UI_H
66

7-
#endif //UI_H
7+
#include "openssl/base.h"
8+
struct ui_st {
9+
char _unused;
10+
};
11+
12+
struct ui_method_st {
13+
char _unused;
14+
};
15+
16+
typedef struct ui_st UI;
17+
typedef struct ui_method_st UI_METHOD;
18+
19+
/// UI_new does nothing, always returns NULL.
20+
OPENSSL_EXPORT OPENSSL_DEPRECATED UI *UI_new(void);
21+
22+
/// UI_free invokes OPENSSL_free on its parameter.
23+
OPENSSL_EXPORT OPENSSL_DEPRECATED void UI_free(UI *ui);
824

9-
// Intentionally empty.
25+
/// UI_add_input_string does nothing, always returns 0.
26+
OPENSSL_EXPORT OPENSSL_DEPRECATED int UI_add_input_string(UI *ui, const char *prompt, int flags,
27+
char *result_buf, int minsize, int maxsize);
1028

11-
// Prevent compiler fall-through picking up "openssl/ui.h" from the system path.
29+
/// UI_add_verify_string does nothing, always returns 0.
30+
OPENSSL_EXPORT OPENSSL_DEPRECATED int UI_add_verify_string(UI *ui, const char *prompt, int flags,
31+
char *result_buf, int minsize, int maxsize, const char *test_buf);
32+
33+
/// UI_add_info_string does nothing, always returns 0.
34+
OPENSSL_EXPORT OPENSSL_DEPRECATED int UI_add_info_string(UI *ui, const char *text);
35+
36+
/// UI_process does nothing, always returns 0.
37+
OPENSSL_EXPORT OPENSSL_DEPRECATED int UI_process(UI *ui);
38+
39+
#endif //UI_H

0 commit comments

Comments
 (0)